Update yt-noshorts.user.js
This commit is contained in:
parent
86b008caaa
commit
61f6323643
@ -2,22 +2,53 @@
|
||||
// @name NoShorts for YouTube
|
||||
// @description Redirects Shorts to normal video webpage
|
||||
// @namespace tretrauit-dev
|
||||
// @match *://*.youtube.com/shorts/*
|
||||
// @match *://*.youtube.com/*
|
||||
// @exclude-match`*://music.youtube.com/*
|
||||
// @grant none
|
||||
// @version 1.1.1
|
||||
// @version 1.2
|
||||
// @author tretrauit
|
||||
// @description 22:36:53, 18/3/2022
|
||||
// @require https://raw.githubusercontent.com/naugtur/insertionQuery/master/insQ.min.js
|
||||
// @homepageURL https://gitlab.com/tretrauit/scripts
|
||||
// @supportURL https://gitlab.com/tretrauit/scripts/-/issues
|
||||
// @downloadURL https://gitlab.com/tretrauit/scripts/-/raw/main/userscripts/yt-noshorts.user.js
|
||||
// @noframes
|
||||
// ==/UserScript==
|
||||
|
||||
console.log("Fuck you YouTube")
|
||||
// Make sure our script won't die because const
|
||||
function getShortsId(videoPathname)
|
||||
{
|
||||
const shortPath = window.location.pathname.split("/")
|
||||
const shortId = shortPath[shortPath.length - 1]
|
||||
window.location.replace("https://www.youtube.com/watch?v=" + shortId)
|
||||
const shortPath = videoPathname.split("/")
|
||||
return shortPath[shortPath.length - 1]
|
||||
}
|
||||
|
||||
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.")
|
||||
|
Loading…
Reference in New Issue
Block a user