Skip to content

Instantly share code, notes, and snippets.

@willstott101
Created October 15, 2015 19:23
Show Gist options
  • Save willstott101/840ee3867d65901f981f to your computer and use it in GitHub Desktop.
Save willstott101/840ee3867d65901f981f to your computer and use it in GitHub Desktop.
javascript:(function() {
var videoId = /[&?]v=(\w+)/g.exec(window.location.search);
if (videoId) {
videoId = videoId[1];
window.location.href = window.location.origin + '/embed/' + videoId + '?autoplay=1';
} else {
videoId = /\/embed\/(\w+)/g.exec(window.location.pathname);
if (!videoId)
alert("You're not on a video page dumbass.");
videoId = videoId[1];
window.location.href = window.location.origin + '/watch?v=' + videoId;
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment