Skip to content

Commit

Permalink
minor message changes and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Latourelle authored and Will Latourelle committed Jun 17, 2020
1 parent d02735a commit 35a1700
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions dist/animated-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ function renderBackgroundHTML() {
if (current_config.state_url[current_state]) {
if (Previous_State != current_state) {
View_Loaded = false;
STATUS_MESSAGE("Configured entity " + current_config.entity + " is now " + current_state, true);
DEBUG_MESSAGE("Configured entity " + current_config.entity + " is now " + current_state, true);
if (current_config.state_url) {
var url = current_config.state_url[current_state];
if (Array.isArray(url)) {
Expand Down Expand Up @@ -429,11 +429,11 @@ function renderBackgroundHTML() {
var bg = Hui.shadowRoot.getElementById("background-iframe");
var video_type = urlIsVideo(state_url);
var doc_body;
if(video_type){
if (video_type) {
doc_body = `<video id='cinemagraph' autoplay='' loop='' preload='' playsinline='' muted='' poster=''><source src='${state_url}' type='video/${video_type}'></video>`
}
else{
doc_body = `<img src='${state_url}'>`
else {
doc_body = `<img src='${state_url}'>`
}
var source_doc = `
<html>
Expand Down Expand Up @@ -515,11 +515,11 @@ function renderBackgroundHTML() {
}
}

function urlIsVideo(url){
if(url.slice(url.length - 3).toLowerCase() == "mp4" || url.slice(url.length - 4).toLowerCase() == "webm"){
function urlIsVideo(url) {
if (url.slice(url.length - 3).toLowerCase() == "mp4" || url.slice(url.length - 4).toLowerCase() == "webm") {
return url.slice(url.length - 3).toLowerCase();
}
if(url.slice(url.length - 4).toLowerCase() == "webm"){
if (url.slice(url.length - 4).toLowerCase() == "webm") {
return url.slice(url.length - 4).toLowerCase();
}
return false;
Expand All @@ -528,7 +528,7 @@ function urlIsVideo(url){
//removes lovelace theme background
function removeDefaultBackground(node, current_config) {
var background = 'transparent';
if(current_config.background){
if (current_config.background) {
background = current_config.background;
}
if (node.style.background != background || View_Layout.style.background != 'transparent') {
Expand Down Expand Up @@ -623,11 +623,13 @@ function run() {
STATUS_MESSAGE("Starting");
DEBUG_MESSAGE("Starting, Debug mode enabled");
if (!Loaded) {
if (!currentConfig() && Debug_Mode) {
DEBUG_MESSAGE("No configuration found for this view");
}
else {
STATUS_MESSAGE("No configuration found for this dashboard");
if (!currentConfig()) {
if (Debug_Mode) {
DEBUG_MESSAGE("No configuration found");
}
else {
STATUS_MESSAGE("No configuration found");
}
}
}

Expand Down

0 comments on commit 35a1700

Please sign in to comment.