Files
userscripts/scripts/yattee-redirect.user.js
T

25 lines
700 B
JavaScript

// ==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();