Skip to main content
replaced http://chat.stackoverflow.com with https://chat.stackoverflow.com
Source Link

You can find the source on github as part of the scripts used by the regulars in the SO Close Voters roomSO Close Voters room.

You can find the source on github as part of the scripts used by the regulars in the SO Close Voters room.

You can find the source on github as part of the scripts used by the regulars in the SO Close Voters room.

updated to v0.3 after jquery migration due to regression
Source Link
rene Mod
  • 92k
  • 17
  • 244
  • 515
// ==UserScript==
// @name         Stats
// @namespace    http://stackoverflow.com/users/578411/rene
// @version      0.2
// @description  Adds the current stat count in fromnt of your total reviews on the review tab
// @author       rene
// @match        http://stackoverflow.com/review/*
// @grant        none
// ==/UserScript==

(function($, window) {

    var parts,
        statsurl,
        currenthref = window.location.href,
        // here we put our stat
        stat = $('<div></div>')
        .html('...&nbsp;/&nbsp;')
        .css('float','left')
        .css('padding-top','13px');
    
    function buildUrl() {
        // build the stats url
        parts = window.location.pathname.split('/');
        if (parts.length>3) {
           parts[parts.length-1] = 'stats';
        } else {
            parts.push('stats');
        }
        return parts.join('/');
    }
    
    statsurl = buildUrl();
    
    // integrate in the review page
    $('#badge-progress').prepend(stat);
    
    // get the (fullblown) stats page and find your own stat
    function refreshstat() {
        $.get(statsurl, function (data) {
            var html = $(data),
                td = html.find('td.review-stats-count-current-user:first');
            // replace our current stat with the just loaded one
            stat.html(td.text() + '&nbsp;/&nbsp;');    
        }).fail(function(prom, error, msg) {
            if (msg === 'Not Found') {
                // the url is not correct, try a new one
                statsurl = buildUrl();
            }
        });
    }
   
    // check regularly (every 5 seconds) if we have done a review yet
    window.setInterval(function () {
        // if the url changed, lets get the new stat
        if (window.location.href !== currenthref) {
            currenthref = window.location.href;
            refreshstat();
        }
    }, 5000); // now 5 seconds because we hardly ever review quicker than that
    refreshstat(); // run once for an initial value
    
}($ || unsafeWindow.$, window || unsafeWindow));
// ==UserScript==
// @name         Stats
// @namespace    http://stackoverflow.com/users/578411/rene
// @version      0.3
// @description  Adds the current stat count in front of your total reviews on the review tab
// @author       rene
// @match        *://*stackoverflow.com/review/*
// @grant        none
// ==/UserScript==

(function($, window) {

    var parts,
        statsurl,
        currenthref = window.location.href,
        // here we put our stat
        stat = $('<div></div>')
        .html('...&nbsp;/&nbsp;')
        .css('float','left')
        .css('padding-top','13px');

    function buildUrl() {
        // build the stats url
        parts = window.location.pathname.split('/');
        if (parts.length>3) {
           parts[parts.length-1] = 'stats';
        } else {
            parts.push('stats');
        }
        return parts.join('/');
    }

    statsurl = buildUrl();

    // integate in the review page
    $('#badge-progress').prepend(stat);

    // get the (fullblown) stats page and find your own stat
    function refreshstat() {
        $.get(statsurl, function (data) {
            var html = $(data),
                td = html.find('td.review-stats-count-current-user:first'),
                atot = html.find('a.review-stats-count[href^="/review/"]'),
                tot = Number.parseInt(atot.text().replace(',',''),10),
                allowed, 
                current = Number.parseInt(td.text(),10);
            //console.log(tot);
            // http://meta.stackexchange.com/a/223917/158100
            if (tot > 1000) {
                allowed = 40; // was 40, temporary larger in march 2016
            }  else {
                allowed = 20;
            }
            // replace our current stat wit the just loaded one
            stat.html(current.toString() + '&nbsp;(' + (allowed - current).toString() + ')&nbsp;/&nbsp;');
        }).fail(function(prom, error, msg) {
            if (msg === 'Not Found') {
                // the url is not correct, try a new one
                statsurl = buildUrl();
            }
        });
    }

    // check regularly (every 5 seconds) if we done a review yet
    window.setInterval(function () {
        // if the url changed, lets get the new stat
        if (window.location.href !== currenthref) {
            currenthref = window.location.href;
            refreshstat();
        }
    }, 5000); // now 5 seconds because we hardly ever review quicker than that
    refreshstat(); // run once for an initial value

}($ || unsafeWindow.$, window || unsafeWindow));

current daily stat countcurrent daily stat count

// ==UserScript==
// @name         Stats
// @namespace    http://stackoverflow.com/users/578411/rene
// @version      0.2
// @description  Adds the current stat count in fromnt of your total reviews on the review tab
// @author       rene
// @match        http://stackoverflow.com/review/*
// @grant        none
// ==/UserScript==

(function($, window) {

    var parts,
        statsurl,
        currenthref = window.location.href,
        // here we put our stat
        stat = $('<div></div>')
        .html('...&nbsp;/&nbsp;')
        .css('float','left')
        .css('padding-top','13px');
    
    function buildUrl() {
        // build the stats url
        parts = window.location.pathname.split('/');
        if (parts.length>3) {
           parts[parts.length-1] = 'stats';
        } else {
            parts.push('stats');
        }
        return parts.join('/');
    }
    
    statsurl = buildUrl();
    
    // integrate in the review page
    $('#badge-progress').prepend(stat);
    
    // get the (fullblown) stats page and find your own stat
    function refreshstat() {
        $.get(statsurl, function (data) {
            var html = $(data),
                td = html.find('td.review-stats-count-current-user:first');
            // replace our current stat with the just loaded one
            stat.html(td.text() + '&nbsp;/&nbsp;');    
        }).fail(function(prom, error, msg) {
            if (msg === 'Not Found') {
                // the url is not correct, try a new one
                statsurl = buildUrl();
            }
        });
    }
   
    // check regularly (every 5 seconds) if we have done a review yet
    window.setInterval(function () {
        // if the url changed, lets get the new stat
        if (window.location.href !== currenthref) {
            currenthref = window.location.href;
            refreshstat();
        }
    }, 5000); // now 5 seconds because we hardly ever review quicker than that
    refreshstat(); // run once for an initial value
    
}($ || unsafeWindow.$, window || unsafeWindow));

current daily stat count

// ==UserScript==
// @name         Stats
// @namespace    http://stackoverflow.com/users/578411/rene
// @version      0.3
// @description  Adds the current stat count in front of your total reviews on the review tab
// @author       rene
// @match        *://*stackoverflow.com/review/*
// @grant        none
// ==/UserScript==

(function($, window) {

    var parts,
        statsurl,
        currenthref = window.location.href,
        // here we put our stat
        stat = $('<div></div>')
        .html('...&nbsp;/&nbsp;')
        .css('float','left')
        .css('padding-top','13px');

    function buildUrl() {
        // build the stats url
        parts = window.location.pathname.split('/');
        if (parts.length>3) {
           parts[parts.length-1] = 'stats';
        } else {
            parts.push('stats');
        }
        return parts.join('/');
    }

    statsurl = buildUrl();

    // integate in the review page
    $('#badge-progress').prepend(stat);

    // get the (fullblown) stats page and find your own stat
    function refreshstat() {
        $.get(statsurl, function (data) {
            var html = $(data),
                td = html.find('td.review-stats-count-current-user:first'),
                atot = html.find('a.review-stats-count[href^="/review/"]'),
                tot = Number.parseInt(atot.text().replace(',',''),10),
                allowed, 
                current = Number.parseInt(td.text(),10);
            //console.log(tot);
            // http://meta.stackexchange.com/a/223917/158100
            if (tot > 1000) {
                allowed = 40; // was 40, temporary larger in march 2016
            }  else {
                allowed = 20;
            }
            // replace our current stat wit the just loaded one
            stat.html(current.toString() + '&nbsp;(' + (allowed - current).toString() + ')&nbsp;/&nbsp;');
        }).fail(function(prom, error, msg) {
            if (msg === 'Not Found') {
                // the url is not correct, try a new one
                statsurl = buildUrl();
            }
        });
    }

    // check regularly (every 5 seconds) if we done a review yet
    window.setInterval(function () {
        // if the url changed, lets get the new stat
        if (window.location.href !== currenthref) {
            currenthref = window.location.href;
            refreshstat();
        }
    }, 5000); // now 5 seconds because we hardly ever review quicker than that
    refreshstat(); // run once for an initial value

}($ || unsafeWindow.$, window || unsafeWindow));

current daily stat count

fixed a few typos and added a remark that this works for all queues
Source Link
rene Mod
  • 92k
  • 17
  • 244
  • 515

I agree that this would be a good addition to that screen. Until this gets implemented the following userscript achieves the same and this works for all queues, even the new Help and Improvement queue:

// ==UserScript==
// @name         Stats
// @namespace    http://stackoverflow.com/users/578411/rene
// @version      0.2
// @description  Adds the current stat count in fromnt of your total reviews on the review tab
// @author       rene
// @match        http://stackoverflow.com/review/*
// @grant        none
// ==/UserScript==

