luci-app-opkg: listen to filter `input` event 5667/head
authorKid Dong <44045911+kidonng@users.noreply.github.com>
Sat, 12 Feb 2022 14:51:35 +0000 (14:51 +0000)
committerGitHub <noreply@github.com>
Sat, 12 Feb 2022 14:51:35 +0000 (14:51 +0000)
Signed-off-by: Kid Dong <44045911+kidonng@users.noreply.github.com>
applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js

index 69b69be9b9364cc4c1e3101209936e8038d3f2fb..57f2006e53bcb2ed7be7325ed08b7daf6005acd8 100644 (file)
@@ -994,13 +994,13 @@ function updateLists(data)
        });
 }
 
-var keyTimeout = null;
+var inputTimeout = null;
 
-function handleKeyUp(ev) {
-       if (keyTimeout !== null)
-               window.clearTimeout(keyTimeout);
+function handleInput(ev) {
+       if (inputTimeout !== null)
+               window.clearTimeout(inputTimeout);
 
-       keyTimeout = window.setTimeout(function() {
+       inputTimeout = window.setTimeout(function() {
                display(ev.target.value);
        }, 250);
 }
@@ -1027,7 +1027,7 @@ return view.extend({
                                E('div', {}, [
                                        E('label', {}, _('Filter') + ':'),
                                        E('span', { 'class': 'control-group' }, [
-                                               E('input', { 'type': 'text', 'name': 'filter', 'placeholder': _('Type to filter…'), 'value': query, 'keyup': handleKeyUp }),
+                                               E('input', { 'type': 'text', 'name': 'filter', 'placeholder': _('Type to filter…'), 'value': query, 'input': handleInput }),
                                                E('button', { 'class': 'btn cbi-button', 'click': handleReset }, [ _('Clear') ])
                                        ])
                                ]),