Created
September 15, 2017 09:26
-
-
Save uzimith/63caab1bd472f80b34e30861c89cbc9e to your computer and use it in GitHub Desktop.
ignore-slack-user.js
This file contains hidden or 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 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