Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update animated-background.js #59

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ views: ...

### Step 1

Make sure you have [HACS](https://github.com/custom-components/hacs) installed, find Animated Background in the plug section, and install.
Make sure you have [HACS](https://github.com/custom-components/hacs) installed, add https://github.com/dreimer1986/lovelace-animated-background as custom repo and find Animated Background in the plug section, and install.

### Step 2

Expand Down
8 changes: 2 additions & 6 deletions dist/animated-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ var Panel_Holder;
var Hui;
var Lovelace;
var Animated_Config;
var View_Layout;
var Haobj = null;
var View;
var Debug_Mode = false;
Expand Down Expand Up @@ -56,7 +55,7 @@ function getVars() {
Root = Root && Root.shadowRoot;
Root = Root && Root.querySelector("home-assistant-main");
Root = Root && Root.shadowRoot;
Root = Root && Root.querySelector("app-drawer-layout partial-panel-resolver");
Root = Root && Root.querySelector("app-drawer-layout partial-panel-resolver, ha-drawer partial-panel-resolver");
Root = (Root && Root.shadowRoot) || Root;
Root = Root && Root.querySelector("ha-panel-lovelace");
if (Root) {
Expand All @@ -70,7 +69,6 @@ function getVars() {
if (Lovelace) {
Animated_Config = Lovelace.config.animated_background;
}
View_Layout = Root.shadowRoot.getElementById("layout");
View = Root.shadowRoot.getElementById("view");
}
}
Expand Down Expand Up @@ -535,15 +533,13 @@ function removeDefaultBackground(node, current_config) {
if (current_config.background) {
background = current_config.background;
}
if (node.style.background != background || View_Layout.style.background != 'transparent') {
if (node.style.background != background) {
node.style.background = background;
View_Layout.style.background = 'transparent';
}
}

//restores lovelace theme background
function restoreDefaultBackground(node) {
View_Layout.style.background = null;
node.style.background = null;
}

Expand Down