Skip to content

Instantly share code, notes, and snippets.

@Celeo
Created August 29, 2018 00:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Celeo/3bcaeee92d6e38283687b7a36aa7187d to your computer and use it in GitHub Desktop.
Save Celeo/3bcaeee92d6e38283687b7a36aa7187d to your computer and use it in GitHub Desktop.
Block posts and comments from Tildes users
// ==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