From b36ea1b145a32532276b8c20bdaed7588635d463 Mon Sep 17 00:00:00 2001 From: Ryan Meek <25127328+maykar@users.noreply.github.com> Date: Wed, 30 Jun 2021 10:55:03 -0400 Subject: [PATCH] Fix add/remove files for overflow menu --- kiosk-mode.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) 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"));