summaryrefslogtreecommitdiff
path: root/program/js
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-06-20 14:07:17 +0000
committeralecpl <alec@alec.pl>2009-06-20 14:07:17 +0000
commit297a4359596484069218ca8d94bdf9387f707b70 (patch)
treed40134c5b3ce7961e294c97b44b9828a6c40af1d /program/js
parente014742ffbd92099a59eb7df299e2ba36b0f31c3 (diff)
- minimize autocomplete requests
Diffstat (limited to 'program/js')
-rw-r--r--program/js/app.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/program/js/app.js b/program/js/app.js
index 93ee4d8bb..10b36756a 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -2626,14 +2626,20 @@ function rcube_webmail()
// trim query string
q = q.replace(/(^\s+|\s+$)/g, '').toLowerCase();
- // Don't (re-)search if string is empty or if the last results are still active
+ // Don't (re-)search if the last results are still active
if (q == this.ksearch_value)
return;
+ var old_value = this.ksearch_value;
this.ksearch_value = q;
+ // ...string is empty
if (!q.length)
return;
+
+ // ...new search value contains old one and previous search result was empty
+ if (old_value && old_value.length && this.env.contacts && !this.env.contacts.length && q.indexOf(old_value) == 0)
+ return;
this.display_message(this.get_label('searching'), 'loading', true);
this.http_post('autocomplete', '_search='+urlencode(q));