var d=document; var loc = false, locip, locproto = "http:"; function H(pg="") { window.open("https://kno.wled.ge/"+pg); } function GH() { window.open("https://github.com/wled-dev/WLED"); } function gId(c) { return d.getElementById(c); } // getElementById function cE(e) { return d.createElement(e); } // createElement function gEBCN(c) { return d.getElementsByClassName(c); } // getElementsByClassName function gN(s) { return d.getElementsByName(s)[0]; } // getElementsByName function isE(o) { return Object.keys(o).length === 0; } // isEmpty function isO(i) { return (i && typeof i === 'object' && !Array.isArray(i)); } // isObject function isN(n) { return !isNaN(parseFloat(n)) && isFinite(n); } // isNumber // https://stackoverflow.com/questions/3885817/how-do-i-check-that-a-number-is-float-or-integer function isF(n) { return n === +n && n !== (n|0); } // isFloat function isI(n) { return n === +n && n === (n|0); } // isInteger function toggle(el) { gId(el).classList.toggle("hide"); let n = gId('No'+el); if (n) n.classList.toggle("hide"); } function tooltip(cont=null) { d.querySelectorAll((cont?cont+" ":"")+"[title]").forEach((element)=>{ element.addEventListener("pointerover", ()=>{ // save title element.setAttribute("data-title", element.getAttribute("title")); const tooltip = d.createElement("span"); tooltip.className = "tooltip"; tooltip.textContent = element.getAttribute("title"); // prevent default title popup element.removeAttribute("title"); let { top, left, width } = element.getBoundingClientRect(); d.body.appendChild(tooltip); const { offsetHeight, offsetWidth } = tooltip; const offset = element.classList.contains("sliderwrap") ? 4 : 10; top -= offsetHeight + offset; left += (width - offsetWidth) / 2; tooltip.style.top = top + "px"; tooltip.style.left = left + "px"; tooltip.classList.add("visible"); }); element.addEventListener("pointerout", ()=>{ d.querySelectorAll('.tooltip').forEach((tooltip)=>{ tooltip.classList.remove("visible"); d.body.removeChild(tooltip); }); // restore title element.setAttribute("title", element.getAttribute("data-title")); }); }); }; // sequential loading of external resources (JS or CSS) with retry, calls init() when done function loadResources(files, init) { let i = 0; const loadNext = () => { if (i >= files.length) { if (init) { d.documentElement.style.visibility = 'visible'; // make page visible after all files are loaded if it was hidden (prevent ugly display) d.readyState === 'complete' ? init() : window.addEventListener('load', init); } return; } const file = files[i++]; const isCSS = file.endsWith('.css'); const el = d.createElement(isCSS ? 'link' : 'script'); if (isCSS) { el.rel = 'stylesheet'; el.href = file; const st = d.head.querySelector('style'); if (st) d.head.insertBefore(el, st); // insert before any