// ==UserScript== // @name yahvt // @description yet another html5 video tool // @namespace gnblizz // @include http://anilinkz.tv/* // @include http://www.animeboy.org/* // @include http://www.animeboy.tv/* // @include http://www.animecenter.tv/* // @include http://www.animedreaming.tv/* // @include http://anime-exceed.com/* // @include http://www.animefreak.tv/* // @include http://www.animefushigi.co/* // @include http://www.animefushigi.com/* // @include http://www.animehere.com/* // @include http://www.animenova.org/* // @include http://www.animenova.tv/* // @include http://www.animeplus.tv/* // @include http://www.animeseason.com/* // @include http://ww1.animes-stream24.net/* // @include http://www.anime-sub.com/* // @include http://www.animetoon.eu/* // @include http://www.animetoon.org/* // @include http://www.animetoon.tv/* // @include http://www.animeultima.io/* // @include http://animewow.eu/* // @include http://www.animewow.eu/* // @include http://www.animewow.org/* // @include http://bestanimes.tv/* // @include http://www.chia-anime.tv/* // @include http://www.clipfish.de/* // @include http://dramago.com/* // @include http://www.dramago.com/* // @include http://www.dramagalaxy.eu/* // @include http://www.dramagalaxy.com/* // @include http://www.dramagalaxy.tv/* // @include http://dubbedanime.net/* // @include http://www.dubzonline.cm/* // @include http://www.dubzonline.com/* // @include http://freeanime.com/* // @include http://www.gogoanime.com/* // @include http://www.goodanime.co/* // @include http://www.goodanime.eu/* // @include http://www.goodanime.net/* // @include http://www.gooddrama.net/* // @include http://www.lovemyanime.net/* // @include http://www.theanime.tv/* // @include http://www.videozoo.me/* // @include http*embed* // @include http*gogo/* // @include http*widget/* // @include http://hdmovie168.com/* // @include http://an-yip.mangaotaku.org/* // @include http://an-boo.mangaotaku.org/* // @include http://player.arkvid.tv/* // @version 1.08 // @grant GM_xmlhttpRequest // @icon data:image/gif;base64,R0lGODlhMAAwAKECAAAAAICAgP///////yH5BAEKAAMALAAAAAAwADAAAALQnI+py+0Po5y02ouz3rz7D4biBJTmiabqyrbuC8fyHAf2jedpzuOvAAwKh6mhUfg7Hks3gHLpehptwIBTioxig0zrdStIgrslMFA8pCKp1oAZjXW6w/Mt/Nl2t8HeFl7o5QZgBagEYyawNxhUl7h4dlelFlZG+QVY6aglmIjjuKd50xla9RKI0mSCqaPJSMM0aEK4mhfbpSnTabM4WXrShtpHI6gqKvmKnCwns0tm2lOsLP3aUy08aK0zvc3d7b09Ei4+Tl5ufo6err7O3n5QAAA7 // @compatible firefox // @downloadURL none // ==/UserScript== "use strict"; var domain; try { domain = document.domain.match(/^(?:www\.)?(.*)$/)[1]; } catch(e) { domain = 'unknown'; } function sites(){ var a,i,o,e,b; //console.log('domain='+domain); switch(location.hostname.match(/([^.]+)\.\w+$/)[1]) { case 'anilinkz'://.tv allowFullscreen('#player'); break; case 'animeboy'://.org,tv allowFullscreen('div[align]', 'center'); break; case 'animecenter'://.tv allowFullscreen('#video'); break; case 'animedreaming'://.tv allowFullscreen('.videoholder'); break; case 'anime-exceed'://.com allowFullscreen('#player', (/^\/cool\//.test(location.pathname)?'':'body'),0,999); break; case 'animefreak'://.tv a=objs('.multi'); for(o of a) { e = o.getAttribute('onclick'); if(e && /loadParts\('http/.test(e)) o.onclick = function(event) { var vid_file = decodeURIComponent(this.getAttribute('onclick').match(/loadParts\('([^']+)'/)[1]); document.getElementById("player").innerHTML = ''; }; } break; case 'animefushigi'://.co,com allowFullscreen('#vidboxx', '.videoloadbg'); break; case 'animehere'://.com allowFullscreen('#playbox'); break; case 'animenova'://.org,tv case 'animeplus'://.tv case 'animetoon'://.eu,org,tv case 'animewow'://.eu,org case 'dramagalaxy'://.com,eu,tv case 'dramago'://.com case 'gooddrama'://.net allowFullscreen('#streams'); break; case 'animeseason'://.com if(obj('#series_info')) SetStyle('table a:visited{color:gray;}table a:hover{color:#FC0;}'); allowFullscreen('#video_source', 0, '#player_list A'); break; case 'anime-sub'://.com allowFullscreen('#movie-content'); break; case 'animeultima'://.io allowFullscreen('#pembed'); break; case 'bestanimes'://.tv allowFullscreen('.post'); break; case 'clipfish'://.de obj('+SCRIPT', document.body).innerHTML = 'checkMobile=function(){isMobile=true;}'; break; case 'freeanime'://.com obj('+SCRIPT', document.body).innerHTML = '$(window).unbind();\n$("#header").css("background-attachment","scroll")'; allowFullscreen('.z-video', 0, 'ul.z-tabs-nav LI', 999); break; case 'dubzonline'://.cm,com case 'theanime'://.tv case 'goodanime'://.co,eu,net case 'videozoo'://.me allowFullscreen('#content'); return(location.pathname == '/embed.php'); case 'lovemyanime'://.net allowFullscreen('.player-area'); break; case 'animes-stream24'://.net allowFullscreen('#main'); break; case 'gogoanime'://.com return location.pathname=='/flowplayer/' || allowFullscreen('#content'); //case 'chia-anime':return !top; // ok //case 'dubbedanime':break; // ok case 'arkvid': return domain=='player.arkvid.tv'; case 'mangaotaku': // animeboy case 'hdmovie168': // veuue.se (koreandrama.eu) return 1; default: return(/(embed\b|\/gogo\/|\/widget\/)/.test(document.URL)); } function allowFullscreen(selTop, selFrame, mirrors, delay) { if(delay) window.setTimeout( function() { allowFullscreen(selTop, selFrame, mirrors); }, delay); else { var a,i; if(window.self==window.top) { if(mirrors) { a = document.querySelectorAll(mirrors); for(i of a) { i.addEventListener('click', function() { window.setTimeout( function() { document.querySelector(selTop+' IFRAME').setAttribute('allowfullscreen', 'true'); }, 99); }); } } a = document.querySelectorAll(selTop+' IFRAME'); if(!a.length)console.log('couldn\'t apply fullscreen attribute because '+selTop+' IFRAME not found in '+document.URL); for(i of a) { i.setAttribute('allowfullscreen', 'true'); } } else if(selFrame) { a = document.querySelectorAll(selFrame+' IFRAME'); for(i of a) { i.setAttribute('allowfullscreen', 'true'); } } } }} //requires about:config full-screen-api.allow-trusted-requests-only=false function SetFullScreenMode() { var v = obj('VIDEO'); // () try{ v.mozRequestFullScreen(); // v.requestFullScreen || v.mozRequestFullScreen || v.webkitRequestFullScreen; //if(!document.mozFullScreenElement) console.info('To allow full screen mode, you may want to set full-screen-api.allow-trusted-requests-only to false in about:config.'); }catch(e){} } function EndFullScreenMode() { try{ if(document.mozFullScreenElement) { document.mozCancelFullScreen(); return true; } }catch(e){} return false; } function NoScriptClickBugHandler(event) { var v = event.currentTarget; if(v.paused) v.play(); else v.pause(); } function findVideoFiles() { var v = [], s, m, a, i, p; a = obj('VIDEO', document.body); if(a) {//usually doesn't exist yet if(m = a.getAttribute('src')) v.push(m); a = objs('SOURCE', a); for(i of a) { if(m = i.getAttribute('src')) v.push(m); } } a = objs('SCRIPT', (domain=='videozoo.me' ? document.documentElement : document.body)); for(i of a) { if(s=getScript(i)) { find(/"(http:\/\/[^"]+\.(?:mp4|flv)\b[^"]*)"/gi); find(/"(.+\.php\b.+\.(?:mp4|flv))"/gi); find(/"([^"]+\bpicasa\.php\b[^"]+)"/gi); find(/"(https\:\/\/[^"]*\.google(?:video\.com\/videoplayback|usercontent.com\/)[^"]+)"/gi); } } if(/trollvid\.net$/i.test(domain)) {//Is this of any use today? for(i of a) { s = i.innerHTML; m = s.match(/['"](http.+?data.*?file.*?)['"]/i); if(m) v.push(m[1]); } a = objs('SCRIPT', document.head); for(i of a) { m = i.innerHTML.match(/unescape\(atob\('(.+?)'/); if(m) { m = unescape(atob(m[1])); if(/\.(mp4|flv)/i.test(m)) v.push(m); } } } else if('videobam.com' == domain) {//Is this of any use today? for(i of a) { s = i.innerHTML; m = s.match(/['"](http:\\\/\\\/[^'"]+\.(?:mp4|flv)\b[^'"]*)['"]/i); if(m) v.push(m[1].replace(/\\\//g,'/')); } } try {// even if it looks wierd... m = document.querySelector('#flowplayer+script').innerHTML.replace(/\s+/g, ' ').match(/\/\* playlist\: \[ \{ url\: '(.*)'/)[1]; if(!/\<|\>/.test(m)) { console.log('html5_path in comment found.'); v.push(m); } } catch(e){} try {// animeboy v.push(unescape(obj('NOSCRIPT').innerHTML.match(/
'; autoplay = true; obj('BUTTON').onclick = function() { insertVideo(); } } else { insertVideo(); } } else { if(/^video(?:wing|zoo).me$/.test(domain) && !/\bnoflash\b/i.test(location.search)) { console.log('redirecting to location + noflash'); location.search = location.search ? location.search+'&noflash' : '?noflash'; } var as = objs('SCRIPT'), i; for(i of as) { if(/_url\s*=\s*\"video not found\"/i.test(i.innerHTML)) { document.body.innerHTML = 'Video not found.
'; break; } } } } } catch(e) { console.log('yahvt: ' + e); } function insertVideo() { var nvf = NextPart(document.URL), txt = ''; if(obj('#flowplayer')) txt += ''; else if(obj('#player')) txt += ''; document.body.innerHTML = txt; console.log('starting ' + domain + (nvf ? (' video part '+nvf[2]) : ' video')); var v = obj('VIDEO'); v.onloadedmetadata = function(event) { StopInfo(); //console.log('now playing: '+v.currentSrc); if(remembered('fullscreen', true)=='yes') SetFullScreenMode(); v.focus(); }; v.onkeypress = function(event) { if(event.altKey || event.metaKey || event.ctrlKey) return; var key = event.key; if(key.length == 1) { switch(key.toUpperCase()) { case 'A':// toggle stretch mode v.style.objectFit = v.style.objectFit ? '' : 'fill'; v.parentNode.style.height = '100%'; break; case 'H':// toggle LMB behavior ((altClick = !altClick) ? v.addEventListener : v.removeEventListener).call(v, 'click', NoScriptClickBugHandler, false); break; case 'I':// show some info ShowSomeInfo(true); break; case 'F':// toggle full screen if(!EndFullScreenMode()) SetFullScreenMode(); break; case 'Z':// toggle zoom mode if(v.parentNode.style.width) { v.parentNode.style.width = ''; v.parentNode.style.margin = ''; } else if(v.videoWidth) { v.parentNode.style.width = v.videoWidth+'px'; v.parentNode.style.minHeight = v.videoHeight+'px'; v.parentNode.style.margin = '0px auto'; } break; default: return; } } else if(!event.shiftKey) { switch(key) { case 'ArrowRight': v.currentTime += v.paused ? .5 : 5; break; case 'ArrowLeft': v.currentTime -= v.paused ? .5 : 5; break; default: return; } } else return; event.preventDefault(); event.stopImmediatePropagation(); }; v.lastChild.onerror = function(event) { StopInfo(); if(!/\bnoflash\b/.test(location.search)) { Remember('autoplay'); location.search = location.search ? location.search+'&noflash' : '?noflash'; throw 'redirecting to location + noflash'; } console.log('video load error'); if(nvf && nvf[2]>1) document.body.innerHTML = '