Advanced button stats

Show Advanced button stats

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Advanced button stats
// @namespace    http://bwochinski.com/
// @version      0.5
// @description  Show Advanced button stats
// @author       bwochinski
// @match        *://www.reddit.com/r/thebutton/
// @grant        none
// ==/UserScript==

//CONFIG
var advInterval = 500; //update interval
var advKeepAmt = 60; //history to keep (in seconds)

//Imoprtant variables
var parHist = [];
var histLen = (1000 / advInterval) * advKeepAmt;
var lowestTime = 60.00;

$(".thebutton-form").append("<div id='advButtonStats' style='position: relative; float: clear; margin-top: 100px; width: 500px;'></div>");
$("#advButtonStats").append("<div id='advBOPS' style='Font: 18px Verdana normal black; width: 50%; float: left;''>BOPS:</div>");
$("#advButtonStats").append("<div id='advLowest' style='Font: 18px Verdana normal;  width: 50%; float: left;'>Lowest Seen:</div>");
$("#advButtonStats").append("<div id='advPPM' style='Font: 18px Verdana normal black; width: 50%; float: left;''>Clicks/min:</div>");
$("#advButtonStats").append("<div id='advFlair' style='Font: 18px Verdana normal; width: 50%; float: left;'>Current Flair:</div>");
$("#advButtonStats").append("<div id='advSPC' style='Font: 18px Verdana normal; width: 50%; float: left;'>Avg Secs/Click:</div>");

function advStatUpdate() {
    if (parHist.length > histLen) {
        parHist.pop();
    }
    var advText = $("span.thebutton-participants").text().replace(",","");
    parHist.unshift(parseInt(advText));

    //console.log(parHist);
    var curBOPS = (parHist[0] - parHist[parHist.length - 1]) / (parHist.length / (1000 / advInterval));
    var curPPM = (parHist[0] - parHist[parHist.length - 1]) * (60 / advKeepAmt) * (advKeepAmt / (parHist.length / (1000 / advInterval)));
    var curTime = parseFloat($("#thebutton-s-10s").text() + $("#thebutton-s-1s").text() + "." + $("#thebutton-s-100ms").text() + $("#thebutton-s-10ms").text());
    if (curTime < lowestTime) {
        lowestTime = curTime;
    }
    $("#advBOPS").html("<b>BOPS:</b> " + curBOPS.toFixed(5));
    $("#advPPM").html("<b>Clicks/min:</b> " + Math.round(curPPM));
    $("#advFlair").html("<b>Current Flair:</b> <span class='flair flair-press-" + String(curTime + 9).substring(0,1) + "'>" + String(curTime).substring(0,2) + "s</span>");
    $("#advLowest").html("<b>Lowest Seen:</b> " + lowestTime + "s</span>");
    $("#advSPC").html("<b>Avg Secs/Click:</b> " + (1 / curBOPS.toFixed(5)).toFixed(2));
}

advStatUpdate();
setInterval(advStatUpdate, advInterval);