Indentation: Consistent use of Tab

Added style guide
Updated changelog
This commit is contained in:
cschwinne 2022-03-01 12:14:41 +01:00
parent 17907589cc
commit adcdaba199
7 changed files with 1040 additions and 958 deletions

View File

@ -2,6 +2,14 @@
### Builds after release 0.12.0 ### Builds after release 0.12.0
#### Build 2203011
- IR rewrite (PR #2561), supports CCT
- Added locate button to Time settings
- CSS fixes and adjustments
- Consistent Tab indentation in index JS and CSS
- Added initial contribution style guideline
#### Build 2202222 #### Build 2202222
- Version bump to 0.13.0-b7 "Toki" - Version bump to 0.13.0-b7 "Toki"

78
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,78 @@
## Thank you for making WLED better!
Here are a few suggestions to make it easier for you to contribute!
### Code style
When in doubt, it is easiest to replicate the code style you find in the files you want to edit :)
Below are the guidelines we use in the WLED repository.
#### Indentation
We use tabs for Indentation in Web files (.html/.css/.js) and spaces (2 per indentation level) for all other files.
You are all set if you have enabled `Editor: Detect Indentation` in VS Code.
#### Blocks
Whether the opening bracket of e.g. an `if` block is in the same line as the condition or in a separate line is up to your discretion. If there is only one statement, leaving out block braches is acceptable.
Good:
```cpp
if (a == b) {
doStuff(a);
}
```
```cpp
if (a == b)
{
doStuff(a);
}
```
```cpp
if (a == b) doStuff(a);
```
There should always be a space between a keyword and its condition and between the condition and brace.
Within the condition, no space should be between the paranthesis and variables.
Spaces between variables and operators are up to the authors discretion.
There should be no space between function names and their argument parenthesis.
Good:
```cpp
if (a == b) {
doStuff(a);
}
```
Not good:
```cpp
if( a==b ){
doStuff ( a);
}
```
#### Comments
Comments should have a space between the delimiting characters (e.g. `//`) and the comment text.
Note: This is a recent change, the majority of the codebase still has comments without spaces.
Good:
```
// This is a comment.
/* This is a CSS inline comment */
/*
* This is a comment
* wrapping over multiple lines,
* used in WLED for file headers and function explanations
*/
<!-- This is an HTML comment -->
```
There is no set character limit for a comment within a line,
though as a rule of thumb you should wrap your comment if it exceeds the width of your editor window.
Inline comments are OK if they describe that line only and are not exceedingly wide.

View File

@ -981,7 +981,7 @@ input[type=number]::-webkit-outer-spin-button {
border-radius: 20px; border-radius: 20px;
text-align: left; text-align: left;
transition: background-color 0.5s; transition: background-color 0.5s;
filter: brightness(1); filter: brightness(1); /* required for slider background to render? */
} }
.selected { .selected {
@ -989,7 +989,7 @@ input[type=number]::-webkit-outer-spin-button {
} }
/* "selected" CSS class is applied to the segment when it is the main segment. /* "selected" CSS class is applied to the segment when it is the main segment.
By default, do not highlight. Can be overridden by skin.css */ By default, do not highlight. Can be overridden by skin.css */
.selected .seg { .selected.seg {
background-color: var(--c-2); /* var(--c-4); */ background-color: var(--c-2); /* var(--c-4); */
} }
.selected .checkmark, .selected .radiokmark { .selected .checkmark, .selected .radiokmark {

View File

@ -227,7 +227,6 @@
<button class="btn" onclick="setLor(2)">Override until reboot</button><br> <button class="btn" onclick="setLor(2)">Override until reboot</button><br>
<span class="h">For best performance, it is recommended to turn off the streaming source when not in use.</span> <span class="h">For best performance, it is recommended to turn off the streaming source when not in use.</span>
</div> </div>
<i id="roverstar" class="icons huge" onclick="setLor(0)">&#xe410;</i><br> <i id="roverstar" class="icons huge" onclick="setLor(0)">&#xe410;</i><br>
<script src="iro.js"></script> <script src="iro.js"></script>
<script src="rangetouch.js"></script> <script src="rangetouch.js"></script>

View File

@ -27,7 +27,7 @@ var fxlist = d.getElementById('fxlist'), pallist = d.getElementById('pallist');
var cfg = { var cfg = {
theme:{base:"dark", bg:{url:""}, alpha:{bg:0.6,tab:0.8}, color:{bg:""}}, theme:{base:"dark", bg:{url:""}, alpha:{bg:0.6,tab:0.8}, color:{bg:""}},
comp :{colors:{picker: true, rgb: false, quick: true, hex: false}, comp :{colors:{picker: true, rgb: false, quick: true, hex: false},
labels:true, pcmbot:false, pid:true, seglen:false, css:true, hdays:false} labels:true, pcmbot:false, pid:true, seglen:false, css:true, hdays:false}
}; };
var hol = [ var hol = [
[0,11,24,4,"https://aircoookie.github.io/xmas.png"], // christmas [0,11,24,4,"https://aircoookie.github.io/xmas.png"], // christmas
@ -40,14 +40,14 @@ var hol = [
var cpick = new iro.ColorPicker("#picker", { var cpick = new iro.ColorPicker("#picker", {
width: 260, width: 260,
wheelLightness: false, wheelLightness: false,
wheelAngle: 270, wheelAngle: 270,
wheelDirection: "clockwise", wheelDirection: "clockwise",
layout: [ layout: [
{ {
component: iro.ui.Wheel, component: iro.ui.Wheel,
options: {} options: {}
} }
] ]
}); });
function handleVisibilityChange() { function handleVisibilityChange() {
@ -107,45 +107,45 @@ function tglLabels()
function cTheme(light) { function cTheme(light) {
if (light) { if (light) {
sCol('--c-1','#eee'); sCol('--c-1','#eee');
sCol('--c-f','#000'); sCol('--c-f','#000');
sCol('--c-2','#ddd'); sCol('--c-2','#ddd');
sCol('--c-3','#bbb'); sCol('--c-3','#bbb');
sCol('--c-4','#aaa'); sCol('--c-4','#aaa');
sCol('--c-5','#999'); sCol('--c-5','#999');
sCol('--c-6','#999'); sCol('--c-6','#999');
sCol('--c-8','#888'); sCol('--c-8','#888');
sCol('--c-b','#444'); sCol('--c-b','#444');
sCol('--c-c','#333'); sCol('--c-c','#333');
sCol('--c-e','#111'); sCol('--c-e','#111');
sCol('--c-d','#222'); sCol('--c-d','#222');
sCol('--c-r','#c42'); sCol('--c-r','#c42');
sCol('--c-o','rgba(204, 204, 204, 0.9)'); sCol('--c-o','rgba(204, 204, 204, 0.9)');
sCol('--c-sb','#0003'); sCol('--c-sbh','#0006'); sCol('--c-sb','#0003'); sCol('--c-sbh','#0006');
sCol('--c-tb','rgba(204, 204, 204, var(--t-b))'); sCol('--c-tb','rgba(204, 204, 204, var(--t-b))');
sCol('--c-tba','rgba(170, 170, 170, var(--t-b))'); sCol('--c-tba','rgba(170, 170, 170, var(--t-b))');
sCol('--c-tbh','rgba(204, 204, 204, var(--t-b))'); sCol('--c-tbh','rgba(204, 204, 204, var(--t-b))');
d.getElementById('imgw').style.filter = "invert(0.8)"; d.getElementById('imgw').style.filter = "invert(0.8)";
} else { } else { // default dark theme
sCol('--c-1','#111'); sCol('--c-1','#111');
sCol('--c-f','#fff'); sCol('--c-f','#fff');
sCol('--c-2','#222'); sCol('--c-2','#222');
sCol('--c-3','#333'); sCol('--c-3','#333');
sCol('--c-4','#444'); sCol('--c-4','#444');
sCol('--c-5','#555'); sCol('--c-5','#555');
sCol('--c-6','#666'); sCol('--c-6','#666');
sCol('--c-8','#888'); sCol('--c-8','#888');
sCol('--c-b','#bbb'); sCol('--c-b','#bbb');
sCol('--c-c','#ccc'); sCol('--c-c','#ccc');
sCol('--c-e','#eee'); sCol('--c-e','#eee');
sCol('--c-d','#ddd'); sCol('--c-d','#ddd');
sCol('--c-r','#831'); sCol('--c-r','#831');
sCol('--c-o','rgba(34, 34, 34, 0.9)'); sCol('--c-o','rgba(34, 34, 34, 0.9)');
sCol('--c-sb','#fff3'); sCol('--c-sbh','#fff5'); sCol('--c-sb','#fff3'); sCol('--c-sbh','#fff5');
sCol('--c-tb','rgba(34, 34, 34, var(--t-b))'); sCol('--c-tb','rgba(34, 34, 34, var(--t-b))');
sCol('--c-tba','rgba(102, 102, 102, var(--t-b))'); sCol('--c-tba','rgba(102, 102, 102, var(--t-b))');
sCol('--c-tbh','rgba(51, 51, 51, var(--t-b))'); sCol('--c-tbh','rgba(51, 51, 51, var(--t-b))');
d.getElementById('imgw').style.filter = "unset"; d.getElementById('imgw').style.filter = "unset";
} }
} }
@ -418,7 +418,7 @@ function loadPresets(callback = null)
}) })
.then(res => { .then(res => {
if (!res.ok) { if (!res.ok) {
showErrorToast(); showErrorToast();
} }
return res.json(); return res.json();
}) })
@ -524,7 +524,7 @@ function populateInfo(i)
urows += inforow(k,val); urows += inforow(k,val);
} }
} }
} }
var vcn = "Kuuhaku"; var vcn = "Kuuhaku";
if (i.ver.startsWith("0.13.")) vcn = "Toki"; if (i.ver.startsWith("0.13.")) vcn = "Toki";
@ -536,8 +536,8 @@ function populateInfo(i)
${inforow("Signal strength",i.wifi.signal +"% ("+ i.wifi.rssi, " dBm)")} ${inforow("Signal strength",i.wifi.signal +"% ("+ i.wifi.rssi, " dBm)")}
${inforow("Uptime",getRuntimeStr(i.uptime))} ${inforow("Uptime",getRuntimeStr(i.uptime))}
${inforow("Free heap",heap," kB")} ${inforow("Free heap",heap," kB")}
${inforow("Estimated current",pwru)} ${inforow("Estimated current",pwru)}
${inforow("Frames / second",i.leds.fps)} ${inforow("Frames / second",i.leds.fps)}
${inforow("MAC address",i.mac)} ${inforow("MAC address",i.mac)}
${inforow("Filesystem",i.fs.u + "/" + i.fs.t + " kB (" +Math.round(i.fs.u*100/i.fs.t) + "%)")} ${inforow("Filesystem",i.fs.u + "/" + i.fs.t + " kB (" +Math.round(i.fs.u*100/i.fs.t) + "%)")}
${inforow("Environment",i.arch + " " + i.core + " (" + i.lwip + ")")} ${inforow("Environment",i.arch + " " + i.core + " (" + i.lwip + ")")}
@ -695,14 +695,13 @@ function populatePalettes(palettes)
for (let i = 0; i < palettes.length; i++) { for (let i = 0; i < palettes.length; i++) {
html += generateListItemHtml( html += generateListItemHtml(
'palette', 'palette',
palettes[i].id, palettes[i].id,
palettes[i].name, palettes[i].name,
'setPalette', 'setPalette',
`<div class="lstIprev" style="${genPalPrevCss(palettes[i].id)}"></div>`, `<div class="lstIprev" style="${genPalPrevCss(palettes[i].id)}"></div>`,
palettes[i].class, palettes[i].class,
); );
} }
pallist.innerHTML=html; pallist.innerHTML=html;
} }
@ -773,7 +772,7 @@ function genPalPrevCss(id)
function generateListItemHtml(listName, id, name, clickAction, extraHtml = '', extraClass = '') function generateListItemHtml(listName, id, name, clickAction, extraHtml = '', extraClass = '')
{ {
return `<div class="lstI btn fxbtn ${extraClass}" data-id="${id}" onClick="${clickAction}(${id})"> return `<div class="lstI btn fxbtn ${extraClass}" data-id="${id}" onClick="${clickAction}(${id})">
<label class="radio fxchkl"> <label class="radio fxchkl">
<input type="radio" value="${id}" name="${listName}"> <input type="radio" value="${id}" name="${listName}">
<span class="radiomark"></span> <span class="radiomark"></span>
@ -786,22 +785,22 @@ ${extraHtml}
} }
function btype(b){ function btype(b){
switch (b) { switch (b) {
case 32: return "ESP32"; case 32: return "ESP32";
case 82: return "ESP8266"; case 82: return "ESP8266";
} }
return "?"; return "?";
} }
function bname(o){ function bname(o){
if (o.name=="WLED") return o.ip; if (o.name=="WLED") return o.ip;
return o.name; return o.name;
} }
function populateNodes(i,n) function populateNodes(i,n)
{ {
var cn=""; var cn="";
var urows=""; var urows="";
var nnodes = 0; var nnodes = 0;
if (n.nodes) { if (n.nodes) {
n.nodes.sort((a,b) => (a.name).localeCompare(b.name)); n.nodes.sort((a,b) => (a.name).localeCompare(b.name));
for (var x=0;x<n.nodes.length;x++) { for (var x=0;x<n.nodes.length;x++) {
@ -809,7 +808,7 @@ function populateNodes(i,n)
if (o.name) { if (o.name) {
var url = `<button class="btn btna-icon tab" onclick="location.assign('http://${o.ip}');">${bname(o)}</button>`; var url = `<button class="btn btna-icon tab" onclick="location.assign('http://${o.ip}');">${bname(o)}</button>`;
urows += inforow(url,`${btype(o.type)}<br><i>${o.vid==0?"N/A":o.vid}</i>`); urows += inforow(url,`${btype(o.type)}<br><i>${o.vid==0?"N/A":o.vid}</i>`);
nnodes++; nnodes++;
} }
} }
} }
@ -978,7 +977,7 @@ function makeWS() {
ws = new WebSocket('ws://'+(loc?locip:window.location.hostname)+'/ws'); ws = new WebSocket('ws://'+(loc?locip:window.location.hostname)+'/ws');
ws.binaryType = "arraybuffer"; ws.binaryType = "arraybuffer";
ws.onmessage = function(event) { ws.onmessage = function(event) {
if (event.data instanceof ArrayBuffer) return; //liveview packet if (event.data instanceof ArrayBuffer) return; //liveview packet
var json = JSON.parse(event.data); var json = JSON.parse(event.data);
clearTimeout(jsonTimeout); clearTimeout(jsonTimeout);
jsonTimeout = null; jsonTimeout = null;
@ -1007,90 +1006,90 @@ function makeWS() {
} }
function readState(s,command=false) { function readState(s,command=false) {
isOn = s.on; isOn = s.on;
d.getElementById('sliderBri').value= s.bri; d.getElementById('sliderBri').value= s.bri;
nlA = s.nl.on; nlA = s.nl.on;
nlDur = s.nl.dur; nlDur = s.nl.dur;
nlTar = s.nl.tbri; nlTar = s.nl.tbri;
nlMode = s.nl.mode; nlMode = s.nl.mode;
syncSend = s.udpn.send; syncSend = s.udpn.send;
currentPreset = s.ps; currentPreset = s.ps;
tr = s.transition; tr = s.transition;
d.getElementById('tt').value = tr/10; d.getElementById('tt').value = tr/10;
var selc=0; var ind=0; var selc=0; var ind=0;
populateSegments(s); populateSegments(s);
for (let i = 0; i < (s.seg||[]).length; i++) for (let i = 0; i < (s.seg||[]).length; i++)
{ {
if(s.seg[i].sel) {selc = ind; break;} ind++; if(s.seg[i].sel) {selc = ind; break;} ind++;
} }
var i=s.seg[selc]; var i=s.seg[selc];
if (!i) { if (!i) {
showToast('No Segments!', true); showToast('No Segments!', true);
updateUI(); updateUI();
return; return;
} }
selColors = i.col; selColors = i.col;
var cd = d.getElementById('csl').children; var cd = d.getElementById('csl').children;
for (let e = 2; e >= 0; e--) for (let e = 2; e >= 0; e--)
{ {
cd[e].style.backgroundColor = "rgb(" + i.col[e][0] + "," + i.col[e][1] + "," + i.col[e][2] + ")"; cd[e].style.backgroundColor = "rgb(" + i.col[e][0] + "," + i.col[e][1] + "," + i.col[e][2] + ")";
if (isRgbw) whites[e] = parseInt(i.col[e][3]); if (isRgbw) whites[e] = parseInt(i.col[e][3]);
selectSlot(csel); selectSlot(csel);
} }
if (i.cct != null && i.cct>=0) d.getElementById("sliderA").value = i.cct; if (i.cct != null && i.cct>=0) d.getElementById("sliderA").value = i.cct;
d.getElementById('sliderSpeed').value = i.sx; d.getElementById('sliderSpeed').value = i.sx;
d.getElementById('sliderIntensity').value = i.ix; d.getElementById('sliderIntensity').value = i.ix;
// Effects // Effects
var selFx = fxlist.querySelector(`input[name="fx"][value="${i.fx}"]`); var selFx = fxlist.querySelector(`input[name="fx"][value="${i.fx}"]`);
if (selFx) selFx.checked = true; if (selFx) selFx.checked = true;
else location.reload(); //effect list is gone (e.g. if restoring tab). Reload. else location.reload(); //effect list is gone (e.g. if restoring tab). Reload.
var selElement = fxlist.querySelector('.selected'); var selElement = fxlist.querySelector('.selected');
if (selElement) { if (selElement) {
selElement.classList.remove('selected') selElement.classList.remove('selected')
} }
var selectedEffect = fxlist.querySelector(`.lstI[data-id="${i.fx}"]`); var selectedEffect = fxlist.querySelector(`.lstI[data-id="${i.fx}"]`);
selectedEffect.classList.add('selected'); selectedEffect.classList.add('selected');
selectedFx = i.fx; selectedFx = i.fx;
// Palettes // Palettes
pallist.querySelector(`input[name="palette"][value="${i.pal}"]`).checked = true; pallist.querySelector(`input[name="palette"][value="${i.pal}"]`).checked = true;
selElement = pallist.querySelector('.selected'); selElement = pallist.querySelector('.selected');
if (selElement) { if (selElement) {
selElement.classList.remove('selected') selElement.classList.remove('selected')
} }
pallist.querySelector(`.lstI[data-id="${i.pal}"]`).classList.add('selected'); pallist.querySelector(`.lstI[data-id="${i.pal}"]`).classList.add('selected');
if (!command) { if (!command) {
selectedEffect.scrollIntoView({ selectedEffect.scrollIntoView({
behavior: 'smooth', behavior: 'smooth',
block: 'nearest', block: 'nearest',
}); });
} }
if (s.error && s.error != 0) { if (s.error && s.error != 0) {
var errstr = ""; var errstr = "";
switch (s.error) { switch (s.error) {
case 10: case 10:
errstr = "Could not mount filesystem!"; errstr = "Could not mount filesystem!";
break; break;
case 11: case 11:
errstr = "Not enough space to save preset!"; errstr = "Not enough space to save preset!";
break; break;
case 12: case 12:
errstr = "Preset not found."; errstr = "Preset not found.";
break; break;
case 19: case 19:
errstr = "A filesystem error has occured."; errstr = "A filesystem error has occured.";
break; break;
} }
showToast('Error ' + s.error + ": " + errstr, true); showToast('Error ' + s.error + ": " + errstr, true);
} }
updateUI(); updateUI();
} }
var jsonTimeout; var jsonTimeout;
@ -1113,15 +1112,15 @@ function requestJson(command, rinfo = true) {
var type = command ? 'post':'get'; var type = command ? 'post':'get';
if (command) if (command)
{ {
command.v = true; //get complete API response command.v = true; //get complete API response
command.time = Math.floor(Date.now() / 1000); command.time = Math.floor(Date.now() / 1000);
var t = d.getElementById('tt'); var t = d.getElementById('tt');
if (t.validity.valid && command.transition===undefined) { if (t.validity.valid && command.transition===undefined) {
var tn = parseInt(t.value*10); var tn = parseInt(t.value*10);
if (tn != tr) command.transition = tn; if (tn != tr) command.transition = tn;
} }
req = JSON.stringify(command); req = JSON.stringify(command);
if (req.length > 1000) useWs = false; //do not send very long requests over websocket if (req.length > 1000) useWs = false; //do not send very long requests over websocket
} }
if (useWs) { if (useWs) {
@ -1254,7 +1253,7 @@ function toggleLiveview() {
} }
function toggleInfo() { function toggleInfo() {
if (isNodes) toggleNodes(); if (isNodes) toggleNodes();
isInfo = !isInfo; isInfo = !isInfo;
if (isInfo) populateInfo(lastinfo); if (isInfo) populateInfo(lastinfo);
d.getElementById('info').style.transform = (isInfo) ? "translateY(0px)":"translateY(100%)"; d.getElementById('info').style.transform = (isInfo) ? "translateY(0px)":"translateY(100%)";
@ -1392,8 +1391,8 @@ function plR(p) {
} }
function makeP(i,pl) { 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 = `<div class="first c">Playlist Entries</div> content = `<div class="first c">Playlist Entries</div>
<div id="ple${i}"></div> <div id="ple${i}"></div>
@ -1417,7 +1416,7 @@ function makeP(i,pl) {
</div> </div>
<button class="btn btn-i btn-p" onclick="testPl(${i}, this)"><i class='icons btn-icon'>&#xe139;</i>Test</button>`; <button class="btn btn-i btn-p" onclick="testPl(${i}, this)"><i class='icons btn-icon'>&#xe139;</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>
@ -1466,30 +1465,30 @@ function makePUtil() {
} }
function makePlEntry(p,i) { function makePlEntry(p,i) {
return ` return `
<div class="plentry"> <div class="plentry">
<select class="btn sel sel-pl" onchange="plePs(${p},${i},this)" data-val=${plJson[p].ps[i]} data-index=${i}> <select class="btn sel sel-pl" onchange="plePs(${p},${i},this)" data-val=${plJson[p].ps[i]} data-index=${i}>
${makePlSel()} ${makePlSel()}
</select> </select>
<button class="btn btn-i btn-xs btn-pl-del" onclick="delPl(${p},${i})"><i class="icons btn-icon">&#xe037;</i></button> <button class="btn btn-i btn-xs btn-pl-del" onclick="delPl(${p},${i})"><i class="icons btn-icon">&#xe037;</i></button>
<div class="h plnl">Duration</div><div class="h plnl">Transition</div><div class="h pli">#${i+1}</div><br> <div class="h plnl">Duration</div><div class="h plnl">Transition</div><div class="h pli">#${i+1}</div><br>
<input class="noslide pln" type="number" max=6553.0 min=0.2 step=0.1 oninput="pleDur(${p},${i},this)" value=${plJson[p].dur[i]/10.0}> <input class="noslide pln" type="number" max=6553.0 min=0.2 step=0.1 oninput="pleDur(${p},${i},this)" value=${plJson[p].dur[i]/10.0}>
<input class="noslide pln" type="number" max=65.0 min=0.0 step=0.1 oninput="pleTr(${p},${i},this)" value=${plJson[p].transition[i]/10.0}> s <input class="noslide pln" type="number" max=65.0 min=0.0 step=0.1 oninput="pleTr(${p},${i},this)" value=${plJson[p].transition[i]/10.0}> s
<button class="btn btn-i btn-xs btn-pl-add" onclick="addPl(${p},${i})"><i class="icons btn-icon">&#xe18a;</i></button> <button class="btn btn-i btn-xs btn-pl-add" onclick="addPl(${p},${i})"><i class="icons btn-icon">&#xe18a;</i></button>
<div class="hrz"></div> <div class="hrz"></div>
</div>`; </div>`;
} }
function makePlUtil() { function makePlUtil() {
if (pNum < 1) { if (pNum < 1) {
showToast("Please make a preset first!"); return; showToast("Please make a preset first!"); return;
} }
if (plJson[0].transition[0] < 0) plJson[0].transition[0] = tr; if (plJson[0].transition[0] < 0) plJson[0].transition[0] = tr;
d.getElementById('putil').innerHTML = `<div class="pres"> d.getElementById('putil').innerHTML = `<div class="pres">
<div class="pname newseg"> <div class="pname newseg">
New playlist</div> New playlist</div>
<div class="segin expanded" id="seg100"> <div class="segin expanded" id="seg100">
${makeP(0,true)}</div></div>`; ${makeP(0,true)}</div></div>`;
refreshPlE(0); refreshPlE(0);
} }
@ -1509,7 +1508,7 @@ function tglCs(i){
function tglSegn(s) function tglSegn(s)
{ {
d.getElementById(`seg${s}t`).style.display = d.getElementById(`seg${s}t`).style.display =
(window.getComputedStyle(d.getElementById(`seg${s}t`)).display === "none") ? "inline":"none"; (window.getComputedStyle(d.getElementById(`seg${s}t`)).display === "none") ? "inline":"none";
} }
// Select only the clicked segment and unselect all others // Select only the clicked segment and unselect all others
@ -1806,7 +1805,7 @@ function updatePSliders() {
s = d.getElementById('sliderB'); s = d.getElementById('sliderB');
s.value = col.b; updateTrail(s,3); s.value = col.b; updateTrail(s,3);
//update hex field //update hex field
var str = cpick.color.hexString.substring(1); var str = cpick.color.hexString.substring(1);
var w = whites[csel]; var w = whites[csel];
if (w > 0) str += w.toString(16); if (w > 0) str += w.toString(16);
@ -1814,17 +1813,17 @@ function updatePSliders() {
d.getElementById('hexcnf').style.backgroundColor = "var(--c-3)"; d.getElementById('hexcnf').style.backgroundColor = "var(--c-3)";
//update value slider //update value slider
var v = d.getElementById('sliderV'); var v = d.getElementById('sliderV');
v.value = cpick.color.value; v.value = cpick.color.value;
//background color as if color had full value //background color as if color had full value
var hsv = {"h":cpick.color.hue,"s":cpick.color.saturation,"v":100}; var hsv = {"h":cpick.color.hue,"s":cpick.color.saturation,"v":100};
var c = iro.Color.hsvToRgb(hsv); var c = iro.Color.hsvToRgb(hsv);
var cs = 'rgb('+c.r+','+c.g+','+c.b+')'; var cs = 'rgb('+c.r+','+c.g+','+c.b+')';
v.parentNode.getElementsByClassName('sliderdisplay')[0].style.setProperty('--bg',cs); v.parentNode.getElementsByClassName('sliderdisplay')[0].style.setProperty('--bg',cs);
updateTrail(v); updateTrail(v);
// update Kelvin slider // update Kelvin slider
d.getElementById('sliderK').value = cpick.color.kelvin; d.getElementById('sliderK').value = cpick.color.kelvin;
} }
// Fired when a key is pressed while in the HEX color input // Fired when a key is pressed while in the HEX color input
@ -1950,7 +1949,6 @@ function loadPalettesData(callback = null)
var d = new Date(); var d = new Date();
if (palettesDataJson && palettesDataJson.vid == lastinfo.vid) { if (palettesDataJson && palettesDataJson.vid == lastinfo.vid) {
palettesData = palettesDataJson.p; palettesData = palettesDataJson.p;
//redrawPalPrev() //?
if (callback) callback(); if (callback) callback();
return; return;
} }
@ -2017,10 +2015,10 @@ function search(searchField) {
} }
function cancelSearch(ic) { function cancelSearch(ic) {
var searchField = ic.parentElement.getElementsByClassName('search')[0]; var searchField = ic.parentElement.getElementsByClassName('search')[0];
searchField.value = ""; searchField.value = "";
search(searchField); search(searchField);
searchField.focus(); searchField.focus();
} }
//make sure "dur" and "transition" are arrays with at least the length of "ps" //make sure "dur" and "transition" are arrays with at least the length of "ps"
@ -2057,9 +2055,9 @@ function expand(i,a)
d.getElementById('seg' +i).style.display = (expanded[i]) ? "block":"none"; d.getElementById('seg' +i).style.display = (expanded[i]) ? "block":"none";
d.getElementById('sege' +i).style.transform = (expanded[i]) ? "rotate(180deg)":"rotate(0deg)"; d.getElementById('sege' +i).style.transform = (expanded[i]) ? "rotate(180deg)":"rotate(0deg)";
if (i < 100) { if (i < 100) {
d.getElementById(`seg${i}nedit`).style.display = (expanded[i]) ? "inline":"none"; d.getElementById(`seg${i}nedit`).style.display = (expanded[i]) ? "inline":"none";
return; //no preset, we are done return; //no preset, we are done
} }
var p = i-100; var p = i-100;
d.getElementById(`p${p}o`).style.background = (expanded[i] || p != currentPreset)?"var(--c-2)":"var(--c-6)"; d.getElementById(`p${p}o`).style.background = (expanded[i] || p != currentPreset)?"var(--c-2)":"var(--c-6)";
@ -2127,9 +2125,9 @@ function move(e) {
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) {
_C.style.setProperty('--i', iSlide -= s); _C.style.setProperty('--i', iSlide -= s);
f = 1 - f; f = 1 - f;
updateTablinks(iSlide); updateTablinks(iSlide);

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2203010 #define VERSION 2203011
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG