/* ===========================
SISTEMA DE VOTAÇÃO RENZZY 2025
Desenvolvido para Blogspot
=========================== */
const RENZZY_CONFIG = {
adminPassword: "admin2025",
categories: [
"CATEGORIA JÚRI DO 2025",
"CATEGORIA ROSTO DAS RUAS",
"CATEGORIA DESIGNER DO ANO 2025",
"MÍDIA & COMUNICAÇÃO 2025",
"CATEGORIA IMPULSIONADOR DO CAMPEONATO",
"CATEGORIA HUMORISTA DESTAQUE 2025",
"POETA DAS RUAS",
"CATEGORIA MULHER DESTAQUE",
"CATEGORIA RAPPER POPULAR",
"CATEGORIA ARTISTAS FEMININA+ OUVIDA ANO",
"CATEGORIA ARTISTAS MASCULINOS+OUVIDO DO ANO",
"CATEGORIA MAIOR FÃ",
"FOTÓGRAFO DESTAQUE 2025",
"CATEGORIA GRUPO MÚSICA DO ANO",
"CATEGORIA SLOGAN DO ANO",
"PERFORMANCE 2025",
"CATEGORIA GLADIADOR REVELAÇÃO 2025",
"CATEGORIA GLADIADOR POPULAR DO ANO",
"CATEGORIA PRODUTOR DO ANO"
],
competitors: [
{ name: "Nome 1", img: "" },
{ name: "Nome 2", img: "" },
{ name: "Nome 3", img: "" },
{ name: "Nome 4", img: "" },
{ name: "Nome 5", img: "" },
{ name: "Nome 6", img: "" },
{ name: "Nome 7", img: "" }
]
};
// --- CRIAÇÃO DO DESIGN ---
function renderVotingSystem() {
const wrap = document.createElement("div");
wrap.style = `
background:#0b0b0d;color:#e8e8e8;font-family:system-ui,-apple-system,Segoe UI,Roboto;
padding:18px;border-radius:10px;max-width:1100px;margin:0 auto;
`;
const header = `
🗳️ GALA 2025 — SISTEMA DE VOTAÇÃO RENZZY
`;
wrap.innerHTML = header;
RENZZY_CONFIG.categories.forEach(cat => {
const catId = cat.toLowerCase().replace(/\s+/g, "_");
const div = document.createElement("div");
div.style = `
background:#111113;padding:14px;border-radius:12px;margin:18px 0;
box-shadow:0 6px 20px rgba(0,0,0,0.5);
`;
let html = `
${cat}
`;
RENZZY_CONFIG.competitors.forEach((c, i) => {
const voteKey = `${catId}_votes`;
const votes = JSON.parse(localStorage.getItem(voteKey) || "[]");
html += `
${c.img ? `

`
: `
${c.name}
`}
${c.name}
0 votos
`;
});
html += `
`;
div.innerHTML = html;
wrap.appendChild(div);
});
document.getElementById("votacao-renzzy").appendChild(wrap);
bindVotingLogic();
}
// --- FUNÇÕES DE LÓGICA ---
function bindVotingLogic() {
document.addEventListener("click", e => {
const btn = e.target.closest(".vote-btn");
if (!btn) return;
const cat = btn.dataset.cat;
const idx = parseInt(btn.dataset.idx);
const votedKey = "voted_" + cat;
if (localStorage.getItem(votedKey)) {
alert("Já votaste nesta categoria!");
return;
}
const votesKey = cat + "_votes";
const arr = JSON.parse(localStorage.getItem(votesKey) || "[]");
arr[idx] = (arr[idx] || 0) + 1;
localStorage.setItem(votesKey, JSON.stringify(arr));
localStorage.setItem(votedKey, "1");
btn.textContent = "✅ Voto registado";
btn.disabled = true;
document.getElementById("msg_" + cat).textContent = "Voto registado com sucesso!";
updateCounts();
});
document.getElementById("adminBtn").onclick = () => {
const pass = document.getElementById("adminPass").value;
if (pass === RENZZY_CONFIG.adminPassword) {
showResults(true);
document.getElementById("adminBtn").style.display = "none";
document.getElementById("adminHideBtn").style.display = "inline-block";
} else alert("Senha incorreta!");
};
document.getElementById("adminHideBtn").onclick = () => {
showResults(false);
document.getElementById("adminBtn").style.display = "inline-block";
document.getElementById("adminHideBtn").style.display = "none";
};
}
function showResults(show) {
RENZZY_CONFIG.categories.forEach(cat => {
const catId = cat.toLowerCase().replace(/\s+/g, "_");
const votesKey = catId + "_votes";
const arr = JSON.parse(localStorage.getItem(votesKey) || "[]");
arr.forEach((v, i) => {
const el = document.getElementById("count_" + catId + "_" + i);
if (el) {
el.textContent = `${v || 0} voto${v === 1 ? "" : "s"}`;
el.style.display = show ? "block" : "none";
}
});
});
}
function updateCounts() {
showResults(true);
showResults(false);
}
document.addEventListener("DOMContentLoaded", renderVotingSystem);