Skip to content

Instantly share code, notes, and snippets.

@khsk
Last active September 26, 2017 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khsk/ba27ce37ee3d2bfd5da2331fcc797a26 to your computer and use it in GitHub Desktop.
Save khsk/ba27ce37ee3d2bfd5da2331fcc797a26 to your computer and use it in GitHub Desktop.
Qiitaのフィードから特定ユーザーの投稿を非表示にするユーザースクリプト ref: http://qiita.com/khsk/items/392ec147c4962caed9ca
// ==UserScript==
// @name Qiita user filter for feed
// @namespace khsk
// @description フィードから特定ユーザーの投稿を非表示にする
// @include http://qiita.com/
// @include https://qiita.com/
// @include http://qiita.com/items
// @include https://qiita.com/items
// @include http://qiita.com/stock
// @include https://qiita.com/stock
// @include http://qiita.com/mine
// @include https://qiita.com/mine
// @version 1
// @grant none
// ==/UserScript==
console.time('userfilter');
var NG_USERS = [
'',
];
// 変更を監視する。追加分だけには対応しておらず、毎回全チェック。
var mo = new MutationObserver(function(data1, data2) {
var posts = document.querySelectorAll('div.item-box-title > h1 > a');
Array.prototype.forEach.call(posts,function(post){
var user = post.href.match(/https?:\/\/qiita.com\/([^/]+)/)[1];
if (NG_USERS.indexOf(user) != -1) {
// えぇ…
post.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.display = 'none';
}
});
});
var items = document.getElementsByClassName('col-sm-9')[0];
var options = {childList: true, subtree:true};
mo.observe(items, options);
console.timeEnd('userfilter');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment