Skip to content

Instantly share code, notes, and snippets.

@shu8
Created July 13, 2015 14:13
Show Gist options
  • Save shu8/aeb9f69dda4612fe368c to your computer and use it in GitHub Desktop.
Save shu8/aeb9f69dda4612fe368c to your computer and use it in GitHub Desktop.
Quick Revision Comment Viewer
// ==UserScript==
// @name View revision comments quickly
// @namespace http://stackexchange.com/users/4337810/
// @version 1.0
// @description Adds the latest revision's comment as a tooltip for quick and easy viewing
// @author ᔕᖺᘎᕊ (http://stackexchange.com/users/4337810/)
// @match *://*.stackexchange.com/*
// @match *://*.stackoverflow.com/*
// @match *://*.superuser.com/*
// @match *://*.serverfault.com/*
// @match *://*.askubuntu.com/*
// @match *://*.stackapps.com/*
// @match *://*.mathoverflow.net/*
// @grant none
// ==/UserScript==
function getComment(url, $that) {
$.get(url, function(responseText, textStatus, XMLHttpRequest) {
$that.find('.shub-revision-comment').attr('title', $(XMLHttpRequest.responseText).find('.revision-comment:eq(0)')[0].innerHTML);
});
}
$('.question, .answer').each(function() {
if($(this).find('.post-signature').length > 1) {
var id = $(this).attr('data-questionid') || $(this).attr('data-answerid');
$(this).find('.post-signature:eq(0)').find('.user-action-time a').wrapInner("<span class='shub-revision-comment'></span>");
$that = $(this);
getComment('http://' + $(location).attr('hostname') + '/posts/'+id+'/revisions', $that);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment