Skip to content

Instantly share code, notes, and snippets.

@dvingerh
Last active January 9, 2019 07:24
Show Gist options
  • Save dvingerh/5ba4880ff33a3c2dfb85323f212f5c17 to your computer and use it in GitHub Desktop.
Save dvingerh/5ba4880ff33a3c2dfb85323f212f5c17 to your computer and use it in GitHub Desktop.
Discord Userscript: Hide Blocked User Message Bar
// ==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));
@Bios-Marcel
Copy link

Bios-Marcel commented Oct 14, 2018

Yo, how the heck do I use this? :D

Added it to Violentmonkey, but it doesn't seem to be doin anything.

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