JS optimisation.

Namelabel clarity.
This commit is contained in:
Blaz Kristan 2021-08-16 18:24:06 +02:00
parent c8db90b644
commit b3dd368920
4 changed files with 2263 additions and 2265 deletions

View File

@ -93,8 +93,8 @@ button {
#namelabel {
position: fixed;
bottom: calc(var(--bh) + 6px);
right: 4px;
color: var(--c-6);
right: 6px;
color: var(--c-b);
cursor: pointer;
writing-mode: vertical-rl;
}
@ -577,6 +577,8 @@ input[type=range]::-moz-range-thumb {
transition-duration: 0.3s;
-webkit-backface-visibility: hidden;
-webkit-transform:translate3d(0,0,0);
backface-visibility: hidden;
transform:translate3d(0,0,0);
overflow: clip;
text-overflow: clip;
}
@ -652,6 +654,8 @@ input[type=range]::-moz-range-thumb {
transition-duration: 0.5s;
-webkit-backface-visibility: hidden;
-webkit-transform:translate3d(0,0,0);
backface-visibility: hidden;
transform:translate3d(0,0,0);
}
#tt {
text-align: center;
@ -775,8 +779,8 @@ input[type=number]::-webkit-outer-spin-button {
height: 50px;
}
.qcs, .xxs {
text-shadow: -1px -1px 0 var(--c-6), 1px -1px 0 var(--c-6), -1px 1px 0 var(--c-6), 1px 1px 0 var(--c-6);
.qcs, .xxs, #namelabel {
text-shadow: -1px -1px 0 var(--c-4), 1px -1px 0 var(--c-4), -1px 1px 0 var(--c-4), 1px 1px 0 var(--c-4);
}
.psts {

View File

@ -559,6 +559,21 @@ function populatePresets(fromls)
populateQL();
}
function parseInfo() {
var li = lastinfo;
var name = li.name;
gId('namelabel').innerHTML = name;
// if (name === "Dinnerbone") d.documentElement.style.transform = "rotate(180deg)";
if (li.live) name = "(Live) " + name;
if (loc) name = "(L) " + name;
d.title = name;
isRgbw = li.leds.wv;
ledCount = li.leds.count;
syncTglRecv = li.str;
maxSeg = li.leds.maxseg;
pmt = li.fs.pmt;
}
function loadInfo(callback=null)
{
var url = (loc?`http://${locip}`:'') + '/json/info';
@ -572,17 +587,7 @@ function loadInfo(callback=null)
.then(json => {
clearErrorToast();
lastinfo = json;
var name = json.name;
gId('namelabel').innerHTML = name;
// if (name === "Dinnerbone") d.documentElement.style.transform = "rotate(180deg)";
if (json.live) name = "(Live) " + name;
if (loc) name = "(L) " + name;
d.title = name;
isRgbw = json.leds.wv;
ledCount = json.leds.count;
syncTglRecv = json.str;
maxSeg = json.leds.maxseg;
pmt = json.fs.pmt;
parseInfo();
showNodes();
if (isInfo) populateInfo(json);
reqsLegal = true;
@ -1082,26 +1087,16 @@ function makeWS() {
clearErrorToast();
gId('connind').style.backgroundColor = "var(--c-l)";
// json object should contain json.info AND json.state (but may not)
var info = json.info;
if (info) {
var name = info.name;
lastinfo = info;
gId('namelabel').innerHTML = name;
//if (name === "Dinnerbone") d.documentElement.style.transform = "rotate(180deg)";
if (info.live) name = "(Live) " + name;
if (loc) name = "(L) " + name;
d.title = name;
isRgbw = info.leds.wv;
ledCount = info.leds.count;
syncTglRecv = info.str;
maxSeg = info.leds.maxseg;
pmt = info.fs.pmt;
var i = json.info;
if (i) {
lastinfo = i;
parseInfo();
showNodes();
if (isInfo) populateInfo(info);
if (isInfo) populateInfo(i);
} else
info = lastinfo;
i = lastinfo;
var s = json.state ? json.state : json;
displayRover(info, s);
displayRover(i, s);
readState(s);
};
ws.onclose = function(event) {

File diff suppressed because it is too large Load Diff

View File

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