Skip to content

Instantly share code, notes, and snippets.

@internetimagery
Last active January 4, 2022 09:29
Show Gist options
  • Save internetimagery/f4790730f1205a3322b059944c4b606a to your computer and use it in GitHub Desktop.
Save internetimagery/f4790730f1205a3322b059944c4b606a to your computer and use it in GitHub Desktop.
Minimal Youtube switcher (Make a new bookmark and use the following minimized code as the content)
var url = new URL(window.location.href);
if (new RegExp("(www\\.)?youtube\\.com").test(url.hostname)) {
var newurl = url.protocol + "//minimal-yt.web.app" + url.pathname + url.search;
window.location.href = newurl
return
}
if (new RegExp("minimal\\-yt\\.web\\.app").test(url.hostname)) {
var newurl = url.protocol + "//youtube.com" + url.pathname + url.search;
window.location.href = newurl
return
}
alert("Not a youtube or minimal-yt URL. Go to a video and then try again.");
javascript:void%20function(){var%20o=new%20URL(window.location.href);if(new%20RegExp(%22(www\\.)%3Fyoutube\\.com%22).test(o.hostname)){var%20t=o.protocol+%22//minimal-yt.web.app%22+o.pathname+o.search;return%20void(window.location.href=t)}if(new%20RegExp(%22minimal\\-yt\\.web\\.app%22).test(o.hostname)){var%20t=o.protocol+%22//youtube.com%22+o.pathname+o.search;return%20void(window.location.href=t)}alert(%22Not%20a%20youtube%20or%20minimal-yt%20URL.%20Go%20to%20a%20video%20and%20then%20try%20again.%22)}();
@internetimagery
Copy link
Author

To use. Make a new bookmark. Copy paste the bookmark.min.js as the bookmarks url. Then from youtube / minimal-yt the bookmark will switch between for distractionless viewing (or distractioned viewing if preferred).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment