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

View File

@ -559,6 +559,21 @@ function populatePresets(fromls)
populateQL(); 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) function loadInfo(callback=null)
{ {
var url = (loc?`http://${locip}`:'') + '/json/info'; var url = (loc?`http://${locip}`:'') + '/json/info';
@ -572,17 +587,7 @@ function loadInfo(callback=null)
.then(json => { .then(json => {
clearErrorToast(); clearErrorToast();
lastinfo = json; lastinfo = json;
var name = json.name; parseInfo();
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;
showNodes(); showNodes();
if (isInfo) populateInfo(json); if (isInfo) populateInfo(json);
reqsLegal = true; reqsLegal = true;
@ -1082,26 +1087,16 @@ function makeWS() {
clearErrorToast(); clearErrorToast();
gId('connind').style.backgroundColor = "var(--c-l)"; gId('connind').style.backgroundColor = "var(--c-l)";
// json object should contain json.info AND json.state (but may not) // json object should contain json.info AND json.state (but may not)
var info = json.info; var i = json.info;
if (info) { if (i) {
var name = info.name; lastinfo = i;
lastinfo = info; parseInfo();
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;
showNodes(); showNodes();
if (isInfo) populateInfo(info); if (isInfo) populateInfo(i);
} else } else
info = lastinfo; i = lastinfo;
var s = json.state ? json.state : json; var s = json.state ? json.state : json;
displayRover(info, s); displayRover(i, s);
readState(s); readState(s);
}; };
ws.onclose = function(event) { 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) // 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 //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