Last active
March 13, 2023 15:12
-
-
Save cwillsey06/dc70addb16f52353e58062989f624cdf to your computer and use it in GitHub Desktop.
Discord — hide blocked messages and their "spoiler blocks"
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 Hide blocked messages | |
| // @namespace https://gist.github.com/cwillsey06 | |
| // @version 1.0 | |
| // @description Hide blocked messages and their "spoiler blocks" | |
| // @author cwillsey06 | |
| // @license Unlicense | |
| // @run-at document-start | |
| // @match *://discord.com/channels/* | |
| // ==/UserScript== | |
| (function () { | |
| 'use strict'; | |
| let blockedlist = document.querySelectorAll("div[class^='blockedSystemMessage']"); | |
| blockedlist.forEach(elem=>(elem.parentElement.parentElement.style.display="none")); | |
| let mutationObserver = new MutationObserver(function(mutations) { | |
| mutations.forEach(function(mutation) { | |
| mutation.addedNodes.forEach( function(currentValue, currentIndex, listObj) { | |
| if (currentValue.nodeType == Node.ELEMENT_NODE) { | |
| let blockedlist = currentValue.querySelectorAll("div[class^='blockedSystemMessage']"); | |
| blockedlist.forEach(elem=>(elem.parentElement.parentElement.style.display="none")); | |
| } | |
| }); | |
| }); | |
| }); | |
| mutationObserver.observe(document.documentElement, { | |
| childList: true, | |
| subtree: true | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment