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

De Wiki Gla
Ir para navegação Ir para pesquisar
m
m
Linha 76: Linha 76:
         }
         }
         function initClickable() {
         function initClickable() {
             document.querySelectorAll(".weekly-bosses__btn[data-link]").forEach(function (el) {
             document.querySelectorAll(".weekly-bosses__btn[data-href], .weekly-bosses__btn[data-link]").forEach(function (el) {
                 if (el._wbClick) return;
                 if (el._wbClick) return;
                 el._wbClick = true;
                 el._wbClick = true;
                 el.setAttribute("role", "link");
                 el.setAttribute("role", "link");
                 el.setAttribute("tabindex", "0");
                 el.setAttribute("tabindex", "0");
                el.style.cursor = "pointer";
                 el.addEventListener("click", function (e) {
                 el.addEventListener("click", function (e) {
                     var title = el.getAttribute("data-link");
                    e.preventDefault();
                     if (title && !e.target.closest("a")) {
                     var url = el.getAttribute("data-href");
                         var url = (typeof mw !== "undefined" && mw.util && mw.util.getUrl) ? mw.util.getUrl(title) : ("/index.php?title=" + encodeURIComponent(title));
                     if (!url && el.getAttribute("data-link")) {
                        window.location.href = url;
                         url = (typeof mw !== "undefined" && mw.util && mw.util.getUrl) ? mw.util.getUrl(el.getAttribute("data-link")) : ("/index.php?title=" + encodeURIComponent(el.getAttribute("data-link")));
                     }
                     }
                    if (url) window.location.href = url;
                 });
                 });
                 el.addEventListener("keydown", function (e) {
                 el.addEventListener("keydown", function (e) {

Edição das 04h01min de 22 de fevereiro de 2026

<style>

   /* Estilo inspirado no Menu Quest da Tibia Wiki - botões de redirecionamento */
   .weekly-bosses {
       display: flex;
       flex-wrap: wrap;
       gap: 12px;
       justify-content: center;
       padding: 16px 0;
   }
   .weekly-bosses__btn {
       display: inline-block;
       border: 0.14em solid #F5A00F;
       padding: 5px 0;
       text-align: center;
       color: #F5A00F;
       font-weight: bold;
       font-size: 14px;
       border-radius: 10px;
       background: linear-gradient(120deg, rgba(18, 34, 45, 1) 0%, rgba(22, 40, 55, 1) 25%, rgba(26, 46, 65, 1) 50%, rgba(30, 52, 74, 1) 75%, rgba(34, 58, 84, 1) 100%);
       cursor: pointer;
       transition: all 0.2s ease;
       min-width: 120px;
   }
   .weekly-bosses__btn a {
       display: block;
       color: inherit;
       text-decoration: none;
       padding: 8px 16px;
   }
   .weekly-bosses__btn:hover {
       box-shadow: 0 0 0.5em #3E3F40;
       color: #F5A00F;
       transform: translateY(-2px);
   }
   .weekly-bosses__btn:focus-within {
       outline: 2px solid #F5A00F;
       outline-offset: 2px;
   }
   .weekly-bosses__btn img {
       width: 48px;
       height: 48px;
       object-fit: contain;
       image-rendering: pixelated;
       image-rendering: -moz-crisp-edges;
       image-rendering: crisp-edges;
       display: block;
       margin: 0 auto 4px;
   }
   .weekly-bosses__btn table {
       margin: 0 auto;
   }
   @media (max-width: 600px) {
       .weekly-bosses {
           flex-direction: column;
       }
       .weekly-bosses__btn {
           width: 100%;
       }
   }

</style>

<script>

   (function () {
       function applyBackgrounds() {
           document.querySelectorAll(".weekly-bosses__btn[data-background]").forEach(function (el) {
               el.style.background = el.getAttribute("data-background") || "#2a3544";
           });
       }
       function initClickable() {
           document.querySelectorAll(".weekly-bosses__btn[data-href], .weekly-bosses__btn[data-link]").forEach(function (el) {
               if (el._wbClick) return;
               el._wbClick = true;
               el.setAttribute("role", "link");
               el.setAttribute("tabindex", "0");
               el.style.cursor = "pointer";
               el.addEventListener("click", function (e) {
                   e.preventDefault();
                   var url = el.getAttribute("data-href");
                   if (!url && el.getAttribute("data-link")) {
                       url = (typeof mw !== "undefined" && mw.util && mw.util.getUrl) ? mw.util.getUrl(el.getAttribute("data-link")) : ("/index.php?title=" + encodeURIComponent(el.getAttribute("data-link")));
                   }
                   if (url) window.location.href = url;
               });
               el.addEventListener("keydown", function (e) {
                   if (e.key === "Enter" || e.key === " ") {
                       e.preventDefault();
                       el.click();
                   }
               });
           });
       }
       function run() {
           applyBackgrounds();
           initClickable();
       }
       if (document.readyState === "loading") {
           document.addEventListener("DOMContentLoaded", run);
       } else {
           run();
       }
   })();

</script>