NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Atelier801 Staff badges // @namespace http://your.homepage/ // @version 0.1 // @description Adds staff badges, showing ranks that are linked to the staff rank. // @author Jordynl // @match http://atelier801.com/topic?f=* // @grant none // ==/UserScript== var ranks = ["admin", "moderateur", "mapcrew", "sentinelle"]; var rankColor = []; rankColor.admin = "#ff5860"; rankColor.moderateur = "#f1f436"; rankColor.sentinelle = "#2ecf73"; rankColor.mapcrew = "#2f7fcc"; rankColor.joueur = "#009d9d"; var staffRanks = []; staffRanks.admin = ['moderateur', 'sentinelle', 'mapcrew']; staffRanks.moderateur = ["mapcrew"]; $(document).ready(function(){ for (var i in ranks) { glowify(ranks[i]); } }); function renameRank(rank) { if (rank == "admin") { return "Admin"; } else if (rank == "moderateur") { return "Moderator"; } else if (rank == "sentinelle") { return "Sentinel"; } else if (rank == "mapcrew") { return "MapCrew"; } else { return rank; } } function glowify(rank) { element = document.getElementsByClassName("cadre-type-auteur-"+ rank); for(var i=0;i<element.length;i++){ var color = document.defaultView.getComputedStyle(element[i],null).color; var text = element[i].innerText; badgeBox = []; var badgeElement = document.createElement('CENTER'); badgeElement.style.textAlign = "left"; badgeElement.style.maxLenght = "10px"; if (staffRanks[rank]) { rankList = staffRanks[rank]; rankList.forEach(function(value) { badgeBox.push("<span style='display:inline-block;min-width:12px;font-size:11px;padding-right:500px;padding:2px;color:#FFFFFF;border-radius:2px;vertical-align:baseline;background-color:"+rankColor[value]+"'>"+renameRank(value)+"</span>"); }); badgeElement.innerHTML = badgeBox.join("<br/>"); element[i].appendChild(badgeElement); } } }