Skip to content

Instantly share code, notes, and snippets.

@uzimith
Created September 15, 2017 09:26
Show Gist options
  • Save uzimith/63caab1bd472f80b34e30861c89cbc9e to your computer and use it in GitHub Desktop.
Save uzimith/63caab1bd472f80b34e30861c89cbc9e to your computer and use it in GitHub Desktop.
ignore-slack-user.js
// ==UserScript==
// @name Ignore slack user
// @namespace https://github.com/uzimith/
// @version 0.1
// @description ignore slack user
// @author uzimith
// @match https://*.slack.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
//無視したいユーザーとルール
var users = [
{name: "slackbot", rooms: ["#general"]}
];
if(document.body) {
console.log("user delete event is registered.");
$("#msgs_div").on('DOMSubtreeModified propertychange', function() {
users.forEach(function(user) {
var room_name = $("#channel_title").text();
var ignore = room_name.startsWith("#") &&
(
(user.rooms && user.rooms.includes(room_name)) ||
(user.hosts && user.hosts.includes(location.host))
);
if(ignore) {
$(".message_sender:contains(" + user.name + ")").parent().parent().parent().parent().hide();
}
});
});
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment