stfu-slack-apps/foz.user.js
2023-11-20 10:08:34 -08:00

30 lines
1.2 KiB
JavaScript

// ==UserScript==
// @name slack-app-notif-nuker
// @namespace http://git.minimally.online/
// @version 0.1
// @description Allows you to hide Slack messages from needlessly noisy apps/individuals based on content
// @author Max
// @match *://app.slack.com/*
// @icon https://i.ibb.co/wCj7Tg5/ear-plug.png
// @grant none
// @downloadURL https://git.minimally.online/drudgesentinel/stfu-zapier/raw/branch/main/foz.user.js
// @updateURL https://git.minimally.online/drudgesentinel/stfu-zapier/raw/branch/main/foz.user.js
// ==/UserScript==
// Icon from flaticons.com
// At present, this filtration is specific to app generated messages.
const removeMessages = () => {
const messages = Array.from(document.querySelectorAll('[data-qa="virtual-list-item"]'));
const haveButtons = messages.filter(message => message.querySelector('button'));
haveButtons.forEach( (node) => removeIfSpam(node, "SEV2 Handoff Candidate"));
}
const removeIfSpam = (node, spamMessage) => {
if(node.querySelector('button').textContent.includes(spamMessage)) {
node.replaceChildren();
}
}
//adjust this, faster is better but might impact performance idk
setInterval( removeMessages, 500);