Skip to content

Instantly share code, notes, and snippets.

@user19
Created November 22, 2014 11:38
Show Gist options
  • Save user19/f3e9149bf6ed1220a1b2 to your computer and use it in GitHub Desktop.
Save user19/f3e9149bf6ed1220a1b2 to your computer and use it in GitHub Desktop.
window.document.getElementsByTagName("html")[0].innerHTML = '<html><head><style type="text/css"></style><style type="text/css"></style></head><body><input type="button" value="fullscreen" onclick="func();"><div id="player"></div></body></html>';
var elements = {};
var screen_width = window.parent.screen.width;
var baseNode = window.document.createElement("iframe");
baseNode.setAttribute( "frameborder", "0");
var player = window.document.getElementById("player");
var style_sheets = window.document.getElementsByTagName("style");
style_sheets[0].innerHTML = "#player{ width:"+screen_width+"px; height:"+Math.floor(screen_width*9/16)+"px;}";
var style = style_sheets[1];
var v = "PqJNc9KVIZE";
function func(){
style.innerHTML = "iframe{ vertical-align:bottom; width:25%; height:25%;}";
for(var i=1; i<=16; i++){
elements[i] = baseNode.cloneNode(true);
elements[i].src = "//www.youtube.com/embed/"+v;
}
player.webkitRequestFullscreen();
for(var i=1; i<=16; i++)
player.appendChild(elements[i]);
elements = {};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment