add Webpage shortcuts, resolves #2362

This commit is contained in:
Woody 2024-04-30 18:57:53 +02:00
parent ff10130176
commit d2984e9e16
No known key found for this signature in database
GPG Key ID: 9872D7F5072789B2

View File

@ -272,6 +272,7 @@ function onLoad()
selectSlot(0);
updateTablinks(0);
handleLocationHash();
cpick.on("input:end", () => {setColor(1);});
cpick.on("color:change", () => {updatePSliders()});
pmtLS = localStorage.getItem('wledPmt');
@ -314,6 +315,21 @@ function openTab(tabI, force = false)
_C.classList.toggle('smooth', false);
_C.style.setProperty('--i', iSlide);
updateTablinks(tabI);
switch (tabI) {
case 0: window.location.hash = "Colors"; break;
case 1: window.location.hash = "Effects"; break;
case 2: window.location.hash = "Segments"; break;
case 3: window.location.hash = "Presets"; break;
}
}
function handleLocationHash() {
switch (window.location.hash) {
case "#Colors": openTab(0); break;
case "#Effects": openTab(1); break;
case "#Segments": openTab(2); break;
case "#Presets": openTab(3); break;
}
}
var timeout;
@ -3212,6 +3228,7 @@ size();
_C.style.setProperty('--n', N);
window.addEventListener('resize', size, true);
window.addEventListener('hashchange', handleLocationHash);
_C.addEventListener('mousedown', lock, false);
_C.addEventListener('touchstart', lock, false);