Last active
October 9, 2020 12:15
-
-
Save MuTLY/dd867ede63841e3d2982791f43e95156 to your computer and use it in GitHub Desktop.
Hide e-Cores bots on Slack
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 Hide e-Core bots | |
// @namespace https://gist.github.com/MuTLY/dd867ede63841e3d2982791f43e95156 | |
// @version 0.1 | |
// @description Hide the e-Core bots on Slack | |
// @author MuTLY | |
// @match https://app.slack.com/* | |
// @grant none | |
// ==/UserScript== | |
// hide e-Coritos | |
const botsParent = 'div.c-virtual_list__item'; // parent | |
const bots = 'div.c-virtual_list__item [data-stringify-text*="e-Coritos"], div.c-virtual_list__item [data-stringify-text*="HiThrive"]'; // a bot message | |
setInterval(function hideBots() { | |
// all the bot messages | |
const elems = document.querySelectorAll(bots); | |
// if there are no elements, do nothing | |
if (elems.length === 0) { | |
return; | |
} | |
let par; | |
let index = 0; | |
const len = elems.length; | |
for ( ; index < len; index++) { | |
// if element is already hidden, do nothing | |
if (elems[index].offsetParent === null) { | |
return; | |
} | |
// hide the message row | |
par = elems[index].closest(botsParent); | |
par.style.display = 'none'; | |
// par.remove(); | |
} | |
console.log(len + ' e-Core bots hidden'); | |
}, 250); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment