Skip to content

Instantly share code, notes, and snippets.

@Ciantic
Created June 10, 2016 18:27
Show Gist options
  • Select an option

  • Save Ciantic/fdba31720cce36363c429ae1c3dd9949 to your computer and use it in GitHub Desktop.

Select an option

Save Ciantic/fdba31720cce36363c429ae1c3dd9949 to your computer and use it in GitHub Desktop.
Bookmarklet to show YouTube in fullscreen
javascript: var v = document.getElementsByTagName("video"); var u = window.location.href; var t = v && v[0] && (v[0].currentTime | 0); var m = /v=(.+?)(&|$)/.exec(u); if (m && m[1]) { var r = document.getElementsByTagName("html")[0]; r.innerHTML = '<iframe width="854" height="480" src="https://www.youtube.com/embed/' + m[1] + '?autoplay=1&start=' + t + '" frameborder="0" allowfullscreen style="width: 100% !important; height: 100% !important; left: 0px !important; position: fixed !important; top: 0px !important; z-index: 9999;"></iframe>'; setTimeout(function () { u = u.replace(/&t=\d+/, ""); v = document.getElementsByTagName("iframe")[0].contentDocument.getElementsByTagName("video")[0]; setInterval(function () { history.replaceState(null, null, u + "&t=" + Math.floor(v && v.currentTime)); }, 5000); }, 10000); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment