Update yt-noshorts.user.js

This commit is contained in:
tretrauit 2022-03-18 16:52:39 +00:00
parent 86b008caaa
commit 61f6323643

View File

@ -2,22 +2,53 @@
// @name NoShorts for YouTube // @name NoShorts for YouTube
// @description Redirects Shorts to normal video webpage // @description Redirects Shorts to normal video webpage
// @namespace tretrauit-dev // @namespace tretrauit-dev
// @match *://*.youtube.com/shorts/* // @match *://*.youtube.com/*
// @exclude-match`*://music.youtube.com/* // @exclude-match`*://music.youtube.com/*
// @grant none // @grant none
// @version 1.1.1 // @version 1.2
// @author tretrauit // @author tretrauit
// @description 22:36:53, 18/3/2022 // @description 22:36:53, 18/3/2022
// @require https://raw.githubusercontent.com/naugtur/insertionQuery/master/insQ.min.js
// @homepageURL https://gitlab.com/tretrauit/scripts // @homepageURL https://gitlab.com/tretrauit/scripts
// @supportURL https://gitlab.com/tretrauit/scripts/-/issues // @supportURL https://gitlab.com/tretrauit/scripts/-/issues
// @downloadURL https://gitlab.com/tretrauit/scripts/-/raw/main/userscripts/yt-noshorts.user.js // @downloadURL https://gitlab.com/tretrauit/scripts/-/raw/main/userscripts/yt-noshorts.user.js
// @noframes
// ==/UserScript== // ==/UserScript==
console.log("Fuck you YouTube") function getShortsId(videoPathname)
// Make sure our script won't die because const
{ {
const shortPath = window.location.pathname.split("/") const shortPath = videoPathname.split("/")
const shortId = shortPath[shortPath.length - 1] return shortPath[shortPath.length - 1]
window.location.replace("https://www.youtube.com/watch?v=" + shortId)
} }
function redirect()
{
window.location.replace("https://www.youtube.com/watch?v=" + getShortsId(window.location.pathname))
}
function replaceHrefURL(element)
{
if (element.href.includes("/shorts/"))
{
element.href = "/watch?v=" + getShortsId(element.href)
}
}
function checkCurrentURL()
{
if (window.location.pathname.includes("/shorts/"))
{
redirect()
}
}
function checkElements()
{
insertionQ(':is(#video-title, #thumbnail) ').every(function(element){
replaceHrefURL(element)
});
}
window.addEventListener('yt-navigate-finish', checkCurrentURL)
checkCurrentURL()
checkElements()
console.log("Fuck you YouTube - NoShorts loaded.")