Last active
December 17, 2015 19:08
-
-
Save guoxiao/5657686 to your computer and use it in GitHub Desktop.
Zhihu Filter
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 Zhihu Filter | |
// @namespace skydiver | |
// @description I just want to hide some questions. | |
// @match http://www.zhihu.com/ | |
// ==/UserScript== | |
var blacklist = ['苹果', '女朋友']; | |
var len = blacklist.length; | |
function process(){ | |
var items = document.querySelectorAll('.feed-item .question_link'); | |
for (var j = 0; j < items.length; j++) { | |
for (var i = 0; i < len; i++) { | |
if(items[j].innerHTML.match(blacklist[i])) { | |
items[j].parentNode.parentNode.parentNode.parentNode.style.display = 'none'; | |
} | |
} | |
}; | |
} | |
process(); | |
document.addEventListener('DOMSubtreeModified', process, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment