Last active
June 24, 2019 07:55
-
-
Save Akii/3b916b6a7f9147e9cb364883be31a369 to your computer and use it in GitHub Desktop.
Basically a starting point of hiding channels and blocking users in 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
document.addEventListener("DOMContentLoaded", function() { | |
let hiddenChannels = ['general'] | |
let blockedUsers = ['Slackbot'] | |
let customCss = ` | |
.p-channel_sidebar__static_list div[role="listitem"]:empty { display: none; } | |
` | |
hiddenChannels.concat(blockedUsers).forEach(it => { | |
customCss += `a[aria-label~="${it}"] { display: none; }\n` | |
}) | |
let s = document.createElement('style'); | |
s.type = 'text/css'; | |
s.innerHTML = customCss; | |
document.head.appendChild(s); | |
let remover = function () { | |
setTimeout(function () { | |
hiddenChannels.forEach(it => { | |
document.querySelectorAll(`a[aria-label~="${it}"]`).forEach(it => it.remove()); | |
}) | |
blockedUsers.forEach(it => { | |
document.querySelectorAll(`a[aria-label~="${it}"]`).forEach(it => it.parentNode.remove()); | |
}) | |
remover(); | |
}, 250); | |
} | |
remover(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, I know. You might think: if you need this, something is wrong with your organisation. And maybe that's true. I just don't care and want more control about what I'm exposing myself to on Slack.
How to install:
Append Gist contents to this file:
/Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js
How it works:
It just adds some CSS and removes DOM elements. That means, you have to mute the channel you want to hide (usually, that's general). Regarding users: It will not hide notifications correctly. Not sure what to do about that yet.