Skip to content

Instantly share code, notes, and snippets.

@lassekongo83
Last active February 17, 2023 08:56
Show Gist options
  • Save lassekongo83/2c89bd38cf897f84b8423f78d5e9b415 to your computer and use it in GitHub Desktop.
Save lassekongo83/2c89bd38cf897f84b8423f78d5e9b415 to your computer and use it in GitHub Desktop.
Hides the app-drawer aka guide menu by default
// ==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);
@ngoclong19
Copy link

ngoclong19 commented Nov 24, 2021

I think in the if condition, we should check for appDawer is not null, before accessing hasAttribute, to avoid null pointer exception, e.g.

if (window.location.pathname !== '/watch' && appDrawer !== null && appDrawer.hasAttribute('opened'))

@Juggernaut99
Copy link

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