There are 17 previous versions of this script.
Add Syntax Highlighting (this will take a few seconds, probably freezing your browser while it works)
// ==UserScript==
// @id youtube-me-again
// @name YouTube Me Again!
// @namespace hateradio)))
// @author hateradio
// @version 3.0
// @description YouTube Me Again! automatically converts YouTube and Vimeo links into real embedded videos. It allows videos to hide, to rescale, and to change aspect ratio. This script works on NeoGAF and What.
// @homepage https://www.userscripts.org/scripts/show/60843
// @updateURL https://www.userscripts.org/scripts/source/60843.meta.js
// @icon https://dl.dropbox.com/u/14626536/userscripts/i/ytma/ytma32.png
// @icon64 https://dl.dropbox.com/u/14626536/userscripts/i/ytma/ytma64.png
// @screenshot http://i.min.us/ic9lvy.png http://i.min.us/kc9lvy.jpg
// @include http://www.neogaf.com/forum/showthread.php*
// @include http://www.neogaf.com/forum/showpost.php?p*
// @include http://www.neogaf.com/forum/newreply.php*
// @include http://www.neogaf.com/forum/editpost.php*
// @include http://www.neogaf.com/forum/private.php*
// @include http*://*what.cd/forums.php?*viewthread*
// @include http*://*what.cd/torrents.php?*
// @updated 11 Oct 2011
// ==/UserScript==
// Do not modify and re-release my script. If you would like support any site, tell me and I'll put it in the includes.
// Whitelist these sites on NoScript/NotScript/etc.
// neogaf.com, youtube.com, youtube-nocookie.com, vimeo.com, vimeocdn.com, dropbox.com
// S T O R A G E HANDLE
var strg = {
on:(function(){ try { var s = window.localStorage; if(s.getItem&&s.setItem&&s.removeItem){return true;} }catch(e){return false;} }()),
read:function(key){ return this.on ? JSON.parse(window.localStorage.getItem(key)) : false; },
save:function(key,dat){ return this.on ? !window.localStorage.setItem(key, JSON.stringify(dat)) : false; },
wipe:function(key){ return this.on ? !window.localStorage.removeItem(key) : false; },
zero:function(o){ var k; for(k in o){ if(o.hasOwnProperty(k)){ return false; } } return true; }
};
// U P D A T E HANDLE
var update = {
name:'YouTube Me Again!',
version:3000,
key:'ujs_YTMA_UPDT_HR',
callback:'ytmaupdater',
page:'https://www.userscripts.org/scripts/show/60843',
urij:'https://dl.dropbox.com/u/14626536/userscripts/updt/ytma/ytma.json',
uric:'https://dl.dropbox.com/u/14626536/userscripts/updt/ytma/ytma.js', // If you get "Failed to load source for:" in Firebug, allow dropbox.com to run scripts.
checkchrome:true,
interval:5,
day:(new Date()).getTime(),
gmu:(function(){ try { if (GM_updatingEnabled===true) { return true; } } catch(e) {} }()),
time:function(){return new Date(this.day + (1000*60*60*24*this.interval)).getTime();},
loc:document.head || document.getElementsByTagName('head')[0],
css:function(t){
if(!this.style){this.style = document.createElement('style'); this.style.type = 'text/css'; this.loc.appendChild(this.style);} this.style.appendChild(document.createTextNode(t+'\n'));
},
js:function(t){
var j = document.createElement('script'); j.type = 'text/javascript'; /^https?\:\/\//i.test(t) ? j.src = t : j.textContent = t; this.loc.appendChild(j);
},
notification:function(j){
if(j){if(this.version < j.version){window.localStorage.setItem(this.key,JSON.stringify({date:this.time(),version:j.version}));}else{return true;}}
var a = document.createElement('a'); a.href = this.page; a.id = 'userscriptupdater'; a.title = 'Update now.'; a.textContent = 'An update for '+this.name+' is available.'; document.body.appendChild(a); return true;
},
check:function(opt){
if(this.gmu===true|| !strg.on){return;}
var stored = strg.read(this.key), J, page;
if(opt || !stored || stored.date < this.day){
page = this.page || (stored && stored.page ? stored.page : false);
strg.save(this.key,{date:this.time(),version:this.version,page:page});
if(!opt){this.css(this.csstxt);}
if(!opt && typeof(GM_xmlhttpRequest) === 'function' && !this.chrome()){
GM_xmlhttpRequest({method: 'GET', url: update.urij, onload: function(r){ update.notification(JSON.parse(r.responseText));}, onerror: function(){update.check(1);}});
}else{
J = this.notification.toString().replace('function','function '+this.callback).replace('this.version',this.version).replace('this.key',"'"+this.key+"'").replace('this.time()',this.time()).replace('this.page','"'+this.page+'"').replace('this.name','j.name');
this.js(J); this.js(this.uric);
}
}else if(this.version < stored.version){ this.css(this.csstxt); this.notification(); }
},
chrome:function(){
if(this.checkchrome === true && typeof(chrome) === 'object'){ return true; }
},
csstxt:'#userscriptupdater,#userscriptupdater:visited{-moz-box-shadow: 0 0 6px #787878;-webkit-box-shadow: 0 0 6px #787878;box-shadow: 0 0 6px #787878;border: 1px solid #777;-moz-border-radius:4px;border-radius:4px; cursor:pointer;color:#555;font-family: Arial;font-size: 11px;font-weight: bold; text-align: justify;min-height: 45px;padding: 12px 20px 10px 65px;position: fixed; right: 10px;top: 10px;width: 170px;background: #ebebeb url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACsAAACLCAYAAAD4QWAuAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2RpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo1NUIzQjc3MTI4N0RFMDExOUM4QzlBNkE2NUU3NDJFNCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpGN0Q1OEQyNjdEQzUxMUUwQThCNEE3MTU1NDU1NzY2OSIgeG1wTU06SW5zdGFuY2V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usGAJ1NuPr0KLoFdYQ3GGBXAiMLWC9gBRDX2gTa9g3Wp7Rbk8TqaPfjWWRp9I0kaLARVCbiXMO/xLGwdfCd7Oa4eDGQdD0fYYcJ7z/bzXHpxbWEDRaddO1FF3aSobE6pazAawztX0H7465mXWVqB2hwqWdwFeFfGaM+Wlh4V/rkMO2fpmy3VWTf5AD0NzLLkYsfn53T7fUs21k2UPmw5jBs9qZgx/AH4Ns+VxvQwJg0rGXTMPUfnhYgj0MLmayb6+TIBFZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBVZgBTZzVrg3U+Nsz1iTo7m7c+GRFU2ONGBFkyMNWNHkSANWNDl0xqbJAZ+j1/nR5HBOv6zm/8JaPjQ5KKqiyRFVpORfk8PRf3NZq8lRrd3PhiaHc6pvcLk0ORDdfGlyAFg0OdKAPUlliG76mhyGUNaDLXOaHIjuJdXkoKVKXzU5wlJZZjU5AFyKKhErFkuVbjcoUo3Apcmhnu6Ebkcmc5oczd2dZlA3YNHkUAFwUtLkcJlWnm1a1ng94AvkbKnM1SxVTKwRMphYNDkAPNiFFU0OZuPV5NDMYiyaHOgKvJoc8CVftFk1ORRsi/FxvYR3yH9qZjYba+VGkwOTw5GCzZcmByzTmhyI6ra/kNkiz4wmByD/0+T4J8AAyDkZArebBxMAAAAASUVORK5CYII=) no-repeat 13px 15px} #userscriptupdater:hover,#userscriptupdater:visited:hover { border-color: #8f8d96; color:#55698c !important;background-position: 13px -85px }'
};
update.check();
// Y T M A CLASS
function ytma(){
var it = this;
this.bond = function(m){ var b = function(e){ m.call(it,e); }; return b; };
this.idu = false; //modified unique id
this.idr = false; //real id
this.spn = document.createElement('span');
this.img = document.createElement('img');
this.wrp = document.createElement('div');
this.wrs = this.wrp.cloneNode(false);
this.ul = document.createElement('ul');
this.inj = this.wrp.cloneNode(false);
this.obj = false;
this.hrf = false;
this.rst = 0;
this.gif = 1;
this.vimeo = false;
}
ytma.vid = [];
ytma.num = 0;
ytma.max = 50;
ytma.inr = 250;
ytma.inv = 10000;
ytma.not = /(?:\b(?:smallfont|user_title|spoiler)\b)/; // Class attributes to ignore
ytma.reg = /(?:(?:youtu)(?:\.be\/|.*?(?:v\=|#p\/u\/\d*?\/))([A-Za-z0-9-_]{11}))|(?:vimeo\.com\/(\d+))/i;
ytma.ret = /(?:t\=(\d*?)m?(\d*?)s)/;
ytma.pod = /(?:\b(?:ipod|iphone|ipad))\b/i;
ytma.iv = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACUAAAAXCAYAAACMLIalAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAalJREFUeNrMl79PwkAUx6/XH1SUCAmLCaCTMammYdKB0bnp3r+AkT+AjakbIwNbNwdgYMDJGCbDbEhHFhckBaECLa3vQps46GChHt/kc/On7727vDJom0vgDuAAH9HJG/AM2AwcV4ABZAAP0QtxeQB0Upl7IA2sEN0IwC1wg+FgKVcojB94JDDFGfpVDu/4ZbEkqpQvSVJCFEUmDrmoUp6maaeDweCiXC6nOY5jDkEKQZUQVEus1+tnRA4kU8lkktlHayNLed72wvI8z8iyLBqGkev3++eqqp5ks1k2EPP/VeqnFIvFo1arlQdyiqKkCoUCjzGmKxWmVCoddzqdfKVSyQiC8Od54+KQWiwWG2jntN1uzx3HQdSloHWzRqNh9Xq9eTBTmJqUaZqrWq027na788lk4gYykZ6KnaWWy6Wn6/q42WxOR6ORs49Z3UkKZmZWrVbHw+Fw5bquH7Uy+5JioVXvtm176/X6+z6EaEohy7JiW3fCfepQQqrNEqlPslgdwF6Fg859kOMJ0ACJ4kpMhMgz8gi8hsN5DcjBz8OGUttM4AWYfQkwAOU+isXJ6aEzAAAAAElFTkSuQmCC';
ytma.iy = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACUAAAAXCAYAAACMLIalAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR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OGRH7GaW1vb6f5+XnTNu4a+C25qKiIAf0UMgXUEYg4jKpRrMuZMGZnZ/+2axjIiqewsDDhBmofHrYKtp5b9x/ZzZDvIwDIB2Nnke+KQEVRCV9aW1tfdHd3l0FPcIGUTv8g0ArkcDjsHRwc/AopfHBmJd11OA/jDVp/DW6Gj6AX6U/NOWPOYGMwcK2ysjICcB8x9TnTHd2OAozHlifd918eyWoBPzDObn/5S4ABAIM++tkxV/qQAAAAAElFTkSuQmCC';
ytma.user = {
def:function(){ return {fa:ytma.pod===true?0:1,sz:5,rt:2,td:1,fc:0}; }, // 0 "Frame", 1 Flash // 3 Hidden, 4 Small (240p), 5 Medium (360p), 6 Large (480p), 7 (720p) // 1 4:3, 2 16:9 // Description // URL Anchor
load:function(){
var s = strg.read('ytmasetts'); // if(s){console.log(s.toSource());}
ytma.user.opt = strg.zero(s) ? this.def() : {fa:+s.fa,sz:+s.sz,rt:+s.rt,td:+s.td,fc:+s.fc}; //console.log(ytma.user.opt.toSource()); console.log(ytma.user.opt);
},
input:function(){
var i = ytma.form.getElementsByTagName('input'), j = i.length;
while(j--){ i[j].addEventListener('click',ytma.user.save,false); }
ytma.settingserror = document.getElementById('ytmasettingserror');
j = document.getElementById('ytmaclose'); j.addEventListener('click',ytma.user.toggle,false);
j = document.getElementById('ytmareset'); j.addEventListener('click',ytma.user.reset,false);
},
save:function(){
switch(this.name){
case 'ytmaframe' : ytma.user.opt.fa=+this.checked; break;
case 'ytmasize' : ytma.user.opt.sz=+this.value; break;
case 'ytmaratio' : ytma.user.opt.rt=+this.value; break;
case 'ytmainfo' : ytma.user.opt.td=+this.checked; break;
case 'ytmafocus' : ytma.user.opt.fc=+this.checked; break;
default : return false;
}
ytma.settingserror.className = (strg.save('ytmasetts',ytma.user.opt)) ? 'ytnone' : '';
ytma.user.load(); // console.log('n'+ytma.user.opt.toSource()); console.log('n'+ytma.user.opt);
},
mark:function(){
var f = document.getElementById('ytmaratio'+ytma.user.opt.rt); f.checked = true;
f = document.getElementById('ytmasize'+ytma.user.opt.sz); f.checked = true;
f = document.getElementById('ytmaframe'); f.checked = !!ytma.user.opt.fa;
f = document.getElementById('ytmainfo'); f.checked = !!ytma.user.opt.td;
f = document.getElementById('ytmafocus'); f.checked = !!ytma.user.opt.fc;
},
reset:function(){
ytma.user.opt = ytma.user.def();
ytma.user.mark();
strg.wipe('ytmasetts');
},
form:function(){
var f = '<form action=""><div id="ytmasettingst">YouTube Me Again! Persistent Site Settings</div><p><small>Change video defaults.</small></p><div id="ytmaclears"><fieldset><legend>Information</legend><p><input name="ytmainfo" type="checkbox" id="ytmainfo" value="info" /><label for="ytmainfo">Load titles and descriptions.</label></p></fieldset><fieldset><legend>Flash Support</legend><p><input name="ytmaframe" type="checkbox" id="ytmaframe" value="f" /><label for="ytmaframe">Use Flash.*</label></p></fieldset>'+'<fieldset id="ytmasizefield"><legend>Size</legend><p><span class="ytmahalf"><input type="radio" name="ytmasize" value="4" id="ytmasize4" /><label for="ytmasize4">S <small>240p</small></label></span><span class="ytmahalf"><input name="ytmasize" type="radio" id="ytmasize5" value="5" /><label for="ytmasize5">M <small>360p</small></label></span><span class="ytmahalf"><input type="radio" name="ytmasize" value="6" id="ytmasize6" /><label for="ytmasize6">L <small>480p</small></label></span><span class="ytmahalf"><input type="radio" name="ytmasize" value="7" id="ytmasize7" /><label for="ytmasize7">X <small>720p</small></label></span></p></fieldset>'+'<fieldset><legend>Aspect Ratio</legend><p><span class="ytmahalf"><input name="ytmaratio" type="radio" id="ytmaratio2" value="2" /><label for="ytmaratio2">16:9</label></span><span class="ytmahalf"><input type="radio" name="ytmaratio" value="1" id="ytmaratio1" /><label for="ytmaratio1">4:3</label></span></p></fieldset>'+'<fieldset><legend>Window Focus</legend><p><input name="ytmafocus" type="checkbox" id="ytmafocus" value="focus" /><label for="ytmafocus">Show videos at the top of the window.</label></p></fieldset>'+'</div><p><small id="ytmasettingserror" class="ytnone">Error! Your settings could not be saved.</small></p><p id="ytmaopts"><small id="ytmaclose">Close</small> <small id="ytmareset">Reset</small> <small>*Disable this option for iOS and other devices.</small></p></form>';
ytma.form = document.createElement('div'); ytma.form.id = 'ytmasettings'; ytma.form.className = 'ytnone'; ytma.form.innerHTML = f; document.body.appendChild(ytma.form);
ytma.user.load();
ytma.user.input();
ytma.user.mark();
},
toggle:function(opt){
ytma.form.className = (/(?:ytnone)/.test(ytma.form.className))||opt===1 ? '' : 'ytnone';
}
};
ytma.css=function(){
var wb = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAuCAIAAABmjeQ9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAFBJREFUeNp0jNENgEAIQ6EuwSre/vOcC1jwegkfJkryQqEUO8fANSeyCiTBm6hKZL6p5ZvZJ/KavhURcWh2941K/e9PA90os3RnW2uf5CPAAIQ5NuW1miKmAAAAAElFTkSuQmCC',
wy = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAJCAYAAADO1CeCAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAW9JREFUeNqMU71Ow0AMtvPfVKGlZe3UsiAxwAwSQuqKVHZeI2JjRX0B3gAhIcHQsQsvgEB0JF2YGBoQqoA2gA47d4QQQoglx7F99nf+ORRCtECSTTxXkimAIuo0hfxBYgGliI+NQ9SqFWvbc7QDtmm6uddeWdv4N5gBgxAkTzJOlPY8QhmLVGkHEW9JLpM8JbmjqnWIZ6nqHRX6RIF3MvmEk/xOzqB5dkUaf1zH9BlYN8xjBqjYRo/0UXVhqcc6++KLko1E7btXROubEkQoMNa/gI9O5D/LyzHA2UUCGjy/RuesvL/Fcj6LPvpU8erLNOxDWULMjgCg2wXwD6Ws1ROXUSafbWLJLSncg2SwWVCeHziWzu0euV7TZ13XjVi33EU/N+Fw+HN5rq6lPhgA9Pepn2q5bmg6u1vAi8THWqknExF7mYvYKX1Kt75/nD8kXRWiuOPsR7W9dauRgGYOF7dTtBuZfv71VnPsQYifAgwAXEh9O1dFCWsAAAAASUVORK5CYII=',
wv = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAMAAAC67D+PAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABhQTFRFutjhDKrTKqzN+Pz9H5CxT7nVis7g////lqc5nAAAAAh0Uk5T/////////wDeg71ZAAAAP0lEQVR42iTMyREAMAgCQASP/jsOGj7s8AATPxzwUDai0AG1SQhsYdeEolVLt8c8llZHYuXyTeb9YYo/8wQYAC81AOQXjj+CAAAAAElFTkSuQmCC',
wl = 'data:image/gif;base64,R0lGODlhDgAKAJEAAP///+BKV////wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFCgACACwAAAAADgAKAAACHFSOeQYI71p6MtAJz41162yBH+do5Ih1kKG0QgEAIfkEBQoAAgAsAAABAA0ACAAAAhSUYGEoerkgdIzKGlu2ET/9ceJmFAAh+QQFCgACACwAAAEADQAIAAACFJRhcbmiglx78SXKYK6za+NxHyYVACH5BAUKAAIALAAAAQANAAgAAAIWVCSAl+hqEGRTLhtbdvTqnlUf9nhTAQAh+QQFCgACACwAAAEADQAIAAACFZRiYCh6uaCRzNXYsKVT+5eBW3gJBQAh+QQJCgACACwAAAAADgAKAAACGpSPaWGwfZhwQtIK8VTUvuxpm9Yp4XlmpiIUADs=',
c = '\n/* youtube me again! */\n.yclear,.ytmdiv,.ytmwrap,object{clear:both}.yclear{overflow:auto;margin:0 0 6px}#ytmasettings,.arialsans{font-family:Arial,Helvetica,sans-serif!important}.ylinks{display:block;width:118px;height:68px;overflow:hidden;font-style:normal;background-color:#111!important;background-repeat:no-repeat!important;background-position:center -11px!important;cursor:pointer;-moz-border-radius:2px;border-radius:1px;position:relative;float:left;-moz-box-shadow:0 0 2px #222;box-shadow:0 0 2px #222;margin:4px}.ylinks img{border:0;opacity:1;top:28px;left:42px;z-index:9;position:absolute}.ylinks:hover img{opacity:.8}.ytmainit{display:block;background:#111;color:#fff;text-shadow:#333 0 0 2px;opacity:.8;text-align:left;font-size:11px;margin:0;padding:1px 3px;-moz-border-radius:2px 2px 0 0}.ytmwrap{overflow:hidden;font-style:normal;margin:3px 0 0} ul.ytmbar{overflow:hidden;margin:0;padding:3px 0 4px}.ytmbar li{-webkit-user-select:none;-moz-user-select:none;-o-user-select:none;user-select:none;list-style-type:none;cursor:pointer;float:left;color:#858585;border:1px solid #222;border-bottom:1px solid #000;box-shadow:0 0 1px #333;height:14px;font-size:12px!important;line-height:12px!important;background:#161616 url('+wb+');margin:0;padding:5px 9px 3px}.yliop{-moz-border-radius:2px 0 0 2px;border-radius:2px 0 0 2px}.ylimi{border-left:0!important}.ylicl{border-left:0!important;-moz-border-radius:0 2px 2px 0;border-radius:0 2px 2px 0;margin:0 2px 0 0 !important}.ylicr{-moz-border-radius:2px;border-radius:2px}.ytmbar li:hover{color:#ccc;text-shadow:1px 1px 0 #333;background:#222 url('+wb+') 0 -23px} li[id^=sel]{color:#ddd;text-shadow:0 0 2px #444} span.yloading{font-style:italic;background:url('+wl+') 0 3px no-repeat;text-indent:17px}.ypg,.ypgv{background:url('+wy+') 2px 3px no-repeat !important;-moz-border-radius:1px;border-radius:1px;padding:0 3px 0 35px !important}.ypgv{background:url('+wv+') 3px 2px no-repeat !important;padding:0 3px 0 16px !important}.ypg b,.ypg strong{font-weight:400!important}.ypg u{text-decoration:none}.ypg i,.ypg em{font-style:normal}.ypg:hover{background-color:#fff}.ytitled{float:left;width:500px;font-style:normal;font-weight:700;margin:5px 0 0 3px}.yterror{color:#CC2F24;font-style:italic} q[ondblclick]{cursor:pointer}.ydescropen{white-space:pre-line;}.ydescr{display:block;word-wrap:break-word;font-weight:400;max-height:48px;overflow:auto;padding-right:5px}#ytmasettings{font-size:12px;width:410px;border-radius:3px;background:#fbfbfb;border:1px solid #bbb;color:#444;box-shadow:0 0 5px rgba(0,0,0,.2), 0 0 3px rgba(239,239,239,.1) inset;margin:3px 1px 8px;padding:4px 8px 0}#ytmasettings *{font-weight:400}#ytmasettings p{font-size:12px;clear:both;margin:5px 0;padding:0}#ytmaclears{overflow:hidden}#ytmasettings fieldset{border-radius:3px;border:1px solid #ccc;float:left;width:180px;margin:0 2px;padding:4px 7px 9px}#ytmasettings p>input{margin:3px 3px 0 4px !important}#ytmasettings p>span>input[type=radio]{margin:3px 5px!important}#ytmasettingst{font-size:14px;border-bottom:1px dashed #D00;margin-bottom:6px;padding:0 3px 3px}#ytmasettings .ytmahalf{width:80px;display:inline-block}#ytmasettings .ytmahalf label{width:50px;display:inline-block;cursor:pointer}#ytmasizefield p .ytmahalf{width:140px}#ytmasettingserror{font-weight:700;color:#d00}#ytmaopts small{cursor:pointer;display:inline-block;margin-right:20px}#ytmaopts small:hover{color:#222}.ytnone,.ypg br{display:none}';
update.css(c);
};
ytma.callbackinit=function(){
var J = 'function ytrems(d){ d=document.getElementById(d); d.parentNode.removeChild(d); } function ySeconds(n){ if(!n){return "";} var T = " (", H = 0, M = 0; if(n >= 3600){H = Math.floor(n/3600); n = n - H*3600; T = H+":";} if(n >= 60){ M = Math.floor(n/60); n = n - M*60; } if(M < 10 && H){ M = "0"+M; } if(n < 10){ n = "0"+n; } T += M; T += ":"+n+")"; return T;} function $videoInfo(a){var b,c,d,e,f,g,h=-1,i,j,k;Object.prototype.toString.call(a)==="[object Array]"?(a=a[0],b=a.id,c=a.title+" "+ySeconds(a.duration),d=a.description.replace(/<br.?.?>/g,""),f=unescape(a.thumbnail_medium)):(a=a.entry,b=a.media$group.yt$videoid.$t,a.media$group.yt$duration?(c=a.title.$t+" "+ySeconds(a.media$group.yt$duration.seconds),d=a.media$group.media$description.$t):g=!0),d&&d.length>140&&(e=d,d=d.substr(0,130)+" . . .");if(i=document.getElementsByClassName("_"+b)){while(++h<i.length)j=i[h],/(?:ylinks)/.test(j.className)?f&&j.setAttribute("style","background: url("+f+")"):g?(j.textContent="YTMA has detected a problem with this video.",j.className="yterror ytitled"):(j.textContent=c,j.className="ytitled _"+b,d&&(k=document.createElement("q"),k.className="ydescr",k.textContent=d,e&&(k.data=e,k.title="Click to toggle the length of the description.",k.setAttribute("ondblclick","this.className=this.className===\'ydescr\'?\'ydescr ydescropen\':\'ydescr\';this.textContent=this.textContent.length<140?this.data:this.data.substr(0,130)+\' . . .\';")),j.appendChild(k)));ytrems(b)}}';
update.js(J);
};
ytma.titled=function(n){
if(ytma.thr){window.clearInterval(ytma.thr);} //console.log('clear');
if(ytma.vid.length>0){ window.setTimeout(function(){ ytma.thr = window.setInterval(ytma.titles,ytma.inr); }, n); }
};
ytma.titles=function(){
var id = ytma.vid[ytma.num], s;
if(id || ytma.num < ytma.vid.length){// console.log(ytma.num+' '+id);
s = document.createElement('script'); s.id = id;
s.src = id.length < 11 ? 'http://vimeo.com/api/v2/video/'+id+'.json?callback=$videoInfo' : 'https://gdata.youtube.com/feeds/api/videos/'+id+'?v=2&alt=json-in-script&callback=$videoInfo';
document.body.appendChild(s);
s.addEventListener('error',ytma.error,false);
if(ytma.num&&ytma.num % ytma.max === 0){ ytma.titled(ytma.inv); }
ytma.num += 1;
}else{// console.log('clear');
window.clearInterval(ytma.thr);
}
};
ytma.error=function(){
var m = document.getElementsByClassName('_'+this.id), i = m.length, k;
while(i--){ k = m[i];
if(/\b(?:yloading)\b/.test(k.className)){ // if(k.classList.contains('yloading')){
k.textContent = 'YTMA has detected a problem with this video.'; k.className = 'yterror ytitled';
} // else{ k.className += ' ytnone'; /* k.classList.add('ytnone'); */ }
}
document.body.removeChild(document.getElementById(this.id));
};
ytma.out=function(){
var all = document.links, i = -1, j = all.length, id, a, y, imgs, p, q, r, t = 100, f;
while(++i<j){ a = all[i];
p = a.parentNode || false;
id = a.href.match(ytma.reg);
if(p && id && !ytma.not.test(p.className)){
f = r = document.createDocumentFragment();
q = a.nextSibling;
id = id[1] || id[2];
y = new ytma();
y.idr = id; //real id
y.idu = id+i;
y.vimeo = (id.length < 11);
y.hrf = a.href;
y.spn.title = 'YouTube Me!'; y.spn.className = 'ylinks _'+y.idr; y.spn.addEventListener('click',y.bond(y.init),false);
y.sp2 = y.spn.cloneNode(false); y.sp2.className = 'ytmainit arialsans';
y.img.src = y.vimeo ? ytma.iv : ytma.iy; y.img.height = 23; y.img.width = 37;
f.appendChild(y.sp2); f.appendChild(y.img); y.spn.appendChild(f);
y.wrs.id = 'w'+y.idu;
y.wrs.className = 'yclear';
r.appendChild(y.spn);
if(ytma.user.opt.td){
if(ytma.vid.indexOf(id) === -1){ytma.vid.push(id);}
y.sp3 = y.spn.cloneNode(false);
y.sp3.className = 'ytitled yloading _'+y.idr;
y.sp3.textContent = 'Loading data . . .';
r.appendChild(y.sp3);
}
p.insertBefore(y.wrs,q);
imgs = (a.getElementsByTagName('img').length<1);
if(!y.vimeo){
a.title = 'Go To The YouTube Page';
a.href = a.href.replace('http:','https:');
if(/(?:\byoutu\.be\b)/.test(a.href)){ a.href = a.href.replace('youtu.be/','youtube.com/watch?v='); }
y.spn.addEventListener('mouseover',y.bond(y.pseudogif),false);
y.spn.addEventListener('mouseout',y.bond(y.stop),false);
y.spn.setAttribute('style','background: url(https://i3.ytimg.com/vi/'+id+'/1.jpg)');
if(imgs){a.className = 'ypg';}
}else{
y.spn.title = 'Vimeo Me Too!';
if(imgs){a.className = 'ypgv';}
}
y.sp2.textContent = y.spn.title;
y.wrs.appendChild(r);
}
}
if(ytma.vid.length>100){t = 2500; ytma.inv = 15000;}
ytma.titled(t);
};
ytma.init=function(){
if(this.initializer){return;}
ytma.pod = (ytma.pod.test(navigator.userAgent));
ytma.css();
ytma.user.form();
ytma.callbackinit();
ytma.out();
this.initializer = true;
};
ytma.prototype = {
changedim:function(){
var bar = (this.vimeo || this.size === 3) ? 0 : 30; // +30 pixels for the youtube bar
this.dimm || (this.dimm = ytma.user.opt.rt);
if(this.dimm === 2){this.obj.height = Math.round((this.obj.width*9)/16)+bar; ytma.user.opt.rt = 2;}
else{this.obj.height = Math.round((this.obj.width*3)/4)+bar; ytma.user.opt.rt = 1;}
this.obj.height = ((Math.floor(this.obj.height)%2===0) && (Math.abs(this.obj.height-Math.floor(this.obj.height))===0.5)) ? Math.round(this.obj.height)-1 : Math.round(this.obj.height);
if(this.size === 3){this.size = 4;}// console.log(this.obj.height,this.obj.width); // ytma.user.opt.sz = this.size;
},
changesize:function(){
this.size || (this.size = ytma.user.opt.sz);
switch(this.size){ case 3 : this.obj.width = 1; break; case 4 : this.obj.width = 320; break; case 5 : this.obj.width = 640; break; case 6 : this.obj.width = 853; break; case 7 : this.obj.width = 1280; break; default: break; }
this.changedim();
},
repo:function(){
this.toggle();
this.wrp.parentNode.removeChild(this.wrp);
},
liopts:function(e){
e = e.currentTarget;
var n = +e.getAttribute('n');
if(n === 9){ ytma.user.toggle(); if(ytma.form.parentNode != this.inj.parentNode){this.inj.parentNode.insertBefore(ytma.form,this.inj); ytma.user.toggle(1);} return true; }
if(n === 8){ this.repo(); return true; }
if(n <= 2){ this.dimm = n; this.changedim(); this.seldim.removeAttribute('id'); e.id = 'seldim-'+this.idu; this.seldim = e; }
else{ this.size = n; this.changesize(); this.sel.removeAttribute('id'); e.id = 'sel-'+this.idu; this.sel = e; }
},
li:function(txt,n,t,c){
var l = document.createElement('li'); l.textContent = txt; l.setAttribute('n',n); l.title = t; l.className = c;
if(n > 2 && n < 8){ if(this.size === n){l.id = 'sel-'+this.idu; this.sel = l;} }
else if(n < 3){ if(this.dimm === n){l.id = 'seldim-'+this.idu; this.seldim = l;} }
l.addEventListener('click',this.bond(this.liopts),false);
return l;
},
prm:function(n,v){
var p = document.createElement('param'); p.name = n; p.value = v; return p;
},
stime:function(){
var m = this.hrf.match(ytma.ret);
if(!this.vimeo && m){
m = [m[1]*60,+m[2]];
this.rst = m[1] ? m[0] + m[1] : m[0];
}
},
output:function(){
var close = 'ylicr', f, r, a;
if(!this.obj){
f = r = a = document.createDocumentFragment();
this.obj = document.createElement('object');
this.stime();
if(ytma.user.opt.fa&&!ytma.pod){
this.obj.type = 'application/x-shockwave-flash';
this.obj.data = this.vimeo ? 'http://vimeo.com/moogaloop.swf?clip_id='+this.idr+'&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=&fullscreen=1&autoplay=0&loop=0' : 'http://www.youtube-nocookie.com/v/'+this.idr+'?version=3&theme=dark&color=white&showinfo=0&start='+this.rst;
a.appendChild(this.prm('movie',this.obj.data)); a.appendChild(this.prm('allowFullScreen','true')); a.appendChild(this.prm('AllowScriptAccess','always')); a.appendChild(this.prm('allowFullScreen','true')); this.obj.appendChild(a);
this.obj.movie = this.obj.data; this.obj.allowFullScreen = true; this.obj.AllowScriptAccess = 'always'; //ie9
}else{
this.obj.type = 'text/html';
this.obj.data = this.vimeo ? 'http://player.vimeo.com/video/'+this.idr+'?title=0&byline=0&portrait=0' : 'http://www.youtube-nocookie.com/embed/'+this.idr+'?theme=dark&color=white&showinfo=0#at='+this.rst;
}
this.changesize();
this.ul.className = 'ytmbar arialsans'; /* O P T I O N S */
f.appendChild(this.li('4:3',1,'Change aspect ratio.','yliop'));
f.appendChild(this.li('16:9',2,'Change aspect ratio.','ylicl'));
f.appendChild(this.li('\u00D8',3,'Hide the video.','yliop'));
f.appendChild(this.li('S',4,'240p','ylimi'));
f.appendChild(this.li('M',5,'360p','ylimi'));
f.appendChild(this.li('L',6,'480p','ylimi'));
f.appendChild(this.li('X',7,'720p','ylicl'));
if(strg.on){f.appendChild(this.li('!',9,'Edit YTMA\'s settings.','yliop')); close = 'ylicl';}
f.appendChild(this.li('\u00D7',8,'Close the video.',close));
this.ul.appendChild(f);
this.wrp.className = 'ytmwrap';
this.inj.className = 'ytmdiv';
this.inj.appendChild(this.obj);
r.appendChild(this.ul); r.appendChild(this.inj); this.wrp.appendChild(r); /* M A G I C */
}
this.spn.parentNode.insertBefore(this.wrp,this.spn.nextSibling);
},
init:function(){
this.toggle();
this.output();
if(ytma.user.opt.fc){window.location.hash = '#'+this.wrs.id;}
},
toggle:function(){
if(/(?:\b(?:ytnone)\b)/.test(this.spn.className)){ this.spn.className = this.spn.className.replace(' ytnone',''); }else{ this.spn.className = this.spn.className+' ytnone';} // this.spn.classList.toggle('ytnone'); // Opera doesn't have it.
},
pseudogif:function(){
this.gif = this.gif <3 ? this.gif+1 : 1;
this.spn.style.backgroundImage='url(https://i3.ytimg.com/vi/'+this.idr+'/'+this.gif+'.jpg)';
this.time = window.setTimeout(this.bond(this.pseudogif),1000);
},
stop:function(){
window.clearTimeout(this.time);
}
};
ytma.init();