haiku_spam_hidden

はてなハイクのスパムを非表示します。

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name        haiku_spam_hidden
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @namespace   haiku_spam_hidden
// @description はてなハイクのスパムを非表示します。
// @include     http://h.hatena.ne.jp/*
// @version     1.1.1
// @grant       none
// ==/UserScript==

$(function() {
//スパマーのID
var su = [];
//スパムキーワード
var sk = [];

setInterval(function() {
	//spamだと見なすパターン
	//キーワード
	var km = new RegExp(/http|free|movie|w.?a.?t.?c.?h|s.?t.?r.?e.?a.?m|l.?i.?v.?e|justin|tv|izle|online|ver|purdue|n.?u.?d.?e|kidia|zynga|forum|Nordic|get|asistida|онлайн|смотреть|Александр|Солнечный|full|video|pastebin|ℯ|sgh|costa|fast income|business discussions|www\..*\.com|voir|The V Groove|Eva3drs|gratis/i);
	//本文
	var bm = new RegExp(/amigomedico|justineskye|goodsie|heartofamericahospice|educavie|wkdy|willistonfirst|wetwebmediaforum|oxfordyouthexpression/i);
	//例外(idページ)
	var nop = new RegExp(/id\:/i);
	
	//timeline上(キーワード)
	$('body').find('a.title-anchor').each(function() {
		if (!$(this).html().match(nop)) {
			if ($(this).html().match(km)) {
				$(this).parent().parent().parent().css('display','none');
				
				//スパマーの判別
				var userid = $(this).parent().parent().parent().find('span.username').children('a').attr('href');
				if (su.indexOf(userid) == -1) {
					su.push(userid);
				}
			}
		}
	});

	//timeline上(本文)
	$('body').find('div.entry-body-content').each(function() {		
		if ($(this).html().match(bm)) {
			$(this).parent().parent().parent().css('display','none');
			
			//キーワードを認識してスパムキーワードに加える
			sk.push($(this).parent().parent().find('a.title-anchor').html());
			
			//スパマーの判別
			var userid = $(this).parent().parent().parent().find('span.username').children('a').attr('href');
			if (su.indexOf(userid) == -1) {
				su.push(userid);
			}
		}
	});

	//注目キーワード
	$('body').find('a.keyword').each(function() {
		if ($(this).html().match(km)) {
			$(this).parent().css('display','none');
		}
	});

	//検出したスパマーに目印をつける
	$('body').find('li.user').each(function() {
		for (i = 0; i < su.length; i++) {
			if ($(this).find('a').attr('href') == su[i]) {
				$(this).children().children().children().css('border','solid 2px').css('color','black');
			}
		}
	});
},350);
});