nicolive_onair_filter5

ニコ生トップの興味のないサムネイルを削除する。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        nicolive_onair_filter5
// @namespace   http://catherine.v0cyc1pp.com/
// @match       http://live.nicovideo.jp/
// @match       http://live.nicovideo.jp/recent*
// @author      greg10
// @run-at      document-end
// @license     GPL 3.0
// @version     5.0
// @require     http://code.jquery.com/jquery-3.3.1.min.js
// @grant       none
// @description ニコ生トップの興味のないサムネイルを削除する。
// ==/UserScript==

this.$ = this.jQuery = jQuery.noConflict(true);

//================================
// Configurations
//   - 表示させたくないコミュニティを指定してください。
var g_text = "co1268146, co3618802";
//================================


console.log("nicolive_onair_filter5 start");

var nglist = g_text.split(",");

function nico_ranking() {
	//console.log("nico_ranking() start");



	$("#onair > li").each(function() {
		var aaa = $(this).children("a");
		//console.log("aaa="+aaa);
		//var href= $(aaa).attr("href");
		//console.log("href="+href);
		var img = aaa.children("img");
		//console.log("img="+img);
		var str = img.attr("src");
		//console.log("str="+str);
		if ( str == null || str == undefined ) {
			str = "";
		}
		//console.log("str="+str);
		for ( var i = 0; i < nglist.length; ++i) {
			var ngword = nglist[i];
			ngword = ngword.replace(/^\s+|\s+$/g, "");
            if ( ngword == "" ) {
                continue;
            }

			var obj = new RegExp( ngword, "i");
			var index = str.search( obj );
			//var index = str.indexOf( ngword );
			if ( index != -1 ) {
				$(this).remove();
				console.log("nico_ranking(): hide: index="+index+", community="+ngword);
			}
		}


	});
}
function nico_search() {
	//console.log("nico_search() start");



	$("li.user-program-item").each(function() {
		var aaa = $(this).children("a");
		//console.log("aaa="+aaa);
		//var href= $(aaa).attr("href");
		//console.log("href="+href);
		var img = aaa.children(".user-program-item-body-area").children(".thumbnail-area").children("img");
		//console.log("img="+img);
		var str = img.attr("src");
		//console.log("str="+str);
		if ( str == null || str == undefined ) {
			str = "";
		}
		//console.log("str="+str);
		for ( var i = 0; i < nglist.length; ++i) {
			var ngword = nglist[i];
			ngword = ngword.replace(/^\s+|\s+$/g, "");
            if ( ngword == "" ) {
                continue;
            }

			var obj = new RegExp( ngword, "i");
			var index = str.search( obj );
			//var index = str.indexOf( ngword );
			if ( index != -1 ) {
				$(this).remove();
				console.log("nico_search(): hide: index="+index+", community="+ngword);
			}
		}


	});
}
function nico_osusume() {
	//console.log("nico_osusume() start");



	$("ul[class^='___program-card-list'] > li").each(function() {
		var aaa = $(this).children("div[class^='___program-card']").children("a");
		//console.log("aaa="+aaa);
		//var href= $(aaa).attr("href");
		//console.log("href="+href);
		var img = aaa.children("div[class^='___program-detail']").children("h3").children("span").children("img");
		//console.log("img="+img);
		var str = img.attr("src");
		//console.log("str="+str);
		if ( str == null || str == undefined ) {
			str = "";
		}
		//console.log("str="+str);
		for ( var i = 0; i < nglist.length; ++i) {
			var ngword = nglist[i];
			ngword = ngword.replace(/^\s+|\s+$/g, "");
            if ( ngword == "" ) {
                continue;
            }

			var obj = new RegExp( ngword, "i");
			var index = str.search( obj );
			//var index = str.indexOf( ngword );
			if ( index != -1 ) {
				$(this).remove();
				console.log("nico_osusume(): hide: index="+index+", community="+ngword);
			}
		}


	});
}

function main() {
	nico_ranking();
	nico_search();
	nico_osusume();
}

main();


var observer = new MutationObserver(function(mutations) {
    observer.disconnect();
    main();
    observer.observe( document, config);
});

var config = { attributes: true, childList: true, characterData: true, subtree:true };

observer.observe( document, config);