What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 128 Stack Exchange communities.

After finding and reading How do I audit my reputation? I thought it would be a good idea to write some JavaScript that makes the response from http://stackoverflow.com/reputation a little bit more readable and useful.

Here's what I came up with for Opera's UserJS:

// ==UserScript==
// @include http://*stackoverflow.com/reputation
// ==/UserScript==

// add useful info to the reputation output
        var html, pre, host;

        if (e.event.eventPhase != Event.CAPTURING_PHASE) return;

        pre = e.event.target.getElementsByTagName("pre")[0];
        html = pre.innerHTML;
        host = e.event.target.location.host;

        // link the question/post id
        html = html.replace(/(\d{5,})/g, "<a href=\"http://" + host + "/questions/$1\">$1</a>");

        // explain the various status codes
        html = html.replace(/^(\s*1\s+.*$)/gm, "$1   accepted answer (to or from you)");
        html = html.replace(/^(\s*2\s+.*$)/gm, "$1   upvote (to you)");
        html = html.replace(/^(\s*3\s+.*$)/gm, "$1   downvote (to or from you)");
        html = html.replace(/^(\s*4\s+.*$)/gm, "$1   penalty for post flagged as offensive");
        html = html.replace(/^(\s*8\s+.*$)/gm, "$1   bounty grant (from you)");
        html = html.replace(/^(\s*9\s+.*$)/gm, "$1   bounty award (to you)");
        html = html.replace(/^(\s*12\s+.*$)/gm, "$1   penalty for post flagged as spam");

        // append further links to reputations
        e.event.target.body.innerHTML +=
            "<hr>more reputation:<br>" +
            "<a href=\"http://stackoverflow.com/reputation\">http://stackoverflow.com/reputation</a><br>" +
            "<a href=\"http://cooking.stackexchange.com/reputation\">http://cooking.stackexchange.com/reputation</a><br>" +
            "<a href=\"http://serverfault.com/reputation\">http://serverfault.com/reputation</a><br>" +
            "<a href=\"http://gaming.stackexchange.com/reputation\">http://gaming.stackexchange.com/reputation</a><br>" +
            "<a href=\"http://superuser.com/reputation\">http://superuser.com/reputation</a><br>" +
            "<a href=\"http://meta.stackoverflow.com/reputation\">http://meta.stackoverflow.com/reputation</a><br>";

        pre.innerHTML = html;
    }, false);

Could anyone convert this to other browsers in case they support some client-side JavaScript?

I assume this is more of a wiki-entry than a question, but I can't create a wiki-question.

share|improve this question
This script makes certain naive assumptions, especially the regex used to match posts: /(\d{5,})/g, which will match any number in the page that has 5 or more digits. Newer SE sites have post ids starting with 1, and 10k users have reputation more than 5 digits. –  Yi Jiang Jan 16 '11 at 2:02
actually, I think this might be a better fit on stackapps.com than here, honestly –  Jeff Atwood Jan 16 '11 at 7:44
@JeffAtwood I thought StackApps is only for scripts that actually uses the API? Because this one, as far as I can tell, doesn't. –  Yi Jiang Jan 16 '11 at 9:22
@yij true, I guess there's no good place for greasemonkey stuff other than here then –  Jeff Atwood Jan 16 '11 at 17:45
Starting a bounty to award it to YiJiang's answer. That is such great work –  Pëkka Jan 21 '11 at 10:54
add comment

1 Answer 1

up vote 7 down vote accepted

I've rewritten the script so that it works on Firefox, Chrome and Opera. It now lists all sites in the Stack Exchange network, by using the API to retrieve the list of sites. I've also updated the regex to avoid the problem I mentioned in the comments.

Stack Exchange Reputation Audit Helper

Install - Source

Edit: I've updated the parser to infer from the amount of rep changed the type of accepted answer and downvote that was given.

share|improve this answer
Whow, I didn't know there were that many related sites. Anyway, thanks for your work. There isn't really much left from my code ;). –  sjngm Jan 16 '11 at 16:59
Just FYI, you may want to add askubuntu to the include list –  KitsuneYMG Jan 20 '11 at 19:21
@KitsuneYMG Added, together with a few others I missed. Thanks! –  Yi Jiang Jan 21 '11 at 4:11
add comment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .