Last active
February 17, 2023 08:56
-
-
Save lassekongo83/2c89bd38cf897f84b8423f78d5e9b415 to your computer and use it in GitHub Desktop.
Hides the app-drawer aka guide menu by default
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Hide youtube guide menu | |
// @namespace Violentmonkey Scripts | |
// @match https://www.youtube.com/* | |
// @grant none | |
// @version 1.0 | |
// @author - | |
// @description Hides the app-drawer aka guide menu by default | |
// ==/UserScript== | |
function hideGuide() { | |
'use strict'; | |
const appDrawer = document.querySelector('tp-yt-app-drawer#guide'); | |
if (window.location.pathname !== '/watch' && appDrawer !== null && appDrawer.hasAttribute('opened')) { | |
appDrawer.removeAttribute('opened'); | |
} | |
} | |
hideGuide(); | |
window.addEventListener('yt-navigate-finish', hideGuide); |
When used together with Tree Style Tab add-on for Firefox and "YouTube Video Preview and Ratings Keyless" script, going to fullscreen (during video preview) and back restores big guide menu on the left of channel page (in Home, Videos, Playlist tabs).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think in the
if
condition, we should check forappDawer
is not null, before accessinghasAttribute
, to avoid null pointer exception, e.g.