Skip to content

Instantly share code, notes, and snippets.

@The-Quill
Created March 20, 2016 07:57
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 The-Quill/59fc5e775ff328ab3964 to your computer and use it in GitHub Desktop.
Save The-Quill/59fc5e775ff328ab3964 to your computer and use it in GitHub Desktop.
Show no deleted messages in CHQ
// ==UserScript==
// @name No Deleted Messages
// @description No deleted messages
// @version 0.0.1
// @match http://chat.stackexchange.com/rooms/11540/charcoal-hq
// @author The-Quill
// @run-at document-end
// ==/UserScript==
function hideMessage(message){
var messageBlock = message.parentNode.parentNode;
if (messageBlock.classList.contains('deleted')){
var parentNode = message.parentNode;
parentNode.removeChild(message);
if (parentNode.children.length === 0){
messageBlock.style.display = "none";
}
}
}
function nodeInsertionListener(){
var messages = document.querySelectorAll(".monologue .message");
Array.prototype.slice.apply(messages).forEach(hideMessage);
}
window.addEventListener("DOMNodeInserted", nodeInsertionListener);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment