stfu-slack-apps/foz.user.js
2023-11-20 09:56:17 -08:00

31 lines
1.3 KiB
JavaScript

// ==UserScript==
// @name Zapier, why won't u just leave me alone?
// @namespace http://git.minimally.online/
// @version 0.1
// @description Allows you to hide Slack messages from needlessly noisy apps/individuals based on content
// @author drudgesentinel (Sean)
// @match *://app.slack.com/*
// @icon https://i.postimg.cc/NGb9WSWn/is-it-joy.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==
//going to eventually want to check if the terraform-support is highlighted, probably. We'll see.
// 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);