44

As a moderator, I've frequently found that I want to see the undoctored transcript for an event. Currently, we see the following by default (the same as what a non-moderator user sees):

enter image description here

However, through a series of odd clicks we can pull up the history of a deleted message. Here's something closer to what I'd like to see:

enter image description here

Would it be possible to unhide removed messages for moderators to see, using the deleted post color? For one or two messages, it's not an issue - just a few clicks away. However, this would make it far easier to understand and parse chat logs with many deleted messages.

26

Here's a userscript (the relevant part, other than the template wrapper, is literally 7 lines of code by the Power of jQuery™):

// ==UserScript==
// @name Show deleted chat messages for Stack Exchange
// @grant none
// @match *://chat.stackexchange.com/*
// ==/UserScript==

setTimeout(function() {

    var userscript = function($) {

    $('span.deleted').closest('.message').each(function() {
        var id = this.id.replace('message-', ''), _this = this;
        $.get('//chat.stackexchange.com/messages/' + id + '/history', function(data) {
            var msgtxt = data.match(/<div class="content">([\s\S]+?)<\/div>/)[1].trim();
            $('.content > span', _this).html(msgtxt).css({backgroundColor: '#f4eaea', color: '#000'});
        });
    });

    };

    var el = document.createElement('script');
    el.type = 'text/javascript';
    el.text = '(' + userscript + ')(jQuery);';
    document.head.appendChild(el);

}, 2000);

screenshot

To use the userscript, you have a few options:

  • Install Tampermonkey (Chrome/Chromium) or Greasemonkey (Firefox), and then simply click on this link, which should automagically install the script.

  • If you don't want to do that, if you're on Chrom{e,ium}, you can still click that link, right click and press "save page as" (or just press Ctrl+S), save it somewhere, type chrome://extensions into the URL bar, and then drag'n'drop the .user.js file into it, which should also install the script.

For other browsers or alternative options, you can also just Google for "install userscript [browser]."

  • 2
    GO jQuery! Down JS! – Braiam Jan 8 '15 at 1:15
  • Actually you need an extension first to use userscripts. – Universal Electricity Jun 19 '15 at 12:53
  • 1
    @UniKitty Not in Chrome/Chromium. In Firefox, the userscript should work with GreaseMonkey. – Doorknob Jun 19 '15 at 12:54
  • @Doorknob But I needed to install tampermonkey first for it to work. – Universal Electricity Jun 19 '15 at 12:57
  • @UNICYCLEZ: You can install user scripts directly as Chrome extensions without Tampermonkey, it's just (nowadays) somewhat difficult. (It used to be a lot easier, but apparently enough clueless folks ended up installing malicious user scripts that the Chrome folks made it hard to install any kind of extensions from outside the Chrome Web Store.) – Ilmari Karonen Nov 16 '15 at 23:07
  • Just an FYI, this might need a rate limit. I think (?) it's failing for large transcripts. Would be willing to help run tests, though. Also, might just edit one on later :P – Aza Nov 17 '15 at 4:57
  • You probably ought to add matches to the MSE and SO chatrooms as well. – Quill Jan 14 '16 at 6:16
  • This doesn't work for me, on Chrome on Ubuntu. – Mithrandir Jul 24 '17 at 9:26

You must log in to answer this question.

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