This commit is contained in:
Marat Fayzullin 2024-08-19 11:40:07 -04:00
parent fc8ea76c1e
commit aab1ca9a2b
2 changed files with 6 additions and 2 deletions

View File

@ -41,7 +41,7 @@
<meta name="theme-color" content="#222" />
<script src="static/plugins.js"></script>
</head>
<body onload="openwebrx_init();" onkeydown="Shortcuts.handleKeyEvent(event);">
<body onload="openwebrx_init();">
<div id="webrx-page-container">
${header}

View File

@ -4,6 +4,10 @@
function Shortcuts() {}
Shortcuts.init = function(target) {
target.addEventListener("keydown", this.handleKey);
};
Shortcuts.moveSlider = function(slider, delta) {
var $control = $(slider);
if (!$control.prop('disabled')) {
@ -21,7 +25,7 @@ Shortcuts.moveSelector = function(selector, steps) {
}
};
Shortcuts.handleKeyEvent = function(event) {
Shortcuts.handleKey = function(event) {
// Do not handle shortcuts when focused on a text or numeric input
var on_input = !!($('input:focus').length && ($('input:focus')[0].type === 'text' || $('input:focus')[0].type === 'number'));
if (on_input) return;