(function($, window) {

    var parts,
        statsurl,
        currenthref = window.location.href,
        // here we put our stat
        stat = $('<div></div>')
        .html('...&nbsp;/&nbsp;')
        .css('float','left')
        .css('padding-top','13px');
    
    function buildUrl() {
        // build the stats url
        parts = window.location.pathname.split('/');
        if (parts.length>3) {
           parts[parts.length-1] = 'stats';
        } else {
            parts.push('stats');
        }
        return parts.join('/');
    }
    
    statsurl = buildUrl();
    
    // integateintegrate in the review page
    $('#badge-progress').prepend(stat);
    
    // get the (fullblown) stats page and find your own stat
    function refreshstat() {
        $.get(statsurl, function (data) {
            var html = $(data),
                td = html.find('td.review-stats-count-current-user:first');
            // replace our current stat witwith the just loaded one
            stat.html(td.text() + '&nbsp;/&nbsp;');    
        }).fail(function(prom, error, msg) {
            debugger;
            if (msg === 'Not Found') {
                // the url is not correct, try a new one
                statsurl = buildUrl();
            }
        });
    }
   
    // check regularly (every 5 seconds) if we have done a review yet
    window.setInterval(function () {
        // if the url changed, lets get the new stat
        if (window.location.href !== currenthref) {
            currenthref = window.location.href;
            refreshstat();
        }
    }, 5000); // now 5 seconds because we hardly ever review quicker than that
    refreshstat(); // run once for an initial value
    
}($ || unsafeWindow.$, window || unsafeWindow));

I agree that this would be a good addition to that screen. Until this gets implemented the following userscript achieves the same:

// ==UserScript==
// @name         Stats
// @namespace    http://stackoverflow.com/users/578411/rene
// @version      0.2
// @description  Adds the current stat count in fromnt of your total reviews on the review tab
// @author       rene
// @match        http://stackoverflow.com/review/*
// @grant        none
// ==/UserScript==

(function($, window) {

    var parts,
        statsurl,
        currenthref = window.location.href,
        // here we put our stat
        stat = $('<div></div>')
        .html('...&nbsp;/&nbsp;')
        .css('float','left')
        .css('padding-top','13px');
    
    function buildUrl() {
        // build the stats url
        parts = window.location.pathname.split('/');
        if (parts.length>3) {
           parts[parts.length-1] = 'stats';
        } else {
            parts.push('stats');
        }
        return parts.join('/');
    }
    
    statsurl = buildUrl();
    
    // integate in the review page
    $('#badge-progress').prepend(stat);
    
    // get the (fullblown) stats page and find your own stat
    function refreshstat() {
        $.get(statsurl, function (data) {
            var html = $(data),
                td = html.find('td.review-stats-count-current-user:first');
            // replace our current stat wit the just loaded one
            stat.html(td.text() + '&nbsp;/&nbsp;');    
        }).fail(function(prom, error, msg) {
            debugger;
            if (msg === 'Not Found') {
                // the url is not correct, try a new one
                statsurl = buildUrl();
            }
        });
    }
   
    // check regularly (every 5 seconds) if we done a review yet
    window.setInterval(function () {
        // if the url changed, lets get the new stat
        if (window.location.href !== currenthref) {
            currenthref = window.location.href;
            refreshstat();
        }
    }, 5000); // now 5 seconds because we hardly ever review quicker than that
    refreshstat(); // run once for an initial value
    
}($ || unsafeWindow.$, window || unsafeWindow));

I agree that this would be a good addition to that screen. Until this gets implemented the following userscript achieves the same and this works for all queues, even the new Help and Improvement queue:

// ==UserScript==
// @name         Stats
// @namespace    http://stackoverflow.com/users/578411/rene
// @version      0.2
// @description  Adds the current stat count in fromnt of your total reviews on the review tab
// @author       rene
// @match        http://stackoverflow.com/review/*
// @grant        none
// ==/UserScript==

(function($, window) {

    var parts,
        statsurl,
        currenthref = window.location.href,
        // here we put our stat
        stat = $('<div></div>')
        .html('...&nbsp;/&nbsp;')
        .css('float','left')
        .css('padding-top','13px');
    
    function buildUrl() {
        // build the stats url
        parts = window.location.pathname.split('/');
        if (parts.length>3) {
           parts[parts.length-1] = 'stats';
        } else {
            parts.push('stats');
        }
        return parts.join('/');
    }
    
    statsurl = buildUrl();
    
    // integrate in the review page
    $('#badge-progress').prepend(stat);
    
    // get the (fullblown) stats page and find your own stat
    function refreshstat() {
        $.get(statsurl, function (data) {
            var html = $(data),
                td = html.find('td.review-stats-count-current-user:first');
            // replace our current stat with the just loaded one
            stat.html(td.text() + '&nbsp;/&nbsp;');    
        }).fail(function(prom, error, msg) {
            if (msg === 'Not Found') {
                // the url is not correct, try a new one
                statsurl = buildUrl();
            }
        });
    }
   
    // check regularly (every 5 seconds) if we have done a review yet
    window.setInterval(function () {
        // if the url changed, lets get the new stat
        if (window.location.href !== currenthref) {
            currenthref = window.location.href;
            refreshstat();
        }
    }, 5000); // now 5 seconds because we hardly ever review quicker than that
    refreshstat(); // run once for an initial value
    
}($ || unsafeWindow.$, window || unsafeWindow));
added github link
Source Link
rene Mod
  • 92k
  • 17
  • 244
  • 515
Loading
fixed a bug when you start from review
Source Link
rene Mod
  • 92k
  • 17
  • 244
  • 515
Loading
Source Link
rene Mod
  • 92k
  • 17
  • 244
  • 515
Loading