nicolive_onair_filter5

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);