mirror of
https://github.com/manilarome/the-glorious-startpage.git
synced 2024-11-24 00:23:39 +01:00
keybindings cleanup
This commit is contained in:
parent
9034dfb507
commit
db66c1d957
@ -22,19 +22,27 @@ document.addEventListener(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.key === 'Escape') {
|
if (event.key === 'Escape') {
|
||||||
|
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
// If any of this are open, close it
|
// If any of this are open, close it
|
||||||
if (searchBoxVisility) {
|
if (searchBoxVisility) {
|
||||||
|
|
||||||
// Hide searchbox
|
// Hide searchbox
|
||||||
toggleSearchBox();
|
toggleSearchBox();
|
||||||
searchBox.value = '';
|
searchBox.value = '';
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else if (weatherScreenVisibility) {
|
} else if (weatherScreenVisibility) {
|
||||||
|
|
||||||
toggleWeatherScreen();
|
toggleWeatherScreen();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else if (rightDashboardVisibility) {
|
} else if (rightDashboardVisibility) {
|
||||||
|
|
||||||
toggleDashboard();
|
toggleDashboard();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show web menu
|
// Show web menu
|
||||||
@ -49,16 +57,8 @@ document.addEventListener(
|
|||||||
if (webMenuVisibility || weatherScreenVisibility ||
|
if (webMenuVisibility || weatherScreenVisibility ||
|
||||||
rightDashboardVisibility) return;
|
rightDashboardVisibility) return;
|
||||||
|
|
||||||
// Dont accept ctrl, alt,
|
// Only accept single charactered key and backspace to open search box
|
||||||
// left window key, f5, f12, return
|
if ((event.key.length > 1) && (event.key !== 'Backspace')) return;
|
||||||
if (event.key === 'Control' ||
|
|
||||||
event.key === 'Alt' ||
|
|
||||||
event.key === 'Shift' ||
|
|
||||||
event.key === 'Meta' ||
|
|
||||||
event.key === 'F5' ||
|
|
||||||
event.key === 'F12' ||
|
|
||||||
event.key === 'Enter')
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Open searchbox
|
// Open searchbox
|
||||||
toggleSearchBox();
|
toggleSearchBox();
|
||||||
|
Loading…
Reference in New Issue
Block a user