// ==UserScript==
// @name Bronies.de RPG
// @description Stellt statt der Juwelen einen Erfahrungsbalken bis zum nächsten Levelup dar.
// @namespace Gallery
// @match
https://*.bronies.de/showthread.php*
// @match
https://*.bronies.de/member.php*
// @match
https://*.bronies.de/memberlist.php*
// @match
https://*.bronies.de/private.php*
// @version 1.2.1
// @author mrx - Update by root
// @grant none
// ==/UserScript==
(function(){
var $ = document.querySelectorAll.bind(document);
function makerank(lvl, von, bis, act) {
var act2 = act - von;
var bis2 = bis - von;
var prozent = Math.round((100 / bis2) * act2);
return '</span><span style="height:4px;width:' + prozent + 'px;background-color:#2F2;display:inline-block;"></span><span style="height:4px;width:' + (100 - prozent) + 'px;background-color:grey;display:inline-block;"></span><br>' +
'<span style="font-size:14px;display:inline-block;">' + act + '/' + bis + '</span> <span style="font-size:14px;display:inline-block;">Lv ' + lvl + '</span><br>';
}
var ranks = $("[src^='images/stufe']");
for (rank of ranks) {
var posts = rank.parentNode.innerText.match(/Beiträge: ([\.\d]+)/)[1].replace(".", "");
var html = "";
if (posts >= 10000) html = makerank(11, 10000, 10000, posts);
else if (posts >= 7500) html = makerank(10, 7500, 10000, posts);
else if (posts >= 5000) html = makerank(9, 5000, 7500, posts);
else if (posts >= 2500) html = makerank(8, 2500, 7500, posts);
else if (posts >= 1000) html = makerank(7, 1000, 2500, posts);
else if (posts >= 750) html = makerank(6, 750, 1000, posts);
else if (posts >= 500) html = makerank(5, 500, 750, posts);
else if (posts >= 250) html = makerank(4, 250, 500, posts);
else if (posts >= 100) html = makerank(3, 100, 250, posts);
else if (posts >= 50) html = makerank(2, 50, 100, posts);
else if (posts >= 10) html = makerank(1, 10, 50, posts);
else html = makerank(0, 0, 10, posts);
rank.outerHTML = html;
}
})();