Skip to content

Commit

Permalink
fixed state change bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Villhellm authored May 3, 2020
1 parent 447d818 commit 5f4dc3c
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions dist/animated-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,18 @@ let previous_state;
let previous_entity;
let previous_url;

function getHaobj(skip) {
//main function
function run() {
get_vars();

console.log("Animated Background: Starting");

document.querySelector("home-assistant").provideHass({
set hass(value) {
haobj = value;
if (skip != true) {
renderBackgroundHTML();
}
}
});
}

//main function
function run() {
get_vars();

console.log("Animated Background: Starting");

viewObserver.disconnect();
viewObserver.observe(view, {
Expand Down Expand Up @@ -244,9 +240,11 @@ function removeDefaultBackground() {
else {
viewNode = root.shadowRoot.getElementById("view");
viewNode = viewNode.querySelector("hui-panel-view");
if (configured() && enabled(haobj)) {
viewNode.style.background = 'transparent';
viewLayout.style.background = 'transparent';
if (!isNullOrUndefined(viewNode)) {
if (configured() && enabled(haobj)) {
viewNode.style.background = 'transparent';
viewLayout.style.background = 'transparent';
}
}
}
}
Expand Down Expand Up @@ -293,7 +291,7 @@ function currentViewEnabled() {
//main render function
function renderBackgroundHTML() {
if (haobj == null) {
getHaobj(true);
return;
}
if (!enabled(haobj)) {
return;
Expand Down

0 comments on commit 5f4dc3c

Please sign in to comment.