Last active
January 4, 2022 09:29
-
-
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)
This file contains hidden or 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
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."); |
This file contains hidden or 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: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)}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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).