Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge

  • Loading branch information...
commit 9da8ed4c10b0ec948df9dbd02add62572c2a4417 2 parents b66ef4d + 468f770
@tms tms authored
View
8 README.md
@@ -136,6 +136,14 @@ consistent with [these criteria](http://meta.stackoverflow.com/questions/43019/h
Note that while editors can be notified, their usernames will not show up
on the list of names.
+##SEReputationAuditHelper
+
+This script adds certain useful information to the reputation audit page (`/reputation` on all SE 2.0 sites):
+
+* Autolinkifies the post ID associated with each reputation event
+* Adds description for each vote type instead of seeing vote ID
+* Adds a links to reputation audit pages for all other SE sites for faster navigation
+
##SEChatFaviconNotifier
![Chatroom favicons with different numbers of unread message counts](http://i.imgur.com/llq97.png)
View
7 SEChatFaviconNotification.user.js
@@ -30,10 +30,13 @@
programmers: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABcUlEQVQ4ja3PsYoaYRSG4VPogJ2d6AXI3oBgOc0MgzCChUiCyEyzLLvl3sCylZ07zcKAoGA6y8Q6hB8kF2FhiEbCVDY6M+L/ptphA6sSNh+c7pyH74j8z6xvboiCgHchvx8eiB4f+X53x5erK9T19WUwen4+ufTZsvhkmueR6OmJH67Lzw8f+XV/T3R7yzfHyY6++v773vqnWJaF7/t4nkev16PT6dBut6nX61Sr1fNNWq0Wg8GA19lutywWC5RSNJtNGo3G24ht2/T7fcIw5Hg8kqYpaZpyOBwyYDQaYdv2aUBEZDgcorUmSZJsXoAgCE4DpmnieR5hGKK1Jo7jDEjTFKUU4/H4NCAiUqvVmE6nAH81SJIEpRSTyeQ8ICLiui77/T47jOM4azCbzS4DjuOw2+0A0FqjtQZAKYVS6jLQ7XaZz+csl0vW6zWr1YrNZnO+gWEYGIZBPp+nUCiQy+UoFouUy2VKpRKVSuXNERH5A+OVSIxr3NrHAAAAAElFTkSuQmCC',
math: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQ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Mnt/4w8KJFuQcKLXeDAg2cJ4NkDbh+476AucAZvkR5Kfd9hcRpkNVLSN2DeU/UTMWC+gArR/ulCsAnDSukC7drefEVcBhn4f/AKBs7SVr7eXywAAAABJRU5ErkJggg==',
- serverfault: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAkUlEQVQ4jWNgoBRcvHTlPzGYgYGB4aWG7v83str/38hq/3+tbvj/tYrif6IMuHb1LtwAZPxWUYw4A5Bd8ExHH8UQioOAYcXKtf+JwQwMDAwzFJX/o+OBNWC+rDQVwiAqKuY/MZiBgYFBX1z8PzoeBAZQA/yHYQ5Obqw0FDNwcHL/R8cM6JrxYPwGYHMJGhurAQAacYAPCrFaGAAAAABJRU5ErkJggg=='
+ serverfault: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAkUlEQVQ4jWNgoBRcvHTlPzGYgYGB4aWG7v83str/38hq/3+tbvj/tYrif6IMuHb1LtwAZPxWUYw4A5Bd8ExHH8UQioOAYcXKtf+JwQwMDAwzFJX/o+OBNWC+rDQVwiAqKuY/MZiBgYFBX1z8PzoeBAZQA/yHYQ5Obqw0FDNwcHL/R8cM6JrxYPwGYHMJGhurAQAacYAPCrFaGAAAAABJRU5ErkJggg==',
+ english: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACWCAYAAABkW7XSAAAB4UlEQVR4nO3aMZHjMBQGYEMIhIWgJpYsN4FgCIEQCGHwlkEgBEIgBEIgBMJeYTuTzLm9U7HfN6NGav7qzdOTug4AgH8s+mGKXC9R6jlS2rXOA7Ap+mH6LuPPuiLXy8d5qcd5f3xGqcdGMQG6Lko9R66PSGkXuV7+Klj9MM3Fqhwij7dWOQG6yMNpLVKR0u61+mGKUs9RymEuVvWqYAFNrVe+7zL+rDOsyPX+fk18nffD1Dov8Est17xnlPIVeTjFvqal47pHKYdlGH+fB/Llq3Ve4BfbuuYtBev66rj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x7sXb394FzXW4GP3NT0XJYOiydnL15/O5pZiuPv7/9x65fHu6OZpdjefV2YX32R9C/3ut4KEEIIoaybWNZN3Nhsfp1U29nC8sN3bbDWq1e9rvcBvFduNs1+sPbWq1e92cW1rTZYG5vNludXwIkxqbazg9E6GKz3D93rnXHXOwGO+dBb8FPTc1kvu3Sqq10Ax/xTsJL+5V46LGLSz0cdTgP4236YnrTBSgf53XRw5Ub7sbR/DIETI+kX42RQPP/Q6XofAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8H/0F7olCY2MH7ueAAAAAElFTkSuQmCC'
};
canvas.width = 16;
View
29 SEModifications.user.js
@@ -277,6 +277,33 @@ with_jquery(function ($) {
}
// adds an audit link next to your rep in the header that leads to /reputation
- $("#hlinks-user .reputation-score").parent().after("<a href='/reputation'>(audit)</a>");
+ var locationBits = location.hostname.split('.');
+
+ if(locationBits[0] !== 'meta' || locationBits[1] === 'stackoverflow')
+ $("#hlinks-user .reputation-score").parent().after("<a href='/reputation'>(audit)</a>");
+
+ // Uses ajax to load revision source inline
+ if(location.pathname.match(/^\/posts\/\d+\/revisions/)){
+ $('.revision a:contains("view source"), .owner-revision a:contains("view source")').one('click', function(){
+ var link = $(this).text('loading...');
+
+ $.ajax({
+ url:this.href,
+ context: $(this).closest('tr').next().find('.post-text'),
+ success: function(data){
+ link.removeAttr('href').removeAttr('target');
+
+ $('<pre>', {
+ text: $(data).filter('pre').text(),
+ css: {
+ whiteSpace: 'pre-wrap'
+ }
+ }).appendTo(this);
+ }
+ });
+
+ return false;
+ });
+ }
});
});
View
127 SEReputationAuditHelper.user.js
@@ -0,0 +1,127 @@
+// ==UserScript==
+// @name Stack Exchange Reputation Audit Helper
+// @namespace yijiang
+// @include http://stackoverflow.com/reputation
+// @include http://meta.stackoverflow.com/reputation
+// @include http://superuser.com/reputation
+// @include http://serverfault.com/reputation
+// @include http://askubuntu.com/reputation
+// @include http://answers.onstartups.com/reputation
+// @include http://stackapps.com/reputation
+// @include http://*.stackexchange.com/reputation
+// ==/UserScript==
+
+(function(){
+ function json (data) {
+ var sites = data.api_sites,
+ list = document.createElement('div');
+
+ list.innerHTML = "more reputation: <br>";
+ list.style.position = 'absolute';
+ list.style.top = 0;
+ list.style.left = '40em';
+ list.style.fontFamily = 'Ubuntu, Arial, sans-serif';
+ list.style.lineHeight = '1.8em';
+
+ document.body.appendChild(list);
+
+ for(var i = 0; i < sites.length; i++) {
+ // Exclude SE 2.0 linked Metas
+ if(sites[i].state !== 'linked_meta') {
+ var a = document.createElement('a'),
+ icon = document.createElement('img');
+
+ // Include the favicon in the link
+ icon.src = sites[i].icon_url.replace('apple-touch-icon.png', 'favicon.ico');
+ icon.style.border = '0';
+ icon.style.verticalAlign = 'middle';
+ icon.style.paddingRight = '3px';
+
+ a.href = sites[i].site_url + '/reputation';
+ a.style.color = '#999';
+ a.style.display = 'block';
+
+ a.appendChild(icon);
+ a.innerHTML += sites[i].name;
+
+ // Stick ya links in the pre element
+ list.appendChild(a);
+ }
+ }
+ }
+
+ function spaces (n) {
+ return new Array(n + 1).join(' ');
+ }
+
+ function inObject (value, obj) {
+ for(var i in obj) {
+ if(i === value) return obj[i];
+ }
+
+ return false;
+ }
+
+ var voteTypesComplex = {
+ 1: {
+ 15: 'your answer accepted',
+ 2: 'answer accepted by you'
+ },
+ 3: {
+ '-1': 'downvote by you',
+ '-2': 'downvote to you'
+ }
+ }, voteTypeSimple = {
+ 2: 'upvote',
+ 4: 'penalty for post flagged as offensive',
+ 8: 'bounty granted by you',
+ 9: 'bounty awarded to you',
+ 12: 'penalty for post flagged as spam',
+ 16: 'post edit accepted'
+ };
+
+ var pre = document.getElementsByTagName('pre')[0],
+ html = pre.innerHTML,
+ lines = html.split(/\n/g),
+ maxLen = Math.max.apply(Math, lines.filter(function(c){
+ var n = c.split(/\s/g)[1];
+ return !c || inObject(n, voteTypesComplex) || inObject(n, voteTypeSimple);
+ }).map(function(c){
+ return c.length;
+ }));
+
+ for(var i = 0; i < lines.length; i++) {
+ var chunks = lines[i].split(/\s+/g);
+
+ if(chunks.length > 3) {
+ if(inObject(chunks[1], voteTypesComplex)) {
+ console.log((/^[([](-?\d+)[)\]]$/).exec(chunks[3]), chunks[3]);
+ chunks.push(voteTypesComplex[chunks[1]][(/^[([](-?\d+)[)\]]$/).exec(chunks[3])[1]]);
+ } else if(inObject(chunks[1], voteTypeSimple)) {
+ chunks.push(voteTypeSimple[chunks[1]]);
+ }
+
+ if(!isNaN(chunks[1])) {
+ lines[i] = spaces(1) + chunks[1] + spaces(2) + chunks[2] + spaces(10 - chunks[2].length - chunks[1].length) + chunks[3] + spaces(maxLen - lines[i].length + 3) + chunks[4];
+ }
+ }
+ }
+
+ html = lines.join('\n');
+
+ // link the question/post id
+ html = html.replace(/^\s*(12|16|1|2|3|4|8|9)\s*(\d+)/gm, " $1 <a href='http://" + window.location.host + "/q/$2'>$2</a>");
+
+ pre.innerHTML = html;
+
+ // Inject json function into page
+ var script = document.createElement('script');
+ script.innerHTML = json.toString();
+ document.getElementsByTagName('head')[0].appendChild(script);
+
+ // Grab site list from StackAuth
+ var jsonScript = document.createElement('script');
+ jsonScript.src = 'http://stackauth.com/1.0/sites?jsonp=json';
+
+ document.getElementsByTagName('head')[0].appendChild(jsonScript);
+})();
Please sign in to comment.
Something went wrong with that request. Please try again.