Skip to content

Instantly share code, notes, and snippets.

@aggieben
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aggieben/2d09cecafec5cbb784ca to your computer and use it in GitHub Desktop.
Save aggieben/2d09cecafec5cbb784ca to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Show Deleted Chat Messages
// @namespace https://gist.github.com/aggieben
// @version 0.2.2
// @description show deleted messages on chat.*.stackexchange.com and chat.(*.\.)stackoverflow.com
// @match *://chat.meta.stackexchange.com/*
// @match *://chat.stackexchange.com/*
// @match *://chat.stackoverflow.com/*
// @copyright 2012+, Ben Collins
// ==/UserScript==
function with_jquery(f) {
var script = document.createElement("script");
script.type = "text/javascript";
script.textContent = "(" + f.toString() + ")(jQuery)";
document.body.appendChild(script);
};
with_jquery(function($){
$sidebar_widgets = $('#widgets');
if ($sidebar_widgets.length == 0) {
$('#sidebar-content').append($('<div id="widgets"></div>'));
}
$sidebar_widgets = $('#widgets');
$link = $('<a href="#">show deleted messages</a>').on('click', function(event, data) {
event.preventDefault();
$('.message').has('.deleted').each(function() {
var mid = this.id.split('-')[1];
var host = window.location.host;
$.get('//' + host + '/messages/' + mid + '/history', function(data) {
$('#message-'+mid).css('color','red').html($(data).find('.message:eq(0)').html());
});
});
});
$widget = $('<div class="sidebar-widget"></div>').append($link);
$(function() {
$sidebar_widgets.append($widget);
});
});
@aggieben
Copy link
Author

0.2.2: updated for move from meta.so to meta.se

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment