Skip to content

Instantly share code, notes, and snippets.

@ethanbeyer
Created August 2, 2016 20:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ethanbeyer/787d326b8e4b24d43061cf54729f58c3 to your computer and use it in GitHub Desktop.
Save ethanbeyer/787d326b8e4b24d43061cf54729f58c3 to your computer and use it in GitHub Desktop.
Open Current YouTube in same tab as embed (so it's full screen)
javascript:(function(){
var video_id = window.location.search.split("v=")[1];
var ampersandPosition = video_id.indexOf("&");
var ytplayer = document.getElementById("movie_player");
var $time = ytplayer.getCurrentTime();
$time = Math.round($time);
if(ampersandPosition != -1) {
video_id = video_id.substring(0, ampersandPosition);
}
window.location.assign("http://youtube.com/embed/" + video_id + "?autoplay=1&start=" + $time);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment