Created
June 15, 2018 09:37
-
-
Save homocomputeris/dee2ed211fb2915fdc75f8f03db92306 to your computer and use it in GitHub Desktop.
Habr editor blocker
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
// ==UserScript== | |
// @name Habr editor blocker | |
// @description Hides articles that were posted by certain authors | |
// @match https://habr.com/* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
// @namespace http://tampermonkey.net/ | |
// https://habr.com/post/391233/ | |
var authors = [ | |
'alizar', | |
'marks', | |
'ivansychev', | |
'ragequit', | |
'SLY_G', | |
]; | |
var posts = document.querySelectorAll('.post'); | |
for (var idx = 0; idx < posts.length; ++idx) { | |
var post = posts[idx]; | |
for (var i = 0; i < authors.length; ++i) { | |
var selector = '.post__user-info[href$="/' + authors[i] + '/"]'; | |
var blockedAuthor = post.querySelector(selector); | |
if (blockedAuthor) { | |
post.style.display = 'none'; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment