Mudanças entre as edições de "Widget:TesteBossYawn"
Ir para navegação
Ir para pesquisar
| Linha 24: | Linha 24: | ||
const data = JSON.parse(root.dataset.json); | const data = JSON.parse(root.dataset.json); | ||
const d = data[diff]; | const d = data[diff]; | ||
// | |||
const content = root.querySelector(".boss-content"); | |||
let html = ""; | |||
html += "<div class='box'><h3>REQUISITOS</h3>"; | |||
d.requisitos.forEach(r => html += `<div>- ${r}</div>`); | |||
html += "</div>"; | |||
html += "<div class='box'><h3>RECOMPENSAS</h3>"; | |||
d.recompensas.forEach(r => html += `<div>${r}</div>`); | |||
html += "</div>"; | |||
content.innerHTML = html; | |||
} | |||
window.bossSetDiff = function(el, diff){ | window.bossSetDiff = function(el, diff){ | ||
Edição das 12h42min de 4 de abril de 2026
<button onclick="bossSetDiff(this,'normal')">NORMAL</button> <button onclick="bossSetDiff(this,'elite')">ELITE</button> <button onclick="bossSetDiff(this,'hard')">HARD</button>
<style> .boss-component .box { ... } </style>
<script> (function() {
function init() {
document.querySelectorAll(".boss-component").forEach(root => {
bossRender(root, "normal");
});
}
function bossRender(root, diff) {
const data = JSON.parse(root.dataset.json);
const d = data[diff];
const content = root.querySelector(".boss-content");
let html = "";
html += "
REQUISITOS
"; d.requisitos.forEach(r => html += `- ${r}
`);
html += ""; html += "
RECOMPENSAS
"; d.recompensas.forEach(r => html += `${r}
`);
html += "";
content.innerHTML = html; }
window.bossSetDiff = function(el, diff){
const root = el.closest(".boss-component");
bossRender(root, diff);
}
window.bikiSetSkill = function(el, index){
// skill logic
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
if (typeof mw !== 'undefined' && mw.hook) {
mw.hook('wikipage.content').add(init);
}
})(); </script>