Skip to content

Commit e158e22

Browse files
authored
Update index.js
Signed-off-by: Grouvex <168425996+Grouvex@users.noreply.github.com>
1 parent 688aaea commit e158e22

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

index.js

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,106 @@ function googleTranslateElementInit() {
271271
console.error("Google Translate API no está disponible.");
272272
}
273273
}
274+
275+
// ============================================
276+
// Código para insignias de usuarios
277+
// ============================================
278+
279+
const usuarios = {
280+
"Grouvex Studios": {
281+
principales: ["verified-team", "owner", "vvadmin", "vdeveloper", "vbughunter","gsmember"],
282+
GSRecording: [],
283+
GSAnimation: [],
284+
GSDesign: []
285+
},
286+
"Grouvex Phoenix": {
287+
principales: ["verified-team", "vvadmin", "vdeveloper", "vbughunter", "verified"],
288+
GSRecording: ["owner-recording", "artista", "verified"],
289+
GSAnimation: ["verified"],
290+
GSDesign: ["diseñador", "verified"]
291+
},
292+
"Tarlight Etherall": {
293+
principales: ["verified-team", "admin", "artista"],
294+
GSRecording: ["vvadmin", "artista", "gsmember", "verified"],
295+
GSAnimation: [],
296+
GSDesign: ["owner-designs", "diseñador", "verified"]
297+
},
298+
"Maiki Dran": {
299+
principales: ["gsmember", "verified"],
300+
GSRecording: ["artista", "verified"],
301+
GSAnimation: [],
302+
GSDesign: []
303+
},
304+
"Clara Langa": {
305+
principales: ["gsmember", "verified"],
306+
GSRecording: ["artista", "verified"],
307+
GSAnimation: [],
308+
GSDesign: []
309+
},
310+
"Joshuatdepedro": {
311+
principales: ["verified"],
312+
GSRecording: ["artista"],
313+
GSAnimation: [],
314+
GSDesign: []
315+
}
316+
};
317+
318+
function mostrarUsuarioYInsignias(nombreUsuario, elements) {
319+
elements.forEach(element => {
320+
// Mostrar nombre de usuario
321+
const spanNombre = document.createElement("span");
322+
spanNombre.textContent = nombreUsuario;
323+
element.appendChild(spanNombre);
324+
325+
// Mostrar insignias principales
326+
const divPrincipales = document.createElement("div"); usuarios[nombreUsuario].principales.forEach(insignia => {
327+
if (insignia) { // Solo agregar si la insignia no está vacía
328+
const spanInsignia = document.createElement("span");
329+
spanInsignia.classList.add("insignia", insignia);
330+
divPrincipales.appendChild(spanInsignia);
331+
}
332+
});
333+
element.appendChild(divPrincipales);
334+
335+
function crearDetallesInsignias(titulo, categoria) {
336+
if (usuarios[nombreUsuario][categoria] && usuarios[nombreUsuario][categoria].length > 0 && usuarios[nombreUsuario][categoria][0] !== "") {
337+
const details = document.createElement("details");
338+
const summary = document.createElement("summary");
339+
summary.textContent = titulo;
340+
summary.style.fontSize = "10px";
341+
342+
details.appendChild(summary);
343+
const divInsignias = document.createElement("div");
344+
usuarios[nombreUsuario][categoria].forEach(insignia => {
345+
if (insignia) {
346+
const spanInsignia = document.createElement("span");
347+
spanInsignia.classList.add("insignia", insignia);
348+
divInsignias.appendChild(spanInsignia);
349+
}
350+
});
351+
details.appendChild(divInsignias);
352+
return details;
353+
}
354+
return null;
355+
}
356+
357+
const gsRecordingDetails = crearDetallesInsignias("GSRecording", "GSRecording");
358+
if (gsRecordingDetails) element.appendChild(gsRecordingDetails);
359+
360+
const gsAnimationDetails = crearDetallesInsignias("GSAnimation", "GSAnimation");
361+
if (gsAnimationDetails) element.appendChild(gsAnimationDetails);
362+
363+
const gsDesignDetails = crearDetallesInsignias("GSDesign", "GSDesign");
364+
if (gsDesignDetails) element.appendChild(gsDesignDetails);
365+
});
366+
}
367+
368+
// Esperar a que el DOM esté completamente cargado
369+
document.addEventListener("DOMContentLoaded", () => {
370+
Object.keys(usuarios).forEach(usuario => {
371+
const elements = document.querySelectorAll(`.${usuario.replace(/\s+/g, '-')}`);
372+
if (elements.length > 0) {
373+
mostrarUsuarioYInsignias(usuario, elements);
374+
}
375+
});
376+
});

0 commit comments

Comments
 (0)