// ==UserScript==
// @name niconico assist
// @namespace http://bmky.net/diary/log/1566.html
// @include http://www.nicovideo.jp/watch/*
// @version 1.2
// ==/UserScript==
//wrapper を使っているなら true
var flvplayer_wrapper = true;
//フルスクリーン拡大用倍率。 2.2 は 1280*1024 用
var fullScreenRate = 2.3;
//市場を表示したくないなら true
var hidden_ichiba = true;
( function( ) {
var container_width = 952; //flvplayer の幅
var container_height = 540;//flvplayer の高さ
var niwa_height = 66; //ニワニュースの高さ
//市場を自動で読み込ませない
if( ichiba_bootstrap )
window.removeEventListener( "load", ichiba_bootstrap, false );
//F5キャンセラーキャンセラー
keyPRESS = function( ){ };
var link = document.createElement( "link" );
link.rel = "stylesheet";
link.href = 'data:text/css;abbr, #PAGEHEADER, #PAGEFOOTER, #WATCHFOOTER > p:first-child /* 使い方等 */, *[class^="ad"] /* 広告の類 */, td > strong /* iframeとかブログ貼り付けとかの項目名 */, .tool_bg_L /* コメント・マイリストの画像ボタン */, td[width="320"] > table > tbody > tr:first-child + tr + tr /* ブログ投稿 */, td[width="640"] > p:first-child /* smilevideoアイコン */, .mb16p4 > p{ display : none !important; }* { background-image : none !important; }.ichiba_frm {width : auto !important;border : 0 !important;}#WATCHFOOTER { width : auto !important; }table, td, th {width : auto !important;display : block;}#WATCHHEADER {display : none; /* 初期状態では動画情報を隠す */width : auto !important;height : auto !important;border-left: 1px solid #666;}body {padding-left : 8px !important;width : auto !important;overflow-x : hidden !important;}.toolButton {position : absolute;display : block;height : 48px;width : 8px;left : 0;padding : 0;}.info {top : 0;background-color : #fdd;}.full {top : 48px;background-color : #dfd;}.reload {bottom : 0;background-color : #ddf;}'
link.type = "text/css";
document.getElementsByTagName( "head" )[ 0 ].appendChild( link );
if( hidden_ichiba ) {
var link = document.createElement( "link" );
link.rel = "stylesheet";
link.href = 'data:text/css;abbr, #WATCHFOOTER > div { display : none !important; }'
link.type = "text/css";
document.getElementsByTagName( "head" )[ 0 ].appendChild( link );
}
//動画情報表示ボタン
var infoButton = document.createElement( "input" );
document.body.appendChild( infoButton );
infoButton.type = "button";
infoButton.className = "info toolButton";
infoButton.onmousedown = function( ) {
var flv = $( "flvplayer_container" );
if( flv.style.visibility == "hidden" ) {
flv.style.visibility = "visible";
flv.style.height = container_height + "px";
$( "WATCHHEADER" ).style.display = "none";
$( "WATCHFOOTER" ).style.display = "none";
}
else {
flv.style.visibility = "hidden";
flv.style.height = "0px";
$( "WATCHHEADER" ).style.display = "block";
$( "WATCHFOOTER" ).style.display = "block";
}
}
//フルスクリーンボタン
var fullButton = document.createElement( "input" );
document.body.appendChild( fullButton );
fullButton.type = "button";
fullButton.className = "full toolButton";
fullButton.onmousedown = function( ) {
var p = $( "flvplayer" );
var c = $( "flvplayer_container" );
p.SetVariable( 'Stage.scaleMode', "showAll" );
if( fullButton.mode == "full" ) {
fullButton.mode = "normal";
var r = 1;
if( !flvplayer_wrapper )
c.style.marginTop = "0px";
}
else {
fullButton.mode = "full";
var r = fullScreenRate;
if( !flvplayer_wrapper )
c.style.marginTop = "-" + ( niwa_height * r ) + "px";
}
p.style.width = c.style.width = container_width * r;
p.style.height = c.style.height = container_height * r;
}
//リロードボタン
var reloadButton = document.createElement( "input" );
document.body.appendChild( reloadButton );
reloadButton.type = "button";
reloadButton.className = "reload toolButton";
reloadButton.onmousedown = function( ) {
document.location.href = document.location.href;
}
//市場表示ボタン
var ichiba = $( "ichiba_placeholder" ).parentNode;
var ichibaButton = document.createElement( "button" );
ichiba.appendChild( ichibaButton );
ichibaButton.innerHTML = "ニコニコ市場を表示";
ichibaButton.className = "ichibaButton";
ichibaButton.onmousedown = function( ) {
ichiba_bootstrap( );
}
} )( );