random bg image
This commit is contained in:
parent
f7893d4e4b
commit
f10a9d7f61
@ -27,7 +27,8 @@
|
|||||||
"tab":"Button opacity"
|
"tab":"Button opacity"
|
||||||
},
|
},
|
||||||
"bg":{
|
"bg":{
|
||||||
"url":"BG image URL"
|
"url":"BG image URL",
|
||||||
|
"random":"Random BG image"
|
||||||
},
|
},
|
||||||
"color":{
|
"color":{
|
||||||
"bg":"BG HEX color"
|
"bg":"BG HEX color"
|
||||||
@ -163,6 +164,24 @@
|
|||||||
var f = gId('theme_base');
|
var f = gId('theme_base');
|
||||||
if (f) f.value = (gId('dm').checked) ? 'light':'dark';
|
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()
|
function GetV()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -197,7 +216,8 @@
|
|||||||
<span class="l"></span>: <input type="number" min=0.0 max=1.0 step=0.01 id="theme_alpha_tab" class="agi"><br>
|
<span class="l"></span>: <input type="number" min=0.0 max=1.0 step=0.01 id="theme_alpha_tab" class="agi"><br>
|
||||||
<span class="l"></span>: <input type="number" min=0.0 max=1.0 step=0.01 id="theme_alpha_bg" class="agi"><br>
|
<span class="l"></span>: <input type="number" min=0.0 max=1.0 step=0.01 id="theme_alpha_bg" class="agi"><br>
|
||||||
<span class="l"></span>: <input id="theme_color_bg" maxlength="9" class="agi"><br>
|
<span class="l"></span>: <input id="theme_color_bg" maxlength="9" class="agi"><br>
|
||||||
<span class="l">BG image URL</span>: <input id="theme_bg_url" class="agi">
|
<span class="l">BG image URL</span>: <input id="theme_bg_url" class="agi" oninput="checkRandomBg()"><br>
|
||||||
|
<span class="l">Random BG image</span>: <input type="checkbox" id="theme_bg_random" class="agi cb" onchange="setRandomBg()"><br>
|
||||||
<input id="theme_base" class="agi" style="display:none">
|
<input id="theme_base" class="agi" style="display:none">
|
||||||
<hr><button type="button" onclick="B()">Back</button><button type="button" onclick="Save()">Save</button>
|
<hr><button type="button" onclick="B()">Back</button><button type="button" onclick="Save()">Save</button>
|
||||||
</form>
|
</form>
|
||||||
|
@ -168,7 +168,7 @@ const char PAGE_settings_dmx[] PROGMEM = R"=====()=====";
|
|||||||
// Autogenerated from wled00/data/settings_ui.htm, do not edit!!
|
// Autogenerated from wled00/data/settings_ui.htm, do not edit!!
|
||||||
const char PAGE_settings_ui[] PROGMEM = R"=====(<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport"
|
const char PAGE_settings_ui[] PROGMEM = R"=====(<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport"
|
||||||
content="width=500"><title>UI Settings</title><script>
|
content="width=500"><title>UI Settings</title><script>
|
||||||
var initial_ds,initial_st,d=document,sett=null,l={comp:{labels:"Show button labels",colors:{LABEL:"Color selection methods",picker:"Color Wheel",rgb:"RGB sliders",quick:"Quick color selectors",hex:"HEX color input"},pcmbot:"Show bottom tab bar in PC mode",pid:"Show preset IDs"},theme:{alpha:{bg:"Background opacity",tab:"Button opacity"},bg:{url:"BG image URL"},color:{bg:"BG HEX color"}}};function gId(e){return d.getElementById(e)}function isObject(e){return e&&"object"==typeof e&&!Array.isArray(e)}function set(e,i,t){for(var n=i,l=e.split("_"),s=l.length,o=0;o<s-1;o++){var r=l[o];n[r]||(n[r]={}),n=n[r]}n[l[s-1]]=t}function addRec(e,t="",n=null){var l="";for(i in e){var s=t+(t?"_":"")+i;if(isObject(e[i]))n&&n[i]&&n[i].LABEL&&(l+=`<h3>${n[i].LABEL}</h3>`),l+=addRec(e[i],s,n?n[i]:null);else{var o=s;if(n&&n[i]?o=n[i]:e[i+"LABEL"]&&(o=e[i+"LABEL"]),i.indexOf("LABEL")>0)continue;var r=typeof e[i];gId(s)?("boolean"===r?gId(s).checked=e[i]:gId(s).value=e[i],gId(s).previousElementSibling.matches(".l")&&(gId(s).previousElementSibling.innerHTML=o)):"boolean"===r?l+=`${o}: <input class="agi cb" type="checkbox" id=${s} ${e[i]?"checked":""}><br>`:"number"===r?l+=`${o}: <input class="agi" type="number" id=${s} value=${e[i]}><br>`:"string"===r&&(l+=`${o}:<br><input class="agi" id=${s} value=${e[i]}><br>`)}}return l}function genForm(e){var i;i=addRec(e,"",l),gId("gen").innerHTML=i}function GetLS(){(sett=localStorage.getItem("wledUiCfg"))||(gId("lserr").style.display="inline");try{sett=JSON.parse(sett)}catch(e){sett={},gId("lserr").style.display="inline",gId("lserr").innerHTML="⚠ Settings JSON parsing failed. ("+e+")"}genForm(sett),gId("dm").checked="light"===gId("theme_base").value}function SetLS(){for(var e=d.querySelectorAll(".agi"),i=0;i<e.length;i++){var t=e[i],n=t.classList.contains("cb")?t.checked:t.value;set(t.id,sett,n),console.log(`${t.id} set to ${n}`)}try{localStorage.setItem("wledUiCfg",JSON.stringify(sett)),gId("lssuc").style.display="inline"}catch(t){gId("lssuc").style.display="none",gId("lserr").style.display="inline",gId("lserr").innerHTML="⚠ Settings JSON saving failed. ("+t+")"}}function Save(){SetLS(),d.Sf.DS.value==initial_ds&&d.Sf.ST.checked==initial_st||d.Sf.submit()}function S(){GetV(),initial_ds=d.Sf.DS.value,initial_st=d.Sf.ST.checked,GetLS()}function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#user-interface-settings")}function B(){window.open("/settings","_self")}function UI(){gId("idonthateyou").style.display=gId("dm").checked?"inline":"none";var e=gId("theme_base");e&&(e.value=gId("dm").checked?"light":"dark")}function GetV() {var d=document;
|
var initial_ds,initial_st,d=document,sett=null,l={comp:{labels:"Show button labels",colors:{LABEL:"Color selection methods",picker:"Color Wheel",rgb:"RGB sliders",quick:"Quick color selectors",hex:"HEX color input"},pcmbot:"Show bottom tab bar in PC mode",pid:"Show preset IDs"},theme:{alpha:{bg:"Background opacity",tab:"Button opacity"},bg:{url:"BG image URL",random:"Random BG image"},color:{bg:"BG HEX color"}}};function gId(e){return d.getElementById(e)}function isObject(e){return e&&"object"==typeof e&&!Array.isArray(e)}function set(e,t,i){for(var n=t,l=e.split("_"),o=l.length,s=0;s<o-1;s++){var d=l[s];n[d]||(n[d]={}),n=n[d]}n[l[o-1]]=i}function addRec(e,t="",n=null){var l="";for(i in e){var o=t+(t?"_":"")+i;if(isObject(e[i]))n&&n[i]&&n[i].LABEL&&(l+=`<h3>${n[i].LABEL}</h3>`),l+=addRec(e[i],o,n?n[i]:null);else{var s=o;if(n&&n[i]?s=n[i]:e[i+"LABEL"]&&(s=e[i+"LABEL"]),i.indexOf("LABEL")>0)continue;var d=typeof e[i];gId(o)?("boolean"===d?gId(o).checked=e[i]:gId(o).value=e[i],gId(o).previousElementSibling.matches(".l")&&(gId(o).previousElementSibling.innerHTML=s)):"boolean"===d?l+=`${s}: <input class="agi cb" type="checkbox" id=${o} ${e[i]?"checked":""}><br>`:"number"===d?l+=`${s}: <input class="agi" type="number" id=${o} value=${e[i]}><br>`:"string"===d&&(l+=`${s}:<br><input class="agi" id=${o} value=${e[i]}><br>`)}}return l}function genForm(e){var t;t=addRec(e,"",l),gId("gen").innerHTML=t}function GetLS(){(sett=localStorage.getItem("wledUiCfg"))||(gId("lserr").style.display="inline");try{sett=JSON.parse(sett)}catch(e){sett={},gId("lserr").style.display="inline",gId("lserr").innerHTML="⚠ Settings JSON parsing failed. ("+e+")"}genForm(sett),gId("dm").checked="light"===gId("theme_base").value}function SetLS(){for(var e=d.querySelectorAll(".agi"),t=0;t<e.length;t++){var i=e[t],n=i.classList.contains("cb")?i.checked:i.value;set(i.id,sett,n),console.log(`${i.id} set to ${n}`)}try{localStorage.setItem("wledUiCfg",JSON.stringify(sett)),gId("lssuc").style.display="inline"}catch(i){gId("lssuc").style.display="none",gId("lserr").style.display="inline",gId("lserr").innerHTML="⚠ Settings JSON saving failed. ("+i+")"}}function Save(){SetLS(),d.Sf.DS.value==initial_ds&&d.Sf.ST.checked==initial_st||d.Sf.submit()}function S(){GetV(),initial_ds=d.Sf.DS.value,initial_st=d.Sf.ST.checked,GetLS()}function H(){window.open("https://github.com/Aircoookie/WLED/wiki/Settings#user-interface-settings")}function B(){window.open("/settings","_self")}function UI(){gId("idonthateyou").style.display=gId("dm").checked?"inline":"none";var e=gId("theme_base");e&&(e.value=gId("dm").checked?"light":"dark")}function setRandomBg(){gId("theme_bg_random").checked?gId("theme_bg_url").value="https://picsum.photos/1920/1080":gId("theme_bg_url").value=""}function checkRandomBg(){"https://picsum.photos/1920/1080"===gId("theme_bg_url").value?gId("theme_bg_random").checked=!0:gId("theme_bg_random").checked=!1}function GetV() {var d=document;
|
||||||
%CSS%%SCSS%</head><body onload="S()"><form
|
%CSS%%SCSS%</head><body onload="S()"><form
|
||||||
id="form_s" name="Sf" method="post"><div
|
id="form_s" name="Sf" method="post"><div
|
||||||
style="position:sticky;top:0;background-color:#222"><div class="helpB"><button
|
style="position:sticky;top:0;background-color:#222"><div class="helpB"><button
|
||||||
@ -195,9 +195,11 @@ step="0.01" id="theme_alpha_tab" class="agi"><br><span class="l"></span>: <input
|
|||||||
type="number" min="0.0" max="1.0" step="0.01" id="theme_alpha_bg" class="agi">
|
type="number" min="0.0" max="1.0" step="0.01" id="theme_alpha_bg" class="agi">
|
||||||
<br><span class="l"></span>: <input id="theme_color_bg" maxlength="9"
|
<br><span class="l"></span>: <input id="theme_color_bg" maxlength="9"
|
||||||
class="agi"><br><span class="l">BG image URL</span>: <input id="theme_bg_url"
|
class="agi"><br><span class="l">BG image URL</span>: <input id="theme_bg_url"
|
||||||
class="agi"> <input id="theme_base" class="agi" style="display:none"><hr><button
|
class="agi" oninput="checkRandomBg()"><br><span class="l">Random BG image</span>
|
||||||
type="button" onclick="B()">Back</button><button type="button"
|
: <input type="checkbox" id="theme_bg_random" class="agi cb"
|
||||||
onclick="Save()">Save</button></form></body></html>)=====";
|
onchange="setRandomBg()"><br><input id="theme_base" class="agi"
|
||||||
|
style="display:none"><hr><button type="button" onclick="B()">Back</button>
|
||||||
|
<button type="button" onclick="Save()">Save</button></form></body></html>)=====";
|
||||||
|
|
||||||
|
|
||||||
// Autogenerated from wled00/data/settings_sync.htm, do not edit!!
|
// Autogenerated from wled00/data/settings_sync.htm, do not edit!!
|
||||||
|
Loading…
Reference in New Issue
Block a user