Last active
August 29, 2015 14:11
-
-
Save polarblau/a46a040c86360ca09ea6 to your computer and use it in GitHub Desktop.
Apple trailers in fullscreen: save as bookmarklet, start a trailer video on trailers.apple.com, run the script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){try{var video=find('.moviePanel object embed');var origWidth=video.width,origHeight=video.height,origStyleWidth=video.style.width,origStyleHeight=video.style.height;onEnterFullscreen(function(){video.width='100%';video.height='100%';video.style.width='100%';video.style.height='100%';});onExitFullscreen(function(){video.width=origWidth;video.height=origHeight;video.style.width=origStyleWidth;video.style.height=origStyleHeight;});fullscreen(video);}catch(e){}function getVideoSize(video){return[video.width,video.height,video.style.width,video.style.height];}function setVideoSize(video,size){video.width=size[0];video.height=size[1];video.style.width=size[2];video.style.height=size[3];}function find(query){return document.querySelector(query);}function isFullscreen(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;}function onFullscreenChange(cb){document.addEventListener('fullscreenchange',cb,false);document.addEventListener('msfullscreenchange',cb,false);document.addEventListener('mozfullscreenchange',cb,false);document.addEventListener('webkitfullscreenchange',cb,false);}function onEnterFullscreen(cb){onFullscreenChange(function(){if(isFullscreen())cb();});}function onExitFullscreen(cb){onFullscreenChange(function(){if(!isFullscreen())cb();});}function fullscreen(el){if(el.requestFullscreen){el.requestFullscreen();}else if(el.msRequestFullscreen){el.msRequestFullscreen();}else if(el.mozRequestFullScreen){el.mozRequestFullScreen();}else if(el.webkitRequestFullscreen){el.webkitRequestFullscreen();}return el;}})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
var video = find('.moviePanel object embed'); | |
var origWidth = video.width, | |
origHeight = video.height, | |
origStyleWidth = video.style.width, | |
origStyleHeight = video.style.height; | |
onEnterFullscreen(function() { | |
video.width = '100%'; | |
video.height = '100%'; | |
video.style.width = '100%'; | |
video.style.height = '100%'; | |
}); | |
onExitFullscreen(function() { | |
video.width = origWidth; | |
video.height = origHeight; | |
video.style.width = origStyleWidth; | |
video.style.height = origStyleHeight; | |
}); | |
fullscreen(video); | |
} catch(e) {} | |
// --- | |
function find(query) { | |
return document.querySelector(query); | |
} | |
function isFullscreen() { | |
return document.fullscreenElement || | |
document.webkitFullscreenElement || | |
document.mozFullScreenElement || | |
document.msFullscreenElement; | |
} | |
function onFullscreenChange(cb) { | |
document.addEventListener('fullscreenchange', cb, false); | |
document.addEventListener('msfullscreenchange', cb, false); | |
document.addEventListener('mozfullscreenchange', cb, false); | |
document.addEventListener('webkitfullscreenchange', cb, false); | |
} | |
function onEnterFullscreen(cb) { | |
onFullscreenChange(function() { | |
if (isFullscreen()) cb(); | |
}); | |
} | |
function onExitFullscreen(cb) { | |
onFullscreenChange(function() { | |
if (!isFullscreen()) cb(); | |
}); | |
} | |
function fullscreen(el) { | |
if (el.requestFullscreen) { | |
el.requestFullscreen(); | |
} else if (el.msRequestFullscreen) { | |
el.msRequestFullscreen(); | |
} else if (el.mozRequestFullScreen) { | |
el.mozRequestFullScreen(); | |
} else if (el.webkitRequestFullscreen) { | |
el.webkitRequestFullscreen(); | |
} | |
return el; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment