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

De Wiki Gla
Ir para navegação Ir para pesquisar
 
(337 revisões intermediárias por 2 usuários não estão sendo mostradas)
Linha 1: Linha 1:
  <div class="map-container" id="map">
<div class="language-switch">
    <!-- Caveiras e elementos serão inseridos via JS -->
  <a data-lang="pt"><img src="https://upload.wikimedia.org/wikipedia/en/0/05/Flag_of_Brazil.svg" width="32" height="24"></a>
  </div>
  <a data-lang="es"><img src="https://upload.wikimedia.org/wikipedia/commons/9/9a/Flag_of_Spain.svg" width="32" height="24"></a>
  <a data-lang="en"><img src="https://upload.wikimedia.org/wikipedia/en/a/a4/Flag_of_the_United_States.svg" width="32" height="24"></a>
  <a data-lang="pl"><img src="https://upload.wikimedia.org/wikipedia/en/1/12/Flag_of_Poland.svg" width="32" height="24"></a>
</div>


  <script>
<style>
    const skulls = [
.language-switch {
      {
  display: flex;
        x: 410, y: 220,
  gap: 6px;
        title: "White Skull",
  margin: 8px 0;
        desc: "Boss: White Skull<br>Área sombria, cuidado com os ataques surpresa!"
  justify-content: center;
      },
}
      {
.language-switch img {
        x: 650, y: 125,
  border: 1px solid #ccc;
        title: "Red Fang",
  border-radius: 6px;
        desc: "Boss: Red Fang<br>Possui resistência a fogo. Traga ataques de gelo!"
  cursor: pointer;
      },
  transition: transform 0.2s ease, border-color 0.2s ease;
      {
}
        x: 250, y: 410,
.language-switch img:hover {
        title: "Void Wraith",
  transform: scale(1.1);
        desc: "Boss: Void Wraith<br>Evite ataques diretos. Usa magia de sombras."
  border-color: #333;
      },
}
      {
.language-switch img.active {
        x: 248, y: 320,
  border-color: #000;
        title: "Night Howler",
}
        desc: "Boss: Night Howler<br>Ataca com velocidade e confusão. Use proteção contra atordoamento!"
</style>
      }
    ];
 
    const hearts = [
      { x: 280, y: 210, desc: "Cura escondida: Quebre a caixa para obter uma cura." },
      { x: 312, y: 196 },
      { x: 245, y: 358, desc: "Após o chefe, o jogador com menos vida receberá uma cura automática." }
    ];
 
    const puzzleButton = {
      x: 244,
      y: 217,
      videoUrl: "https://www.youtube.com/embed/10rhyP32vdw"
    };


    const map = document.getElementById("map");
<script>
(function () {
  let currentLang = 'pt'; // idioma por defecto


    // Adiciona as caveiras
  const langSwitch = document.querySelector('.language-switch');
     skulls.forEach((skull, index) => {
  if (langSwitch) {
       const icon = document.createElement("img");
     langSwitch.querySelectorAll('a[data-lang]').forEach(btn => {
      icon.src = "https://ibb.co/VYGCJq5M";
       btn.addEventListener('click', () => {
      icon.className = "skull-icon";
        currentLang = btn.dataset.lang;
      icon.style.left = skull.x + "px";
        langSwitch.querySelectorAll('img').forEach(img => img.classList.remove('active'));
      icon.style.top = skull.y + "px";
        btn.querySelector('img').classList.add('active');
      icon.dataset.index = index;


      const popup = document.createElement("div");
        const active = document.querySelector('.skill-icon.active');
      popup.className = "popup";
        if (active) active.click();
      popup.innerHTML = `<strong>${skull.title}</strong><br>${skull.desc}`;
      popup.style.left = (skull.x + 30) + "px";
      popup.style.top = (skull.y - 10) + "px";
 
      icon.addEventListener("click", () => {
        popup.style.display = popup.style.display === "block" ? "none" : "block";
       });
       });
      document.addEventListener("click", (e) => {
        if (!icon.contains(e.target) && !popup.contains(e.target)) {
          popup.style.display = "none";
        }
      });
      map.appendChild(icon);
      map.appendChild(popup);
     });
     });


     // Adiciona os corações
     // Activar la bandera por defecto
     hearts.forEach((heart, index) => {
     const defaultBtn = langSwitch.querySelector('a[data-lang="pt"] img');
      const icon = document.createElement("img");
    if (defaultBtn) defaultBtn.classList.add('active');
      const desc = heart.desc || "Pegue o coração para se curar";
  }
      icon.src = "https://ibb.co/jvKK6v5b";
      icon.className = "heart-icon";
      icon.style.left = heart.x + "px";
      icon.style.top = heart.y + "px";
      icon.dataset.index = index;


      const popup = document.createElement("div");
  const oldClicks = document.querySelectorAll('.skill-icon');
      popup.className = "popup";
  oldClicks.forEach(el => {
      popup.innerHTML = `<strong>Cura</strong><br>${desc}`;
    el.addEventListener('click', () => {
       popup.style.left = (heart.x + 30) + "px";
       const name = el.dataset.nome || '';
       popup.style.top = (heart.y - 10) + "px";
      const rawDesc = el.dataset.desc || '';
       let descText = '';


       icon.addEventListener("click", () => {
       try {
         popup.style.display = popup.style.display === "block" ? "none" : "block";
         const obj = JSON.parse(rawDesc);
      });
         descText = obj[currentLang] || obj['pt'] || '';
 
       } catch (e) {
      document.addEventListener("click", (e) => {
         descText = rawDesc; // fallback si no es un JSON
         if (!icon.contains(e.target) && !popup.contains(e.target)) {
       }
          popup.style.display = "none";
        }
      });
 
       map.appendChild(icon);
      map.appendChild(popup);
    });
 
    // Ícone do Puzzle
    const button = document.createElement("img");
    button.className = "puzzle-button";
    button.src = "https://ibb.co/rRwJhSFD";
    button.alt = "Puzzle";
    button.style.left = puzzleButton.x + "px";
    button.style.top = puzzleButton.y + "px";
 
    const popup = document.createElement("div");
    popup.className = "popup";
    popup.style.left = (puzzleButton.x + 60) + "px";
    popup.style.top = (puzzleButton.y - 10) + "px";
    popup.innerHTML = `
      <strong>Desafio Puzzle</strong><br>
      <iframe width="400" height="260"
        src="${puzzleButton.videoUrl}"
         frameborder="0"
        allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
        allowfullscreen>
      </iframe>
    `;
 
    button.addEventListener("click", () => {
       popup.style.display = popup.style.display === "block" ? "none" : "block";
    });


    document.addEventListener("click", (e) => {
      const attrs = el.dataset.atr || '';
       if (!button.contains(e.target) && !popup.contains(e.target)) {
      const descBox = document.querySelector('.desc-box');
         popup.style.display = "none";
       if (descBox) {
         descBox.innerHTML = `<div class="skill-title"><h3>${name}</h3></div>${renderAttributes(attrs)}<div class="desc">${descText}</div>`;
       }
       }
     });
     });
 
   });
    map.appendChild(button);
})();
    map.appendChild(popup);
// CSS
    document.head.insertAdjacentHTML('beforeend', `
   <style>
    body {
      margin: 0;
      background: #0d0d0d;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
      font-family: sans-serif;
    }
 
    .map-container {
      position: relative;
      width: 811px;
      height: 554px;
      background: url('https://ibb.co/LdtrThKk') no-repeat center center;
      background-size: cover;
    }
 
    .skull-icon {
      position: absolute;
      width: 24px;
      height: 24px;
      cursor: pointer;
      transition: transform 0.2s, filter 0.2s;
    }
 
    .heart-icon {
      position: absolute;
      width: 26px;
      height: 26px;
      padding: 1px;
      cursor: pointer;
      transition: transform 0.2s, filter 0.2s;
    }
 
    .skull-icon:hover,
    .heart-icon:hover,
    .puzzle-button:hover {
      transform: scale(1.3);
      filter: brightness(1.5);
    }
 
    .popup {
      position: absolute;
      background: #1e1e1e;
      color: #fff;
      padding: 10px 14px;
      border-radius: 8px;
      border: 1px solid #444;
      box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
      display: none;
      z-index: 10;
      max-width: 500px;
      font-size: 14px;
      animation: fadeIn 0.3s ease-out;
    }
 
    .popup iframe {
      border-radius: 6px;
      margin-top: 6px;
      max-width: 100%;
    }
 
    .puzzle-button {
      position: absolute;
      cursor: pointer;
      z-index: 999;
      width: 28px;
      height: 28px;
      transition: transform 0.2s, filter 0.2s;
    }
 
    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(-5px); }
      to { opacity: 1; transform: translateY(0); }
    }
  </style>
  `);
</script>
</script>

Edição atual tal como às 06h05min de 31 de agosto de 2025

 <a data-lang="pt"><img src="https://upload.wikimedia.org/wikipedia/en/0/05/Flag_of_Brazil.svg" width="32" height="24"></a>
 <a data-lang="es"><img src="https://upload.wikimedia.org/wikipedia/commons/9/9a/Flag_of_Spain.svg" width="32" height="24"></a>
 <a data-lang="en"><img src="https://upload.wikimedia.org/wikipedia/en/a/a4/Flag_of_the_United_States.svg" width="32" height="24"></a>
 <a data-lang="pl"><img src="https://upload.wikimedia.org/wikipedia/en/1/12/Flag_of_Poland.svg" width="32" height="24"></a>

<style> .language-switch {

 display: flex;
 gap: 6px;
 margin: 8px 0;
 justify-content: center;

} .language-switch img {

 border: 1px solid #ccc;
 border-radius: 6px;
 cursor: pointer;
 transition: transform 0.2s ease, border-color 0.2s ease;

} .language-switch img:hover {

 transform: scale(1.1);
 border-color: #333;

} .language-switch img.active {

 border-color: #000;

} </style>

<script> (function () {

 let currentLang = 'pt'; // idioma por defecto
 const langSwitch = document.querySelector('.language-switch');
 if (langSwitch) {
   langSwitch.querySelectorAll('a[data-lang]').forEach(btn => {
     btn.addEventListener('click', () => {
       currentLang = btn.dataset.lang;
       langSwitch.querySelectorAll('img').forEach(img => img.classList.remove('active'));
       btn.querySelector('img').classList.add('active');
       const active = document.querySelector('.skill-icon.active');
       if (active) active.click();
     });
   });
   // Activar la bandera por defecto
   const defaultBtn = langSwitch.querySelector('a[data-lang="pt"] img');
   if (defaultBtn) defaultBtn.classList.add('active');
 }
 const oldClicks = document.querySelectorAll('.skill-icon');
 oldClicks.forEach(el => {
   el.addEventListener('click', () => {
     const name = el.dataset.nome || ;
     const rawDesc = el.dataset.desc || ;
     let descText = ;
     try {
       const obj = JSON.parse(rawDesc);
       descText = obj[currentLang] || obj['pt'] || ;
     } catch (e) {
       descText = rawDesc; // fallback si no es un JSON
     }
     const attrs = el.dataset.atr || ;
     const descBox = document.querySelector('.desc-box');
     if (descBox) {

descBox.innerHTML = `

${name}

${renderAttributes(attrs)}

${descText}

`;

     }
   });
 });

})(); </script>