// ==UserScript==
// @name CustomGinzaWatch
// @include http://www.nicovideo.jp/watch/*
// @version 4.0.52
// @namespace http://d.hatena.ne.jp/wfwjfow/
// @description ニコニコ動画:GINZAの動画プレイヤーのUIをお手軽カスタマイズ。
// ==/UserScript==
/*
■参考スクリプト
NicoRankingKidokuDelete → http://userscripts.org/scripts/show/45927
*/
var main = 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 targetself(){
if( GM_getValue("targetself")=="on"){
function onajitab(){
$(".videoDescription a[href*='http://www.nicovideo.jp/mylist/'],#videoHeaderTagList li.videoHeaderTag a.videoHeaderTagLink").click( function() {
$("body").css("display","none")
$("#videoExplorerBackContainer").click();
window.location.href=this.href;
});
}
onajitab();
setInterval(function(){onajitab()},1000);
$("head").append('<style type="text/css"></style>');
}
}
//タグクリック等時に別タブで開く
function targetblank(){
if( GM_getValue("targetblank")=="on"){
function betsutab(){
$(".videoDescription a[href*='http://www.nicovideo.jp/mylist/'],#videoHeaderTagList li.videoHeaderTag a.videoHeaderTagLink").click( function() {
window.open(this.href,'blank');
setTimeout(function(){
$("#videoExplorerBackContainer").click();
},200);
});
}
betsutab();
setInterval(function(){betsutab()},1000);
$("head").append('<style type="text/css"></style>');
}
}
//コメント欄のソーシャルボタンを消す
function delkomesocial(){
if( GM_getValue("delkomesocial")=="on"){
$("head").append('<style type="text/css">#playerTabContainer .socialButtons{display:none!important;}</style>');
}
}
//もっと見るを3列に
function mottoright3line(){
if( GM_getValue("mottoright3line")=="on"){
$("head").append('<style type="text/css"></style>');
}
}
//もっと見るで簡易大百科記事を消す
function delminidic(){
if( GM_getValue("delminidic")=="on"){
$("head").append('<style type="text/css">#videoExplorer div.tagRelatedNicopedia{display:none!important;}</style>');
}
}
//もっと見るでユーザー広告を消す
function deluserad(){
if( GM_getValue("deluserad")=="on"){
$("head").append('<style type="text/css">#videoExplorer div.uadTagRelatedContainer{display:none!important;}</style>');
}
}
//ブラックモード
function backblack(){
if( GM_getValue("backblack")=="on"){
$("head").append('<style type="text/css">body{background-color:#393939!important;}#content,#videoHeader,#outline{background:transparent!important;color:#ccc!important;}*{color:#ccc!important;}#ichibaMain .balloonUe * , #prefDiv * , #playerTabContainer *,#divmottoright *,#menudivmenu *{color:#000000!important;}#videoTagContainer .tagInner #videoHeaderTagList .toggleTagEdit{background-color:#000000!important;}#content #videoTagContainer .tagInner #videoHeaderTagList li.videoHeaderTag a{color:#ccc!important;}#videoStats{border:1px solid #ccc!important;}span.isNotFavoritedText{color:#000000!important;}</style>');
}
}
//下の説明文等を開閉式に
function josdestoggle(){
if( GM_getValue("josdestoggle")=="on"){
var divdata = document.createElement("a");
divdata.id="toggle10";
divdata.innerHTML="↓説明文の開閉";
document.getElementById("playerNicoplayer").appendChild(divdata);
$("#toggle10").click(function(){
$("#outline .outer .main #videoInfo").toggle();
GM_setValue("josdesDisplay",$("#outline .outer .main #videoInfo").css("display"));
});
if(GM_getValue("josdesDisplay")=="none"){
$("#outline .outer .main #videoInfo").hide();
}
$("head").append('<style type="text/css">#toggle10{float:right!important;margin-right:15px;cursor:pointer;}</style>');
}
}
//着うたとかを1行に
function uta1line(){
if( GM_getValue("uta1line")=="on"){
setTimeout(function(){
var divuta = document.createElement("div");
divuta.id="divuta";
document.getElementById("ichibaMain").appendChild(divuta);
$("#divuta").insertBefore("#ichibaMain .ichiba_mainitem:first");
$("#ichiba_mainpiaitem").appendTo("#divuta");
$(".mobile").parent().parent().appendTo("#divuta");
},2000);
$("head").append('<style type="text/css">#divuta .ichiba_mainitem{width:100%!important;height:auto!important;}#divuta .ichiba_mainitem dd{float:left!important;margin:0 0 0 10px!important;line-height:20px!important;}#divuta .ichiba_mainitem dt{display:none!important;}#divuta dd.mobile a{width:100px!important;}#divuta dd.mobile a.kashi{background-position:-41px -285px!important;background-size:auto auto!important;}#divuta dd.mobile a.uta{background-position:-41px -70px!important;background-size:auto auto!important;}#divuta dd.mobile a.kisekae{background-position:-40px -250px!important;background-size:auto auto!important;}#divuta dd.mobile a.utafull{background-position:-40px -538px!important;background-size:auto auto!important;}#divuta dd.mobile a.melo{background-position:-40px -33px!important;background-size:auto auto!important;}#divuta dd.mobile a.decome{background-position:-39px -106px!important;background-size:auto auto!important;}#divuta .thumbnail,#divuta .action,#divuta .goIchiba{margin:0!important;}#divuta #ichiba_mainpiaitem,#ichibaMain #divuta dl.pia{width:100%!important;margin:0!important;}#ichibaMain #divuta dl{height:auto!important;}#ichibaMain #divuta dl.pia dd.pia *{font-size:20px!important;}#ichibaMain #divuta dl.pia dd.ichiba{float:left!important;margin-left:10px!important;}#ichibaMain #divuta dl.pia dd.pia span.eke{float:left!important;}#ichibaMain #divuta dl.pia dd.pia a{display:block!important;}#ichibaMain #divuta dl.pia dd.pia{width:auto!important;float:left!important;}</style>');
}
}
//タグを開閉式に
function tagtoggle(){
if( GM_getValue("tagtoggle")=="on"){
var divdata = document.createElement("a");
divdata.id="toggle9";
divdata.innerHTML="Tagの開閉";
document.getElementById("playerNicoplayer").appendChild(divdata);
$("#toggle9").click(function(){
$("#videoTagContainer").toggle();
GM_setValue("tagDisplay",$("#videoTagContainer").css("display"));
});
if(GM_getValue("tagDisplay")=="none"){
$("#videoTagContainer").hide();
}
$("head").append('<style type="text/css">#toggle9{float:left!important;margin-left:15px;cursor:pointer;}</style>');
}
}
//ウォールのアイコンだけを消す
function walliconoff(){
if( GM_getValue("walliconoff")=="on"){
$("head").append('<style type="text/css">#chipWallList{display:none!important;}</style>');
}
}
//検索ボックスを消去
function delsearchbox(){
if( GM_getValue("delsearchbox")=="on"){
$("head").append('<style type="text/css">#videoHeaderMenu .searchContainer{display:none!important;}</style>');
}
}
//タグのピンを常時表示
function tagpinon(){
if( GM_getValue("tagpinon")=="on"){
$("head").append('<style type="text/css">#videoTagContainer .tagInner #videoTagContainerPin{display:block!important;}</style>');
}
}
//ウォールを消す
function walloff(){
if( GM_getValue("walloff")=="on"){
$("head").append('<style type="text/css">#wallImageContainer .wallAlignmentArea , #chipWallList{display:none!important;}</style>');
}
}
//タグのピンを消す
function deltagpin(){
if( GM_getValue("deltagpin")=="on"){
$("head").append('<style type="text/css">#videoTagContainerPin{display:none!important;}</style>');
}
}
//プレイヤーのサイズを大きく
function bigwatch(){
if( GM_getValue("bigwatch")=="on" ){
$("head").append('<style type="text/css">#playerAlignmentArea.size_normal{width:99%!important;}#playerTabWrapper{float:right!important;position:relative!important;}#playerNicoplayer{float:left!important;}</style>');
$(window).on("load resize", function(){
var wh = $(window).height();
var ww = $(window).width();
var tw = $("#playerTabWrapper").width();
var ww2= Math.round(ww*0.99-tw-30)+"px";
var wh2= Math.round((ww*0.99-tw-30)*0.695)+"px";
$("#playerAlignmentArea.size_normal #playerContainer.controll_panel.oldTypeCommentInput #nicoplayerContainer,#playerAlignmentArea.size_normal #playerNicoplayer, #playerAlignmentArea.size_normal #external_nicoplayer").css({'cssText': 'width:'+ww2+'!important;height:'+wh2+'!important;'});
$("#playerContainerWrapper,#playerAlignmentArea.size_normal #playerContainer.controll_panel.oldTypeCommentInput.text_marquee,#playerAlignmentArea.size_normal #playerContainer.controll_panel.oldTypeCommentInput #playerTabWrapper").css({'cssText': 'height:'+wh2+'!important;'});
});
if( GM_getValue("komepaneltoggle_on")=="on"){
function panelcheck(){
var wh = $(window).height();
var ww = $(window).width();
var tw = $("#playerTabWrapper").width();
var tdis = $("#playerTabWrapper").css("display");
if(tdis=="none"){
tw=0;
var thide = "none"
}else{thide="block"}
var ww2= Math.round(ww*0.99-tw-30)+"px";
var wh2= Math.round((ww*0.99-tw-30)*0.695)+"px";
$("#playerAlignmentArea.size_normal #playerContainer.controll_panel.oldTypeCommentInput #nicoplayerContainer,#playerAlignmentArea.size_normal #playerNicoplayer, #playerAlignmentArea.size_normal #external_nicoplayer").css({'cssText': 'width:'+ww2+'!important;height:'+wh2+'!important;'});
$("#playerContainerWrapper,#playerAlignmentArea.size_normal #playerContainer.controll_panel.oldTypeCommentInput.text_marquee").css({'cssText': 'height:'+wh2+'!important;'});
$("#playerAlignmentArea.size_normal #playerContainer.controll_panel.oldTypeCommentInput #playerTabWrapper").css({'cssText': 'height:'+wh2+'!important;display:'+thide});
}
panelcheck();
setInterval(function(){panelcheck()},1000);
}
}
}
//パンくずリストを消去
function delbread(){
if( GM_getValue("delbread")=="on"){
$("head").append('<style type="text/css">div.ch_breadcrumb{display:none!important;}</style>');
}
if( GM_getValue("infotocomepanel_on")=="on" && GM_getValue("delbread")=="on"){
$("head").append('<style type="text/css">div.ch_breadcrumb,#videoHeaderDetail .videoDetailExpand{display:none!important;}</style>');
}
}
//ツイートボタン等を消去
function delsocial(){
if( GM_getValue("delsocial")=="on"){
$("head").append('<style type="text/css">#videoShareLinks{display:none!important;}#topVideoInfo .socialLinks{display:none!important;}</style>');
}
}
//動画詳細情報を消去
function delshosai(){
if( GM_getValue("delshosai")=="on"){
$("head").append('<style type="text/css">#bottomVideoDetailInformation,#bottomVideoDetailInformation .supplementary{display:none!important;}#topVideoInfo .hiddenInfoTabContent,#topVideoInfo .hiddenInfoTabHeader{display:none!important;}</style>');
}
}
//マイリスボタン・とりあえずマイリスボタン以外を消去
function delbuttons(){
if( GM_getValue("delbuttons")=="on"){
$("head").append('<style type="text/css">#videoMenuTopList .uadButton,#videoMenuTopList .mymemoryButton,#videoMenuTopList .videoMenuListNicoru,#videoMenuTopList .downloadButton,#videoMenuTopList .menuAward,#videoMenuTopList #speedChecker,#videoMenuTopList .userChannel{display:none!important;width:0!important;height:0!important;}#videoMenuWrapper{height:auto!important;}#videoTagContainer{min-height:48px!important;}</style>');
}
}
//ツイートボタンをヘッダーに移動
function tweetinheader(){
if( GM_getValue("tweetinheader")=="on"){
$("head").append('<style type="text/css">.twitter-share-button{margin:7px 0 0 7px!important;}.socialLinkTwitter{width:140px!important;}</style>');
$("#videoShareLinks li.socialLinkTwitter").appendTo("#siteHeaderInner ul.siteHeaderMenuList");
}
}
//コンテンツツリー消去
function ctreeCut(){
if( GM_getValue("ctree_off")=="on"){
$("head").append('<style type="text/css">.parentVideoInfo{display:none!important;}</style>');
}
}
//簡易動画説明文消去
function shortinfoCut(){
if( GM_getValue("shortinfo_off")=="on"){
$("head").append('<style type="text/css">#videoHeader div.shortVideoInfo,#videoHeader div.toggleDetailExpand{display:none!important;}</style>');
}
}
//下の動画説明文・動画情報を消去
function deljosdes(){
if( GM_getValue("deljosdes")=="on"){
$("head").append('<style type="text/css">#videoInfo{display:none!important;}#videoComment{display:none!important;}</style>');
}
}
//広告消去
function senCut2(){
if( GM_getValue("senden2")=="on"){
$("head").append('<style type="text/css">#tagRelatedBannerContainer,#tagRelatedBanner,#playerBottomAd,#pageFooterAds,#selectionFooter,#videoReviewBottomAd,#resultContainer .resultAdsWrap,#selectionSideAd,.nicoSpotAds{display:none!important;}#videoStartAds{display:none!important;}#leftPanelAdAds,#leftPanelAd{display:none!important;}.ja-jp .panel_ads_shown #playerCommentPanel.has_panel_ads .section #commentDefault.commentTable, .ja-jp .panel_ads_shown #playerCommentPanel.has_panel_ads .section #commentLog.commentTable, .ja-jp .panel_ads_shown #playerCommentPanel.has_panel_ads .section #commentNgSetting.commentTable{bottom:5px!important;}#playerTabWrapper .playerTabContent{bottom:0!important;}#playerTabContainer .playerTabAds{display:none!important;}</style>');
}
}
//コメント一覧非表示
function comeCut(){
if( GM_getValue("come_off")=="on"){
$("head").append('<style type="text/css">#playerTabWrapper{display:none!important;}</style>');
}
}
//動画上マーキー消去
function marqueeCut(){
if( GM_getValue("marquee_off")=="on"){
$("head").append('<style type="text/css">#textMarquee{display:none!important;}#playerContainerSlideArea.size_medium #playerContainer.controll_panel.oldTypeCommentInput.text_marquee,#playerContainerSlideArea.size_normal #playerContainer.controll_panel.oldTypeCommentInput.text_marquee{height:auto!important;}#playerContainerSlideArea.size_medium #playerContainer.full_with_browser.oldTypeCommentInput.text_marquee,#playerContainerSlideArea.size_normal #playerContainer.full_with_browser.oldTypeCommentInput.text_marquee{height:100%!important;}</style>');
// $("head").append('<style type="text/css">#playerContainerSlideArea.size_medium #playerContainer.controll_panel.oldTypeCommentInput.text_marquee{height:506px!important;}#playerContainerSlideArea.size_normal #playerContainer.controll_panel.oldTypeCommentInput.text_marquee{height:602px!important;}</style>');
if(GM_getValue("set8_on")=="off"){
$("head").append('<style type="text/css">#playerAlignmentArea.size_medium #playerContainer.controll_panel.oldTypeCommentInput #playerTabWrapper,#playerAlignmentArea.size_medium #playerContainer.controll_panel.oldTypeCommentInput #playerTabWrapper #playerTabContainer{height:459px!important;}#playerAlignmentArea.size_normal #playerContainer.controll_panel.oldTypeCommentInput #playerTabWrapper,#playerAlignmentArea.size_normal #playerContainer.controll_panel.oldTypeCommentInput #playerTabWrapper #playerTabContainer{height:555px!important;}#playerAlignmentArea.up_marquee.size_medium #playerContainer.controll_panel.oldTypeCommentInput #playerTabWrapper,#playerAlignmentArea.up_marquee.size_medium #playerContainer.controll_panel.oldTypeCommentInput #playerTabWrapper #playerTabContainer{height:516px!important;}#playerAlignmentArea.up_marquee.size_normal #playerContainer.controll_panel.oldTypeCommentInput #playerTabWrapper,#playerAlignmentArea.up_marquee.size_normal #playerContainer.controll_panel.oldTypeCommentInput #playerTabWrapper #playerTabContainer{height:612px!important;}#playerContainer{margin-bottom:0!important;}#playerContainerSlideArea.size_medium #playerContainer.full_with_browser.oldTypeCommentInput.text_marquee,#playerContainerSlideArea.size_normal #playerContainer.full_with_browser.oldTypeCommentInput.text_marquee,#playerAlignmentArea.size_normal #playerContainer.full_with_browser.controll_panel.oldTypeCommentInput.text_marquee{height:100%!important;}#playerAlignmentArea.size_medium #playerContainer.controll_panel.oldTypeCommentInput.text_marquee{height:468px!important;}#playerAlignmentArea.size_normal #playerContainer.controll_panel.oldTypeCommentInput.text_marquee{height:563px!important;}</style>');
/*setTimeout(function(){
$("#playerContainerSlideArea.size_medium #playerContainer.controll_panel.oldTypeCommentInput.text_marquee").css("height","488px");
$("#playerContainerSlideArea.size_normal #playerContainer.controll_panel.oldTypeCommentInput.text_marquee").css("height","573px");
},2000);*/
}
}
}
//フィードバックリンク消去
function feedbackCut(){
if( GM_getValue("feedback_off")=="on"){
$("head").append('<style type="text/css">#feedbackLink{display:none!important;}</style>');
}
}
//もっと見るにマイリスコメント?常時表示
function infoPlus(){
if( GM_getValue("infoplus")=="on"){
$("head").append('<style type="text/css">#videoExplorer .column4 .video .balloon{display:block!important;height:auto!important;min-height:46px!important;box-shadow:none!important;padding-top:5px!important;line-height:1.4em!important;top:-80px!important;left:0!important;}#videoExplorer .column4 li.video{margin-top:70px!important;}#videoExplorer .column4 li .balloon ul.videoInformation{display:block!important;}#videoExplorer .column4 li .balloon .videoInformationOuter .videoInformation li{float:none!important;}.balloon .contentInfo{display:none!important;}.balloon .uadComments{font-size:13px!important;line-height:1.2em!important;}</style>');
}
}
//レビュー消去
function reviewCut(){
if( GM_getValue("review_off")=="on"){
$("head").append('<style type="text/css">#videoReview{display:none!important;}</style>');
}
}
//レビューを開閉式に
function reviewtoggle(){
if( GM_getValue("reviewtoggle_on")=="on"){
var divdata = document.createElement("a");
divdata.id="toggle3";
divdata.innerHTML="Reviewの開閉";
document.getElementById("playerNicoplayer").appendChild(divdata);
$("#toggle3").click(function(){
$("#videoReview").toggle();
GM_setValue("reviewDisplay",$("#videoReview").css("display"));
});
if(GM_getValue("reviewDisplay")=="none"){
$("#videoReview").hide();
}
$("head").append('<style type="text/css">#toggle3{float:right!important;margin-left:15