Instantly go full screen and skip ads with this bookmarklet. Drag this link to your bookmarks bar. Next time you’re on YouTube, click this and your tab will switch to a full screen popup, basically, and skip the ads.
Here's the JS if you want to copy and paste it into a new bookmark:
javascript:(function(){function getYouTubeId(url){const patterns=[/(?:youtube\\.com\\/(?:[^\\/]+\\/.+\\/|(?:v|e(?:mbed)?)\\/|.*[?&]v=)|youtu\\.be\\/|youtube\\.com\\/shorts\\/)([^"&?\\/\\s]{11})/i,/youtube\\.com\\/live\\/([^"&?\\/\\s]{11})/i];for (let pattern of patterns){const match=url.match(pattern);if (match&&match[1]){return match[1];}}return null;}const videoId=getYouTubeId(window.location.href);if(videoId){window.location.href='<https://www.youtube.com/embed/'+videoId;}else{alert('No> valid YouTube video ID found!');}})();
Here’s the code in a more readable format for the curious:
javascript:(function(){
function getYouTubeId(url) {
// Match patterns for different YouTube URL formats
const patterns = [
/(?:youtube\\.com\\/(?:[^\\/]+\\/.+\\/|(?:v|e(?:mbed)?)\\/|.*[?&]v=)|youtu\\.be\\/|youtube\\.com\\/shorts\\/)([^"&?\\/\\s]{11})/i,
/youtube\\.com\\/live\\/([^"&?\\/\\s]{11})/i
];
for (let pattern of patterns) {
const match = url.match(pattern);
if (match && match[1]) {
return match[1];
}
}
return null;
}
const videoId = getYouTubeId(window.location.href);
if (videoId) {
window.location.href = '<https://www.youtube.com/embed/>' + videoId;
} else {
alert('No valid YouTube video ID found!');
}
})();
··· ◂◈▸ ···