diff options
| author | Tim Keller <tjk@tjkeller.xyz> | 2026-09-21 23:18:15 -0500 |
|---|---|---|
| committer | Tim Keller <tjk@tjkeller.xyz> | 2026-09-21 23:18:15 -0500 |
| commit | b88ff9fe8e80cc4d8aa0db2a3595ab10f40f4439 (patch) | |
| tree | 234e442aaaff83d1a50fb15998690dc4f0bfe6c6 /youtube | |
| parent | 531a76993e2babcecc69be7b5333729078c8dd9b (diff) | |
| download | userscripts-b88ff9fe8e80cc4d8aa0db2a3595ab10f40f4439.tar.xz userscripts-b88ff9fe8e80cc4d8aa0db2a3595ab10f40f4439.zip | |
move all scripts to scripts dir
Diffstat (limited to 'youtube')
| -rw-r--r-- | youtube/disable-mini-player.user.js | 35 | ||||
| -rw-r--r-- | youtube/embedtube-button.user.js | 65 | ||||
| -rw-r--r-- | youtube/remove-home-shorts.user.js | 64 |
3 files changed, 0 insertions, 164 deletions
diff --git a/youtube/disable-mini-player.user.js b/youtube/disable-mini-player.user.js deleted file mode 100644 index fea5f1f..0000000 --- a/youtube/disable-mini-player.user.js +++ /dev/null @@ -1,35 +0,0 @@ -// ==UserScript== -// @name Disable YouTube Miniplayer -// @author tjkeller.xyz -// @include *youtube.com* -// @grant GM_addStyle -// @homepageURL https://git.tjkeller.xyz/userscripts/about -// @downloadURL https://git.tjkeller.xyz/userscripts/plain/youtube/disable-mini-player.user.js -// @version 1.1 -// @author tjkeller.xyz -// ==/UserScript== - -// Remove home and shorts button -GM_addStyle(` - ytd-miniplayer, - .ytp-miniplayer-button - { - display: none !important; /* Needs !important flag */ - } -`) - - -// Pause video before navigating -document.body.addEventListener("yt-navigate-start", () => { - if (window.location.pathname == "/watch") - document.querySelector("ytd-player video").pause() -}) - -// Close miniplayer by clicking close button in code -document.body.addEventListener("yt-navigate-finish", () => { - setTimeout(() => { - const miniplayerCloseButton = document.querySelector("button.ytp-miniplayer-close-button") - if (miniplayerCloseButton) - miniplayerCloseButton.click() - }, 500) // Wait 500ms to close consistantly since miniplayer loads a little after this event -}) diff --git a/youtube/embedtube-button.user.js b/youtube/embedtube-button.user.js deleted file mode 100644 index 6f50e31..0000000 --- a/youtube/embedtube-button.user.js +++ /dev/null @@ -1,65 +0,0 @@ -// ==UserScript== -// @name Redirect to EmbedTube -// @namespace Violentmonkey Scripts -// @match https://www.youtube.com/* -// @grant GM_addStyle -// @homepageURL https://git.tjkeller.xyz/userscripts/about -// @downloadURL https://git.tjkeller.xyz/userscripts/plain/youtube/embedtube-button.user.js -// @version 1.1 -// @author tjkeller.xyz -// @description 3/9/2024, 8:38:47 PM -// ==/UserScript== - -/* Config */ -const instanceHostname = "yt.tjkeller.xyz" -const instanceProtocol = "https:" -const instanceIconLogo = "/static/favicon.svg" - -const instanceUrl = `${instanceProtocol}//${instanceHostname}` - -const redirectButtonId = "embedtube-button" - -GM_addStyle(` - a#${redirectButtonId} button { - background-color: #272727; - border-radius: 18px; - border: none; - color: white; - cursor: pointer; - display: flex; - font-family: "Roboto","Arial",sans-serif; - font-weight: 500; - height: 36px; - padding: .25em 1em .25em .65em; - text-decoration: none; - } - a#${redirectButtonId} button:hover { background-color: #3f3f3f; } - a#${redirectButtonId} button * { align-self: center; max-height: 100%; } -`) - - -function newUrl() { - return `${instanceProtocol}//${instanceHostname}${document.location.pathname}${document.location.search}` -} - -if (!document.getElementById(redirectButtonId)) { - const redirectButton = document.createElement("a") - const redirectButtonC = redirectButton.appendChild(document.createElement("button")) - const redirectButtonImg = redirectButtonC.appendChild(document.createElement("img")) - const redirectButtonTxt = redirectButtonC.appendChild(document.createElement("span")) - redirectButton.id = redirectButtonId - redirectButtonImg.src = instanceUrl + instanceIconLogo - redirectButtonImg.alt = "(Down)" // Logo effectively acts as a test to see whether the instance is up or not as a bonus - redirectButtonTxt.innerText = "EmbedTube" - - redirectButton.addEventListener("mouseover", () => { redirectButton.href = newUrl() }) - - /* Insert */ - document.body.addEventListener("yt-navigate-finish", () => { - - setTimeout(() => { - const headContainer = document.querySelector("#masthead-container #container #start") - headContainer.appendChild(redirectButton) - }, 500) // Wait 500ms for page load to finish after event called - }) -} diff --git a/youtube/remove-home-shorts.user.js b/youtube/remove-home-shorts.user.js deleted file mode 100644 index a028817..0000000 --- a/youtube/remove-home-shorts.user.js +++ /dev/null @@ -1,64 +0,0 @@ -// ==UserScript== -// @name Remove youtube home and shorts -// @namespace Violentmonkey Scripts -// @include *youtube.com* -// @grant GM_addStyle -// @homepageURL https://git.tjkeller.xyz/userscripts/about -// @downloadURL https://git.tjkeller.xyz/userscripts/plain/youtube/embedtube-button.user.js -// @version 1.1 -// @author tjkeller.xyz -// @description 9/21/2023, 9:44:13 AM -// @license MIT -// ==/UserScript== - - -// Remove home and shorts button -GM_addStyle(` - tp-yt-app-drawer a[title=Home], - tp-yt-app-drawer a[title=Shorts], - ytd-mini-guide-renderer a[title=Home], - ytd-mini-guide-renderer a[title=Shorts] - { - display: none !important; /* Needs !important flag */ - } -`) - - -// Subscriptions page is new homepage -const subscriptionsPath = "/feed/subscriptions" - -function redirectToSubscriptions() { - // Invoke clicking the subscriptions button to use youtube's hot page reloading if possible instead of reloading the whole page - const subscriptionsButton = document.querySelector("tp-yt-app-drawer a[title=Subscriptions]") - if (subscriptionsButton) - subscriptionsButton.click() - else - window.location.replace(subscriptionsPath) -} - - -// Redirect to new homepage -function redirectIfHome() { - if (window.location.pathname === "/") - redirectToSubscriptions() -} - -redirectIfHome() -window.addEventListener("popstate", redirectIfHome) -//document.body.addEventListener("yt-navigate-finish", redirectIfHome) - - -// Youtube logo navigate to subscriptions -/* Needs to be done safely in case youtube changes and also because it throws - * an error otherwise because violentmonkey seems to load the script twice */ - -const logo = document.querySelector("#logo a") -if (logo) { - logo.href = subscriptionsPath - logo.addEventListener("click", e => { - // Seems there is an event listener that forces redirect to site root, so stop that first - e.stopPropagation() - e.preventDefault() - redirectToSubscriptions() - }) -} |
