2022-03-18 15:57:34 +00:00
|
|
|
// ==UserScript==
|
|
|
|
// @name NoShorts for YouTube
|
2022-03-18 16:04:58 +00:00
|
|
|
// @description Redirects Shorts to normal video webpage
|
2022-03-18 15:57:34 +00:00
|
|
|
// @namespace tretrauit-dev
|
2022-03-18 16:52:39 +00:00
|
|
|
// @match *://*.youtube.com/*
|
2022-03-18 16:04:58 +00:00
|
|
|
// @exclude-match`*://music.youtube.com/*
|
2022-03-18 17:02:47 +00:00
|
|
|
// @icon https://upload.wikimedia.org/wikipedia/commons/f/fc/Youtube_shorts_icon.svg
|
2022-03-18 15:57:34 +00:00
|
|
|
// @grant none
|
2022-03-18 17:02:47 +00:00
|
|
|
// @version 1.2.1
|
2022-03-18 15:57:34 +00:00
|
|
|
// @author tretrauit
|
|
|
|
// @description 22:36:53, 18/3/2022
|
2022-03-18 16:52:39 +00:00
|
|
|
// @require https://raw.githubusercontent.com/naugtur/insertionQuery/master/insQ.min.js
|
2022-03-18 15:57:34 +00:00
|
|
|
// @homepageURL https://gitlab.com/tretrauit/scripts
|
|
|
|
// @supportURL https://gitlab.com/tretrauit/scripts/-/issues
|
2022-03-18 15:59:52 +00:00
|
|
|
// @downloadURL https://gitlab.com/tretrauit/scripts/-/raw/main/userscripts/yt-noshorts.user.js
|
2022-03-18 15:57:34 +00:00
|
|
|
// ==/UserScript==
|
|
|
|
|
2022-03-18 16:52:39 +00:00
|
|
|
function getShortsId(videoPathname)
|
2022-03-18 15:57:34 +00:00
|
|
|
{
|
2022-03-18 16:52:39 +00:00
|
|
|
const shortPath = videoPathname.split("/")
|
|
|
|
return shortPath[shortPath.length - 1]
|
2022-03-18 15:57:34 +00:00
|
|
|
}
|
2022-03-18 16:52:39 +00:00
|
|
|
|
|
|
|
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.")
|