From a4239a466b12c2b45b6c16fe7907c33e8ef025a3 Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 12 Jan 2024 00:20:38 +0100 Subject: [PATCH] immediately perform search if a checkbox is toggled --- copyparty/web/browser.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index f152b152..af93bc48 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -5179,9 +5179,11 @@ document.onkeydown = function (e) { function ev_search_input() { var v = unsmart(this.value), - id = this.getAttribute('id'); + id = this.getAttribute('id'), + is_txt = id.slice(-1) == 'v', + is_chk = id.slice(-1) == 'c'; - if (id.slice(-1) == 'v') { + if (is_txt) { var chk = ebi(id.slice(0, -1) + 'c'); chk.checked = ((v + '').length > 0); } @@ -5193,6 +5195,9 @@ document.onkeydown = function (e) { cap = 125; clearTimeout(defer_timeout); + if (is_chk) + return do_search(); + defer_timeout = setTimeout(try_search, 2000); try_search(v); }