Last active
July 27, 2023 14:10
-
-
Save evanreichard/8db561c7be7a6c308db18ce3e983c8d6 to your computer and use it in GitHub Desktop.
yattee-redirect.user.js
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
// ==UserScript== | |
// @name Yattee Redirect | |
// @version 0.0.3 | |
// @updateURL https://gist.github.com/evanreichard/8db561c7be7a6c308db18ce3e983c8d6/raw/yattee-redirect.user.js | |
// @match https://www.youtube.com/* | |
// @match https://m.youtube.com/* | |
// @grant none | |
// @noframes | |
// @run-at document-start | |
// ==/UserScript== | |
function attemptRedirect(){ | |
if (document.location.pathname == "/watch") { | |
let newPath = document.location.href.split("https://" + document.location.host + "/")[1]; | |
document.location.href = "yattee://" + newPath | |
} | |
} | |
var pushState = history.pushState; | |
history.pushState = function () { | |
pushState.apply(history, arguments); | |
attemptRedirect(); | |
}; | |
attemptRedirect(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment