Last active
March 29, 2016 13:56
-
-
Save shu8/75e293808fbf85ca3f60 to your computer and use it in GitHub Desktop.
A userscript that makes the reviewer stats less wordy :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Tabular reviewer stats on /review/suggested-edits | |
// @namespace http://stackexchange.com/users/4337810/ | |
// @version 1.1 | |
// @description A userscript that makes the reviewer stats less wordy :) | |
// @author ᔕᖺᘎᕊ (http://stackexchange.com/users/4337810/) | |
// @match *://*.stackoverflow.com/review/suggested-edits/* | |
// @match *://*.stackexchange.com/review/suggested-edits/* | |
// @match *://*.superuser.com/review/suggested-edits/* | |
// @match *://*.serverfault.com/review/suggested-edits/* | |
// @match *://*.askubuntu.com/review/suggested-edits/* | |
// @match *://*.stackapps.com/review/suggested-edits/* | |
// @match *://*.mathoverflow.net/review/suggested-edits/* | |
// @grant none | |
// ==/UserScript== | |
//Idea by lolreppeatlol @ http://meta.stackexchange.com/a/277446/260841 :) | |
setTimeout(function() { | |
var info = {}; | |
$('.review-more-instructions ul:eq(0) li').each(function() { | |
var text = $(this).text(), | |
username = $(this).find('a').text(), | |
link = $(this).find('a').attr('href'), | |
approved = text.match(/approved (.*?)[a-zA-Z]/)[1], | |
rejected = text.match(/rejected (.*?)[a-zA-Z]/)[1], | |
improved = text.match(/improved (.*?)[a-zA-Z]/)[1]; | |
info[username] = { | |
'link': link, | |
'approved': approved, | |
'rejected': rejected, | |
'improved': improved | |
}; | |
}); | |
var $editor = $('.review-more-instructions ul:eq(1) li'), | |
editorName = $editor.find('a').text(), | |
editorLink = $editor.find('a').attr('href'), | |
editorApproved = $editor.text().match(/([0-9])/g)[0], | |
editorRejected = $editor.text().match(/([0-9])/g)[1]; | |
info[editorName] = { | |
'editorLink': link, | |
'approved': editorApproved, | |
'rejected': editorRejected | |
}; | |
var table = "<table><tbody><tr><th style='padding: 4px;'>User</th><th style='padding: 4px;'>Approved</th><th style='padding: 4px;'>Rejected</th><th style='padding: 4px;'>Improved</th style='padding: 4px;'></tr>"; | |
$.each(info, function(user, details) { | |
table += "<tr><td style='padding: 4px;'><a href='" + details.link + "'>" + user + "</a></td><td style='padding: 4px;'>" + details.approved + "</td><td style='padding: 4px;'>" + details.rejected + "</td><td style='padding: 4px;'>" + (details.improved ? details.improved : 'N/A') + "</td></tr>"; | |
}); | |
table += "</tbody></table>"; | |
$('.review-more-instructions p, .review-more-instructions ul').remove(); | |
$('.review-more-instructions').append(table); | |
}, 2000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment