mirror of
https://github.com/wled/WLED.git
synced 2025-07-18 00:06:31 +00:00
Merge pull request #3945 from w00000dy/Webpage-shortcuts
Add Webpage shortcuts and Fix resizing bug
This commit is contained in:
commit
85b95a2940
@ -272,6 +272,7 @@ function onLoad()
|
|||||||
|
|
||||||
selectSlot(0);
|
selectSlot(0);
|
||||||
updateTablinks(0);
|
updateTablinks(0);
|
||||||
|
handleLocationHash();
|
||||||
cpick.on("input:end", () => {setColor(1);});
|
cpick.on("input:end", () => {setColor(1);});
|
||||||
cpick.on("color:change", () => {updatePSliders()});
|
cpick.on("color:change", () => {updatePSliders()});
|
||||||
pmtLS = localStorage.getItem('wledPmt');
|
pmtLS = localStorage.getItem('wledPmt');
|
||||||
@ -304,7 +305,6 @@ function updateTablinks(tabI)
|
|||||||
{
|
{
|
||||||
var tablinks = gEBCN("tablinks");
|
var tablinks = gEBCN("tablinks");
|
||||||
for (var i of tablinks) i.classList.remove('active');
|
for (var i of tablinks) i.classList.remove('active');
|
||||||
if (pcMode) return;
|
|
||||||
tablinks[tabI].classList.add('active');
|
tablinks[tabI].classList.add('active');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,6 +315,21 @@ function openTab(tabI, force = false)
|
|||||||
_C.classList.toggle('smooth', false);
|
_C.classList.toggle('smooth', false);
|
||||||
_C.style.setProperty('--i', iSlide);
|
_C.style.setProperty('--i', iSlide);
|
||||||
updateTablinks(tabI);
|
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;
|
var timeout;
|
||||||
@ -3051,8 +3066,7 @@ function togglePcMode(fromB = false)
|
|||||||
pcMode = (wW >= 1024) && pcModeA;
|
pcMode = (wW >= 1024) && pcModeA;
|
||||||
if (cpick) cpick.resize(pcMode && wW>1023 && wW<1250 ? 230 : 260); // for tablet in landscape
|
if (cpick) cpick.resize(pcMode && wW>1023 && wW<1250 ? 230 : 260); // for tablet in landscape
|
||||||
if (!fromB && ((wW < 1024 && lastw < 1024) || (wW >= 1024 && lastw >= 1024))) return; // no change in size and called from size()
|
if (!fromB && ((wW < 1024 && lastw < 1024) || (wW >= 1024 && lastw >= 1024))) return; // no change in size and called from size()
|
||||||
openTab(0, true);
|
if (pcMode) openTab(0, true);
|
||||||
updateTablinks(0);
|
|
||||||
gId('buttonPcm').className = (pcMode) ? "active":"";
|
gId('buttonPcm').className = (pcMode) ? "active":"";
|
||||||
gId('bot').style.height = (pcMode && !cfg.comp.pcmbot) ? "0":"auto";
|
gId('bot').style.height = (pcMode && !cfg.comp.pcmbot) ? "0":"auto";
|
||||||
sCol('--bh', gId('bot').clientHeight + "px");
|
sCol('--bh', gId('bot').clientHeight + "px");
|
||||||
@ -3214,6 +3228,7 @@ size();
|
|||||||
_C.style.setProperty('--n', N);
|
_C.style.setProperty('--n', N);
|
||||||
|
|
||||||
window.addEventListener('resize', size, true);
|
window.addEventListener('resize', size, true);
|
||||||
|
window.addEventListener('hashchange', handleLocationHash);
|
||||||
|
|
||||||
_C.addEventListener('mousedown', lock, false);
|
_C.addEventListener('mousedown', lock, false);
|
||||||
_C.addEventListener('touchstart', lock, false);
|
_C.addEventListener('touchstart', lock, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user