Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[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