Mudanças entre as edições de "Widget:WeeklyBosses"
Ir para navegação
Ir para pesquisar
m |
m |
||
| Linha 89: | Linha 89: | ||
(function () { | (function () { | ||
function applyBackgrounds() { | function applyBackgrounds() { | ||
document.querySelectorAll(".weekly-bosses__btn | document.querySelectorAll(".weekly-bosses__btn").forEach(function (el) { | ||
el. | var bg = el.getAttribute("data-background"); | ||
var bgimg = el.getAttribute("data-bgimg"); | |||
if (bgimg) { | |||
var url = bgimg.indexOf("url(") === 0 ? bgimg : ("url(" + bgimg + ")"); | |||
el.style.backgroundImage = url; | |||
el.style.backgroundSize = "cover"; | |||
el.style.backgroundPosition = "center"; | |||
el.style.backgroundRepeat = "no-repeat"; | |||
if (bg) el.style.backgroundColor = bg; | |||
} else if (bg) { | |||
el.style.background = bg; | |||
} else { | |||
el.style.backgroundColor = "#2a3544"; | |||
} | |||
}); | }); | ||
} | } | ||
Edição das 05h02min de 22 de fevereiro de 2026
<style>
.weekly-bosses {
display: flex;
flex-wrap: wrap;
gap: 12px;
justify-content: center;
padding: 16px 0;
}
.weekly-bosses__btn {
display: flex;
flex-direction: column;
border: 0.14em solid #2a4a6a;
padding: 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;
width: 180px;
overflow: hidden;
}
.weekly-bosses__btn a {
display: block;
color: inherit;
text-decoration: none;
padding: 0;
}
.weekly-bosses__btn:hover {
box-shadow: 0 0 0.5em #2a4a6a;
color: #F5A00F;
transform: translateY(-2px);
border-color: #3a5a7a;
}
.weekly-bosses__btn:focus-within {
outline: 2px solid #2a4a6a;
outline-offset: 2px;
}
.weekly-bosses__btn-img {
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
flex: 1 1 auto;
}
.weekly-bosses__btn-img img {
max-width: 100%;
width: auto;
height: auto;
display: block;
image-rendering: pixelated;
image-rendering: -moz-crisp-edges;
image-rendering: crisp-edges;
}
.weekly-bosses__btn-label {
background: rgba(10, 20, 32, 0.9);
padding: 8px 12px;
text-align: center;
margin-top: auto;
border-radius: 0 0 9px 9px;
line-height: 1.2;
}
.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").forEach(function (el) {
var bg = el.getAttribute("data-background");
var bgimg = el.getAttribute("data-bgimg");
if (bgimg) {
var url = bgimg.indexOf("url(") === 0 ? bgimg : ("url(" + bgimg + ")");
el.style.backgroundImage = url;
el.style.backgroundSize = "cover";
el.style.backgroundPosition = "center";
el.style.backgroundRepeat = "no-repeat";
if (bg) el.style.backgroundColor = bg;
} else if (bg) {
el.style.background = bg;
} else {
el.style.backgroundColor = "#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>