Mudanças entre as edições de "Widget:Droflax"
Ir para navegação
Ir para pesquisar
| Linha 12: | Linha 12: | ||
<script> | <script> | ||
(function () { | |||
const raw = document.getElementById('infoboxboss-data')?.dataset?.habilidadesRaw; | const raw = document.getElementById('infoboxboss-data')?.dataset?.habilidadesRaw; | ||
console.log(raw); | console.log(raw); | ||
if (!raw) | if (!raw) return; | ||
const parts = raw.split('||').filter(p => p.trim()); | const parts = raw.split('||').filter(p => p.trim()); | ||
| Linha 89: | Linha 87: | ||
// Limpia el div original | // Limpia el div original | ||
document.getElementById('infoboxboss-data')?.remove(); | document.getElementById('infoboxboss-data')?.remove(); | ||
})(); | |||
</script> | </script> | ||
Edição das 00h36min de 21 de maio de 2025
<script> (function () {
const raw = document.getElementById('infoboxboss-data')?.dataset?.habilidadesRaw;
console.log(raw);
if (!raw) return;
const parts = raw.split('||').filter(p => p.trim());
const habilidades = [];
for (let i = 0; i < parts.length; i += 3) {
habilidades.push({
nome: parts[i],
descricao: parts[i + 1],
video: parts[i + 2]
});
}
const tabsContainer = document.getElementById('skill-tabs');
const videoContainer = document.getElementById('skill-videos');
const descText = document.getElementById('desc-text');
habilidades.forEach((hab, idx) => {
const id = `video${idx + 1}`;
// Botón
const btn = document.createElement('button');
btn.className = 'infobox-skill-tab' + (idx === 0 ? ' active' : );
btn.dataset.video = id;
btn.textContent = hab.nome;
tabsContainer.appendChild(btn);
// Video
const vid = document.createElement('video');
vid.id = id;
vid.className = 'skill-video';
vid.controls = true;
vid.autoplay = true;
vid.loop = true;
vid.style.display = idx === 0 ? : 'none';
const source = document.createElement('source');
source.src = hab.video;
source.type = "video/mp4";
vid.appendChild(source);
videoContainer.appendChild(vid);
});
// Descripción inicial
descText.textContent = `${habilidades[0].nome}: ${habilidades[0].descricao}`;
// Lógica de tabs
const tabs = document.querySelectorAll('.infobox-skill-tab');
const videos = document.querySelectorAll('.skill-video');
tabs.forEach((tab, idx) => {
tab.addEventListener('click', () => {
tabs.forEach(t => t.classList.remove('active'));
tab.classList.add('active');
const vidId = tab.dataset.video;
descText.textContent = `${habilidades[idx].nome}: ${habilidades[idx].descricao}`;
videos.forEach(v => {
if (v.id === vidId) {
v.style.display = ;
v.load();
v.play();
} else {
v.pause();
v.style.display = 'none';
}
});
});
});
// Limpia el div original
document.getElementById('infoboxboss-data')?.remove();
})(); </script>
<style> .infobox-boss-wide {
display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: unset; background: none; border: none; border-radius: 12px; box-shadow: none; font-family: sans-serif; color: #222; overflow: hidden;
} .infobox-boss-right {
width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
} .skill-box {
background: none;; color: #222; border-radius: 12px; box-shadow: none; width: 100%; max-width: 700px; box-sizing: border-box; padding: 24px 24px 20px 24px; display: flex; flex-direction: column; align-items: center; gap: 18px; backdrop-filter: blur(2px); margin: 0 auto 24px auto;
} .infobox-skill-info-area {
width: 100%; max-width: 900px; display: flex; flex-direction: column; align-items: center; justify-content: center; margin-bottom: 16px; margin-top: 24px; gap: 12px;
} .infobox-skill-tabs {
display: flex; gap: 12px; justify-content: center; margin-bottom: 0; width: 100%;
} .infobox-skill-tab {
cursor: pointer; background: #fff; color: #222; border: 2px solid #ffc107; border-radius: 8px; padding: 10px 24px; font-size: 1em; font-weight: bold; transition: 0.2s; box-shadow: 0 2px 8px rgba(0,0,0,0.08); opacity: 0.7; margin-bottom: 0;
} .infobox-skill-tab.active, .infobox-skill-tab:hover {
opacity: 1; background: #ffc107; color: #181f2a; border-color: #ffc107;
} .skill-desc {
font-size: 1.08em; width: 100%; text-align: center; font-weight: 500; line-height: 1.5; margin-top: 0; margin-bottom: 0; background: none; color: #222; box-shadow: none; border-radius: 0; padding: 0;
} .infobox-skill-video-area {
width: 100%; max-width: 900px; min-height: 270px; display: flex; align-items: center; justify-content: center; background: transparent; border-radius: 8px; margin-top: 0; margin-bottom: 0; box-shadow: none; padding: 16px 0; margin-left: auto; margin-right: auto;
} .skill-video {
width: 100%; height: auto; max-width: 700px; border-radius: 8px; background: #000; display: block; margin: 0 auto;
} @media (max-width: 900px) {
.infobox-boss-wide {
min-height: unset;
}
.infobox-skill-info-area,
.infobox-skill-video-area {
max-width: 100vw;
width: 100%;
padding: 0 2vw;
}
.skill-video,
.skill-box {
max-width: 100vw;
width: 100%;
}
}
</style>