Last active
January 9, 2019 07:24
-
-
Save dvingerh/5ba4880ff33a3c2dfb85323f212f5c17 to your computer and use it in GitHub Desktop.
Discord Userscript: Hide Blocked User Message Bar
This file contains hidden or 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
Yo, how the heck do I use this? :D
Added it to Violentmonkey, but it doesn't seem to be doin anything.