CustomGinnamaWatch

ニコニコ生放送:GINZAの生放送プレイヤーのUIをお手軽カスタマイズ。

目前為 2015-09-01 提交的版本,檢視 最新版本

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name				CustomGinnamaWatch
// @include				http://live.nicovideo.jp/watch/*
// @version				2.0.4
// @namespace		http://d.hatena.ne.jp/wfwjfow/
// @description		ニコニコ生放送:GINZAの生放送プレイヤーのUIをお手軽カスタマイズ。
// @grant				GM_getValue
// @grant				GM_setValue

// ==/UserScript==
/*
■参考スクリプト
NicoRankingKidokuDelete → http://userscripts.org/scripts/show/45927
■参考サイト
http://userscripts.org/topics/43597
http://stackoverflow.com/questions/2246901/how-can-i-use-jquery-in-greasemonkey-scripts-in-google-chrome
http://www.webopixel.net/javascript/160.html
*/


(function() {

if ((typeof GM_getValue == 'undefined') || (GM_getValue('a', 'b') == undefined)) {

GM_getValue = function(name, defaultValue) {
var value = localStorage.getItem(name);
if (!value)
return defaultValue;
var type = value[0];
value = value.substring(1);
switch (type) {
case 'b':
return value == 'true';
case 'n':
return Number(value);
default:
return value;
}
}
GM_setValue = function(name, value) {
value = (typeof value)[0] + value;
localStorage.setItem(name, value);
}
if(typeof(unsafeWindow)=='undefined') { unsafeWindow=window; } 
}

	//ウォール消去
	function walloff(){
		if( GM_getValue("walloff")=="on"){
			var oStyle = document.createElement('style');
			oStyle.setAttribute('type','text/css');
			var css = '#wall_canvas{display:none!important;}#wall_chip_area{display:none!important;}';
			oStyle.innerHTML = css;
			document.getElementsByTagName('head')[0].appendChild(oStyle);
		}
	}
	//広告消去
	function senCut2(){
		if( GM_getValue("senden2")=="on"){
			var oStyle = document.createElement('style');
			oStyle.setAttribute('type','text/css');
			var css = '#ad_bnr,#footer_ads,#jsFollowingAdContent{display:none!important;}';
			oStyle.innerHTML = css;
			document.getElementsByTagName('head')[0].appendChild(oStyle);
		}
	}
	//宣伝ボタン消去
	function senCut3(){
		if( GM_getValue("senden3")=="on"){
			var oStyle = document.createElement('style');
			oStyle.setAttribute('type','text/css');
			var css = '#watch_title_box .niconikoukoku{display:none!important;}';
			oStyle.innerHTML = css;
			document.getElementsByTagName('head')[0].appendChild(oStyle);
		}
	}
	//フッター消去
	function footcut(){
		if( GM_getValue("footer_off")=="on"){
			var oStyle = document.createElement('style');
			oStyle.setAttribute('type','text/css');
			var css = '#page_footer,#body_footer_wrap{display:none!important;}';
			oStyle.innerHTML = css;
			document.getElementsByTagName('head')[0].appendChild(oStyle);

			
			if(window.parent.location.href.slice(0,35)=="http://live.nicovideo.jp/watch/nsen"){
				var pstyle = document.createElement('style');
				pstyle.setAttribute('type','text/css');
				var css2 = '#utility_link,#page_footer,#body_footer_wrap{display:none!important;}';
				pstyle.innerHTML = css2;
				document.getElementsByTagName('head')[0].appendChild(pstyle);
			}
		}
	}
	//ヘッダー消去
	function headcut(){
		if( GM_getValue("head_off")=="on"){

			var menu=document.getElementById("qnama");
			//menu.innerHTML="■";
			document.body.appendChild(menu);

			var oStyle = document.createElement('style');
			oStyle.setAttribute('type','text/css');
			var css = '#siteHeader{display:none!important;}body{padding-top:0!important;}#qnama{background-color:#fb2db8;position:fixed;top:0;font-size:0px;display:block;width:100%;height:5px;z-index:999999999;cursor:pointer;margin-left:0!important;}';
			oStyle.innerHTML = css;
			document.getElementsByTagName('head')[0].appendChild(oStyle);
		}
	}
	//市場消去
	function ichibaCut(){
		if( GM_getValue("ichiba_off")=="on"){
			var oStyle = document.createElement('style');
			oStyle.setAttribute('type','text/css');
			var css = '#advertisement_box{display:none!important;}div#watch_tab_box{background:transparent!important;}';
			oStyle.innerHTML = css;
			document.getElementsByTagName('head')[0].appendChild(oStyle);
		}
	}
	//ザッピングを消去
	function zappingCut(){
		if( GM_getValue("zapping_off")=="on"){
			var oStyle = document.createElement('style');
			oStyle.setAttribute('type','text/css');
			var css = '#watch_zapping_box{display:none!important;}';
			oStyle.innerHTML = css;
			document.getElementsByTagName('head')[0].appendChild(oStyle);

			if(window.parent.location.href.slice(0,35)=="http://live.nicovideo.jp/watch/nsen"){
				var pstyle = document.createElement('style');
				pstyle.setAttribute('type','text/css');
				var css2 = '{display:none!important;}';
				pstyle.innerHTML = css2;
				document.getElementsByTagName('head')[0].appendChild(pstyle);
			}
		}
	}
	//使い方・共有等を消去
	function helpCut(){
		if( GM_getValue("help_off")=="on"){
			var oStyle = document.createElement('style');
			oStyle.setAttribute('type','text/css');
			var css = '#watch_player_bottom_box{display:none!important;}';
			oStyle.innerHTML = css;
			document.getElementsByTagName('head')[0].appendChild(oStyle);

			if(window.parent.location.href.slice(0,35)=="http://live.nicovideo.jp/watch/nsen"){
				var pstyle = document.createElement('style');
				pstyle.setAttribute('type','text/css');
				var css2 = '#player_btm{display:none!important;}div#reqBoxRule{display:none!important;}#mylistArea{margin:0!important;padding:0!important;}';
				pstyle.innerHTML = css2;
				document.getElementsByTagName('head')[0].appendChild(pstyle);
			}
		}
	}
	//PAGE TOPを消去
	function pagetopCut(){
		if( GM_getValue("pagetop_off")=="on"){
			var oStyle = document.createElement('style');
			oStyle.setAttribute('type','text/css');
			var css = '.page_top{display:none!important;}';
			oStyle.innerHTML = css;
			document.getElementsByTagName('head')[0].appendChild(oStyle);
		}
	}
	//背景灰色
	function backwhite(){
		if( GM_getValue("back_off")=="on"){
			if(window.parent.location.href.slice(0,35)!="http://live.nicovideo.jp/watch/nsen"){
			var oStyle = document.createElement('style');
			oStyle.setAttribute('type','text/css');
			var css = 'body,#all_cover,#all,div#watch_title_box,#watch_player_top_box,div#watch_player_top_box div,div#watch_player_box,div#watch_zapping_box,div#page_header,div#page_cover{background:#F4F4F4!important;border:none!important;}#page *{text-shadow:none!important;color:#000000!important;font-size:13px!important;}';
			oStyle.innerHTML = css;
			document.getElementsByTagName('head')[0].appendChild(oStyle);
			}
		}
	}
	//ロゴ・検索ボックス消去
	function logoCut(){
		if( GM_getValue("logo_off")=="on"){
			var oStyle = document.createElement('style');
			oStyle.setAttribute('type','text/css');
			var css = '#page_header{display:none!important;}#page_cover{margin-top:0px!important;}';
			oStyle.innerHTML = css;
			document.getElementsByTagName('head')[0].appendChild(oStyle);

			if(window.parent.location.href.slice(0,35)=="http://live.nicovideo.jp/watch/nsen"){
				var pstyle = document.createElement('style');
				pstyle.setAttribute('type','text/css');
				var css2 = 'div.headerInner{display:none!important;}div#header{margin-top:20px!important;}';
				pstyle.innerHTML = css2;
				document.getElementsByTagName('head')[0].appendChild(pstyle);
			}
		}
	}
	//ページ左右余白リンク消去
	function dellink(){
		if( GM_getValue("link_off")=="on"){
			if(window.parent.location.href.slice(0,35)!="http://live.nicovideo.jp/watch/nsen"){
			
			var divleft=document.createElement("div");
			var divright=document.createElement("div");
			divleft.id="divleft";
			divright.id="divright";
			document.body.appendChild(divleft);
			document.body.appendChild(divright);
			
			var divwidth=parseInt( (document.body.clientWidth-960)/2 +1 );
			divleft.style.width=divwidth+"px";
			divright.style.width=divwidth+"px";

			var oStyle = document.createElement('style');
			oStyle.setAttribute('type','text/css');
			var css = '#divleft{position:absolute;top:0;left:0;height:100%;background-color:#F4F4F4;z-index:9999999;}#divright{position:absolute;top:0;right:0;height:100%;background-color:#F4F4F4;z-index:9999999;}#siteHeader #siteHeaderInner{width:984px!important;}';
			oStyle.innerHTML = css;
			document.getElementsByTagName('head')[0].appendChild(oStyle);

			var pagewidth=parseInt( (document.body.clientWidth-960)/2 +1 );
			document.getElementById("prefDiv").style.right=pagewidth+"px";
			}
		}
	}
	//ニュース消去
	function delnews(){
		if( GM_getValue("news_off")=="on"){
			if(window.parent.location.href.slice(0,35)!="http://live.nicovideo.jp/watch/nsen"){
			
			var divsus=document.createElement("div");
			divsus.id="divsus";
			document.body.appendChild(divsus);
			
//<h1 id="element-h1">指定要素</h1>
var elm = document.getElementById("slider_container");

//[getBoundingClientRect]を参照する
var rect = elm.getBoundingClientRect() ;

//ブラウザの左上からのX座標を取得する
var positionX = rect.left ;

//ブラウザの左上からのY座標を取得する
var positionY = rect.top ;

//スクロール量の取得に必要なパーツ
var dElm = document.documentElement , dBody = document.body;

//X方向のスクロール量を取得する
var scrollX = dElm.scrollLeft || dBody.scrollLeft ;

//Y方向のスクロール量を取得する
var scrollY = dElm.scrollTop || dBody.scrollTop ;

//要素のX座標
var x = positionX + scrollX ;

//要素のY座標
var y = positionY + scrollY ;

			var winwidth=parseInt( (document.body.clientWidth-960)/2 +1 );

			divsus.style.top=y+22+"px";
			divsus.style.left=x+winwidth+"px";


			var oStyle = document.createElement('style');
			oStyle.setAttribute('type','text/css');
			var css = '#divsus{position:absolute;background-color:#F4F4F4;z-index:9999999;width:680px;height:60px;}';
			oStyle.innerHTML = css;
			document.getElementsByTagName('head')[0].appendChild(oStyle);

			}
		}
	}





	function labelElement(str,che){
		var k = document.createElement("label");
		k.innerHTML = str;
		k.style.cursor = "hand";
		k.setAttribute("for",che);
		k.style.fontSize = "12px";
		return k;
	}

	function interface_kidoku(){
		var prefDiv = document.createElement("div");
			prefDiv.style.width = "300px";
			prefDiv.style.height = "250px";
			prefDiv.style.overflowY = "scroll";
			prefDiv.innerHTML = "GinnamaWatchカスタマイズ設定" + "<br>";
			prefDiv.style.backgroundColor = "#ccccff";
			prefDiv.style.color = "black";
			prefDiv.style.border = "1px solid #888";
			prefDiv.style.position = "fixed";
			prefDiv.style.bottom = "0px";
			prefDiv.style.right = "0px";
			prefDiv.style.textAlign = 'left';
			prefDiv.style.margin = "0 0 0 0";
			prefDiv.style.zIndex = 999;
			prefDiv.style.display = 
				(GM_getValue("prefDisplay") == "none") ? "none" : "";
			prefDiv.id = "prefDiv";
			document.body.appendChild(prefDiv);

		var tojiru=document.createElement("div");
		tojiru.innerHTML = "閉じる";
		tojiru.style.position = "absolute";
		tojiru.style.top = "0px";
		tojiru.style.right = "5px";
		tojiru.style.color="#00BFFF";
		tojiru.style.cursor = "pointer";
		tojiru.id="tojiru";


		var linkwalloff = document.createElement("input");
			linkwalloff.name = "walloff";
			linkwalloff.caption = "ウォール消去";
		var linkSen2 = document.createElement("input");
			linkSen2.name = "senden2";
			linkSen2.caption = "Flash上以外の広告を消去";
		var linkichiba = document.createElement("input");
			linkichiba.name = "ichiba_off";
			linkichiba.caption = "市場消去";
		var linksencut = document.createElement("input");
			linksencut.name = "senden3";
			linksencut.caption = "宣伝ボタン消去";
		var linklist = document.createElement("input");
			linklist.name = "zapping_off";
			linklist.caption = "ザッピングを消去";
		var linkfootcut = document.createElement("input");
			linkfootcut.name = "footer_off";
			linkfootcut.caption = "フッター消去";
		var linkwhite = document.createElement("input");
			linkwhite.name = "back_off";
			linkwhite.caption = "背景を灰色にする";
		var linkhelp = document.createElement("input");
			linkhelp.name = "help_off";
			linkhelp.caption = "使い方・共有等を消去";
		var linkpagetop = document.createElement("input");
			linkpagetop.name = "pagetop_off";
			linkpagetop.caption = "PAGETOPを消去";
		var linklogocut = document.createElement("input");
			linklogocut.name = "logo_off";
			linklogocut.caption = "ロゴ・検索ボックス消去";
		var linkdellink = document.createElement("input");
			linkdellink.name = "link_off";
			linkdellink.caption = "ページ左右余白リンクを消去";
		var linkheadcut = document.createElement("input");
			linkheadcut.name = "head_off";
			linkheadcut.caption = "ヘッダー消去";
		var linkdelnews = document.createElement("input");
			linkdelnews.name = "news_off";
			linkdelnews.caption = "ニュース消去";

		var form = document.createElement("form");

		var links = 
			[linkSen2,linkichiba,linkfootcut,linkwhite,linklist,linkhelp,linkpagetop,linkdellink,linklogocut,linkheadcut,linkwalloff,linksencut,linkdelnews];

		for (var i=0;i<links.length;i++){
				links[i].type = "checkbox";
				links[i].defaultValue = "off";
		}

		for (var i=0;i<links.length;i++){
			if (!GM_getValue(links[i].name)) {
				GM_setValue(links[i].name, links[i].defaultValue);
			}
				links[i].id = links[i].name;
				links[i].checked = (GM_getValue(links[i].name) != "on") ? false : true;
				links[i].addEventListener("click", function(e){
					GM_setValue(this.name, (GM_getValue(this.name) != "on") ? "on" : "off");
				}, true);
		}

		//登録
		form.appendChild(tojiru);
		form.appendChild(document.createElement("br"));
		form.appendChild(linkSen2);
		form.appendChild(labelElement(linkSen2.caption, linkSen2.id));
		form.appendChild(document.createElement("br"));
		form.appendChild(linksencut);
		form.appendChild(labelElement(linksencut.caption, linksencut.id));
		form.appendChild(document.createElement("br"));
		form.appendChild(linkwalloff);
		form.appendChild(labelElement(linkwalloff.caption, linkwalloff.id));
		form.appendChild(document.createElement("br"));
		form.appendChild(linkheadcut);
		form.appendChild(labelElement(linkheadcut.caption, linkheadcut.id));
		form.appendChild(document.createElement("br"));
		form.appendChild(linkfootcut);
		form.appendChild(labelElement(linkfootcut.caption, linkfootcut.id));
		form.appendChild(document.createElement("br"));
		form.appendChild(linklist);
		form.appendChild(labelElement(linklist.caption, linklist.id));
		form.appendChild(document.createElement("br"));
		form.appendChild(linkhelp);
		form.appendChild(labelElement(linkhelp.caption, linkhelp.id));
		form.appendChild(document.createElement("br"));
		form.appendChild(linkichiba);
		form.appendChild(labelElement(linkichiba.caption, linkichiba.id));
		form.appendChild(document.createElement("br"));
		form.appendChild(linkpagetop);
		form.appendChild(labelElement(linkpagetop.caption, linkpagetop.id));
		form.appendChild(document.createElement("br"));
		form.appendChild(linkwhite);
		form.appendChild(labelElement(linkwhite.caption, linkwhite.id));
		form.appendChild(document.createElement("br"));
		form.appendChild(linklogocut);
		form.appendChild(labelElement(linklogocut.caption, linklogocut.id));
		form.appendChild(document.createElement("hr"));
		form.appendChild(linkdellink);
		form.appendChild(labelElement(linkdellink.caption, linkdellink.id));
		form.appendChild(document.createElement("hr"));
		form.appendChild(linkdelnews);
		form.appendChild(labelElement(linkdelnews.caption, linkdelnews.id));

		prefDiv.appendChild(form);

		var prefSw = document.createElement("span");
		prefSw.innerHTML = "カスタマイズ設定";
		prefSw.id = "qnama";
		prefSw.addEventListener("click",function(e){
			prefDiv.style.display = 
				(prefDiv.style.display == "") ? "none" : "";
			GM_setValue("prefDisplay",prefDiv.style.display);
		},false);
		document.getElementById("siteHeaderRightMenuContainer").appendChild(prefSw);

		tojiru.addEventListener("click",function(e){
			prefDiv.style.display = 
				(prefDiv.style.display == "") ? "none" : "";
			GM_setValue("prefDisplay",prefDiv.style.display);
		},false);


		var oStyle = document.createElement('style');
		oStyle.setAttribute('type','text/css');
		var css = '#siteHeader #siteHeaderInner{width:85%!important;}#qnama{margin-left:17px;color:#000000!important;cursor:pointer;}#prefDiv hr{margin:5px 0;border-color:#333333;}';
		oStyle.innerHTML = css;
		document.getElementsByTagName('head')[0].appendChild(oStyle);


	}

interface_kidoku();
senCut2();
senCut3();
zappingCut();
footcut();
backwhite();
ichibaCut();
helpCut();
pagetopCut();
logoCut();
headcut();
dellink();
walloff();
delnews();

})();