From 27aa9c5a38d6273f709d7aa1dc9be19f997791ce Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Fri, 1 May 2020 22:53:54 -0700 Subject: [PATCH] Added search filter to multi-desktop view. --- views/default.handlebars | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/views/default.handlebars b/views/default.handlebars index 83ab8de2..81190c2d 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -224,7 +224,7 @@       -   +   @@ -232,6 +232,7 @@     +      @@ -1298,7 +1299,7 @@ // Setup page controls Q('sortselect').selectedIndex = sort = getstore('sort', 0); Q('sizeselect').selectedIndex = getstore('viewsize', 1); - Q('SearchInput').value = getstore('_search', ''); + Q('KvmSearchInput').value = Q('SearchInput').value = getstore('_search', ''); showRealNames = (getstore('showRealNames', 0) == 1); Q('RealNameCheckBox').checked = showRealNames; Q('viewselect').value = getstore('deviceView', 1); @@ -2868,18 +2869,18 @@ return; } if (e.ctrlKey == true || e.altKey == true || e.metaKey == true) return; - if (Q('viewselect').value < 3) { + if (Q('viewselect').value < 4) { var processed = 0; if (e.key) { - if (e.key.length === 1 && searchFocus == 0) { Q('SearchInput').value = ((Q('SearchInput').value + e.key)); processed = 1; } - if (e.keyCode == 8 && searchFocus == 0) { var x = Q('SearchInput').value; Q('SearchInput').value = x.substring(0, x.length - 1); processed = 1; } - if (e.keyCode == 27) { Q('SearchInput').value = ''; processed = 1; } + if (e.key.length === 1 && searchFocus == 0) { Q('KvmSearchInput').value = Q('SearchInput').value = ((Q('SearchInput').value + e.key)); processed = 1; } + if (e.keyCode == 8 && searchFocus == 0) { var x = Q('SearchInput').value; Q('KvmSearchInput').value = Q('SearchInput').value = x.substring(0, x.length - 1); processed = 1; } + if (e.keyCode == 27) { Q('KvmSearchInput').value = Q('SearchInput').value = ''; processed = 1; } } else { - if (e.charCode != 0 && searchFocus == 0) { Q('SearchInput').value = ((Q('SearchInput').value + String.fromCharCode(e.charCode))); processed = 1; } + if (e.charCode != 0 && searchFocus == 0) { Q('KvmSearchInput').value = Q('SearchInput').value = ((Q('SearchInput').value + String.fromCharCode(e.charCode))); processed = 1; } } if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); } } - if (Q('viewselect').value == 3) { + if (Q('viewselect').value == 4) { if (e.key) { if (e.key.length === 1 && mapSearchFocus == 0) { Q('mapSearchLocation').value = ((Q('mapSearchLocation').value + e.key)); processed = 1; } //if (e.keyCode == 8 && mapSearchFocus == 0) { var x = Q('mapSearchLocation').value; Q('mapSearchLocation').value = x.substring(0, x.length - 1); processed = 1; } @@ -2914,12 +2915,12 @@ } if (xxdialogMode || xxcurrentView != 1 || e.ctrlKey == true || e.altKey == true || e.metaKey == true) return; var processed = 0; - if (Q('viewselect').value < 3) { - if (e.keyCode === 8 && searchFocus == 0) { var x = Q('SearchInput').value; Q('SearchInput').value = (x.substring(0, x.length - 1)); processed = 1; } - if (e.keyCode === 27) { Q('SearchInput').value = ''; processed = 1; } + if (Q('viewselect').value < 4) { + if (e.keyCode === 8 && searchFocus == 0) { var x = Q('SearchInput').value; Q('KvmSearchInput').value = Q('SearchInput').value = (x.substring(0, x.length - 1)); processed = 1; } + if (e.keyCode === 27) { Q('KvmSearchInput').value = Q('SearchInput').value = ''; processed = 1; } if (processed > 0) { if (processed == 1) { masterUpdate(5); } return haltEvent(e); } } - if (Q('viewselect').value == 3) { + if (Q('viewselect').value == 4) { if (e.keyCode === 8 && mapSearchFocus == 0) { var x = Q('mapSearchLocation').value; Q('mapSearchLocation').value = (x.substring(0, x.length - 1)); processed = 1; } if (e.keyCode === 27) { Q('mapSearchLocation').value = ''; mapCloseSearchWindow(); processed = 1; } } @@ -2943,8 +2944,8 @@ if (!xxdialogMode && xxcurrentView == 4) { if ((e.keyCode === 8 && searchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } } if (xxdialogMode && e.keyCode == 27) { dialogclose(0); } if (xxdialogMode || xxcurrentView != 0 || e.ctrlKey == true || e.altKey == true || e.metaKey == true) return; - if (Q('viewselect').value < 3) { if ((e.keyCode === 8 && searchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } } - if (Q('viewselect').value == 3) { if ((e.keyCode === 8 && mapSearchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } } + if (Q('viewselect').value < 4) { if ((e.keyCode === 8 && searchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } } + if (Q('viewselect').value == 4) { if ((e.keyCode === 8 && mapSearchFocus == 0) || e.keyCode === 27) { return haltEvent(e); } } } //function ondocfocus() { } @@ -3404,6 +3405,7 @@ } function disconnectAllKvmFunction() { if (xxdialogMode) return false; for (var nodeid in multiDesktop) { multiDesktop[nodeid].Stop(); } multiDesktop = {}; } function onMultiDesktopStateChange(desk, state) { try { QH('skvmid_' + desk.shortid, ["Disconnected", "Connecting...", "Setup...", '', ''][state]); } catch (ex) {} } + function onDeviceSearchChanged(e) { if (e.target.id == 'SearchInput') { Q('KvmSearchInput').value = Q('SearchInput').value; } else { Q('SearchInput').value = Q('KvmSearchInput').value; } masterUpdate(5); } function showMultiDesktopSettings() { QV('d7amtkvm', false);