aboutsummaryrefslogtreecommitdiff
path: root/youtube/disable-mini-player.user.js
diff options
context:
space:
mode:
authorTim Keller <tjkeller.xyz>2024-11-17 22:36:53 -0600
committerTim Keller <tjkeller.xyz>2024-11-17 22:36:53 -0600
commit6bb49cc16cbf03d4e0980c2343372ff20d0a4b55 (patch)
tree38b659a6081e639cce5bd4503886370a75c5c770 /youtube/disable-mini-player.user.js
parentd7484069764fe74654fe5e7721919462bc1286d2 (diff)
downloaduserscripts-6bb49cc16cbf03d4e0980c2343372ff20d0a4b55.tar.xz
userscripts-6bb49cc16cbf03d4e0980c2343372ff20d0a4b55.zip
rename all scripts to have .user.js ext
Diffstat (limited to 'youtube/disable-mini-player.user.js')
-rw-r--r--youtube/disable-mini-player.user.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/youtube/disable-mini-player.user.js b/youtube/disable-mini-player.user.js
new file mode 100644
index 0000000..126a6a7
--- /dev/null
+++ b/youtube/disable-mini-player.user.js
@@ -0,0 +1,31 @@
+// ==UserScript==
+// @name Disable YouTube Miniplayer
+// @author tjkeller.xyz
+// @include *youtube.com*
+// @grant GM_addStyle
+// ==/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
+})