From 72653c1e930057c8d0fe3b31769b5bea4b269f79 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Fri, 21 Aug 2020 09:57:28 -0500 Subject: [PATCH] check for light theme before enabling particles --- static-data/www/shared/main/apicheck.js | 2 +- static-data/www/shared/main/stats.js | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/static-data/www/shared/main/apicheck.js b/static-data/www/shared/main/apicheck.js index fb89777e..323d4a21 100644 --- a/static-data/www/shared/main/apicheck.js +++ b/static-data/www/shared/main/apicheck.js @@ -23,7 +23,7 @@ async function doPing(){ PNotify.notice('Connection lost with API server') } apiOnline = false - }, 1000) + }, 10000) return await fetch('/ping', { headers: { "token": webpass diff --git a/static-data/www/shared/main/stats.js b/static-data/www/shared/main/stats.js index 0632cd02..446df900 100755 --- a/static-data/www/shared/main/stats.js +++ b/static-data/www/shared/main/stats.js @@ -156,9 +156,19 @@ fetch('/config/get/ui.animated_background', { if (resp == "false"){ return } - /* particlesJS.load(@dom-id, @path-json, @callback (optional)); */ - particlesJS.load('particles-js', '/shared/main/particles.json', function() { - console.debug('callback - particles.js config loaded') - }) + fetch('/config/get/ui.theme', { + headers: { + "token": webpass + }}) + .then((resp) => resp.text()) // Transform the data into text + .then(function(resp) { + if (resp == '"dark"'){ + /* particlesJS.load(@dom-id, @path-json, @callback (optional)); */ + particlesJS.load('particles-js', '/shared/main/particles.json', function() { + console.debug('callback - particles.js config loaded') + }) + } + } + ) } ) \ No newline at end of file