Warning: fopen(/www/sites/greasyfork.cloud/index/store/forever/bfce5b76fd2eb9bcbbf43cdb019681a8.html): failed to open stream: No space left on device in /www/sites/greasyfork.cloud/index/scriptsControl.php on line 127
ニコニコ大百科掲示板NG機能 - 源代码

Greasy Fork

ニコニコ大百科掲示板NG機能

ニコニコ大百科掲示板NG機能。IDを入力して設定を押せばNGできます。

当前为 2017-05-04 提交的版本,查看 最新版本

// ==UserScript==
// @name		ニコニコ大百科掲示板NG機能
// @namespace	yakisoft
// @include		http://dic.nicovideo.jp/a/*
// @include		https://dic.nicovideo.jp/a/*
// @include		http://dic.nicovideo.jp/b/a/*
// @include		https://dic.nicovideo.jp/b/a/*
// @version		1.3
// @grant		none
// @description	ニコニコ大百科掲示板NG機能。IDを入力して設定を押せばNGできます。
// ==/UserScript==

(function(){
	function doNG(NGList){
		var ngList = NGList.value.split('\n')
		var bbs = document.getElementById("bbs").getElementsByTagName("dl")[0]
		var resheads=bbs.getElementsByTagName("dt")
		var resbodies=bbs.getElementsByTagName("dd")
		for(var i=0; i<resheads.length; i++){
			var reshead=resheads[i]
			var resbody=resbodies[i]
			for(var j=0; j<ngList.length; j++){
				if(ngList[j].length!=0)
					if(reshead.textContent.indexOf(ngList[j])!=-1){
						reshead.childNodes[3].textContent="NGしました"
						reshead.childNodes[4].textContent=":NGしました ID: "+ngList[j]
						resbody.textContent="NGしました"
					}
			}
		}
	}
	var div = document.getElementById("contents");
	var NGList = document.createElement("textarea");
	var NGButton = document.createElement("button");
	NGList.name = "NGList";
	NGList.maxLength = "5000";
	NGList.cols = "40";
	NGList.rows = "10";
	if(typeof(Storage) !== "undefined"){
		if(localStorage.nicodicNG){
			NGList.value = localStorage.getItem('nicodicNG')
		}
	}
	NGButton.name = "NGButton";
	NGButton.textContent = "設定"
	NGButton.style = "width:50px; height:25px"
	NGButton.onclick=function(){
		localStorage.setItem('nicodicNG', NGList.value)
		doNG(NGList)
	}
	div.appendChild(NGList); //appendChild
	div.appendChild(NGButton);

	doNG(NGList);
})();