Update: I don't have time to fix it at the moment and have also come to doubt the sustainability of this approach since putting it online, so I tagged it as obsolete.
This is a very basic user script which does the following:
Checks the Review homepage if there's anything you can review
- If so, it changes the title to
(
n
) old_title
wheren
is the number of review tasks you can perform - If not, it refreshes the page in 15 seconds
- If so, it changes the title to
This is the script:
// ==UserScript==
// @name Review Stalker
// @namespace http://camilstaps.nl
// @description Stalks the StackExchange review pages
// @include https://*stackexchange.com/review
// @include https://*stackexchange.com/review/
// @include https://stackoverflow.com/review
// @include https://stackoverflow.com/review/
// @include https://serverfault.com/review
// @include https://serverfault.com/review/
// @include https://superuser.com/review
// @include https://superuser.com/review/
// @include https://askubuntu.com/review
// @include https://askubuntu.com/review/
// @version 1.1
// @grant
// ==/UserScript==
var RS_reviews_avail = 0;
function RS_parseInt(string) {
var got_decimal_point = false;
var divider = 10;
var result = 0;
for (var i = 0; i < string.length; i++) {
var char = string.substring(i,i+1);
if (char >= '0' && char <= '9') {
if (!got_decimal_point) {
result *= 10;
result += parseInt(char);
} else {
result += parseInt(char) / divider;
divider *= 10;
}
} else if (char == ',') {
} else {
return -1;
}
}
return result;
}
function RS_hasClass(element, cls) {
return (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1;
}
var RS_numbers = document.getElementsByClassName("dashboard-num");
for (var RS_i = RS_numbers.length - 1; RS_i >= 0; RS_i--) {
if (!RS_hasClass(RS_numbers[RS_i].parentNode, "dashboard-faded")) {
var int = RS_parseInt(RS_numbers[RS_i].getAttribute('title'));
RS_reviews_avail += int;
}
}
if (RS_reviews_avail) {
window.setTimeout(function(){
document.title = "(" + RS_reviews_avail + ") " + document.title;
}, 300);
} else {
window.setTimeout(function(){
window.location = window.location;
}, 15000);
}