Widget:Droflax
Ir para navegação
Ir para pesquisar
<script> (function () {
const raw= document.getElementById('infoboxboss-data');
console.log(raw);
if (!raw) {
console.error('Persona widget: no se encontró #persona-data');
return;
}
// Extração de dados
let habilidades = [];
const tempRawHabs = (raw.dataset.habilidadesRaw || ).trim();
rawHabs = tempRawHabs.replace(//g, ).trim();
rawHabs.split('||').forEach(line => {
if (!line.trim()) return;
const parts = line.split('|').map(x => x.trim()).filter(Boolean);
const habData = {};
parts.forEach(part => {
const [key, ...valParts] = part.split('=');
if (!key || valParts.length === 0) return;
habData[key.trim()] = valParts.join('=').trim();
});
const { nome, desc = , video = } = habData;
if (nome) {
habilidades.push({
nome,
descricao: desc,
video
});
} else {
console.warn("Habilidad omitida por falta de campos obligatorios:", line);
}
});
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 = false;
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 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';
}
});
});
});
document.getElementById('infoboxboss-data')?.remove();
})(); </script>
<style> .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;
} </style>