Skip to content

Instantly share code, notes, and snippets.

@user19
Created November 22, 2014 15:03
Show Gist options
  • Select an option

  • Save user19/3f46f54cb3c8b30a9d98 to your computer and use it in GitHub Desktop.

Select an option

Save user19/3f46f54cb3c8b30a9d98 to your computer and use it in GitHub Desktop.
window.document.getElementsByTagName("html")[0].innerHTML = "<html><head><style type=\"text/css\"></style></head><body><input type=\"button\" value=\"実行\" onclick=\"func();\"/><div id=\"player\"></div></body></html>";
var elements = {};
var player = window.document.getElementById("player");
var style = window.document.getElementsByTagName("style")[0];
var exp = Number(window.prompt( "level", "2"));
var v = window.prompt( "動画のID", "PqJNc9KVIZE")+"?autoplay=1&amp;controls=0&amp;showinfo=0";
function func(){
style.innerHTML = "#player{width:"+window.parent.screen.width+"px;height:"+Math.floor(window.parent.screen.width*9/16)+"px;} iframe{vertical-align:bottom;width:"+100/exp+"%;height:"+100/exp+"%;}";
var baseNode = window.document.createElement("iframe");
baseNode.src = "//www.youtube.com/embed/"+v;
baseNode.setAttribute("frameborder","0");
for(var i=1; i<=Math.pow(exp,2); i++)elements[i] = baseNode.cloneNode(true);
if (player.webkitRequestFullScreen)
player.webkitRequestFullScreen();
else if(player.mozRequestFullScreen)
player.mozRequestFullScreen();
else if(player.msRequestFullscreen)
player.msRequestFullscreen();
else if(player.requestFullScreen)
player.requestFullScreen();
else
return false;
for(key in elements)player.appendChild(elements[key]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment