/* @title nicoLivew
* @description ニコニコ生放送のプレイヤーだけ抜き出したりとかするやつ
* @description http://ch.nicovideo.jp/star/blomaga/ar303976
* @description ギッタァブでも管理してます https://github.com/uzuky/nicoLivew
* @license MIT License
*/
javascript:!function() {
var loc = document.location.href,
div = document.createElement('div'),
day = 'v20180219',
ver = '' + day + '';
switch (true) {
//いつもの放送ページの処理
case /live\.nicovideo\.jp\/watch/.test(loc): {
//ここ仕様変更に弱そう
var url = document.querySelector('meta[property="al:web:url"]');
//放送IDを取得
liveId = url.outerHTML.replace(/.+?watch\/(lv\d+).*/, '$1');
delButton = 'var f = "flvplayer_container",flv = document.getElementById(f);flv.parentNode.removeChild(flv);';
//放送主かどうか
//ログインしてるユーザーIDを取得
var myUserIdSource = document.getElementById('siteHeaderNotification');
if (!myUserIdSource) {
var myUserId = '0';
} else {
var myUserId = myUserIdSource.outerHTML.replace(/[\s\S]+data\-nico\-userid="(\d+)"[\s\S]*/, '$1');
}
//放送主のユーザーIDを取得(表示がない放送は0)
var liveUserIdSource = document.querySelector('.nicopedia_nushi');
if (!liveUserIdSource) {
var liveUserId = 0;
} else {
var liveUserId = liveUserIdSource.outerHTML.replace(/[\s\S]+nicovideo.jp\/user\/(\d+)[\s\S]+/, '$1');
}
//ログインしてるユーザーIDと放送主のユーザーIDを比較
console.log(myUserIdSource.outerHTML);
if (myUserId != liveUserId) {
var nushi = 'N';
} else {
var nushi = 'Y';
}
break;
//新しい放送ページ(?)の処理
// こんなものはない
// } case /live2\.nicovideo\.jp\/watch/.test(loc): {
// var liveId = loc.replace(/.+?watch\/(lv\d+).*/, '$1'),
// scripts = document.getElementsByTagName('script');
// //ソースから flash に渡すパラメータの部分を取得
// var i = 0;
// while (scripts[i] != null) {
// if (/.+flashVars.+/.test(scripts[i].outerHTML)) {
// var flashParam = scripts[i].outerHTML;
// break;
// }
// //console.log(scripts[i]);
// ++i;
// }
// if (flashParam == null) {
// alert('flashParam が取得できませんでした(◞‸◟)\nこのページのURL「' + loc + '」\n連絡先とか http://nico.ms/ar303976\nfriends.nico@uzuky');
// }
// var p = flashParam.replace(/[\s\u2028\u2029]/g,''),
// //URL のパラメータ
// swf = p.replace(/.*?swf:"(http:.+?AriesPlayer\.swf)".*/,'$1?'),
// ws0 = p.replace(/.*?"(webSocketUrl)".+?"([\w\W]+?)".*/,'&$1=$2'),
// ws = ws0.replace(/\\\//g,'/'),
// ot = p.replace(/.*?"(openTime)".+?"(\w+)".*/,'&$1=$2'),
// at = p.replace(/.*?"(audienceToken)".+?"(\w+)".*/,'&$1=$2'),
// ec = "&enableClientLog=1",
// bt = p.replace(/.*?"(beginTime)".+?"(\d+)".*/,'&$1=$2'),
// rn = p.replace(/.*?"(relatedNicoliveProgramId)".+?"(\w+)".*/,'&$1=$2'),
// bi = p.replace(/.*?"(broadcastId)".+?"(\d+)".*/,'&$1=$2'),
// pi = p.replace(/.*?"(programId)".+?"(\d+)".*/,'&$1=$2');
// var Aries = '
',
// delButton = 'var f = "playerswf",flv = document.getElementById(f);flv.parentNode.removeChild(flv);',
// nushi = 'N',
// break;
} case /live2\.nicovideo\.jp\/watch/.test(loc): {
var liveId = loc.replace(/.+?watch\/(lv\d+).*/, '$1');
delButton = '';
nushi = 'Y';
break;
//それ以外のページの処理
} default: {
var liveId = prompt('放送IDかURL', '');
if (liveId.match(/lv[0-9]+/)) {
var liveId = liveId.replace(/.+?(lv\d+).*/, '$1');
delButton = '';
nushi = 'Y';
} else {
alert('lvで始まる放送IDが入ってないよ!\n「' + liveId + '」\n連絡先とか http://nico.ms/ar303976\nfriends.nico@uzuky');
return false;
}
break;
}}
//放送主だったら追加
if (nushi == 'Y') {
var nama1 = '