"bossSetDiff(this,'normal')">NORMAL</button>
<button onclick="bossSetDiff(this,'elite')">ELITE</button> <button onclick="bossSetDiff(this,'hard')">HARD</button>
| Linha 5: | Linha 5: | ||
<button onclick="bossSetDiff(this,'hard')">HARD</button> | <button onclick="bossSetDiff(this,'hard')">HARD</button> | ||
</tabber> | </tabber> | ||
[[Arquivo:CaminhoBarbarossa.png|thumb|center|500px|Caminho para o boss]] | |||
<div class="boss-content"> | <div class="boss-content"> | ||
</div> | </div> | ||
"bossSetDiff(this,'normal')">NORMAL</button>
<button onclick="bossSetDiff(this,'elite')">ELITE</button> <button onclick="bossSetDiff(this,'hard')">HARD</button>
<script>
(function() {
function bossRender(root, diff) {
const data = JSON.parse(root.dataset.json);
const d = data[diff];
const content = root.querySelector(".boss-content");
let html = "";
// Nome do boss (se existir)
if (data.nome) {
html += `
`;
}
// Introdução (se existir)
if (data.introducao) {
html += `
${data.introducao}
`;
}
// Localização (se existir)
if (data.localizacao) {
html += `
`; html += `
${data.localizacao.descricao}
`;
if (data.localizacao.imagem_html) {
console.log("Img achada");
html += data.localizacao.imagem_html;
}
}
// Requisitos
html += `
`;
// Recompensas
html += `
`;
// Skills
if (d.skills && d.skills.length > 0) {
html += `
`;
}
content.innerHTML = html; }
function init() {
document.querySelectorAll(".boss-component").forEach(root => {
if (root.dataset.rendered === 'true') return;
root.dataset.rendered = 'true';
bossRender(root, "normal");
});
}
window.bossSetDiff = function(el, diff) {
const root = el.closest(".boss-component");
bossRender(root, diff);
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
if (typeof mw !== 'undefined' && mw.hook) {
mw.hook('wikipage.content').add(init);
}
})(); </script>
<style> .boss-component .box { ... } </style>