Created
October 15, 2015 19:23
-
-
Save willstott101/840ee3867d65901f981f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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