Skip to content

Instantly share code, notes, and snippets.

@AccaliaDeElementia
Created February 24, 2017 14:17
Show Gist options
  • Save AccaliaDeElementia/df36be28c0bcb9845bbdc7e4226101e3 to your computer and use it in GitHub Desktop.
Save AccaliaDeElementia/df36be28c0bcb9845bbdc7e4226101e3 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name YoutubeEmbedder
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Accalia <accalia@elementia.me>
// @match https://www.youtube.com/watch*
// @match http://www.youtube.com/watch*
// @grant none
// ==/UserScript==
(function() {
'use strict';
var protocol = location.protocol;
var videoIdSearch = /v=([^&]+)(&|$)/.exec(location.search);
var videoId = (videoIdSearch || [])[1];
if (!videoId) {
return;
}
var destination = `${protocol}//www.youtube.com/embed/${videoId}`;
location.replace(destination);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment