Bugzilla – Attachment 132808 Details for
Bug 27113
Elasticsearch: Autocomplete in search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27113: No autosubmit after clicking autocomplete option in advanced search
Bug-27113-No-autosubmit-after-clicking-autocomplet.patch (text/plain), 3.63 KB, created by
Shi Yao Wang
on 2022-03-31 18:21:48 UTC
(
hide
)
Description:
Bug 27113: No autosubmit after clicking autocomplete option in advanced search
Filename:
MIME Type:
Creator:
Shi Yao Wang
Created:
2022-03-31 18:21:48 UTC
Size:
3.63 KB
patch
obsolete
>From 1118945c92f5198a63dbffbacbcaa2abe86cb024 Mon Sep 17 00:00:00 2001 >From: Shi Yao Wang <shiyao@inlibro.com> >Date: Thu, 31 Mar 2022 14:11:34 -0400 >Subject: [PATCH] Bug 27113: No autosubmit after clicking autocomplete option > in advanced search > >This patch makes it so it doesn't automatically submit form after clicking an autocomplete option >in advanced search. Also removes autocomplete options after pressing tab. >--- > .../js/elasticsearch/autocomplete.js | 17 +++++++++++++++-- > .../js/opac-elasticsearch/opac-autocomplete.js | 17 +++++++++++++++-- > 2 files changed, 30 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/js/elasticsearch/autocomplete.js b/koha-tmpl/intranet-tmpl/js/elasticsearch/autocomplete.js >index 0f689a7b38..e0d80ded89 100644 >--- a/koha-tmpl/intranet-tmpl/js/elasticsearch/autocomplete.js >+++ b/koha-tmpl/intranet-tmpl/js/elasticsearch/autocomplete.js >@@ -213,6 +213,10 @@ function autocomplete(inp, nb, left, right) { > /* press Esc clear all autocomplete */ > else if (e.keyCode == 8) { > closeAllLists(); >+ } >+ /* press Tab clear all autocomplete */ >+ else if (e.keyCode == 9) { >+ closeAllLists(); > }; > }); > function addActive(x) { >@@ -255,8 +259,17 @@ function autocomplete(inp, nb, left, right) { > /* normalyzer hightlight without tags */ > //inp.value = (inp.value.replace(/<\/?[^>]+(>|$)/g, "")).trim(); > inp.value = this.innerText; >- /* Submit form click mouse in div */ >- this.closest("form").submit(); >+ >+ var autocommit = 1; >+ const inputs = document.querySelectorAll("#advanced-search input[type='text']"); >+ for (var i = 0; i < inputs.length && autocommit; i++) { >+ var input = inputs[i]; >+ if (input === inp) { >+ autocommit = 0; >+ } >+ } >+ //Submit form click mouse in div if not in advanced search >+ if (autocommit) this.closest("form").submit(); > }); > return b; > }; >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/opac-elasticsearch/opac-autocomplete.js b/koha-tmpl/opac-tmpl/bootstrap/js/opac-elasticsearch/opac-autocomplete.js >index 01d6332caa..000a58e811 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/opac-elasticsearch/opac-autocomplete.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/opac-elasticsearch/opac-autocomplete.js >@@ -209,6 +209,10 @@ function autocomplete(inp, nb, left, right) { > /* press Esc clear all autocomplete */ > else if (e.keyCode == 8) { > closeAllLists(); >+ } >+ /* press Tab clear all autocomplete */ >+ else if (e.keyCode == 9) { >+ closeAllLists(); > }; > }); > function addActive(x) { >@@ -251,8 +255,17 @@ function autocomplete(inp, nb, left, right) { > /* normalyzer hightlight without tags */ > //inp.value = (inp.value.replace(/<\/?[^>]+(>|$)/g, "")).trim(); > inp.value = this.innerText; >- /* Submit form click mouse in div */ >- this.closest("form").submit(); >+ >+ var autocommit = 1; >+ const inputs = document.querySelectorAll("#booleansearch input[type='text']"); >+ for (var i = 0; i < inputs.length && autocommit; i++) { >+ var input = inputs[i]; >+ if (input === inp) { >+ autocommit = 0; >+ } >+ } >+ //Submit form click mouse in div if not in advanced search >+ if (autocommit) this.closest("form").submit(); > }); > return b; > }; >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27113
:
114168
|
114169
|
114945
|
115117
|
116293
|
119979
|
120028
|
120029
|
120084
|
120088
|
120109
|
120140
|
120141
|
120806
|
121497
|
121498
|
121555
|
121556
|
121557
|
121558
|
131207
|
131208
|
131209
|
131210
|
131211
|
132360
|
132361
|
132362
|
132363
|
132364
|
132808
|
132945
|
132946
|
133042
|
133045
|
133407
|
133409
|
133410
|
136312
|
136456
|
136457
|
136464
|
136465
|
136653
|
136657
|
136658
|
136659
|
136660
|
137436
|
137437
|
137438
|
137439
|
137780
|
137781
|
137782
|
137783
|
139624
|
141466
|
145167
|
146015
|
159769
|
159770
|
159771
|
159772
|
159773
|
159774
|
159775
|
160134
|
160135
|
160136
|
160137
|
160138
|
160139
|
160140
|
160141
|
160142
|
161076
|
161077
|
163826
|
165895
|
165896
|
165897
|
165898
|
165899
|
165900
|
165901
|
165902
|
165903
|
165904
|
165913
|
165922
|
177537
|
177538
|
177539
|
177540
|
177541
|
177542
|
177543
|
177544
|
177545
|
177546
|
177547
|
177548
|
177657
|
178822
|
178823
|
178824
|
178825
|
178826
|
178827
|
178828
|
178829
|
178830
|
178831
|
178832
|
178833