勝手に tampermonkey とかに突っ込んで使ってヨロ
スクリプト保守とかするつもりないから、保守とかするつもりのあるパワーの溢れた人が
これ参考とかにしてもっとかっちょよくしたのを greasy fork あたりに公開してくれ
そしたら俺もそれ使う
localStorage.hatebu_ng_word_list に非表示のトリガーになる文字列を|区切りで登録する。
localStorage.hatebu_ng_word_list = "池田信夫|フェミ|弱者男性|やまもといちろう"
大なり小なり(>)が実体参照で表示されるのはよくわからん。使う人で適宜コードを直してくれ。
// ==UserScript==// @nameはてブの一覧NG記事非表示// @namespacehttp://tampermonkey.net/// @version 0.1// @descriptiontry totakeoverthe world!// @author masuda// @matchhttps://b.hatena.ne.jp/*// @iconhttps://www.google.com/s2/favicons?sz=64&domain=hatena.ne.jp// @grant none// ==/UserScript==(function() {'use strict';if (!localStorage.hatebu_ng_word_list) {return;}console.log("はてブの一覧NG記事非表示", localStorage.hatebu_ng_word_list);/* * 例: * localStorage.hatebu_ng_word_list = * "池田信夫|フェミ|弱者男性|やまもといちろう|togetter.com";*/let words = localStorage.hatebu_ng_word_list.split('|').map(w => newRegExp(w));function entryDelete(els) {els.forEach(el => {let hit =false;words.forEach(w => {hit = hit|| w.test(el.textContent);});if (hit) {el.remove();}});}// entrylist-header-main li 1つ目のアイテムentryDelete(document.querySelectorAll('.entrylist-header-main> li'));// 2つ目以降の liアイテムentryDelete(document.querySelectorAll('.entrylist-item> li'));})();
文字は正規表現として評価されて、ヒットした記事項目をページから削除する(DOMから要素を削除する)。