Skip to content

Instantly share code, notes, and snippets.

@dux
Last active August 29, 2015 13:57
Show Gist options
  • Save dux/9747541 to your computer and use it in GitHub Desktop.
Save dux/9747541 to your computer and use it in GitHub Desktop.
Expand YouTube video to full screen - bookmarklet
// GOOD bookmarklet, copy and paste
javascript:elms=['masthead-positioner-height-offset', 'content', 'footer-container', 'masthead-positioner'];for (i in elms) { var e=document.getElementById(elms[i]); if (e) e.parentNode.removeChild(e); };document.getElementById('player-api').setAttribute('class','player-api');window.exTFS=function(){ s = document.body.clientHeight-1; document.getElementById('player-api').setAttribute('style','position:absolute;top:0px; left:0px; width:100%; min-height:'+s+'px;z-index:100000000000');document.getElementById('movie_player').setAttribute('style','min-height:'+s+'px;');void(document.getElementsByTagName('video')[0].setAttribute('style','width:100%;min-height:'+s+'px;'))};window.onresize=exTFS;exTFS();
// annotated source
elms=['masthead-positioner-height-offset', 'content', 'footer-container', 'masthead-positioner'];
for (i in elms) { var e=document.getElementById(elms[i]); if (e) e.parentNode.removeChild(e); }
document.getElementById('player-api').setAttribute('class','player-api');
window.exTFS=function(){
s = document.body.clientHeight-1;
document.getElementById('player-api').setAttribute('style','position:absolute;top:0px; left:0px; width:100%; min-height:'+s+'px;z-index:100000000000');
document.getElementById('movie_player').setAttribute('style','min-height:'+s+'px;');
void(document.getElementsByTagName('video')[0].setAttribute('style','width:100%;min-height:'+s+'px;'))
}
window.onresize=exTFS;
exTFS();
// shitty bookmarklet , opens video in new page, refreshes screen, avoid
javascript:/v=([\w_\-]+)/.test(location.search);location.href='http://youtube.com/v/'+RegExp.$1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment