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

De Wiki Gla
Ir para navegação Ir para pesquisar
 
(91 revisões intermediárias pelo mesmo usuário não estão sendo mostradas)
Linha 1: Linha 1:
<!DOCTYPE html>
<!-- WEAPON TOGGLE SYSTEM - Estado global + popup -->
<html lang="pt-BR">
<script>
<head>
    (() => {
  <meta charset="UTF-8">
        let modalListenersBound = false;
  <title>Mapa Interativo com Caveiras</title>
 
  <style>
        const bindModalEvents = () => {
    body {
            if (modalListenersBound) return;
      margin: 0;
            modalListenersBound = true;
      background: #0d0d0d;
            document.addEventListener('click', (ev) => {
      display: flex;
                if (ev.target.closest('.weapon-modal-close') || ev.target.closest('.weapon-modal-btn')) {
      justify-content: center;
                    const checkbox = document.getElementById('weapon-dont-show');
      align-items: center;
                    if (checkbox && checkbox.checked) {
      height: 100vh;
                        try { localStorage.setItem('glaWeaponPopupDismissed', '1'); } catch (x) { }
      font-family: sans-serif;
                    }
                    hidePopup();
                    return;
                }
                if (ev.target.classList.contains('weapon-modal-overlay')) {
                    hidePopup();
                }
            });
        };
 
const applyWeaponState = (enabled) => {
    const first = document.querySelector('.skill-icon');
    const selected = document.querySelector('.skill-icon.selected');
    if (first) {
        if (selected) selected.classList.remove('selected');
        first.classList.add('selected');
     }
     }


     .map-container {
     if (typeof window.__setGlobalWeaponEnabled === 'function') {
      position: relative;
        window.__setGlobalWeaponEnabled(enabled);
      width: 811px;
      height: 554px;
      background: url('sabaodyMap.png') no-repeat center center;
      background-size: cover;
     }
     }


     .skull-icon {
     try {
      position: absolute;
        localStorage.setItem('glaWeaponEnabled', enabled ? '1' : '0');
      width: 24px;
    } catch (x) { }
      height: 24px;
 
      cursor: pointer;
    document.querySelectorAll('.skill-icon[data-weapon]').forEach(el => {
      transition: transform 0.2s, filter 0.2s;
        if (enabled) {
            el.classList.add('has-weapon-available');
            let ind = el.querySelector('.weapon-indicator');
            if (!ind) {
                ind = document.createElement('div');
                ind.className = 'weapon-indicator';
                el.appendChild(ind);
            }
        } else {
            el.classList.remove('has-weapon-available');
            el.classList.remove('weapon-equipped');
            el.style.removeProperty('--weapon-badge-url');
            const ind = el.querySelector('.weapon-indicator');
            if (ind) ind.remove();
        }
    });
 
    const sel = document.querySelector('.skill-icon.selected');
    if (sel) {
        sel.dispatchEvent(new Event('click', { bubbles: true }));
     }
     }
};
        const ensureModal = () => {
            let modal = document.getElementById('weapon-info-modal');
            if (modal) return modal;
            modal = document.createElement('div');
            modal.id = 'weapon-info-modal';
            modal.className = 'weapon-modal';
            modal.innerHTML = `
            <div class="weapon-modal-overlay"></div>
            <div class="weapon-modal-content">
                <div class="weapon-modal-header">
                    <h3>Visualização com Arma Especial</h3>
                    <button class="weapon-modal-close">&times;</button>
                </div>
                <div class="weapon-modal-body">
                    <p>Este modo ativa a visualização do personagem equipado com sua <strong>arma especial</strong>.</p>
                    <p>As habilidades melhoradas ficam <strong>destacadas com borda e brilho azul</strong>, mesmo quando não selecionadas.</p>
                    <p class="weapon-info-link" style="margin-top:8px;display:none"></p>
                </div>
                <div class="weapon-modal-footer">
                    <label class="weapon-modal-checkbox">
                        <input type="checkbox" id="weapon-dont-show">
                        <span>Não mostrar novamente</span>
                    </label>
                    <button class="weapon-modal-btn">Entendi</button>
                </div>
            </div>
        `;
            document.body.appendChild(modal);
            try {
                const firstWithWeapon = document.querySelector('.skill-icon[data-weapon]');
                if (firstWithWeapon) {
                    const raw = firstWithWeapon.getAttribute('data-weapon');
                    const obj = JSON.parse(raw || '{}');
                    const nm = (obj && obj.name) ? String(obj.name).trim() : '';
                    if (nm) {
                        const linkHost = (window.mw && mw.util && typeof mw.util.getUrl === 'function') ? mw.util.getUrl(nm) : ('/index.php?title=' + encodeURIComponent(nm));
                        const holder = modal.querySelector('.weapon-info-link');
                        if (holder) {
                            holder.style.display = 'block';
                            holder.innerHTML = `<a href="${linkHost}" style="color:#6BB3FF;text-decoration:none;font-weight:600">Ver página da arma: ${nm}</a>`;
                        }
                    }
                }
            } catch (_) { }
            bindModalEvents();
            return modal;
        };
        const showPopup = () => {
            const modal = ensureModal();
            if (modal) modal.classList.add('show');
        };
        const hidePopup = () => {
            const m = document.getElementById('weapon-info-modal');
            if (m) m.classList.remove('show');
        };
        window.__applyWeaponState = applyWeaponState;
        window.__glaWeaponShowPopup = showPopup;
        window.__glaWeaponHidePopup = hidePopup;
        try {
            window.dispatchEvent(new CustomEvent('weapon:ready', { detail: { applyWeaponState, showPopup, hidePopup } }));
        } catch (err) {
        }
        const boot = () => {
            // Verificar se existe alguma skill com arma
            const hasAnyWeapon = document.querySelectorAll('.skill-icon[data-weapon]').length > 0;
            if (!hasAnyWeapon) return;
            ensureModal();
            // Estado inicial do toggle
            let init = false;
            try {
                if (localStorage.getItem('glaWeaponEnabled') === '1') init = true;
            } catch (x) { }
            setTimeout(() => applyWeaponState(init), 150);
        };


     .heart-icon {
        if (document.readyState === 'loading') {
      position: absolute;
            document.addEventListener('DOMContentLoaded', boot);
      width: 26px;
        } else {
      height: 26px;
            boot();
      padding: 1px;
        }
      cursor: pointer;
    })();
      transition: transform 0.2s, filter 0.2s;
</script>
<style>
     .weapon-modal {
        position: fixed;
        inset: 0;
        z-index: 9999;
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        pointer-events: none;
        transition: opacity .3s;
     }
     }


     .skull-icon:hover,
     .weapon-modal.show {
    .heart-icon:hover,
        opacity: 1;
    .puzzle-button:hover {
        pointer-events: all;
      transform: scale(1.3);
      filter: brightness(1.5);
     }
     }


     .popup {
     .weapon-modal-overlay {
      position: absolute;
        position: absolute;
      background: #1e1e1e;
        inset: 0;
      color: #fff;
        background: rgba(0, 0, 0, .75);
      padding: 10px 14px;
        -webkit-backdrop-filter: blur(4px);
      border-radius: 8px;
        backdrop-filter: blur(4px);
      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 {
     .weapon-modal-content {
      border-radius: 6px;
        position: relative;
      margin-top: 6px;
        background: linear-gradient(135deg, #1f1f1f, #2a2a2a);
      max-width: 100%;
        border: 1px solid rgba(255, 255, 255, .12);
        border-radius: 12px;
        max-width: 420px;
        width: 90%;
        box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
        animation: modalIn .3s;
     }
     }


     .puzzle-button {
     @keyframes modalIn {
      position: absolute;
        from {
      cursor: pointer;
            transform: translateY(-20px);
      z-index: 999;
            opacity: 0;
      width: 28px;
        }
      height: 28px;
 
      transition: transform 0.2s, filter 0.2s;
        to {
            transform: translateY(0);
            opacity: 1;
        }
     }
     }


     @keyframes fadeIn {
     .weapon-modal-header {
      from { opacity: 0; transform: translateY(-5px); }
        display: flex;
      to { opacity: 1; transform: translateY(0); }
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        border-bottom: 1px solid rgba(255, 255, 255, .08);
     }
     }
  </style>
</head>
<body>
  <div class="map-container" id="map">
    <!-- Caveiras e elementos serão inseridos via JS -->
  </div>


  <script>
     .weapon-modal-header h3 {
     const skulls = [
         margin: 0;
      {
         font-size: 16px;
        x: 410, y: 220,
         font-weight: 600;
        title: "White Skull",
         color: #fff;
        desc: "Boss: White Skull<br>Área sombria, cuidado com os ataques surpresa!"
    }
      },
      {
        x: 650, y: 125,
        title: "Red Fang",
        desc: "Boss: Red Fang<br>Possui resistência a fogo. Traga ataques de gelo!"
      },
      {
         x: 250, y: 410,
         title: "Void Wraith",
         desc: "Boss: Void Wraith<br>Evite ataques diretos. Usa magia de sombras."
      },
      {
         x: 248, y: 320,
        title: "Night Howler",
        desc: "Boss: Night Howler<br>Ataca com velocidade e confusão. Use proteção contra atordoamento!"
      }
    ];


     const hearts = [
     .weapon-modal-close {
      { x: 280, y: 210, desc: "Cura escondida: Quebre a caixa para obter uma cura." },
        background: transparent;
      { x: 312, y: 196 },
        border: none;
      { x: 245, y: 358, desc: "Após o chefe, o jogador com menos vida receberá uma cura automática." }
        color: rgba(255, 255, 255, .5);
     ];
        font-size: 24px;
        cursor: pointer;
        padding: 0;
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 4px;
        transition: background .15s, color .15s;
     }


     const puzzleButton = {
     .weapon-modal-close:hover {
      x: 225,
        background: rgba(255, 255, 255, .1);
      y: 210,
        color: #fff;
      videoUrl: "https://www.youtube.com/embed/10rhyP32vdw"
     }
     };


     const map = document.getElementById("map");
     .weapon-modal-body {
        padding: 20px;
        color: rgba(255, 255, 255, .8);
        line-height: 1.6;
        font-size: 14px;
    }


     // Adiciona as caveiras
     .weapon-modal-body p {
    skulls.forEach((skull, index) => {
        margin: 0 0 12px;
      const icon = document.createElement("img");
    }
      icon.src = "Whiteskull.png";
      icon.className = "skull-icon";
      icon.style.left = skull.x + "px";
      icon.style.top = skull.y + "px";
      icon.dataset.index = index;


      const popup = document.createElement("div");
    .weapon-modal-body p:last-child {
      popup.className = "popup";
        margin: 0;
      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", () => {
    .weapon-modal-body strong {
         popup.style.display = popup.style.display === "block" ? "none" : "block";
         color: #6BB3FF;
      });
    }


      document.addEventListener("click", (e) => {
    .weapon-modal-footer {
         if (!icon.contains(e.target) && !popup.contains(e.target)) {
         display: flex;
          popup.style.display = "none";
        align-items: center;
         }
        justify-content: space-between;
      });
        padding: 14px 20px;
        border-top: 1px solid rgba(255, 255, 255, .08);
         gap: 12px;
    }


      map.appendChild(icon);
    .weapon-modal-checkbox {
      map.appendChild(popup);
        display: flex;
     });
        align-items: center;
        gap: 8px;
        font-size: 12px;
        color: rgba(255, 255, 255, .6);
        cursor: pointer;
     }


     // Adiciona os corações
     .weapon-modal-checkbox input[type="checkbox"] {
    hearts.forEach((heart, index) => {
        accent-color: #4A9EFF;
      const icon = document.createElement("img");
    }
      const desc = heart.desc || "Pegue o coração para se curar";
      icon.src = "heart.png";
      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");
    .weapon-modal-btn {
      popup.className = "popup";
        background: #4A9EFF;
      popup.innerHTML = `<strong>Cura</strong><br>${desc}`;
        border: none;
      popup.style.left = (heart.x + 30) + "px";
        color: #fff;
      popup.style.top = (heart.y - 10) + "px";
        padding: 10px 24px;
        border-radius: 6px;
        font-weight: 600;
        font-size: 13px;
        cursor: pointer;
        transition: background .15s;
    }


      icon.addEventListener("click", () => {
    .weapon-modal-btn:hover {
         popup.style.display = popup.style.display === "block" ? "none" : "block";
         background: #3A8EEF;
      });
    }


      document.addEventListener("click", (e) => {
    @media (max-width: 600px) {
         if (!icon.contains(e.target) && !popup.contains(e.target)) {
         .weapon-modal-content {
          popup.style.display = "none";
            width: 95%;
         }
         }
      });


      map.appendChild(icon);
        .weapon-modal-header,
      map.appendChild(popup);
        .weapon-modal-body,
    });
        .weapon-modal-footer {
            padding: 12px 16px;
        }


    // Ícone do Puzzle
        .weapon-modal-footer {
    const button = document.createElement("img");
            flex-direction: column;
    button.className = "puzzle-button";
         }
    button.src = "puzzle.png";
     }
    button.alt = "Puzzle";
</style>
    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) => {
      if (!button.contains(e.target) && !popup.contains(e.target)) {
         popup.style.display = "none";
      }
     });
 
    map.appendChild(button);
    map.appendChild(popup);
  </script>
