Cleaning up indentations (sorry but my OCD is strong).
This commit is contained in:
parent
624993fc89
commit
9f3e66fff0
@ -191,8 +191,7 @@ function onLoad() {
|
|||||||
if (window.location.protocol == "file:") {
|
if (window.location.protocol == "file:") {
|
||||||
loc = true;
|
loc = true;
|
||||||
locip = localStorage.getItem('locIp');
|
locip = localStorage.getItem('locIp');
|
||||||
if (!locip)
|
if (!locip) {
|
||||||
{
|
|
||||||
locip = prompt("File Mode. Please enter WLED IP!");
|
locip = prompt("File Mode. Please enter WLED IP!");
|
||||||
localStorage.setItem('locIp', locip);
|
localStorage.setItem('locIp', locip);
|
||||||
}
|
}
|
||||||
@ -310,8 +309,7 @@ function inforow(key, val, unit = "")
|
|||||||
function getLowestUnusedP()
|
function getLowestUnusedP()
|
||||||
{
|
{
|
||||||
var l = 1;
|
var l = 1;
|
||||||
for (var key in pJson)
|
for (var key in pJson) {
|
||||||
{
|
|
||||||
if (key == l) l++;
|
if (key == l) l++;
|
||||||
}
|
}
|
||||||
if (l > 250) l = 250;
|
if (l > 250) l = 250;
|
||||||
@ -445,8 +443,7 @@ function populateQL()
|
|||||||
cn += `<p class="labels">Quick load</p>`;
|
cn += `<p class="labels">Quick load</p>`;
|
||||||
|
|
||||||
var it = 0;
|
var it = 0;
|
||||||
for (var key of (pQL||[]))
|
for (var key of (pQL||[])) {
|
||||||
{
|
|
||||||
cn += `<button class="xxs btn psts" id="p${key[0]}qlb" onclick="setPreset(${key[0]});">${key[1]}</button>`;
|
cn += `<button class="xxs btn psts" id="p${key[0]}qlb" onclick="setPreset(${key[0]});">${key[1]}</button>`;
|
||||||
it++;
|
it++;
|
||||||
if (it > 4) {
|
if (it > 4) {
|
||||||
@ -518,8 +515,7 @@ function populateInfo(i)
|
|||||||
else if (pwr > 0) {pwr = 50 * Math.round(pwr/50); pwru = pwr + " mA";}
|
else if (pwr > 0) {pwr = 50 * Math.round(pwr/50); pwru = pwr + " mA";}
|
||||||
var urows="";
|
var urows="";
|
||||||
if (i.u) {
|
if (i.u) {
|
||||||
for (const [k, val] of Object.entries(i.u))
|
for (const [k, val] of Object.entries(i.u)) {
|
||||||
{
|
|
||||||
if (val[1]) {
|
if (val[1]) {
|
||||||
urows += inforow(k,val[0],val[1]);
|
urows += inforow(k,val[0],val[1]);
|
||||||
} else {
|
} else {
|
||||||
@ -641,7 +637,7 @@ function populateSegments(s)
|
|||||||
function populateEffects(effects)
|
function populateEffects(effects)
|
||||||
{
|
{
|
||||||
var html = `<div class="searchbar"><input type="text" class="search" placeholder="Search" oninput="search(this)" />
|
var html = `<div class="searchbar"><input type="text" class="search" placeholder="Search" oninput="search(this)" />
|
||||||
<i class="icons search-icon"></i><i class="icons search-cancel-icon" onclick="cancelSearch(this)"></i></div>`;
|
<i class="icons search-icon"></i><i class="icons search-cancel-icon" onclick="cancelSearch(this)"></i></div>`;
|
||||||
|
|
||||||
effects.shift(); //remove solid
|
effects.shift(); //remove solid
|
||||||
for (let i = 0; i < effects.length; i++) {
|
for (let i = 0; i < effects.length; i++) {
|
||||||
@ -687,7 +683,7 @@ function populatePalettes(palettes)
|
|||||||
});
|
});
|
||||||
|
|
||||||
var html = `<div class="searchbar"><input type="text" class="search" placeholder="Search" oninput="search(this)" />
|
var html = `<div class="searchbar"><input type="text" class="search" placeholder="Search" oninput="search(this)" />
|
||||||
<i class="icons search-icon"></i><i class="icons search-cancel-icon" onclick="cancelSearch(this)"></i></div>`;
|
<i class="icons search-icon"></i><i class="icons search-cancel-icon" onclick="cancelSearch(this)"></i></div>`;
|
||||||
for (let i = 0; i < palettes.length; i++) {
|
for (let i = 0; i < palettes.length; i++) {
|
||||||
html += generateListItemHtml(
|
html += generateListItemHtml(
|
||||||
'palette',
|
'palette',
|
||||||
@ -774,11 +770,11 @@ function generateListItemHtml(listName, id, name, clickAction, extraHtml = '', e
|
|||||||
<input type="radio" value="${id}" name="${listName}">
|
<input type="radio" value="${id}" name="${listName}">
|
||||||
<span class="radiomark"></span>
|
<span class="radiomark"></span>
|
||||||
</label>
|
</label>
|
||||||
<span class="lstIname">
|
<span class="lstIname">
|
||||||
${name}
|
${name}
|
||||||
</span>
|
</span>
|
||||||
${extraHtml}
|
${extraHtml}
|
||||||
</div>`;
|
</div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function btype(b){
|
function btype(b){
|
||||||
@ -812,9 +808,9 @@ function populateNodes(i,n)
|
|||||||
if (i.ndc < 0) cn += `Instance List is disabled.`;
|
if (i.ndc < 0) cn += `Instance List is disabled.`;
|
||||||
else if (nnodes == 0) cn += `No other instances found.`;
|
else if (nnodes == 0) cn += `No other instances found.`;
|
||||||
cn += `<table class="infot">
|
cn += `<table class="infot">
|
||||||
${urows}
|
${urows}
|
||||||
${inforow("Current instance:",i.name)}
|
${inforow("Current instance:",i.name)}
|
||||||
</table>`;
|
</table>`;
|
||||||
d.getElementById('kn').innerHTML = cn;
|
d.getElementById('kn').innerHTML = cn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -858,7 +854,6 @@ function updateTrail(e)
|
|||||||
function updateBubble(e)
|
function updateBubble(e)
|
||||||
{
|
{
|
||||||
var bubble = e.target.parentNode.getElementsByTagName('output')[0];
|
var bubble = e.target.parentNode.getElementsByTagName('output')[0];
|
||||||
|
|
||||||
if (bubble) {
|
if (bubble) {
|
||||||
bubble.innerHTML = e.target.value;
|
bubble.innerHTML = e.target.value;
|
||||||
}
|
}
|
||||||
@ -1263,7 +1258,7 @@ function makeSeg() {
|
|||||||
<div class="h" id="seg${lowestUnused}len">${ledCount - ns} LED${ledCount - ns >1 ? "s":""}</div>
|
<div class="h" id="seg${lowestUnused}len">${ledCount - ns} LED${ledCount - ns >1 ? "s":""}</div>
|
||||||
<i class="icons e-icon cnf cnf-s half" id="segc${lowestUnused}" onclick="setSeg(${lowestUnused}); resetUtil();"></i>
|
<i class="icons e-icon cnf cnf-s half" id="segc${lowestUnused}" onclick="setSeg(${lowestUnused}); resetUtil();"></i>
|
||||||
</div>
|
</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
d.getElementById('segutil').innerHTML = cn;
|
d.getElementById('segutil').innerHTML = cn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1361,67 +1356,66 @@ function makeP(i,pl) {
|
|||||||
var content = "";
|
var content = "";
|
||||||
if (pl) {
|
if (pl) {
|
||||||
var rep = plJson[i].repeat ? plJson[i].repeat : 0;
|
var rep = plJson[i].repeat ? plJson[i].repeat : 0;
|
||||||
content = `
|
content = `<div class="first c">Playlist Entries</div>
|
||||||
<div class="first c">Playlist Entries</div>
|
<div id="ple${i}"></div>
|
||||||
<div id="ple${i}"></div><label class="check revchkl">
|
<label class="check revchkl">
|
||||||
Shuffle
|
Shuffle
|
||||||
<input type="checkbox" id="pl${i}rtgl" onchange="plR(${i})" ${plJson[i].r?"checked":""}>
|
<input type="checkbox" id="pl${i}rtgl" onchange="plR(${i})" ${plJson[i].r?"checked":""}>
|
||||||
<span class="checkmark schk"></span>
|
<span class="checkmark schk"></span>
|
||||||
</label>
|
</label>
|
||||||
<label class="check revchkl">
|
<label class="check revchkl">
|
||||||
Repeat indefinitely
|
Repeat indefinitely
|
||||||
<input type="checkbox" id="pl${i}rptgl" onchange="plR(${i})" ${rep?"":"checked"}>
|
<input type="checkbox" id="pl${i}rptgl" onchange="plR(${i})" ${rep?"":"checked"}>
|
||||||
<span class="checkmark schk"></span>
|
<span class="checkmark schk"></span>
|
||||||
</label>
|
</label>
|
||||||
<div id="pl${i}o1" style="display:${rep?"block":"none"}">
|
<div id="pl${i}o1" style="display:${rep?"block":"none"}">
|
||||||
<div class="c">Repeat <input class="noslide" type="number" id="pl${i}rp" oninput="plR(${i})" max=127 min=0 value=${rep>0?rep:1}> times</div>
|
<div class="c">Repeat <input class="noslide" type="number" id="pl${i}rp" oninput="plR(${i})" max=127 min=0 value=${rep>0?rep:1}> times</div>
|
||||||
End preset:<br>
|
End preset:<br>
|
||||||
<select class="btn sel sel-ple" id="pl${i}selEnd" onchange="plR(${i})" data-val=${plJson[i].end?plJson[i].end:0}>
|
<select class="btn sel sel-ple" id="pl${i}selEnd" onchange="plR(${i})" data-val=${plJson[i].end?plJson[i].end:0}>
|
||||||
<option value=0>None</option>
|
<option value=0>None</option>
|
||||||
${makePlSel(true)}
|
${makePlSel(true)}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-i btn-p" onclick="testPl(${i}, this)"><i class='icons btn-icon'></i>Test</button>`;
|
<button class="btn btn-i btn-p" onclick="testPl(${i}, this)"><i class='icons btn-icon'></i>Test</button>`;
|
||||||
}
|
}
|
||||||
else content = `<label class="check revchkl">
|
else content = `<label class="check revchkl">
|
||||||
Include brightness
|
Include brightness
|
||||||
<input type="checkbox" id="p${i}ibtgl" checked>
|
<input type="checkbox" id="p${i}ibtgl" checked>
|
||||||
<span class="checkmark schk"></span>
|
<span class="checkmark schk"></span>
|
||||||
</label>
|
</label>
|
||||||
<label class="check revchkl">
|
<label class="check revchkl">
|
||||||
Save segment bounds
|
Save segment bounds
|
||||||
<input type="checkbox" id="p${i}sbtgl" checked>
|
<input type="checkbox" id="p${i}sbtgl" checked>
|
||||||
<span class="checkmark schk"></span>
|
<span class="checkmark schk"></span>
|
||||||
</label>`;
|
</label>`;
|
||||||
|
|
||||||
return `
|
return `<input type="text" class="ptxt noslide" id="p${i}txt" autocomplete="off" maxlength=32 value="${(i>0)?pName(i):""}" placeholder="Enter name..."/><br>
|
||||||
<input type="text" class="ptxt noslide" id="p${i}txt" autocomplete="off" maxlength=32 value="${(i>0)?pName(i):""}" placeholder="Enter name..."/><br>
|
<div class="c">Quick load label: <input type="text" class="qltxt noslide" maxlength=2 value="${qlName(i)}" id="p${i}ql" autocomplete="off"/></div>
|
||||||
<div class="c">Quick load label: <input type="text" class="qltxt noslide" maxlength=2 value="${qlName(i)}" id="p${i}ql" autocomplete="off"/></div>
|
<div class="h">(leave empty for no Quick load button)</div>
|
||||||
<div class="h">(leave empty for no Quick load button)</div>
|
<div ${pl&&i==0?"style='display:none'":""}>
|
||||||
<div ${pl&&i==0?"style='display:none'":""}>
|
|
||||||
<label class="check revchkl">
|
<label class="check revchkl">
|
||||||
${pl?"Show playlist editor":(i>0)?"Overwrite with state":"Use current state"}
|
${pl?"Show playlist editor":(i>0)?"Overwrite with state":"Use current state"}
|
||||||
<input type="checkbox" id="p${i}cstgl" onchange="tglCs(${i})" ${(i==0||pl)?"checked":""}>
|
<input type="checkbox" id="p${i}cstgl" onchange="tglCs(${i})" ${(i==0||pl)?"checked":""}>
|
||||||
<span class="checkmark schk"></span>
|
<span class="checkmark schk"></span>
|
||||||
</label><br>
|
</label><br>
|
||||||
</div>
|
</div>
|
||||||
<div class="po2" id="p${i}o2">
|
<div class="po2" id="p${i}o2">
|
||||||
API command<br>
|
API command<br>
|
||||||
<textarea class="noslide" id="p${i}api"></textarea>
|
<textarea class="noslide" id="p${i}api"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="po1" id="p${i}o1">
|
<div class="po1" id="p${i}o1">
|
||||||
${content}
|
${content}
|
||||||
</div>
|
</div>
|
||||||
<div class="c">Save to ID <input class="noslide" id="p${i}id" type="number" oninput="checkUsed(${i})" max=250 min=1 value=${(i>0)?i:getLowestUnusedP()}></div>
|
<div class="c">Save to ID <input class="noslide" id="p${i}id" type="number" oninput="checkUsed(${i})" max=250 min=1 value=${(i>0)?i:getLowestUnusedP()}></div>
|
||||||
<div class="c">
|
<div class="c">
|
||||||
<button class="btn btn-i btn-p" onclick="saveP(${i},${pl})"><i class="icons btn-icon"></i>Save ${(pl)?"playlist":(i>0)?"changes":"preset"}</button>
|
<button class="btn btn-i btn-p" onclick="saveP(${i},${pl})"><i class="icons btn-icon"></i>Save ${(pl)?"playlist":(i>0)?"changes":"preset"}</button>
|
||||||
${(i>0)?'<button class="btn btn-i btn-p" id="p'+i+'del" onclick="delP('+i+')"><i class="icons btn-icon"></i>Delete '+(pl?"playlist":"preset"):
|
${(i>0)?'<button class="btn btn-i btn-p" id="p'+i+'del" onclick="delP('+i+')"><i class="icons btn-icon"></i>Delete '+(pl?"playlist":"preset"):
|
||||||
'<button class="btn btn-p" onclick="resetPUtil()">Cancel'}</button>
|
'<button class="btn btn-p" onclick="resetPUtil()">Cancel'}</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="pwarn ${(i>0)?"bp":""} c" id="p${i}warn">
|
<div class="pwarn ${(i>0)?"bp":""} c" id="p${i}warn">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
${(i>0)? ('<div class="h">ID ' +i+ '</div>'):""}`;
|
${(i>0)? ('<div class="h">ID ' +i+ '</div>'):""}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function makePUtil() {
|
function makePUtil() {
|
||||||
@ -1463,7 +1457,7 @@ function makePlUtil() {
|
|||||||
|
|
||||||
function resetPUtil() {
|
function resetPUtil() {
|
||||||
var cn = `<button class="btn btn-s btn-i" onclick="makePUtil()"><i class="icons btn-icon"></i>Create preset</button><br>
|
var cn = `<button class="btn btn-s btn-i" onclick="makePUtil()"><i class="icons btn-icon"></i>Create preset</button><br>
|
||||||
<button class="btn btn-s btn-i" onclick="makePlUtil()"><i class='icons btn-icon'></i>Create playlist</button><br>`;
|
<button class="btn btn-s btn-i" onclick="makePlUtil()"><i class='icons btn-icon'></i>Create playlist</button><br>`;
|
||||||
d.getElementById('putil').innerHTML = cn;
|
d.getElementById('putil').innerHTML = cn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2053,7 +2047,7 @@ function move(e) {
|
|||||||
var s = Math.sign(dx);
|
var s = Math.sign(dx);
|
||||||
var f = +(s*dx/w).toFixed(2);
|
var f = +(s*dx/w).toFixed(2);
|
||||||
|
|
||||||
if((clientX != 0) &&
|
if ((clientX != 0) &&
|
||||||
(iSlide > 0 || s < 0) && (iSlide < N - 1 || s > 0) &&
|
(iSlide > 0 || s < 0) && (iSlide < N - 1 || s > 0) &&
|
||||||
f > 0.12 &&
|
f > 0.12 &&
|
||||||
d.getElementsByClassName("tabcontent")[iSlide].scrollTop == scrollS) {
|
d.getElementsByClassName("tabcontent")[iSlide].scrollTop == scrollS) {
|
||||||
|
1589
wled00/html_ui.h
1589
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user