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

De Wiki Gla
Ir para navegação Ir para pesquisar
m
m
 
(200 revisões intermediárias por 3 usuários não estão sendo mostradas)
Linha 1: Linha 1:
<select id="layerSelector" style="margin-bottom: 8px">
<style>
  <option value="camada1">Camada 1</option>
    .island-grid {
  <option value="camada2">Camada 2</option>
        display: flex;
</select>
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        padding: 12px 0;
    }


<div class="map-container" id="map"></div>
    .island-banner {
        position: relative;
        width: 380px;
        height: 90px;
        overflow: hidden;
        border-radius: 8px;
        box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 10px;
        cursor: pointer;
        transition: transform 0.15s, box-shadow 0.15s;
        display: block;
        box-sizing: border-box;
    }


<script>
     .island-banner::before {
  const MAP_DATA = {
        content: "";
     camada1: {
         position: absolute;
      background: "https://i.imgur.com/9z4WZL1.png",
         top: 0;
      skulls: [
         left: 0;
         { x: 410, y: 220, title: "White Skull", desc: "Boss: White Skull<br>Área sombria, cuidado com os ataques surpresa!" },
         right: 0;
         { x: 650, y: 125, title: "Red Fang", desc: "Boss: Red Fang<br>Possui resistência a fogo. Traga ataques de gelo!" },
         bottom: 0;
         { x: 250, y: 410, title: "Void Wraith", desc: "Boss: Void Wraith<br>Evite ataques diretos. Usa magia de sombras." },
         background: linear-gradient(105deg, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.35) 40%, rgba(0, 0, 0, 0.1) 70%, transparent 100%);
         { x: 248, y: 320, title: "Night Howler", desc: "Boss: Night Howler<br>Ataca com velocidade e confusão. Use proteção contra atordoamento!" }
        pointer-events: none;
      ],
         z-index: 1;
      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." }
      ],
      puzzle: { x: 244, y: 217, videoUrl: "https://www.youtube.com/embed/10rhyP32vdw" }
    },
    camada2: {
      background: "https://i.imgur.com/IoBLbik.png",
      skulls: [
        { x: 330, y: 150, title: "Phantom", desc: "Boss: Phantom<br>Usa invisibilidade e veneno." }
      ],
      hearts: [
         { x: 290, y: 190 }
      ],
      puzzle: { x: 220, y: 200, videoUrl: "https://www.youtube.com/embed/10rhyP32vdw" }
     }
     }
  };


  const map = document.getElementById("map");
    .island-banner:hover {
  const selector = document.getElementById("layerSelector");
        transform: translateY(-2px);
        box-shadow: rgba(0, 0, 0, 0.35) 0px 4px 12px;
    }


  function createIcon(x, y, className, src, popupHTML) {
    .island-banner .island-chests {
    const icon = document.createElement("img");
        position: absolute;
    icon.src = src;
        top: 8px;
    icon.className = className;
        left: 8px;
    icon.style.left = x + "px";
        display: flex;
     icon.style.top = y + "px";
        flex-wrap: wrap;
        gap: 6px;
        z-index: 2;
        pointer-events: none;
     }


     const popup = document.createElement("div");
     .island-banner .island-chest-group {
    popup.className = "popup";
        position: relative;
    popup.innerHTML = popupHTML;
        display: inline-block;
    popup.style.left = (x + 30) + "px";
     }
     popup.style.top = (y - 10) + "px";


     icon.addEventListener("click", () => {
     .island-banner .island-chest-group img {
      popup.style.display = popup.style.display === "block" ? "none" : "block";
        display: block;
    });
        width: auto;
    document.addEventListener("click", (e) => {
         height: auto;
      if (!icon.contains(e.target) && !popup.contains(e.target)) {
     }
         popup.style.display = "none";
      }
     });


     map.appendChild(icon);
     .island-banner .island-chest-count {
     map.appendChild(popup);
    position: absolute;
  }
    left: 0;          /* era right: 0 */
    bottom: 0;
    font-size: 12.5px;  /* era 11px */
    font-weight: bold;
    color: #fff;
    background: rgba(0, 0, 0, 0.75);
     padding: 1px 3px;
    border-radius: 3px;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    z-index: 10;
}


  function renderLayer(layerKey) {
    .island-banner .island-title {
    const config = MAP_DATA[layerKey];
        position: absolute;
    if (!config) return;
        bottom: 10px;
 
        left: 8px;
    map.innerHTML = "";
        font-size: 1.35em;
    map.style.backgroundImage = `url('${config.background}')`;
        font-weight: bold;
        color: #fff;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.5);
        line-height: 1.2;
        z-index: 2;
        pointer-events: none;
        text-transform: uppercase;
    }


     config.skulls?.forEach(skull => {
     @media (max-width: 768px) {
      createIcon(skull.x, skull.y, "skull-icon", "/images/d/dc/Whiteskull.png",
        .island-grid {
        `<strong>${skull.title}</strong><br>${skull.desc}`);
            flex-direction: column;
    });
            align-items: stretch;
        }


    config.hearts?.forEach(heart => {
        .island-banner {
      const desc = heart.desc || "Pegue o coração para se curar";
            width: 100%;
      createIcon(heart.x, heart.y, "heart-icon", "/images/d/d9/Heart.png",
            max-width: none;
        `<strong>Cura</strong><br>${desc}`);
         }
    });
 
    if (config.puzzle) {
      createIcon(config.puzzle.x, config.puzzle.y, "puzzle-button", "/images/d/de/Engrenagem.png",
         `<strong>Desafio Puzzle</strong><br><iframe width="400" height="260" src="${config.puzzle.videoUrl}" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>`);
     }
     }
  }
