Skip to content

Commit

Permalink
add Webpage shortcuts, resolves Aircoookie#2362
Browse files Browse the repository at this point in the history
  • Loading branch information
w00000dy committed Apr 30, 2024
1 parent ff10130 commit d2984e9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions wled00/data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d2984e9

Please sign in to comment.