Created
September 10, 2019 08:42
-
-
Save dvingerh/26d6e8ee1e26fb1aba6438be12d8cfd3 to your computer and use it in GitHub Desktop.
Completely hides the clickable bar to view blocked user messages.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Discord Hide Blocked User Message Bar | |
// @description Completely hides the clickable bar to view blocked user messages. | |
// @namespace Violentmonkey Scripts | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js | |
// @match *://discordapp.com/* | |
// | |
// ==/UserScript== | |
(function($) { | |
"use strict"; | |
$.fn.removeBlockedUser = function() { | |
$("div[class^='messageGroupBlocked']").each( | |
function() { | |
$(this).hide(); | |
} | |
); | |
return this; | |
}; | |
// Helper function for finding all elements matching selector affected by a mutation | |
var mutationFind = function(mutation, selector) { | |
var target = $(mutation.target), | |
addedNodes = $(mutation.addedNodes); | |
var mutated = target.add(addedNodes).filter(selector); | |
var descendants = addedNodes.find(selector); | |
var ancestors = target.parents(selector); | |
return mutated.add(descendants).add(ancestors); | |
}; | |
// Watch for new messages in chat | |
new MutationObserver(function(mutations, observer) { | |
mutations.forEach(function(mutation) { | |
mutationFind(mutation, ".message").removeBlockedUser(); | |
}); | |
}).observe(document, { | |
childList: true, | |
subtree: true | |
}); | |
})(jQuery.noConflict(true)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment