fix filter refilling in chrome and safari (#6209)

Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
Simon Smith 2024-06-27 16:07:03 +01:00 committed by GitHub
parent 602eb3c64a
commit 57442e4988
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -318,7 +318,7 @@
<input type=button id=SelectAllButton onclick="selectallButtonFunction();" value="Select All" />&nbsp;
<input type=button id=GroupActionButton disabled="disabled" value="Group Action" onclick=groupActionFunction() />&nbsp;
<input type=button id=ScrollToTopButton onclick="onDevicesScroll(true);" style="display:none;margin-right:4px" value="Scroll To Top" />
<input id=SearchInput type=search autocomplete=off placeholder=Filter onchange=onDeviceSearchChanged(event) onclick=onDeviceSearchChanged(event) onkeyup=onDeviceSearchChanged(event) onfocus=onSearchFocus(1) onblur=onSearchFocus(0) title="Filter: user:xxx or u:xxx ip:xxx group:xxx or g:xxx tag:xxx or t: xxx atag:xxx or a:xxx os:xxx amt:xxx desc:xxx wsc:ok wsc:noav wsc:noupdate wsc:nofirewall wsc:any"/>&nbsp;
<input id=SearchInput type=input autocomplete=off placeholder=Filter onchange=onDeviceSearchChanged(event) onclick=onDeviceSearchChanged(event) onkeyup=onDeviceSearchChanged(event) onfocus=onSearchFocus(1) onblur=onSearchFocus(0) title="Filter: user:xxx or u:xxx ip:xxx group:xxx or g:xxx tag:xxx or t: xxx atag:xxx or a:xxx os:xxx amt:xxx desc:xxx wsc:ok wsc:noav wsc:noupdate wsc:nofirewall wsc:any"/>&nbsp;
<span id=SearchInputClearButton style="display:none;position:relative"><img src="images/x16.png" type="button" onclick="clearDeviceSearch()" style="position:absolute;cursor:pointer;left:-18px;top:-8px" srcset="images/x32.png 2x"/></span>
<select id=DevFilterSelect onchange=onOnlineCheckBox(event) title="Device Filter">
<option value=0>All</option>
@ -5135,14 +5135,21 @@
function onMultiDesktopStateChange(desk, state) { try { QH('skvmid_' + desk.shortid, ["Disconnected", "Connecting...", "Setup...", '', ''][state]); } catch (ex) {} }
function onDeviceSearchChanged(e) {
var url = new URL(window.location.href);
if ((e != null) && (e.target.value != '')) {
if ((e != null) && ((e.target.id == 'SearchInput') || (e.target.id == 'KvmSearchInput'))){ // search box changed or cleared
if (e.target.id == 'SearchInput') {
Q('KvmSearchInput').value = Q('SearchInput').value;
} else {
Q('SearchInput').value = Q('KvmSearchInput').value;
}
url.searchParams.set('filter', e.target.value);
if (urlargs.filter) { urlargs.filter = e.target.value; }
if (e.target.value != '') {
url.searchParams.set('filter', e.target.value);
if (urlargs.filter) { urlargs.filter = e.target.value; }
} else {
url.searchParams.delete('filter');
if (urlargs.filter) { delete urlargs.filter; }
}
} else if ((e != null) && (e.target.id == 'DevFilterSelect')){ // devfilter box changed
// DO NOTHING
} else {
url.searchParams.delete('filter');
if (urlargs.filter) { delete urlargs.filter; }
@ -6199,7 +6206,7 @@
function lastConnectSort(a, b) { var aa = a.lastconnect, bb = b.lastconnect; if (aa == null) { aa = 99999999999999; } if (bb == null) { bb = 99999999999999; } if (a.conn > 0) { aa = 99999999999998; } if (b.conn > 0) { bb = 99999999999998; } if (aa == bb) { return nameSort(a, b); } return (aa - bb); }
function onSearchFocus(x) { searchFocus = x; }
function clearDeviceSearch() { Q('KvmSearchInput').value = Q('SearchInput').value = ''; Q('DevFilterSelect').value = 0; onOnlineCheckBox(); mainUpdate(1); }
function clearDeviceSearch() { Q('KvmSearchInput').value = Q('SearchInput').value = ''; onOnlineCheckBox(); mainUpdate(1); }
function onMapSearchFocus(x) { mapSearchFocus = x; }
function onUserSearchFocus(x) { userSearchFocus = x; }
function onConsoleFocus(x) { consoleFocus = x; }
@ -6323,8 +6330,8 @@
function onSearchInputChanged() {
var x = Q('SearchInput').value.toLowerCase().trim(); putstore('_search', Q('SearchInput').value);
QS('SearchInput')['background-color'] = QS('KvmSearchInput')['background-color'] = (x == '')?null:'#FDFFBE';
QV('SearchInputClearButton', (x != '') && (navigator.userAgent.indexOf('Firefox') >= 0));
QV('KvmSearchInputClearButton', (x != '') && (navigator.userAgent.indexOf('Firefox') >= 0));
QV('SearchInputClearButton', (x != ''));
QV('KvmSearchInputClearButton', (x != ''));
var r = parseSearchOrInput(x);
for (var d in nodes) { nodes[d].v = (r.indexOf(d) >= 0) }