diff --git a/kiosk-mode.js b/kiosk-mode.js index 240d1d6..38afacc 100644 --- a/kiosk-mode.js +++ b/kiosk-mode.js @@ -89,10 +89,13 @@ class KioskMode { const huiRoot = lovelace.shadowRoot.querySelector("hui-root").shadowRoot; const drawerLayout = this.main.querySelector("app-drawer-layout"); const appToolbar = huiRoot.querySelector("app-toolbar"); + const overflowStyle = "ha-button-menu{display:none !important;}"; + const headerStyle = "#view{min-height:100vh !important;--header-height:0;}app-header{display:none;}"; - if (this.hideHeader) { - this.addStyle("#view{min-height:100vh !important;--header-height:0;}app-header{display:none;}", huiRoot); - if (this.queryString("cache")) this.setCache("kmHeader", "true"); + if (this.hideHeader || this.hideOverflow) { + this.addStyle(`${this.hideheader ? headerStyle : ""}${this.hideOverflow ? overflowStyle : ""}`, huiRoot); + if (this.hideHeader && this.queryString("cache")) this.setCache("kmHeader", "true"); + if (this.hideOverflow && this.queryString("cache")) this.setCache("kmOverflow", "true"); } else { this.removeStyle(huiRoot); } @@ -104,13 +107,6 @@ class KioskMode { } else { this.removeStyle([appToolbar, drawerLayout]); } - - if (this.hideOverflow) { - this.addStyle("ha-button-menu{display:none !important;}", huiRoot); - if (this.queryString("cache")) this.setCache("kmOverflow", "true"); - } else { - this.removeStyle(appToolbar); - } // Resize window to "refresh" view. window.dispatchEvent(new Event("resize"));