-
-
Save tallykatt/93380e4caa4bdd61af9dc042b892a470 to your computer and use it in GitHub Desktop.
youtube unblocker bookmarklet
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%20s=document.createElement('script');s.setAttribute('src','https://code.jquery.com/jquery-2.1.1.min.js');s.setAttribute('type','text/javascript');document.getElementsByTagName('head')[0].appendChild(s);$jq=jQuery.noConflict();$jq("a").each(function(i,el){var%20href=$jq(el).attr("href");var%20matches=href?href.match(/youtube.com\/watch\?.*?v=([a-zA-Z0-9_\-]+)/):null;if(matches){$jq(el).attr("href","https://www.youtube-nocookie.com/embed/"+matches[1]);}});$jq("iframe").each(function(i,el){var%20src=$jq(el).attr("src");var%20matches=src?src.match(/youtube.com\/embed\/([a-zA-Z0-9_\-]+)\??/):null;if(matches){$jq(el).attr("src","https://www.youtube-nocookie.com/embed/"+matches[1]);}});})(); |
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
// http://ted.mielczarek.org/code/mozilla/bookmarklet.html | |
var s = document.createElement('script'); | |
s.setAttribute('src', 'https://code.jquery.com/jquery-2.1.1.min.js'); | |
s.setAttribute('type', 'text/javascript'); | |
document.getElementsByTagName('head')[0].appendChild(s); | |
$jq = jQuery.noConflict(); | |
$jq("a").each(function(i, el) { | |
var href = $jq(el).attr("href"); | |
var matches = href ? href.match(/youtube.com\/watch\?.*?v=([a-zA-Z0-9_\-]+)/) : null; | |
if (matches) { | |
$jq(el).attr("href", "https://www.youtube-nocookie.com/embed/" + matches[1]); | |
} | |
}); | |
$jq("iframe").each(function(i, el) { | |
var src = $jq(el).attr("src"); | |
var matches = src ? src.match(/youtube.com\/embed\/([a-zA-Z0-9_\-]+)\??/) : null; | |
if (matches) { | |
$jq(el).attr("src", "https://www.youtube-nocookie.com/embed/" + matches[1]); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment