Mudanças entre as edições de "Widget:Droflax"

De Wiki Gla
Ir para navegação Ir para pesquisar
Linha 3: Linha 3:
     <div class="infobox-skill-info-area">
     <div class="infobox-skill-info-area">
       <div class="skill-box">
       <div class="skill-box">
         <div class="infobox-skill-tabs">
         <div class="infobox-skill-tabs" id="skill-tabs"></div>
          <button class="infobox-skill-tab active" data-video="video1">Golpe Congelante</button>
         <div class="skill-desc" id="desc-text"></div>
          <button class="infobox-skill-tab" data-video="video2">Muralha de Gelo</button>
          <button class="infobox-skill-tab" data-video="video3">Explosão Ártica</button>
        </div>
         <div class="skill-desc" id="desc-text">
          Golpe Congelante: Causa dano em área e reduz a velocidade dos inimigos.
        </div>
       </div>
       </div>
     </div>
     </div>
     <div class="infobox-skill-video-area">
     <div class="infobox-skill-video-area" id="skill-videos"></div>
      <video id="video1" class="skill-video" controls autoplay loop>
        <source src="https://wiki.gla.com.br/images/2/22/Aokiji_sk3.webm" type="video/mp4">
        Seu navegador não suporta vídeo.
      </video>
      <video id="video2" class="skill-video" controls autoplay loop style="display:none"></video>
      <video id="video3" class="skill-video" controls autoplay loop style="display:none"></video>
    </div>
   </div>
   </div>
</div>
</div>


<script>
<script>
   const videoSources = {
   const raw = document.getElementById('infoboxboss-data')?.dataset?.habilidadesRaw;
     video1: "https://wiki.gla.com.br/images/2/22/Aokiji_sk3.webm",
  if (!raw) return;
     video2: "https://wiki.gla.com.br/images/6/6b/Aokiji_sk2.webm",
 
     video3: "https://wiki.gla.com.br/images/7/76/Aokiji_sk1.webm"
  const parts = raw.split('||').filter(p => p.trim());
  };
  const habilidades = [];
  const skillDescriptions = {
 
     video1: "Golpe Congelante: Causa dano em área e reduz a velocidade dos inimigos.",
  for (let i = 0; i < parts.length; i += 3) {
     video2: "Muralha de Gelo: Cria uma barreira protetora de gelo.",
     habilidades.push({
     video3: "Explosão Ártica: Dispara fragmentos de gelo em várias direções."
      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 tabs = document.querySelectorAll('.infobox-skill-tab');
   const videos = document.querySelectorAll('.skill-video');
   const videos = document.querySelectorAll('.skill-video');
  const desc = document.getElementById('desc-text');


   tabs.forEach(tab => {
   tabs.forEach((tab, idx) => {
     tab.addEventListener('click', () => {
     tab.addEventListener('click', () => {
       tabs.forEach(i => i.classList.remove('active'));
       tabs.forEach(t => t.classList.remove('active'));
       tab.classList.add('active');
       tab.classList.add('active');
       const vid = tab.getAttribute('data-video');
       const vidId = tab.dataset.video;
       desc.textContent = skillDescriptions[vid];
 
       descText.textContent = `${habilidades[idx].nome}: ${habilidades[idx].descricao}`;
 
       videos.forEach(v => {
       videos.forEach(v => {
         if (v.id === vid) {
         if (v.id === vidId) {
          if (!v.querySelector('source')) {
            const source = document.createElement('source');
            source.src = videoSources[vid];
            source.type = "video/mp4";
            v.appendChild(source);
          }
           v.style.display = '';
           v.style.display = '';
           v.load();
           v.load();
Linha 60: Linha 78:
           v.pause();
           v.pause();
           v.style.display = 'none';
           v.style.display = 'none';
          while (v.firstChild) v.removeChild(v.firstChild);
         }
         }
       });
       });
     });
     });
   });
   });
  // Limpia el div original
  document.getElementById('infoboxboss-data')?.remove();
</script>
</script>


<style>
<style>

Edição das 00h27min de 21 de maio de 2025

<script>

 const raw = document.getElementById('infoboxboss-data')?.dataset?.habilidadesRaw;
 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>