From f10a9d7f617184372685363602e8d37962b49cb6 Mon Sep 17 00:00:00 2001 From: Woody <27882680+WoodyLetsCode@users.noreply.github.com> Date: Mon, 21 Dec 2020 21:12:07 +0100 Subject: [PATCH] random bg image --- wled00/data/settings_ui.htm | 24 ++++++++++++++++++++++-- wled00/html_settings.h | 10 ++++++---- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/wled00/data/settings_ui.htm b/wled00/data/settings_ui.htm index 90beb592..7505e034 100644 --- a/wled00/data/settings_ui.htm +++ b/wled00/data/settings_ui.htm @@ -27,7 +27,8 @@ "tab":"Button opacity" }, "bg":{ - "url":"BG image URL" + "url":"BG image URL", + "random":"Random BG image" }, "color":{ "bg":"BG HEX color" @@ -163,6 +164,24 @@ var f = gId('theme_base'); if (f) f.value = (gId('dm').checked) ? 'light':'dark'; } + + // random BG image + function setRandomBg() { + if (gId("theme_bg_random").checked) { + gId("theme_bg_url").value = "https://picsum.photos/1920/1080"; + } else { + gId("theme_bg_url").value = ""; + } + + } + function checkRandomBg() { + if (gId("theme_bg_url").value === "https://picsum.photos/1920/1080") { + gId("theme_bg_random").checked = true; + } else { + gId("theme_bg_random").checked = false; + } + } + function GetV() { } @@ -197,7 +216,8 @@ :
:
:
- BG image URL: + BG image URL:
+ Random BG image:

diff --git a/wled00/html_settings.h b/wled00/html_settings.h index 2afdab8e..b6c7297f 100644 --- a/wled00/html_settings.h +++ b/wled00/html_settings.h @@ -168,7 +168,7 @@ const char PAGE_settings_dmx[] PROGMEM = R"=====()====="; // Autogenerated from wled00/data/settings_ui.htm, do not edit!! const char PAGE_settings_ui[] PROGMEM = R"=====(UI Settings