Created
August 29, 2018 00:19
-
-
Save Celeo/3bcaeee92d6e38283687b7a36aa7187d to your computer and use it in GitHub Desktop.
Block posts and comments from Tildes users
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 Block Tildes user comments | |
// @version 0.1 | |
// @description Block Tildes comments | |
// @author github.com/Celeo | |
// @match https://tildes.net/* | |
// @grant none | |
// @require http://code.jquery.com/jquery-latest.js | |
// ==/UserScript== | |
const $ = window.$ | |
const BLOCKED_USERS = [ | |
'NAME_1', | |
'NAME_1' | |
// ... | |
] | |
function hideComments() { | |
$('a.link-user').each((_, e) => { | |
const ele = $(e) | |
const user = ele.text() | |
if (BLOCKED_USERS.indexOf(user) === -1) { | |
return; | |
} | |
const article = ele.closest('article.comment') | |
const content = article.find('div.comment-text').first() | |
content.text('** Content hidden for blocked user **') | |
content.css('color', '#721212') | |
}) | |
} | |
function hidePosts() { | |
$('a.link-user').each((_, e) => { | |
const ele = $(e) | |
const user = ele.text() | |
if (BLOCKED_USERS.indexOf(user) === -1) { | |
return; | |
} | |
const post = ele.closest('article.topic') | |
post.remove() | |
}) | |
} | |
(function() { | |
hideComments() | |
hidePosts() | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment