videotabs

tabbed video sources

当前为 2015-08-06 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        videotabs
// @namespace   gnblizz
// @description tabbed video sources
// @version     1
// @include     http://www.animenova.org/*
// @include     http://www.animenova.tv/*
// @include     http://www.animeplus.tv/*
// @include     http://www.animetoon.eu/*
// @include     http://www.animetoon.tv/*
// @include     http://animewow.eu/*
// @include     http://www.animewow.eu/*
// @include     http://dramago.com/*
// @include     http://www.dramago.com/*
// @include     http://www.dramagalaxy.eu/*
// @include     http://www.dramagalaxy.com/*
// @include     http://www.gogoanime.com/*
// @include     http://www.goodanime.eu/*
// @include     http://www.goodanime.net/*
// @include     http://www.gooddrama.net/*
// @noframes
// @grant       none
// @icon        data:image/gif;base64,R0lGODlhMAAwAKECAAAAAICAgP///////yH5BAEKAAMALAAAAAAwADAAAALQnI+py+0Po5y02ouz3rz7D4biBJTmiabqyrbuC8fyHAf2jedpzuOvAAwKh6mhUfg7Hks3gHLpehptwIBTioxig0zrdStIgrslMFA8pCKp1oAZjXW6w/Mt/Nl2t8HeFl7o5QZgBagEYyawNxhUl7h4dlelFlZG+QVY6aglmIjjuKd50xla9RKI0mSCqaPJSMM0aEK4mhfbpSnTabM4WXrShtpHI6gqKvmKnCwns0tm2lOsLP3aUy08aK0zvc3d7b09Ei4+Tl5ufo6err7O3n5QAAA7
// ==/UserScript==
"use strict";
var domain = document.domain ? document.domain.match(/^(?:www\.)?(.*)$/)[1] : 'none';

(function videotabs(){
  switch(domain) {
  case 'gooddrama.net':
    MakeTabs('html,body,#body,#header,#top_block,.info_block,.note span,#eps_blocks,#downloads_heading,#comments_heading,.reply,.info_box{color:#888;background-color:#111;height:auto}table[width="790"],#eps_blocks,.right_col,.info_block .ad{opacity:.6;}.note>font>span{background-color:inherit!important;}');
    break;
  case 'dramago.com':
    MakeTabs('#menu-bar,.bar,#content,#top_block,#search-box-banner-inner,.info_block,#eps_blocks,.s_right_col #sidebar,#footer{background-color:#111;color:#aaa;border:1px solid #777}body{background-color:#444;background-blend-mode:color-burn;}.note span{background-color:#111!important;color:#aaa!important}');
    break;
  case 'dramagalaxy.eu':
  case 'dramagalaxy.com':
    MakeTabs('#content,#top_block,#search-box-banner-inner,.info_block,#eps_blocks,.s_right_col #sidebar{background-color:#121B23;color:#aaa;border:1px solid #777}img[src$="2egfcQR.png"]{display:none}');
    break;
  case 'animenova.org':
  case 'animenova.tv':
    MakeTabs('html,body,#body,#header,#comments_heading,.comment,.info_box{color:#555;background-color:#111;height:auto}br:empty,.note img{display:none;}.comment{border:0px}.right_col,table,.ad,.sc_ad,#g_promo,#upper_header{opacity:.6;}');
    break;
  case 'animeplus.tv':
    MakeTabs('html,body,#body,#header,.part,.note>span,.report_video,#comments_heading,.comment,.info_box{background-color:#000!important;color:#aaa!important;}a.report_video:hover{color:red!important;}.right_col,table,.ad,.sc_ad{opacity:.6;}#comments,.comment,#body,#streams{border:1px solid #555}');
    break;
  case 'animewow.eu':
    MakeTabs('#page,#body>.s_left_col,#body>.s_right_col,#search-box-banner-inner,#eps_blocks{color:#aaa;background-color:#111;}.vmargin,#top_block,.info_block{border:1px solid #aaa;background-color:#111;}.info_block *{color:#aaa!important}');
    break;
  case 'gogoanime.com':
    MakeTabs2('');
    break;
  case 'goodanime.eu':
  case 'goodanime.net':
    MakeTabs2('.topad,#wrapper,.premiumdll,.postcontent,td[bgcolor]{background-color:#111;color:#aaa}#header,#footer,html,body{background-color:#000;color:#aaa}a h5,td[bgcolor] *{color:inherit!important;}')
    break;
  default:
    MakeTabs('');
    break;
  }
  RemoveSomeIframes();
  if(obj('#streams')) window.setTimeout( function() { window.autoClose=-1; MHideBar(); }, 999);
})();

function obj(name, parent) {
  if(!parent) parent = document;
  var node = null;
  switch (name.charAt(0)) {
  case '#': node = parent.getElementById(name.slice(1)); break;
  case '.': node = parent.getElementsByClassName(name.slice(1))[0]; break;
  case '+': node = document.createElement(name.slice(1).toUpperCase()); if(parent != document) parent.appendChild(node); break;
  default:  node = parent.getElementsByTagName(name)[0]; break;
  }
  return node;
}

function objs(name, parent) {
  if(!parent) parent = document;
  var node = null;
  switch (name.charAt(0)) {
  case '.': node = parent.getElementsByClassName(name.slice(1)); break;
  default: node = parent.getElementsByTagName(name); break;
  }
  return node;
}

function SetStyle(style) {
  obj('+STYLE', obj('HEAD')).innerHTML = style;
}

function RemoveElement(node) { 
  if(typeof(node)=='string') node = obj(node);
  if(node) return node.parentNode.removeChild(node);
}

function domainName(href) {
  if(!href) href = document.location.href;
  var m = href.match(/\:\/\/(?:www\.|embed\.)?([^\/]+)/);
  return(m ? m[1] : 'unknown');
}

function SetCookie(name, value, min) {
  if(!min) min = 10080; // a week
  var d = new Date();
  d.setTime(min*60000+d.getTime());
  document.cookie=name+'='+value+';expires='+ d.toUTCString()+';'+'path=..';
}

function GetCookie(name) {
  var r = new RegExp(name+'=([^;]+)', '')
  var m = document.cookie.match(r);
  return(m ? m[1] : '');
}

function MakeAButton(caption, help, style, parent) {
  var b = obj('+BUTTON');
  b.setAttribute('type', 'button');
  b.innerHTML = caption;
  if(help) b.setAttribute('title', help);
  b.setAttribute('style', style);
  if(!b.style.position) b.style.position = 'absolute';
  if(!b.style.minWidth) b.style.minWidth = '25px';
  if(!parent) parent = document.body;
  parent.appendChild(b);
  return b;
}

function RemoveSomeIframes() {
  var streams = obj('#streams'), o;
  var a = objs('IFRAME'), i = a.length;
  if(i) do {
    o = a[--i];
    if(!streams.contains(o)) {
      if(o.parentNode.nodeName == 'TD')
	o = o.parentNode;
      o.parentNode.removeChild(o);
    }
  } while(i);
}

function MakeTabs(style) {
  if(obj('#player_tabs')) return true;
  var content = obj('#streams');
  if(content) {
    var va = objs('.vmargin', content), i=va.length;
    if(i) {
      var tabs = obj('+UL');
      tabs.setAttribute('id', 'player_tabs');
      do {
	var o = va[--i];
	var ifr = obj('IFRAME', o);
	if(ifr) {
	  var tab = obj('+LI'), src = ifr.getAttribute('src');
	  if(src.match(/[?&]/) == '&') ifr.setAttribute('src', src = src.replace('&', '?')); // bugfix
	  tab.innerHTML = domainName(src);
	  tab.setAttribute('id', 'player_tab_'+i);
	  tab.onclick = function() { TabSelect(this) };
	  o.setAttribute('id', 'player_data_'+i);
	  o.innerHTML = encodeURI(o.innerHTML);
	  tabs.insertBefore(tab, tabs.firstChild);
	}
      } while(i);
      obj('+LI', tabs).innerHTML = '&nbsp';
      content.insertBefore(tabs, va[0]);
      obj('+DIV', content).setAttribute('id', 'yahvtplayer');
      SetStyle('.vmargin{display:none}#player_tabs li{background-color:#393939;color:white;float:left;padding:5px 10px;display:block;cursor:pointer;}#player_tabs li:hover{color:yellow;}#player_tabs li:last-child{cursor:auto;float:unset;}#player_tabs .active_tab{background-color:#505050;}a.report_video:link{color: #0047AB;}');
      TabSelect(GetCookie('us_preferedServer'));
      Disclaimer();
      if(style) SetStyle(style);
      return true;
    }
  } // auto expand description - it's foolish to hide the last few words of a sen...[expand]
  if(obj('#brief_notes'))SetStyle('span#brief_notes,span#full_notes a[href="#"]{display:none!important;}span#full_notes{display:inline!important;}a:visited{color:red;}');
  return false;
}

//goodanime.eu
function MakeTabs2(style) {
  var streams = obj('.postcontent');
  if(streams) {
    var ifr = obj('IFRAME', streams);
    if(ifr) {
      streams.setAttribute('id', 'streams');
      var a = streams.childNodes, i=a.length;
      do {
	var o = a[--i];
	if(o.nodeType == 1 && obj('IFRAME', o))
	  o.setAttribute('class','vmargin');
      } while(i);
      return MakeTabs(style);
    }
  }
  return false;
}
  
function TabSelect(n) {
  var o, a;
  switch(typeof(n)) {
  case 'object':
    if(n.getAttribute('class')=='active_tab') return;
    //if(!window.confirm("Press a button!")) return;
    n = parseInt(n.id.slice(-1));
    break;
  case 'string':
    o = n; a = obj('#player_tabs').childNodes; n = a.length;
    while(n) if(a[--n].innerHTML == o) break;
    break;
  }
  a = o = obj('.active_tab')
  if(o) a = o.id.slice(-1);
  if(a != n) {
    if(o) o.removeAttribute('class');
    a = obj('#player_tab_'+n);
    a.setAttribute('class', 'active_tab');
    obj('#yahvtplayer').innerHTML=decodeURI(obj('#player_data_'+n).innerHTML);
    SetCookie('us_preferedServer', a.innerHTML);
  }
}

function Disclaimer() {
  var o = obj('#footer');
  if(o && o.textContent.match(/(Copyright|©)/i))
    obj('+P',o).innerHTML = 'Disclaimer: Video materials used here are the property of their respective and rightful owners.';
}

// public domain by gnblizz
// contact me with my username + '@web.de'