</style>
 
<script>
  selector.addEventListener("change", e => renderLayer(e.target.value));
    (function () {
  renderLayer("camada1");
        function applyBackgrounds() {
 
            document.querySelectorAll('.island-banner[data-bgimg]').forEach(function (el) {
  document.head.insertAdjacentHTML('beforeend', `
                var filename = el.getAttribute('data-bgimg');
    <style>
                if (!filename) return;
      .map-container {
                var url;
        position: relative;
                if (typeof mw !== 'undefined' && mw.util && mw.util.getUrl) {
        width: 811px;
                    url = mw.util.getUrl('Especial:FilePath/' + filename);
        height: 554px;
                } else {
        background-size: cover;
                    url = '/index.php?title=Especial:FilePath/' + encodeURIComponent(filename);
        background-repeat: no-repeat;
                }
        background-position: center center;
                el.style.backgroundImage = 'url(' + url + ')';
      }
                el.style.backgroundSize = 'cover';
      .skull-icon, .heart-icon, .puzzle-button {
                el.style.backgroundPosition = 'center';
        position: absolute;
                el.style.backgroundRepeat = 'no-repeat';
        cursor: pointer;
            });
        transition: transform 0.2s, filter 0.2s;
        }
      }
        function initClickable() {
      .skull-icon { width: 24px; height: 24px; }
            document.querySelectorAll('.island-banner[data-href]').forEach(function (el) {
      .heart-icon { width: 26px; height: 26px; padding: 1px; }
                if (el._icClick) return;
      .puzzle-button { width: 28px; height: 28px; z-index: 999; }
                el._icClick = true;
      .skull-icon:hover, .heart-icon:hover, .puzzle-button:hover {
                el.setAttribute('role', 'link');
        transform: scale(1.3);
                el.setAttribute('tabindex', '0');
        filter: brightness(1.5);
                el.addEventListener('click', function () {
      }
                    var href = el.getAttribute('data-href');
      .popup {
                    if (href) window.location.href = href;
        position: absolute;
                });
        background: #1e1e1e;
                el.addEventListener('keydown', function (e) {
        color: #fff;
                    if (e.key === 'Enter' || e.key === ' ') {
        padding: 10px 14px;
                        e.preventDefault();
         border-radius: 8px;
                        var href = el.getAttribute('data-href');
         border: 1px solid #444;
                        if (href) window.location.href = href;
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
                    }
        display: none;
                });
         z-index: 10;
            });
         max-width: 500px;
         }
        font-size: 14px;
         function run() {
        animation: fadeIn 0.3s ease-out;
            applyBackgrounds();
      }
            initClickable();
      .popup iframe {
         }
        border-radius: 6px;
         if (document.readyState === 'loading') {
        margin-top: 6px;
            document.addEventListener('DOMContentLoaded', run);
         max-width: 100%;
         } else {
      }
            run();
      @keyframes fadeIn {
         }
        from { opacity: 0; transform: translateY(-5px); }
    })();
         to  { opacity: 1; transform: translateY(0); }
      }
    </style>
  `);
</script>
</script>

Edição atual tal como às 00h06min de 13 de março de 2026

<style>

   .island-grid {
       display: flex;
       flex-wrap: wrap;
       justify-content: center;
       gap: 10px;
       padding: 12px 0;
   }
   .island-banner {
       position: relative;
       width: 380px;
       height: 90px;
       overflow: hidden;
       border-radius: 8px;
       box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 10px;
       cursor: pointer;
       transition: transform 0.15s, box-shadow 0.15s;
       display: block;
       box-sizing: border-box;
   }
   .island-banner::before {
       content: "";
       position: absolute;
       top: 0;
       left: 0;
       right: 0;
       bottom: 0;
       background: linear-gradient(105deg, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.35) 40%, rgba(0, 0, 0, 0.1) 70%, transparent 100%);
       pointer-events: none;
       z-index: 1;
   }
   .island-banner:hover {
       transform: translateY(-2px);
       box-shadow: rgba(0, 0, 0, 0.35) 0px 4px 12px;
   }
   .island-banner .island-chests {
       position: absolute;
       top: 8px;
       left: 8px;
       display: flex;
       flex-wrap: wrap;
       gap: 6px;
       z-index: 2;
       pointer-events: none;
   }
   .island-banner .island-chest-group {
       position: relative;
       display: inline-block;
   }
   .island-banner .island-chest-group img {
       display: block;
       width: auto;
       height: auto;
   }
   .island-banner .island-chest-count {
   position: absolute;
   left: 0;          /* era right: 0 */
   bottom: 0;
   font-size: 12.5px;  /* era 11px */
   font-weight: bold;
   color: #fff;
   background: rgba(0, 0, 0, 0.75);
   padding: 1px 3px;
   border-radius: 3px;
   line-height: 1;
   white-space: nowrap;
   box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
   z-index: 10;

}

   .island-banner .island-title {
       position: absolute;
       bottom: 10px;
       left: 8px;
       font-size: 1.35em;
       font-weight: bold;
       color: #fff;
       text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8), 0 2px 4px rgba(0, 0, 0, 0.5);
       line-height: 1.2;
       z-index: 2;
       pointer-events: none;
       text-transform: uppercase;
   }
   @media (max-width: 768px) {
       .island-grid {
           flex-direction: column;
           align-items: stretch;
       }
       .island-banner {
           width: 100%;
           max-width: none;
       }
   }

</style> <script>

   (function () {
       function applyBackgrounds() {
           document.querySelectorAll('.island-banner[data-bgimg]').forEach(function (el) {
               var filename = el.getAttribute('data-bgimg');
               if (!filename) return;
               var url;
               if (typeof mw !== 'undefined' && mw.util && mw.util.getUrl) {
                   url = mw.util.getUrl('Especial:FilePath/' + filename);
               } else {
                   url = '/index.php?title=Especial:FilePath/' + encodeURIComponent(filename);
               }
               el.style.backgroundImage = 'url(' + url + ')';
               el.style.backgroundSize = 'cover';
               el.style.backgroundPosition = 'center';
               el.style.backgroundRepeat = 'no-repeat';
           });
       }
       function initClickable() {
           document.querySelectorAll('.island-banner[data-href]').forEach(function (el) {
               if (el._icClick) return;
               el._icClick = true;
               el.setAttribute('role', 'link');
               el.setAttribute('tabindex', '0');
               el.addEventListener('click', function () {
                   var href = el.getAttribute('data-href');
                   if (href) window.location.href = href;
               });
               el.addEventListener('keydown', function (e) {
                   if (e.key === 'Enter' || e.key === ' ') {
                       e.preventDefault();
                       var href = el.getAttribute('data-href');
                       if (href) window.location.href = href;
                   }
               });
           });
       }
       function run() {
           applyBackgrounds();
           initClickable();
       }
       if (document.readyState === 'loading') {
           document.addEventListener('DOMContentLoaded', run);
       } else {
           run();
       }
   })();

</script>