Skip to content

Instantly share code, notes, and snippets.

@guoxiao
Last active December 17, 2015 19:08
Show Gist options
  • Save guoxiao/5657686 to your computer and use it in GitHub Desktop.
Save guoxiao/5657686 to your computer and use it in GitHub Desktop.
Zhihu Filter
// ==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