Created
September 22, 2021 06:12
-
-
Save summatix/7560d087468ee329571e493c86ae206b to your computer and use it in GitHub Desktop.
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 Messages | |
// @namespace https://github.com/Multarix/Discord-Hide-Blocked-Messages | |
// @match https://discord.com/* | |
// @downloadURL https://raw.githubusercontent.com/Multarix/Discord-Hide-Blocked-Messages/master/script.user.js | |
// @homepageURL https://github.com/Multarix/Discord-Hide-Blocked-Messages | |
// @supportURL https://github.com/Multarix/Discord-Hide-Blocked-Messages/issues | |
// @grant none | |
// @version 2.0 | |
// @author Anonymous | |
// @description 10/28/2020, 1:37:40 PM | |
// ==/UserScript== | |
function hideBlocked(){ | |
var blocked = document.querySelectorAll('[class^="groupStart"]'); // Find all "Blocked Messages" | |
blocked.forEach(blokMsg => { | |
if(blokMsg.style.display !== "none") blokMsg.style.display = "none"; // Hide the message if it's not already hidden. | |
}); | |
// Hide all replies to blocked messages | |
var messages = document.querySelectorAll('[class^="messageListItem"]'); | |
messages.forEach(msg => { | |
const replyTxt = msg.querySelector('[class^="repliedTextPlaceholder"]'); | |
if (replyTxt && replyTxt.textContent === 'Blocked message.') { | |
if(msg.style.display !== "none") msg.style.display = "none"; | |
} | |
}); | |
}; | |
setInterval(hideBlocked, 500); // Repeat every half second. Recommended to keep at 500, but raise/ lower if you wish. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment