Mudanças entre as edições de "Widget:Droflax"
Ir para navegação
Ir para pesquisar
(Página substituída por '<!DOCTYPE html> <html lang="pt-BR"> <head> <meta charset="UTF-8"> <title>Botões de Idioma - Wiki GLA</title> <style> body { font-family: Arial, sans-se...') Etiqueta: Substituído |
|||
| Linha 94: | Linha 94: | ||
const path = window.location.pathname; | const path = window.location.pathname; | ||
const currentPage = decodeURIComponent(path.split('/').pop()); | const currentPage = decodeURIComponent(path.split('/').pop()); | ||
console.log(path); | |||
console.log(currentPage); | |||
const mapping = pageMap[currentPage]; | const mapping = pageMap[currentPage]; | ||
Edição das 00h02min de 1 de julho de 2025
<!DOCTYPE html> <html lang="pt-BR"> <head>
<meta charset="UTF-8">
<title>Botões de Idioma - Wiki GLA</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 40px;
background-color: #f9f9f9;
}
.language-buttons {
position: fixed;
top: 20px;
right: 20px;
display: flex;
gap: 10px;
background-color: #ffffffcc;
padding: 6px 10px;
border-radius: 8px;
box-shadow: 0 0 6px rgba(0, 0, 0, 0.2);
z-index: 999;
}
.language-buttons a img {
width: 40px;
height: 28px;
border-radius: 6px;
border: 1px solid #ccc;
transition: transform 0.2s ease;
object-fit: cover;
}
.language-buttons a img:hover {
transform: scale(1.1);
cursor: pointer;
border-color: #888;
}
</style>
</head> <body>
<script>
const pageMap = {
'Chefões': {
en: 'Bosses',
es: 'Jefes',
pl: 'Bossowie',
pt: 'Chefões'
},
'Bosses': {
pt: 'Chefões',
es: 'Jefes',
pl: 'Bossowie',
en: 'Bosses'
},
'Jefes': {
pt: 'Chefões',
en: 'Bosses',
pl: 'Bossowie',
es: 'Jefes'
},
'Bossowie': {
pt: 'Chefões',
en: 'Bosses',
es: 'Jefes',
pl: 'Bossowie'
},
'Página_em_Português': {
en: 'Page_in_English',
es: 'Pagina_en_Espanol',
pl: 'Strona_po_Polsku',
pt: 'Página_em_Português'
}
};
function goToLang(lang) {
const path = window.location.pathname;
const currentPage = decodeURIComponent(path.split('/').pop());
console.log(path);
console.log(currentPage);
const mapping = pageMap[currentPage];
if (mapping && mapping[lang]) {
const newPage = mapping[lang];
const newPath = path.replace(currentPage, encodeURIComponent(newPage));
window.location.pathname = newPath;
} else {
alert('Tradução não disponível para esta página.');
}
}
</script>
</body> </html>