Skip to content

Instantly share code, notes, and snippets.

@dale3h
Last active November 8, 2020 02:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dale3h/e60b237084eca8434b37ca2e45158b2d to your computer and use it in GitHub Desktop.
Save dale3h/e60b237084eca8434b37ca2e45158b2d to your computer and use it in GitHub Desktop.
[Userscript] Home Assistant Sidebar Concealer
// ==UserScript==
// @name Home Assistant Sidebar Concealer
// @namespace https://dale3h.com
// @version 0.1.0
// @icon https://raw.githubusercontent.com/home-assistant/assets/master/logo-round.svg
// @match https://example.duckdns.org/a0d7b954_vscode*
// @match https://example.duckdns.org/a0d7b954_adguard*
// ==/UserScript==
let counter = 0;
if (window.location.href.indexOf('bypass') === -1) {
let mainTimer = setInterval(() => {
if (++counter > 5) {
return clearInterval(mainTimer);
}
try {
let main = document
.querySelector("body > home-assistant").shadowRoot
.querySelector("home-assistant-main");
if (main) {
clearInterval(mainTimer);
main.shadowRoot
.querySelector("#drawer")
.style.display = "none";
main.style.setProperty("--app-drawer-width", 0);
}
} catch (err) {
// DOM is not fully loaded yet.
}
}, 100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment