NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Cuneros-Refverdienst
// @version 1.0
// @description Zeigt den Refverdienst an.
// @author zruF
// @match https://www.cuneros.de/referral/list/
// @grant none
// @copyright 2019, Julian Ueber (www.herrueber.de)
// @require http://code.jquery.com/jquery-3.3.1.min.js
// @license MIT
// ==/UserScript==
// ==OpenUserJS==
// @author zruF
// @collaborator zruF
// ==/OpenUserJS==
(function() {
var apz1 = 0, apz2 = 0, apzToday = 0, apzToday1 = 0, apzToday2 = 0;
$('#ref-table tr').each(function() {
var total = $(this).find("td").eq(5).html();
var today = $(this).find("td").eq(6).html();
var c = $(this).find("td").eq(1).html();
if(today != undefined && today.match(/(\d+)/g) != null){
if(c.includes("7%")) apzToday1 += +today.match(/(\d+)/g)[0];
if(c.includes("3%")) apzToday2 += +today.match(/(\d+)/g)[0];
}
if(c != undefined && total.match(/(\d+)/g) != null){
if(c.includes("7%")) apz1 += +total.match(/(\d+)/g)[0];
if(c.includes("3%")) apz2 += +total.match(/(\d+)/g)[0];
}
});
var div = document.createElement('div'), header = document.createElement('div'), headerh = document.createElement('h4'), body = document.createElement('div');
$(header).addClass("card-header");
$(headerh).text("Refverdienst");
$(header).append(headerh);
$(body).addClass("card-body");
$(div).addClass("card");
$(div).append(header);
$(div).append(body);
var verdienst = ["Refverdienst gesamt:<b> " + prettify((apz1 + apz2)) + "</b> APz"
,"Refverdienst 1.Ebene:<b> " + prettify(apz1) + "</b> APz"
,"Refverdienst 2.Ebene:<b> " + prettify(apz2) + "</b> APz"
,"Refverdienst heute:<b> " + prettify(apzToday1 + apzToday2) + "</b> AP"
,"Refverdienst 1.Ebene heute:<b> " + prettify(apzToday1) + "</b> AP"
,"Refverdienst 2.Ebene heute:<b> " + prettify(apzToday2) + "</b> AP"];
$(body).append("<ul><li>"+verdienst.join`</li><li>` + "</li>");
$(div).insertAfter(".row div:nth-child(4)");
})();
function prettify(n){
var arr = [...(""+n)];
arr.splice((""+n).length-3,0,".")
if((""+n).length > 6) arr.splice((""+n).length-6,0,".")
return arr.join``
}