</body>
</html>

Edição atual tal como às 16h34min de 2 de dezembro de 2025

<script>

   (() => {
       let modalListenersBound = false;
       const bindModalEvents = () => {
           if (modalListenersBound) return;
           modalListenersBound = true;
           document.addEventListener('click', (ev) => {
               if (ev.target.closest('.weapon-modal-close') || ev.target.closest('.weapon-modal-btn')) {
                   const checkbox = document.getElementById('weapon-dont-show');
                   if (checkbox && checkbox.checked) {
                       try { localStorage.setItem('glaWeaponPopupDismissed', '1'); } catch (x) { }
                   }
                   hidePopup();
                   return;
               }
               if (ev.target.classList.contains('weapon-modal-overlay')) {
                   hidePopup();
               }
           });
       };

const applyWeaponState = (enabled) => {

   const first = document.querySelector('.skill-icon');
   const selected = document.querySelector('.skill-icon.selected');
   if (first) {
       if (selected) selected.classList.remove('selected');
       first.classList.add('selected');
   }
   if (typeof window.__setGlobalWeaponEnabled === 'function') {
       window.__setGlobalWeaponEnabled(enabled);
   }
   try {
       localStorage.setItem('glaWeaponEnabled', enabled ? '1' : '0');
   } catch (x) { }
   document.querySelectorAll('.skill-icon[data-weapon]').forEach(el => {
       if (enabled) {
           el.classList.add('has-weapon-available');
           let ind = el.querySelector('.weapon-indicator');
           if (!ind) {
               ind = document.createElement('div');
               ind.className = 'weapon-indicator';
               el.appendChild(ind);
           }
       } else {
           el.classList.remove('has-weapon-available');
           el.classList.remove('weapon-equipped');
           el.style.removeProperty('--weapon-badge-url');
           const ind = el.querySelector('.weapon-indicator');
           if (ind) ind.remove();
       }
   });
   const sel = document.querySelector('.skill-icon.selected');
   if (sel) {
       sel.dispatchEvent(new Event('click', { bubbles: true }));
   }

};


       const ensureModal = () => {
           let modal = document.getElementById('weapon-info-modal');
           if (modal) return modal;
           modal = document.createElement('div');
           modal.id = 'weapon-info-modal';
           modal.className = 'weapon-modal';
           modal.innerHTML = `

Visualização com Arma Especial

                   <button class="weapon-modal-close">×</button>

Este modo ativa a visualização do personagem equipado com sua arma especial.

As habilidades melhoradas ficam destacadas com borda e brilho azul, mesmo quando não selecionadas.

       `;
           document.body.appendChild(modal);
           try {
               const firstWithWeapon = document.querySelector('.skill-icon[data-weapon]');
               if (firstWithWeapon) {
                   const raw = firstWithWeapon.getAttribute('data-weapon');
                   const obj = JSON.parse(raw || '{}');
                   const nm = (obj && obj.name) ? String(obj.name).trim() : ;
                   if (nm) {
                       const linkHost = (window.mw && mw.util && typeof mw.util.getUrl === 'function') ? mw.util.getUrl(nm) : ('/index.php?title=' + encodeURIComponent(nm));
                       const holder = modal.querySelector('.weapon-info-link');
                       if (holder) {
                           holder.style.display = 'block';
                           holder.innerHTML = `<a href="${linkHost}" style="color:#6BB3FF;text-decoration:none;font-weight:600">Ver página da arma: ${nm}</a>`;
                       }
                   }
               }
           } catch (_) { }
           bindModalEvents();
           return modal;
       };
       const showPopup = () => {
           const modal = ensureModal();
           if (modal) modal.classList.add('show');
       };
       const hidePopup = () => {
           const m = document.getElementById('weapon-info-modal');
           if (m) m.classList.remove('show');
       };
       window.__applyWeaponState = applyWeaponState;
       window.__glaWeaponShowPopup = showPopup;
       window.__glaWeaponHidePopup = hidePopup;
       try {
           window.dispatchEvent(new CustomEvent('weapon:ready', { detail: { applyWeaponState, showPopup, hidePopup } }));
       } catch (err) {
       }
       const boot = () => {
           // Verificar se existe alguma skill com arma
           const hasAnyWeapon = document.querySelectorAll('.skill-icon[data-weapon]').length > 0;
           if (!hasAnyWeapon) return;
           ensureModal();
           // Estado inicial do toggle
           let init = false;
           try {
               if (localStorage.getItem('glaWeaponEnabled') === '1') init = true;
           } catch (x) { }
           setTimeout(() => applyWeaponState(init), 150);
       };
       if (document.readyState === 'loading') {
           document.addEventListener('DOMContentLoaded', boot);
       } else {
           boot();
       }
   })();

