public

Shows a SE user's reputation, divided by the number of their questions and answers.

  • Download Gist
stackExchangeUserProfileHacks.user.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
// ==UserScript==
// @name Stack Exchange rep per Q&A
// @namespace http://mjball.github.com
// @description Shows a SE user's reputation, divided by the number of their questions and answers.
// @include http://stackoverflow.com/users/*
// @include http://meta.stackoverflow.com/users/*
// @include http://*.stackexchange.com/users/*
// @include http://superuser.com/users/*
// ==/UserScript==
 
(function ()
{
function calc()
{
$(function ()
{
function p($j) { return parseInt($j.text().replace(/\D+/, ''), 10); }
var $rep = $('#large-user-info div.reputation'),
userrep = p($rep.find('span > a')),
questioncount = p($('#user-panel-questions > div.subheader span.count')),
answercount = p($('#user-panel-answers > div.subheader span.count')),
rawaverage = userrep/(questioncount+answercount),
averagerep = Math.round(rawaverage);
if (isNaN(averagerep)) return;
 
$('<div/>', {title: rawaverage, text: averagerep + ' rep/q&a', 'class': 'reputation'}).insertAfter($rep);
});
}
var script = document.createElement("script");
script.textContent = "(" + calc.toString() + ")();";
document.body.appendChild(script);
})();

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.