From 5ad4c4cf7712f7304a5c7206188c344145f562e1 Mon Sep 17 00:00:00 2001 From: Jean Gauthier Date: Tue, 15 Sep 2020 21:00:03 -0400 Subject: [PATCH 1/4] Update custom-ui.js Fixing warning popping into log (uncaught typeerror: data.push is not a function) --- custom-ui.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/custom-ui.js b/custom-ui.js index 773a5ff..4cd9657 100644 --- a/custom-ui.js +++ b/custom-ui.js @@ -1309,12 +1309,14 @@ console.info( if (!t) return void window.setTimeout(window.customUI.updateConfigPanel, 100); const e = window.customUI.getElementHierarchy(t, ["ha-config-dashboard", "ha-config-navigation"]); - e && (e.localize && !e.cuiPatch && (e.cuiPatch = !0, e._originalComputeLoaded = e._computeLoaded, e._originalComputeCaption = e._computeCaption, e._originalComputeDescription = e._computeDescription, e._computeLoaded = ((t, s) => "customui" === s || e._originalComputeLoaded(t, s)), e._computeCaption = ((t, s) => "customui" === t ? "Custom UI" : e._originalComputeCaption(t, s)), e._computeDescription = ((t, s) => "customui" === t ? "SetUI tweaks" : e._originalComputeDescription(t, s))), e.pages.some(t => "customui" === t || "customui" === t.domain) || e.push("pages", e.localize ? "customui" : { - domain: "customui", - caption: "Custom UI", - description: "Set UI tweaks.", - loaded: !0 - })); + try { + e && (e.localize && !e.cuiPatch && (e.cuiPatch = !0, e._originalComputeLoaded = e._computeLoaded, e._originalComputeCaption = e._computeCaption, e._originalComputeDescription = e._computeDescription, e._computeLoaded = ((t, s) => "customui" === s || e._originalComputeLoaded(t, s)), e._computeCaption = ((t, s) => "customui" === t ? "Custom UI" : e._originalComputeCaption(t, s)), e._computeDescription = ((t, s) => "customui" === t ? "SetUI tweaks" : e._originalComputeDescription(t, s))), e.pages.some(t => "customui" === t || "customui" === t.domain) || e.push("pages", e.localize ? "customui" : { + domain: "customui", + caption: "Custom UI", + description: "Set UI tweaks.", + loaded: !0 + })); + } catch (err) {} const s = () => { const e = document.createElement("ha-config-custom-ui"); return e.isWide = t.isWide, From e23bdbce6cb997c801397d008168083b911a80b8 Mon Sep 17 00:00:00 2001 From: Jean Gauthier Date: Tue, 15 Sep 2020 21:03:25 -0400 Subject: [PATCH 2/4] Update custom-ui.js Fix warning popping into log (Uncaught TypeError: Cannot read property 'state' of undefined, or Uncaught TypeError: Cannot read property 'attribute' of undefined) --- custom-ui.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom-ui.js b/custom-ui.js index 4cd9657..9013b91 100644 --- a/custom-ui.js +++ b/custom-ui.js @@ -1521,9 +1521,9 @@ console.info( try { return new Function("hass", "entities", "entity", "attributes", "attribute", "state", r)(e, s, i, n, a, o) } catch (t) { - if (t instanceof SyntaxError || t instanceof ReferenceError) + /*if (t instanceof SyntaxError || t instanceof ReferenceError) return console.warn(`${t.name}: ${t.message} in template ${r}`), null; - throw t + throw t*/ } } }, From 0a4baf5b5bac743484a9aff510b9209b261c597c Mon Sep 17 00:00:00 2001 From: Jean Gauthier Date: Tue, 15 Sep 2020 21:07:47 -0400 Subject: [PATCH 3/4] Update custom-ui.js Change revision date --- custom-ui.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/custom-ui.js b/custom-ui.js index 9013b91..9f50096 100644 --- a/custom-ui.js +++ b/custom-ui.js @@ -1,5 +1,5 @@ console.info( -`%c CUSTOM-UI (JS) \n%c Version 20200720 adapted for HA110+ `, +`%c CUSTOM-UI (JS) \n%c Version 20200915 adapted for HA110+ `, 'color: orange; font-weight: bold; background: black', 'color: white; font-weight: bold; background: dimgray', ); !function (t) { @@ -1501,9 +1501,9 @@ console.info( return; window.customUI.installClassHooks(); const t = window.customUI.lightOrShadow(document, "home-assistant"); - t.hass && t.hass.states ? (window.customUI.initDone = !0, window.customUI.runHooks(), window.addEventListener("location-changed", window.setTimeout.bind(null, window.customUI.runHooks, 100)), console.log("Loaded CustomUI JS 20200720 adapted for HA 110.+"), window.addEventListener("hass-more-info", window.customUI.updateMoreInfo), window.CUSTOM_UI_LIST || (window.CUSTOM_UI_LIST = []), window.CUSTOM_UI_LIST.push({ + t.hass && t.hass.states ? (window.customUI.initDone = !0, window.customUI.runHooks(), window.addEventListener("location-changed", window.setTimeout.bind(null, window.customUI.runHooks, 100)), console.log("Loaded CustomUI JS 20200915 adapted for HA 110.+"), window.addEventListener("hass-more-info", window.customUI.updateMoreInfo), window.CUSTOM_UI_LIST || (window.CUSTOM_UI_LIST = []), window.CUSTOM_UI_LIST.push({ name: "CustomUI", - version: "JS 20200720 adapted for HA 110.+", + version: "JS 20200915 adapted for HA 110.+", url: "https://github.com/Mariusthvdb/custom-ui" })) : window.setTimeout(window.customUI.init, 1e3) }, From 267f1aa6c892bd5d7ea84785037ae2167fdd0887 Mon Sep 17 00:00:00 2001 From: Jean Gauthier Date: Wed, 16 Sep 2020 08:08:48 -0400 Subject: [PATCH 4/4] Update custom-ui.js Cancel the fix for 'state' or 'attribute' underfined --- custom-ui.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom-ui.js b/custom-ui.js index 9f50096..1d71456 100644 --- a/custom-ui.js +++ b/custom-ui.js @@ -1521,9 +1521,9 @@ console.info( try { return new Function("hass", "entities", "entity", "attributes", "attribute", "state", r)(e, s, i, n, a, o) } catch (t) { - /*if (t instanceof SyntaxError || t instanceof ReferenceError) + if (t instanceof SyntaxError || t instanceof ReferenceError) return console.warn(`${t.name}: ${t.message} in template ${r}`), null; - throw t*/ + throw t } } },