Mudanças entre as edições de "Widget:WeeklyBosses"
Ir para navegação
Ir para pesquisar
m |
m |
||
| Linha 74: | Linha 74: | ||
el.style.background = el.getAttribute("data-background") || "#2a3544"; | el.style.background = el.getAttribute("data-background") || "#2a3544"; | ||
}); | }); | ||
} | |||
function initClickable() { | |||
document.querySelectorAll(".weekly-bosses__btn[data-link]").forEach(function (el) { | |||
if (el._wbClick) return; | |||
el._wbClick = true; | |||
el.setAttribute("role", "link"); | |||
el.setAttribute("tabindex", "0"); | |||
el.addEventListener("click", function (e) { | |||
var title = el.getAttribute("data-link"); | |||
if (title && !e.target.closest("a")) { | |||
var url = mw.util.getUrl(title); | |||
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") { | if (document.readyState === "loading") { | ||
document.addEventListener("DOMContentLoaded", | document.addEventListener("DOMContentLoaded", run); | ||
} else { | } else { | ||
run(); | |||
} | } | ||
})(); | })(); | ||
</script> | </script> | ||
Edição das 03h56min 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-link]").forEach(function (el) {
if (el._wbClick) return;
el._wbClick = true;
el.setAttribute("role", "link");
el.setAttribute("tabindex", "0");
el.addEventListener("click", function (e) {
var title = el.getAttribute("data-link");
if (title && !e.target.closest("a")) {
var url = mw.util.getUrl(title);
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>