There are 55 previous versions of this script.
/*<![CDATA[*/
// ==UserScript==
// @name youtubpItvlStnd
// @description personal configurations for youtube
// @include http://*youtube.com/*
// ==/UserScript==
function adfmtChannel() {
var refmt=function(rpl) { return [rpl.replace(/\&feature=(related|channel_page|channel)/gi,''),'\&fmt=18'].join('');},
refrp=function(rpl) { return [rpl.replace(/user\//gi,'profile?user='),'\&view=videos'].join('');},
doc=document,getanc=doc.getElementsByTagName('a');
for(var i=getanc.length,anc,refer; i--;) {
anc=getanc[i]; refer=anc.href;
if(refer.search(/watch/)!=-1) { anc.setAttribute('href',refmt(refer));}
if(refer.search(/user\//)!=-1) { anc.setAttribute('href',refrp(refer));}
}
}
var confget={
adcod: function() {
var doc=document,adcomm=doc.getElementById('watch-vid-title');
if(adcomm) {
var asloc=doc.location.href,fms=asloc.search(/fmt=18/),adas=adcomm.getElementsByTagName('h1')[0].textContent,ad;
if(fms!=-1) { ad='.mp4';} if(fms==-1) { ad='.flv';} adas=[adas,ad].join('');
var adit=[['\\s\\.','.'],['^\\s',''],['\\s\\s+',' '],['Part\\s','part '],[unescape('\\%22|\\%5B|\\%5D'),' '],['\\&','y'],['\\:',' -'],['\\/','-']];
for(var a=adit.length,asi; a--;) { asi=adit[a]; adas=adas.replace(new RegExp(asi[0],'gi'),asi[1]);}
var adi="width:630px;border:none;font-family:Arial;font-size:16px;font-weight:700;color:#104040;padding-left:5x;";
var adinp=doc.createElement('input');
adinp.setAttribute('type','text');
adinp.setAttribute('value',adas);
adinp.setAttribute('onclick','this.focus(); this.select();');
adinp.setAttribute('onmousedown','this.focus(); this.select();');
adinp.setAttribute('style',adi);
adcomm.parentNode.replaceChild(adinp,adcomm);
}
}
};
function adstyle() {
var doc=document,adstyle=doc.createElement('style');
var codi={
uservid: " body{background-image:none!important;}a:visited{border-bottom:1px dotted #007736;}a:visited:hover{color:#000000;background-color:#f6fff4;}#masthead a{font-size:12px;}#videosPofileVideos{max-width:800px;}#videosPofileVideos a:visited img {outline:solid 2px #aaa0a0;}img{max-width:850px;}#top-margin-links-wrapper{width:700px!important;position:relative;right:20px;}.search-bar{width:840px!important;}input[type=text]{border:solid 1px #606060;background:#fff6f0;}input[type=submit],input[type=button]{border:outset 1px #505050;background:#c0cdc6!important;margin-bottom:2px;}.video-cell,.user-video{width:155px!important;}.video-thumb-big,.video-thumb-120{overflow:inherit!important;width:124px!important;height:auto!important;border:1px solid #ccbbbb!important;}.playnav-playlist-thumb img,.video-thumb-big img{width:auto!important;height:auto!important;margin-top:-6px!important;}.normalText{margin-right:190px;} ",
texti120: " .vimg120,.vimg90{width:auto!important;height:auto!important;}.vCluster120WrapperInner,.v120WrapperInner{overflow:inherit!important;width:auto!important;height:auto!important;border:1px solid #ccbbbb!important;}.vlcell{width:150px!important;}.pagingDiv{width:760px;} ",
texti90: " .v90WrapperInner,.video-thumb-90{overflow:inherit!important;width:auto!important;height:89px!important;border:0px solid #ddc0c0!important;}.v90WrapperOuter{width:auto!important;border:1px solid #e0f0df!important;margin:-4px 4px -7px 0px;}.video-thumb-medium,.video-thumb-medium img{width:auto!important;height:auto!important;}.watch-discoverbox{margin-left:-8px!important;}.v90WideEntry,.v90WrapperOuter{width:auto!important;height:auto!important;}.viewPlaylistMain .v90WrapperInner{width:auto!important;overflow:inherit;}button,button.QLIcon,button.QLIconImg,button.QLIconImgOver,button.QLIconImgDone{opacity:.4!important;outline:1px solid transparent!important;} ",
adentry: " .video-entry{padding:0px!important;}.video-main-content{width:144px!important;margin-left:-3px;padding-left:1px!important;} .video-time span{margin-right:-3px;}.v120WrapperInner a:visited{border:none;}.v120WrapperInner .video-time{margin-top:-10px!important;margin-right:-12px;}.video-time a,.video-time span {font-weight:700;font-size:11px;opacity:.8;background:transparent!important;color:#ecffc0!important;}.video-time a:hover,.video-time span:hover{color:#002244!important;} "
};
var aduser=[codi.uservid,codi.texti120,codi.texti90,codi.adentry].join('');
adstyle.appendChild(doc.createTextNode(aduser));
doc.getElementsByTagName('body')[0].parentNode.firstChild.appendChild(adstyle);
}
var adit={
lochref: document.location.href,
playlink: function playlink() {
var doc=document,getanc=doc.getElementsByTagName('a'),
sdanc,refmt=function(rpl) { sdanc=rpl.replace(/\&feature=([^(\&)]*)/gi,'').replace(/\&p=([^(\&)]*)/gi,'').replace(/\&index=([^(\&)]*)/gi,'').replace(/\&fmt=18/gi,''); return [sdanc,'\&fmt=18'].join('');},
refrp=function(rpl) { return [rpl.replace(/user\//gi,'profile?user='),'\&view=videos'].join('');},
stl=function(ad){ad.style.borderBottom='dashed 1px #aba6a6';};
for(var i=getanc.length,anc,refer; i--;) {
anc=getanc[i]; refer=anc.href;
if(refer.search(/watch/)!=-1) { anc.setAttribute('href',refmt(refer)); stl(anc);}
if(refer.search(/user\//)!=-1) { anc.setAttribute('href',refrp(refer));}
}
},
plnavs: function plnavs() {
var doc=document,anc=doc.createElement('a'); anc.setAttribute('href','javascript:void(HQF)'); anc.setAttribute('onclick','playlink()'); anc.id='pln';
anc.setAttribute('style','margin-left:5px;margin-right:5px;padding:0px 2px 0px 2px;font-size:12px;border:solid 1px #aba6a6;'); anc.appendChild(doc.createTextNode('HQF'));
var adin=doc.getElementById('masthead-search'); if(adin) { var ads=adin.getElementsByTagName('form')[0]; ads.insertBefore(anc,ads.lastChild);}
var pln=doc.getElementById('playnav-navbar'); if(pln) { pln.insertBefore(anc.cloneNode(true),pln.lastChild);}
},
adnormalpage: function adnormalpage(id) {
var doc=document,as=parseInt(doc.getElementById('getpages').value),
profdiv=doc.getElementById('videosPofileVideos'),
favoritediv=doc.getElementById('favoritesPofileVideos');
if (favoritediv) {profdiv=favoritediv;}
var profdivnormal=profdiv.getElementsByTagName('div'),
ancs=profdivnormal[profdivnormal.length-1].getElementsByTagName('a')[0].href;
doc.location.href=ancs.replace(/\&start=[0-9]+/,["&start=",(as*2-2)*10].join(''));
},
adanc: function(clk,fmt) {
var codi={
embs: ["javascript:void('embs');","zapEmbsr()"],
flvr: [['javascript:void(',fmt,');'].join(''),['flavrs(',fmt,'); zapEmbsr()'].join('')]
};
var doc=document,anc=doc.createElement('a');
anc.setAttribute('href',codi[clk][0]);
anc.setAttribute('onclick',codi[clk][1]);
anc.appendChild(doc.createTextNode(fmt));
var anst=anc.style;anst.border='solid 1px #aba6a6';anst.padding='0px 1px';anst.marginLeft='2px';anst.fontSize='10px';anst.opacity='.8';
return anc;
},
flavrs: function flavrs(fmt) {
var doc=document,flavar=doc.getElementsByTagName('embed')[0].getAttribute('flashvars'),
attvr=['http://youtube.com/get_video?video_id=',flavar.match(/video_id=([^\&]*)/)[1],'\&fmt=',fmt],
flvr=flavar.split('\&'),schvr=function(flr){return flr.search(/sk=/)!=-1||flr.search(/t=/)!=-1||flr.search(/tk=/)!=-1;};
for(var a=flvr.length,flr; a--;){
flr=flvr[a]; if(schvr(flr)) {attvr.push('\&',flr);}
}
doc.location.href=attvr.join('');
},
zapEmbsr: function zapEmbsr() {
var doc=document,getemb=doc.getElementsByTagName('embed');
if(getemb.length) {
var embaj=[];
for(var i=getemb.length,embi,emba; i--;) {
embi=getemb[i].attributes; emba=embaj[i]=[];
for(var j=embi.length,embats; j--;) {
embats=embi[j]; emba.push([embats.nodeName,embats.nodeValue]);
}
};
var anc=doc.createElement('a'),tex=doc.createTextNode('em'),
ancs=function(ad){ ad.setAttribute('href','javascript:;'); ad.setAttribute('onclick','replAds(this);return false;'); ad.style.fontSize='9px'; ad.appendChild(tex.cloneNode(true));};
for(var a=embaj.length,embs,adanc,refemb; a--;) {
embs=embaj[a]; adanc=anc.cloneNode(true);
for(var j=embs.length,adref; j--;) {
adref=embs[j]; adanc.setAttribute(adref[0],adref[1]);
}
ancs(adanc); refemb=getemb[a]; refemb.parentNode.replaceChild(adanc,refemb);
}
}
},
replAds: function replAds(obj) {
var ademb=document.createElement('embed'),attr=obj.attributes;
for(var m=0,ems=attr.length,embs; m<ems; m++) {
embs=attr[m]; ademb.setAttribute(embs.nodeName,embs.nodeValue);
}; ademb.removeAttribute('href'); ademb.removeAttribute('onclick');
obj.parentNode.replaceChild(ademb,obj);
},
adfrminp: function(act,val,id,ads) {
var doc=document,adfrm=doc.createElement('form');
var adf=adfrm.style;adf.margin='0px 9px 0px 9px';adf.padding='0px';adf.display='inline';
adfrm.setAttribute("action",act);
var adinp=doc.createElement('input');
adinp.setAttribute("type","text");
adinp.setAttribute("id",id);
adinp.setAttribute("value",[' ',val].join(''));
adinp.setAttribute("onclick","this.select()");
adinp.setAttribute("onmouseup","this.select()");
adinp.setAttribute("onfocus","this.style.backgroundColor='#fff9f0'");
adinp.setAttribute("onblur","this.style.backgroundColor='transparent'");
adinp.setAttribute("style",ads);
var adi=adinp.style;adi.border='solid 1px #aaa0a0';adi.backgroundColor='transparent';adi.padding='0px';adi.fontSize='11px';adi.opacity='.8';
adfrm.appendChild(adinp);
return adfrm;
},
profvid: function() {
var doc=document,adothervids=doc.getElementById('watch-other-vids'),
getprof=doc.getElementById('profileSubNav'),
basediv,asprof,act,ads;
if(this.lochref.search(/\/watch/)==-1) { basediv=doc.getElementById('baseDiv');}
if(adothervids) { asprof=adothervids.getElementsByTagName('a')[0].href;}
if(getprof) { asprof=this.lochref;}
var asuser=asprof.match(/user=([^\&]*)/)[1];
act="javascript:(function provid(){var asval=document.getElementById('profvid').value;if(asval.charAt(0)==' '){asval=asval.substring(1);}window.open('http://www.youtube.com/'+asval);})();";
if(adothervids) {
var adchan=doc.createElement('div'); adchan.setAttribute('axis','fmt_anc');
var adcst=adchan.style;adcst.position='absolute';adcst.marginTop='-16px';
ads="width:96px;";
adchan.appendChild(this.adfrminp(act,asuser,'profvid',ads));
adchan.appendChild(this.adanc('embs','Ea'));
var fmts=[35,34,22,18];
for(var m=fmts.length; m--;) {
adchan.appendChild(this.adanc('flvr',fmts[m]));
}
adothervids.insertBefore(adchan,adothervids.firstChild);
}
if(getprof) {
ads="position:relative;width:96px;";
getprof.insertBefore(this.adfrminp(act,asuser,'profvid',ads),getprof.lastChild);
}
if(basediv) {
act="javascript:adnormalpage('getpages');"; ads="width:25px;";
basediv.insertBefore(this.adfrminp(act,1,'getpages',ads),basediv.lastChild);
}
},
adscript: function() {
var doc=document,adscript=doc.createElement('script'),locwat=this.lochref.search(/\/watch/),navms=[this.playlink,this.plnavs,'; plnavs();'];
if(locwat==-1) { navms.push(this.adnormalpage);}
if(locwat!=-1) { navms.push(this.flavrs,this.zapEmbsr,this.replAds);}
adscript.appendChild(doc.createTextNode(navms.join('')));
doc.getElementsByTagName('body')[0].parentNode.firstChild.appendChild(adscript);
}
};
document.addEventListener('load',adfmtChannel(),confget.adcod(),adstyle(),adit.adscript(),adit.profvid(),false);
/*]]>*/
