CustomGinnamaWatch

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

  1. // ==UserScript==
  2. // @name CustomGinnamaWatch
  3. // @include http://live.nicovideo.jp/watch/*
  4. // @version 2.0.5
  5. // @namespace http://d.hatena.ne.jp/wfwjfow/
  6. // @description ニコニコ生放送:GINZAの生放送プレイヤーのUIをお手軽カスタマイズ。
  7. // @grant GM_getValue
  8. // @grant GM_setValue
  9.  
  10. // ==/UserScript==
  11. /*
  12. 参考スクリプト
  13. NicoRankingKidokuDelete → http://userscripts.org/scripts/show/45927
  14. 参考サイト
  15. http://userscripts.org/topics/43597
  16. http://stackoverflow.com/questions/2246901/how-can-i-use-jquery-in-greasemonkey-scripts-in-google-chrome
  17. http://www.webopixel.net/javascript/160.html
  18. */
  19.  
  20.  
  21. (function() {
  22.  
  23. if ((typeof GM_getValue == 'undefined') || (GM_getValue('a', 'b') == undefined)) {
  24.  
  25. GM_getValue = function(name, defaultValue) {
  26. var value = localStorage.getItem(name);
  27. if (!value)
  28. return defaultValue;
  29. var type = value[0];
  30. value = value.substring(1);
  31. switch (type) {
  32. case 'b':
  33. return value == 'true';
  34. case 'n':
  35. return Number(value);
  36. default:
  37. return value;
  38. }
  39. }
  40. GM_setValue = function(name, value) {
  41. value = (typeof value)[0] + value;
  42. localStorage.setItem(name, value);
  43. }
  44. if(typeof(unsafeWindow)=='undefined') { unsafeWindow=window; }
  45. }
  46.  
  47. //ウォール消去
  48. function walloff(){
  49. if( GM_getValue("walloff")=="on"){
  50. var oStyle = document.createElement('style');
  51. oStyle.setAttribute('type','text/css');
  52. var css = '#wall_canvas{display:none!important;}#wall_chip_area{display:none!important;}';
  53. oStyle.innerHTML = css;
  54. document.getElementsByTagName('head')[0].appendChild(oStyle);
  55. }
  56. }
  57. //広告消去
  58. function senCut2(){
  59. if( GM_getValue("senden2")=="on"){
  60. var oStyle = document.createElement('style');
  61. oStyle.setAttribute('type','text/css');
  62. var css = '#ad_bnr,#footer_ads,#jsFollowingAdContent{display:none!important;}';
  63. oStyle.innerHTML = css;
  64. document.getElementsByTagName('head')[0].appendChild(oStyle);
  65. }
  66. }
  67. //宣伝ボタン消去
  68. function senCut3(){
  69. if( GM_getValue("senden3")=="on"){
  70. var oStyle = document.createElement('style');
  71. oStyle.setAttribute('type','text/css');
  72. var css = '#watch_title_box .niconikoukoku{display:none!important;}';
  73. oStyle.innerHTML = css;
  74. document.getElementsByTagName('head')[0].appendChild(oStyle);
  75. }
  76. }
  77. //フッター消去
  78. function footcut(){
  79. if( GM_getValue("footer_off")=="on"){
  80. var oStyle = document.createElement('style');
  81. oStyle.setAttribute('type','text/css');
  82. var css = '#page_footer,#body_footer_wrap{display:none!important;}#watch_tab_box{border-bottom:0!important;box-shadow:none!important;}';
  83. oStyle.innerHTML = css;
  84. document.getElementsByTagName('head')[0].appendChild(oStyle);
  85.  
  86. if(window.parent.location.href.slice(0,35)=="http://live.nicovideo.jp/watch/nsen"){
  87. var pstyle = document.createElement('style');
  88. pstyle.setAttribute('type','text/css');
  89. var css2 = '#utility_link,#page_footer,#body_footer_wrap{display:none!important;}';
  90. pstyle.innerHTML = css2;
  91. document.getElementsByTagName('head')[0].appendChild(pstyle);
  92. }
  93. }
  94. }
  95. //ヘッダー開閉式に
  96. function headcut(){
  97. if( GM_getValue("head_off")=="on"){
  98.  
  99. var headbar = document.createElement("div");
  100. headbar.id = "headbar";
  101. document.body.appendChild(headbar);
  102.  
  103. var hedda = document.getElementById("siteHeader");
  104.  
  105. if(GM_getValue("heddadisplay","")=="none"){
  106. hedda.style.display="none";
  107. };
  108. headbar.addEventListener("click",function(e){
  109. hedda.style.display =
  110. (hedda.style.display == "") ? "none" : "";
  111. GM_setValue("heddadisplay",hedda.style.display);
  112. },false);
  113.  
  114. var oStyle = document.createElement('style');
  115. oStyle.setAttribute('type','text/css');
  116. var css = 'body{padding-top:0!important;}body #content{padding-top:5px!important;}body.nofix #siteHeader{position:relative!important;z-index:99999999!important;}#headbar{background-color:#222222;position:fixed;top:0;font-size:0px;display:block;width:100%;height:5px;z-index:999999999;cursor:pointer;margin-left:0!important;}#content{background-color:#000000!important;}';
  117. oStyle.innerHTML = css;
  118. document.getElementsByTagName('head')[0].appendChild(oStyle);
  119. }
  120. }
  121. //市場消去
  122. function ichibaCut(){
  123. if( GM_getValue("ichiba_off")=="on"){
  124. var oStyle = document.createElement('style');
  125. oStyle.setAttribute('type','text/css');
  126. var css = '#advertisement_box{display:none!important;}div#watch_tab_box{background:transparent!important;}';
  127. oStyle.innerHTML = css;
  128. document.getElementsByTagName('head')[0].appendChild(oStyle);
  129. }
  130. }
  131. //ザッピングを消去
  132. function zappingCut(){
  133. if( GM_getValue("zapping_off")=="on"){
  134. var oStyle = document.createElement('style');
  135. oStyle.setAttribute('type','text/css');
  136. var css = '#watch_zapping_box{display:none!important;}';
  137. oStyle.innerHTML = css;
  138. document.getElementsByTagName('head')[0].appendChild(oStyle);
  139.  
  140. if(window.parent.location.href.slice(0,35)=="http://live.nicovideo.jp/watch/nsen"){
  141. var pstyle = document.createElement('style');
  142. pstyle.setAttribute('type','text/css');
  143. var css2 = '{display:none!important;}';
  144. pstyle.innerHTML = css2;
  145. document.getElementsByTagName('head')[0].appendChild(pstyle);
  146. }
  147. }
  148. }
  149. //使い方・共有等を消去
  150. function helpCut(){
  151. if( GM_getValue("help_off")=="on"){
  152. var oStyle = document.createElement('style');
  153. oStyle.setAttribute('type','text/css');
  154. var css = '#watch_player_bottom_box{display:none!important;}';
  155. oStyle.innerHTML = css;
  156. document.getElementsByTagName('head')[0].appendChild(oStyle);
  157.  
  158. if(window.parent.location.href.slice(0,35)=="http://live.nicovideo.jp/watch/nsen"){
  159. var pstyle = document.createElement('style');
  160. pstyle.setAttribute('type','text/css');
  161. var css2 = '#player_btm{display:none!important;}div#reqBoxRule{display:none!important;}#mylistArea{margin:0!important;padding:0!important;}';
  162. pstyle.innerHTML = css2;
  163. document.getElementsByTagName('head')[0].appendChild(pstyle);
  164. }
  165. }
  166. }
  167. //ロゴ・検索ボックス消去
  168. function logoCut(){
  169. if( GM_getValue("logo_off")=="on"){
  170. var oStyle = document.createElement('style');
  171. oStyle.setAttribute('type','text/css');
  172. var css = '#page_header{display:none!important;}#page_cover{margin-top:0px!important;}';
  173. oStyle.innerHTML = css;
  174. document.getElementsByTagName('head')[0].appendChild(oStyle);
  175.  
  176. if(window.parent.location.href.slice(0,35)=="http://live.nicovideo.jp/watch/nsen"){
  177. var pstyle = document.createElement('style');
  178. pstyle.setAttribute('type','text/css');
  179. var css2 = 'div.headerInner{display:none!important;}div#header{margin-top:20px!important;}';
  180. pstyle.innerHTML = css2;
  181. document.getElementsByTagName('head')[0].appendChild(pstyle);
  182. }
  183. }
  184. }
  185. //ページ左右余白リンク消去
  186. function dellink(){
  187. if( GM_getValue("link_off")=="on"){
  188. if(window.parent.location.href.slice(0,35)!="http://live.nicovideo.jp/watch/nsen"){
  189. var divleft=document.createElement("div");
  190. var divright=document.createElement("div");
  191. divleft.id="divleft";
  192. divright.id="divright";
  193. document.body.appendChild(divleft);
  194. document.body.appendChild(divright);
  195.  
  196. var divwidth=parseInt( (document.body.clientWidth-960)/2 +1 );
  197. divleft.style.width=divwidth+"px";
  198. divright.style.width=divwidth+"px";
  199. var pagewidth=parseInt( (document.body.clientWidth-960)/2 +1 );
  200. document.getElementById("prefDiv").style.right=pagewidth+"px";
  201.  
  202. var oStyle = document.createElement('style');
  203. oStyle.setAttribute('type','text/css');
  204. 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:99999;}#siteHeader #siteHeaderInner{width:984px!important;}';
  205. oStyle.innerHTML = css;
  206. document.getElementsByTagName('head')[0].appendChild(oStyle);
  207.  
  208.  
  209. window.onresize = function() {
  210. var divwidth=parseInt( (document.body.clientWidth-960)/2 +1 );
  211. divleft.style.width=divwidth+"px";
  212. divright.style.width=divwidth+"px";
  213. var pagewidth=parseInt( (document.body.clientWidth-960)/2 +1 );
  214. document.getElementById("prefDiv").style.right=pagewidth+"px";
  215. }
  216.  
  217. }
  218. }
  219. }
  220. //上のニュース消去
  221. function delnews(){
  222. if( GM_getValue("delnews")=="on"){
  223.  
  224. var divdelnews=document.createElement("div");
  225. divdelnews.id="divdelnews";
  226. document.body.appendChild(divdelnews);
  227. document.getElementById("slider_container").appendChild(divdelnews);
  228.  
  229. var oStyle = document.createElement('style');
  230. oStyle.setAttribute('type','text/css');
  231. var css = '#divdelnews{background-color:#F4F4F4;z-index:9999999;width:100%;height:60px;position:absolute;top:7px;}.JS_PLAYER_FULL #divdelnews{z-index:-100;background-color:#222222;}';
  232. oStyle.innerHTML = css;
  233. document.getElementsByTagName('head')[0].appendChild(oStyle);
  234.  
  235. }
  236. }
  237.  
  238.  
  239. function labelElement(str,che){
  240. var k = document.createElement("label");
  241. k.innerHTML = str;
  242. k.style.cursor = "hand";
  243. k.setAttribute("for",che);
  244. k.style.fontSize = "12px";
  245. return k;
  246. }
  247.  
  248. function interface_kidoku(){
  249. var prefDiv = document.createElement("div");
  250. prefDiv.style.width = "300px";
  251. prefDiv.style.height = "240px";
  252. prefDiv.style.overflowY = "scroll";
  253. prefDiv.innerHTML = "GinnamaWatchカスタマイズ設定" + "<br>";
  254. prefDiv.style.backgroundColor = "#ccccff";
  255. prefDiv.style.color = "black";
  256. prefDiv.style.border = "1px solid #888";
  257. prefDiv.style.position = "fixed";
  258. prefDiv.style.bottom = "0px";
  259. prefDiv.style.right = "0px";
  260. prefDiv.style.textAlign = 'left';
  261. prefDiv.style.margin = "0 0 0 0";
  262. prefDiv.style.zIndex = 999;
  263. prefDiv.style.display =
  264. (GM_getValue("prefDisplay") == "none") ? "none" : "";
  265. prefDiv.id = "prefDiv";
  266. document.body.appendChild(prefDiv);
  267.  
  268. var tojiru=document.createElement("div");
  269. tojiru.innerHTML = "閉じる";
  270. tojiru.style.position = "absolute";
  271. tojiru.style.top = "0px";
  272. tojiru.style.right = "5px";
  273. tojiru.style.color="#00BFFF";
  274. tojiru.style.cursor = "pointer";
  275. tojiru.id="tojiru";
  276.  
  277.  
  278. var linkwalloff = document.createElement("input");
  279. linkwalloff.name = "walloff";
  280. linkwalloff.caption = "ウォール消去";
  281. var linkSen2 = document.createElement("input");
  282. linkSen2.name = "senden2";
  283. linkSen2.caption = "Flash上以外の広告を消去";
  284. var linkichiba = document.createElement("input");
  285. linkichiba.name = "ichiba_off";
  286. linkichiba.caption = "市場消去";
  287. var linksencut = document.createElement("input");
  288. linksencut.name = "senden3";
  289. linksencut.caption = "宣伝ボタン消去";
  290. var linklist = document.createElement("input");
  291. linklist.name = "zapping_off";
  292. linklist.caption = "ザッピングを消去";
  293. var linkfootcut = document.createElement("input");
  294. linkfootcut.name = "footer_off";
  295. linkfootcut.caption = "フッター消去";
  296. var linkhelp = document.createElement("input");
  297. linkhelp.name = "help_off";
  298. linkhelp.caption = "使い方・共有等を消去";
  299. var linklogocut = document.createElement("input");
  300. linklogocut.name = "logo_off";
  301. linklogocut.caption = "ロゴ・検索ボックス消去";
  302. var linkdellink = document.createElement("input");
  303. linkdellink.name = "link_off";
  304. linkdellink.caption = "ページ左右余白リンクを消去";
  305. var linkheadcut = document.createElement("input");
  306. linkheadcut.name = "head_off";
  307. linkheadcut.caption = "ヘッダーを開閉式に";
  308. var linkdelnews = document.createElement("input");
  309. linkdelnews.name = "delnews";
  310. linkdelnews.caption = "上のニュース消去";
  311.  
  312. var form = document.createElement("form");
  313.  
  314. var links =
  315. [linkSen2,linkichiba,linkfootcut,linklist,linkhelp,linkdellink,linklogocut,linkheadcut,linkwalloff,linksencut,linkdelnews];
  316.  
  317. for (var i=0;i<links.length;i++){
  318. links[i].type = "checkbox";
  319. links[i].defaultValue = "off";
  320. }
  321.  
  322. for (var i=0;i<links.length;i++){
  323. if (!GM_getValue(links[i].name)) {
  324. GM_setValue(links[i].name, links[i].defaultValue);
  325. }
  326. links[i].id = links[i].name;
  327. links[i].checked = (GM_getValue(links[i].name) != "on") ? false : true;
  328. links[i].addEventListener("click", function(e){
  329. GM_setValue(this.name, (GM_getValue(this.name) != "on") ? "on" : "off");
  330. }, true);
  331. }
  332.  
  333. //登録
  334. form.appendChild(tojiru);
  335. form.appendChild(document.createElement("br"));
  336. form.appendChild(linkSen2);
  337. form.appendChild(labelElement(linkSen2.caption, linkSen2.id));
  338. form.appendChild(document.createElement("br"));
  339. form.appendChild(linksencut);
  340. form.appendChild(labelElement(linksencut.caption, linksencut.id));
  341. form.appendChild(document.createElement("br"));
  342. form.appendChild(linkwalloff);
  343. form.appendChild(labelElement(linkwalloff.caption, linkwalloff.id));
  344. form.appendChild(document.createElement("br"));
  345. form.appendChild(linkheadcut);
  346. form.appendChild(labelElement(linkheadcut.caption, linkheadcut.id));
  347. form.appendChild(document.createElement("br"));
  348. form.appendChild(linkfootcut);
  349. form.appendChild(labelElement(linkfootcut.caption, linkfootcut.id));
  350. form.appendChild(document.createElement("br"));
  351. form.appendChild(linklist);
  352. form.appendChild(labelElement(linklist.caption, linklist.id));
  353. form.appendChild(document.createElement("br"));
  354. form.appendChild(linkhelp);
  355. form.appendChild(labelElement(linkhelp.caption, linkhelp.id));
  356. form.appendChild(document.createElement("br"));
  357. form.appendChild(linkichiba);
  358. form.appendChild(labelElement(linkichiba.caption, linkichiba.id));
  359. form.appendChild(document.createElement("br"));
  360. form.appendChild(linklogocut);
  361. form.appendChild(labelElement(linklogocut.caption, linklogocut.id));
  362. form.appendChild(document.createElement("hr"));
  363. form.appendChild(linkdellink);
  364. form.appendChild(labelElement(linkdellink.caption, linkdellink.id));
  365. form.appendChild(document.createElement("br"));
  366. form.appendChild(linkdelnews);
  367. form.appendChild(labelElement(linkdelnews.caption, linkdelnews.id));
  368.  
  369.  
  370. prefDiv.appendChild(form);
  371.  
  372. var prefSw = document.createElement("span");
  373. prefSw.innerHTML = "カスタマイズ設定";
  374. prefSw.id = "qnama";
  375. prefSw.addEventListener("click",function(e){
  376. prefDiv.style.display =
  377. (prefDiv.style.display == "") ? "none" : "";
  378. GM_setValue("prefDisplay",prefDiv.style.display);
  379. },false);
  380. document.getElementById("siteHeaderRightMenuContainer").appendChild(prefSw);
  381.  
  382. tojiru.addEventListener("click",function(e){
  383. prefDiv.style.display =
  384. (prefDiv.style.display == "") ? "none" : "";
  385. GM_setValue("prefDisplay",prefDiv.style.display);
  386. },false);
  387.  
  388.  
  389. var oStyle = document.createElement('style');
  390. oStyle.setAttribute('type','text/css');
  391. var css = '#siteHeader #siteHeaderInner{width:85%!important;}#qnama{margin-left:17px;color:#000000!important;cursor:pointer;}#prefDiv hr{margin:5px 0;border-color:#333333;}#utility_link{display:none!important;}.JS_PLAYER_MIDDLE .slider_container,.JS_PLAYER_NORMAL .slider_container{padding: 7px 0!important;}';
  392. oStyle.innerHTML = css;
  393. document.getElementsByTagName('head')[0].appendChild(oStyle);
  394.  
  395. }
  396.  
  397. interface_kidoku();
  398. senCut2();
  399. senCut3();
  400. zappingCut();
  401. footcut();
  402. ichibaCut();
  403. helpCut();
  404. logoCut();
  405. headcut();
  406. dellink();
  407. walloff();
  408. delnews();
  409.  
  410. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址