More CSS & JS optimisations.
This commit is contained in:
parent
93378406c3
commit
28f12a4874
@ -951,12 +951,19 @@ input[type=number]::-webkit-outer-spin-button {
|
|||||||
min-height: 24px;
|
min-height: 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.lstI:hover {
|
.selected { /* has to be after .lstI */
|
||||||
|
background: var(--c-5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.lstI:hover, #pcont .selected:hover {
|
||||||
background: var(--c-4);
|
background: var(--c-4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pcont .expand, #pcont .expand:hover {
|
||||||
|
background-color: var(--c-2);
|
||||||
|
}
|
||||||
|
|
||||||
.lstI.selected {
|
.lstI.selected {
|
||||||
background: var(--c-5);
|
|
||||||
top: 0;
|
top: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
}
|
}
|
||||||
|
@ -156,18 +156,6 @@ function loadBg(iUrl)
|
|||||||
let bg = document.getElementById('bg');
|
let bg = document.getElementById('bg');
|
||||||
let img = document.createElement("img");
|
let img = document.createElement("img");
|
||||||
img.src = iUrl;
|
img.src = iUrl;
|
||||||
/*
|
|
||||||
if (iUrl == "" || iUrl === "https://picsum.photos/1920/1080") {
|
|
||||||
var today = new Date();
|
|
||||||
for (var i=0; i<hol.length; i++) {
|
|
||||||
var yr = hol[i][0]==0 ? today.getFullYear() : hol[i][0];
|
|
||||||
var hs = new Date(yr,hol[i][1],hol[i][2]);
|
|
||||||
var he = new Date(hs);
|
|
||||||
he.setDate(he.getDate() + hol[i][3]);
|
|
||||||
if (today>=hs && today<he) img.src = hol[i][4];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
img.addEventListener('load', (event) => {
|
img.addEventListener('load', (event) => {
|
||||||
var a = parseFloat(cfg.theme.alpha.bg);
|
var a = parseFloat(cfg.theme.alpha.bg);
|
||||||
if (isNaN(a)) a = 0.6;
|
if (isNaN(a)) a = 0.6;
|
||||||
@ -250,7 +238,7 @@ function onLoad()
|
|||||||
|
|
||||||
// Load initial data
|
// Load initial data
|
||||||
loadPalettes(()=>{
|
loadPalettes(()=>{
|
||||||
loadPalettesData();
|
loadPalettesData(redrawPalPrev);
|
||||||
loadFX(()=>{
|
loadFX(()=>{
|
||||||
loadPresets(()=>{
|
loadPresets(()=>{
|
||||||
loadInfo(requestJson);
|
loadInfo(requestJson);
|
||||||
@ -855,11 +843,10 @@ function populatePalettes()
|
|||||||
function redrawPalPrev()
|
function redrawPalPrev()
|
||||||
{
|
{
|
||||||
let palettes = d.querySelectorAll('#pallist .lstI');
|
let palettes = d.querySelectorAll('#pallist .lstI');
|
||||||
for (let i = 0; i < palettes.length; i++) {
|
for (var pal of (palettes||[])) {
|
||||||
let id = palettes[i].dataset.id;
|
let lP = pal.querySelector('.lstIprev');
|
||||||
let lstPrev = palettes[i].querySelector('.lstIprev');
|
if (lP) {
|
||||||
if (lstPrev) {
|
lP.style = genPalPrevCss(pal.dataset.id);
|
||||||
lstPrev.style = genPalPrevCss(id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -993,16 +980,16 @@ function updatePA(scrollto=false)
|
|||||||
{
|
{
|
||||||
var ps = gEBCN("pres");
|
var ps = gEBCN("pres");
|
||||||
for (let i = 0; i < ps.length; i++) {
|
for (let i = 0; i < ps.length; i++) {
|
||||||
ps[i].style.backgroundColor = "";
|
ps[i].classList.remove('selected');;
|
||||||
}
|
}
|
||||||
ps = gEBCN("psts");
|
ps = gEBCN("psts");
|
||||||
for (let i = 0; i < ps.length; i++) {
|
for (let i = 0; i < ps.length; i++) {
|
||||||
ps[i].style.backgroundColor = "";
|
ps[i].classList.remove('selected');;
|
||||||
}
|
}
|
||||||
if (currentPreset > 0) {
|
if (currentPreset > 0) {
|
||||||
var acv = gId(`p${currentPreset}o`);
|
var acv = gId(`p${currentPreset}o`);
|
||||||
if (acv && !expanded[currentPreset+100]) {
|
if (acv && !expanded[currentPreset+100]) {
|
||||||
acv.style.background = "var(--c-6)";
|
acv.classList.add('selected');;
|
||||||
if (scrollto) {
|
if (scrollto) {
|
||||||
// scroll selected preset into view (on WS refresh)
|
// scroll selected preset into view (on WS refresh)
|
||||||
acv.scrollIntoView({
|
acv.scrollIntoView({
|
||||||
@ -1012,7 +999,7 @@ function updatePA(scrollto=false)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
acv = gId(`p${currentPreset}qlb`);
|
acv = gId(`p${currentPreset}qlb`);
|
||||||
if (acv) acv.style.background = "var(--c-6)";
|
if (acv) acv.classList.add('selected');;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1172,8 +1159,8 @@ function readState(s,command=false)
|
|||||||
}
|
}
|
||||||
cd[e].style.backgroundColor = "rgb(" + r + "," + g + "," + b + ")";
|
cd[e].style.backgroundColor = "rgb(" + r + "," + g + "," + b + ")";
|
||||||
if (isRgbw) whites[e] = parseInt(w);
|
if (isRgbw) whites[e] = parseInt(w);
|
||||||
selectSlot(csel);
|
|
||||||
}
|
}
|
||||||
|
selectSlot(csel);
|
||||||
gId('sliderW').value = whites[csel];
|
gId('sliderW').value = whites[csel];
|
||||||
|
|
||||||
gId('sliderSpeed').value = i.sx;
|
gId('sliderSpeed').value = i.sx;
|
||||||
@ -1203,6 +1190,7 @@ function readState(s,command=false)
|
|||||||
|
|
||||||
selectedPal = i.pal;
|
selectedPal = i.pal;
|
||||||
selectedFx = i.fx;
|
selectedFx = i.fx;
|
||||||
|
redrawPalPrev(); // if any color changed (random palette did at least)
|
||||||
updateUI(true);
|
updateUI(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1804,21 +1792,14 @@ function selectSlot(b)
|
|||||||
csel = b;
|
csel = b;
|
||||||
var cd = gId('csl').children;
|
var cd = gId('csl').children;
|
||||||
for (let i = 0; i < cd.length; i++) {
|
for (let i = 0; i < cd.length; i++) {
|
||||||
//cd[i].style.borderWidth="2px";
|
|
||||||
//cd[i].style.margin="5px";
|
|
||||||
//cd[i].style.width="42px";
|
|
||||||
cd[i].classList.remove('xxs-w');
|
cd[i].classList.remove('xxs-w');
|
||||||
}
|
}
|
||||||
//cd[csel].style.borderWidth="5px";
|
|
||||||
//cd[csel].style.margin="2px";
|
|
||||||
//cd[csel].style.width="50px";
|
|
||||||
cd[csel].classList.add('xxs-w');
|
cd[csel].classList.add('xxs-w');
|
||||||
cpick.color.set(cd[csel].style.backgroundColor);
|
cpick.color.set(cd[csel].style.backgroundColor);
|
||||||
gId('sliderW').value = whites[csel];
|
gId('sliderW').value = whites[csel];
|
||||||
updateTrail(gId('sliderW'));
|
updateTrail(gId('sliderW'));
|
||||||
updateHex();
|
updateHex();
|
||||||
updateRgb();
|
updateRgb();
|
||||||
redrawPalPrev();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var lasth = 0;
|
var lasth = 0;
|
||||||
@ -1854,12 +1835,10 @@ function updateHex()
|
|||||||
var w = whites[csel];
|
var w = whites[csel];
|
||||||
if (w > 0) str += w.toString(16);
|
if (w > 0) str += w.toString(16);
|
||||||
gId('hexc').value = str;
|
gId('hexc').value = str;
|
||||||
gId('hexcnf').style.backgroundColor = "var(--c-3)";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function hexEnter()
|
function hexEnter()
|
||||||
{
|
{
|
||||||
gId('hexcnf').style.backgroundColor = "var(--c-6)";
|
|
||||||
if(event.keyCode == 13) fromHex();
|
if(event.keyCode == 13) fromHex();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1942,14 +1921,13 @@ function loadPalettesData(callback = null)
|
|||||||
{
|
{
|
||||||
if (palettesData) return;
|
if (palettesData) return;
|
||||||
const lsKey = "wledPalx";
|
const lsKey = "wledPalx";
|
||||||
var palettesDataJson = localStorage.getItem(lsKey);
|
var lsPalData = localStorage.getItem(lsKey);
|
||||||
if (palettesDataJson) {
|
if (lsPalData) {
|
||||||
try {
|
try {
|
||||||
palettesDataJson = JSON.parse(palettesDataJson);
|
lsPalData = JSON.parse(lsPalData);
|
||||||
if (palettesDataJson && palettesDataJson.vid == lastinfo.vid) {
|
if (lsPalData && lsPalData.vid == lastinfo.vid) {
|
||||||
palettesData = palettesDataJson.p;
|
palettesData = lsPalData.p;
|
||||||
//redrawPalPrev() //?
|
if (callback) callback(); // redrawPalPrev()
|
||||||
if (callback) callback();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
@ -1961,8 +1939,7 @@ function loadPalettesData(callback = null)
|
|||||||
p: palettesData,
|
p: palettesData,
|
||||||
vid: lastinfo.vid
|
vid: lastinfo.vid
|
||||||
}));
|
}));
|
||||||
redrawPalPrev();
|
if (callback) setTimeout(callback, 99); //redrawPalPrev()
|
||||||
if (callback) setTimeout(callback, 99); //go on to connect websocket
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2052,8 +2029,7 @@ function expand(i,a)
|
|||||||
|
|
||||||
if (i >= 100) {
|
if (i >= 100) {
|
||||||
var p = i-100;
|
var p = i-100;
|
||||||
gId(`p${p}o`).style.background = (expanded[i] || p != currentPreset)?"var(--c-2)":"var(--c-6)";
|
gId(`p${p}o`).classList.toggle('expand');
|
||||||
|
|
||||||
if (seg.innerHTML === "") {
|
if (seg.innerHTML === "") {
|
||||||
if (isPlaylist(p)) {
|
if (isPlaylist(p)) {
|
||||||
plJson[p] = pJson[p].playlist;
|
plJson[p] = pJson[p].playlist;
|
||||||
@ -2073,7 +2049,8 @@ function expand(i,a)
|
|||||||
gId(`p${p}api`).value = papi;
|
gId(`p${p}api`).value = papi;
|
||||||
if (papi.indexOf("Please") == 0) gId(`p${p}cstgl`).checked = true;
|
if (papi.indexOf("Please") == 0) gId(`p${p}cstgl`).checked = true;
|
||||||
tglCs(p);
|
tglCs(p);
|
||||||
}
|
} else
|
||||||
|
seg.innerHTML = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
seg.parentElement.scrollIntoView({
|
seg.parentElement.scrollIntoView({
|
||||||
|
4437
wled00/html_ui.h
4437
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// version code in format yymmddb (b = daily build)
|
// version code in format yymmddb (b = daily build)
|
||||||
#define VERSION 2108111
|
#define VERSION 2108121
|
||||||
|
|
||||||
//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
|
||||||
|
Loading…
Reference in New Issue
Block a user