</script> <style>

   .weapon-modal {
       position: fixed;
       inset: 0;
       z-index: 9999;
       display: flex;
       align-items: center;
       justify-content: center;
       opacity: 0;
       pointer-events: none;
       transition: opacity .3s;
   }
   .weapon-modal.show {
       opacity: 1;
       pointer-events: all;
   }
   .weapon-modal-overlay {
       position: absolute;
       inset: 0;
       background: rgba(0, 0, 0, .75);
       -webkit-backdrop-filter: blur(4px);
       backdrop-filter: blur(4px);
   }
   .weapon-modal-content {
       position: relative;
       background: linear-gradient(135deg, #1f1f1f, #2a2a2a);
       border: 1px solid rgba(255, 255, 255, .12);
       border-radius: 12px;
       max-width: 420px;
       width: 90%;
       box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
       animation: modalIn .3s;
   }
   @keyframes modalIn {
       from {
           transform: translateY(-20px);
           opacity: 0;
       }
       to {
           transform: translateY(0);
           opacity: 1;
       }
   }
   .weapon-modal-header {
       display: flex;
       align-items: center;
       justify-content: space-between;
       padding: 16px 20px;
       border-bottom: 1px solid rgba(255, 255, 255, .08);
   }
   .weapon-modal-header h3 {
       margin: 0;
       font-size: 16px;
       font-weight: 600;
       color: #fff;
   }
   .weapon-modal-close {
       background: transparent;
       border: none;
       color: rgba(255, 255, 255, .5);
       font-size: 24px;
       cursor: pointer;
       padding: 0;
       width: 28px;
       height: 28px;
       display: flex;
       align-items: center;
       justify-content: center;
       border-radius: 4px;
       transition: background .15s, color .15s;
   }
   .weapon-modal-close:hover {
       background: rgba(255, 255, 255, .1);
       color: #fff;
   }
   .weapon-modal-body {
       padding: 20px;
       color: rgba(255, 255, 255, .8);
       line-height: 1.6;
       font-size: 14px;
   }
   .weapon-modal-body p {
       margin: 0 0 12px;
   }
   .weapon-modal-body p:last-child {
       margin: 0;
   }
   .weapon-modal-body strong {
       color: #6BB3FF;
   }
   .weapon-modal-footer {
       display: flex;
       align-items: center;
       justify-content: space-between;
       padding: 14px 20px;
       border-top: 1px solid rgba(255, 255, 255, .08);
       gap: 12px;
   }
   .weapon-modal-checkbox {
       display: flex;
       align-items: center;
       gap: 8px;
       font-size: 12px;
       color: rgba(255, 255, 255, .6);
       cursor: pointer;
   }
   .weapon-modal-checkbox input[type="checkbox"] {
       accent-color: #4A9EFF;
   }
   .weapon-modal-btn {
       background: #4A9EFF;
       border: none;
       color: #fff;
       padding: 10px 24px;
       border-radius: 6px;
       font-weight: 600;
       font-size: 13px;
       cursor: pointer;
       transition: background .15s;
   }
   .weapon-modal-btn:hover {
       background: #3A8EEF;
   }
   @media (max-width: 600px) {
       .weapon-modal-content {
           width: 95%;
       }
       .weapon-modal-header,
       .weapon-modal-body,
       .weapon-modal-footer {
           padding: 12px 16px;
       }
       .weapon-modal-footer {
           flex-direction: column;
       }
   }

</style>