diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-06-20 14:07:17 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2009-06-20 14:07:17 +0000 |
| commit | b06e7be74e2c6f4ebcecfdb54d7fc7e07847c152 (patch) | |
| tree | 162709b060f8d4c4dedabd5d23212fbc5d4f4d2d /roundcubemail/program | |
| parent | 52c26184c9e2f0a6ff34fda5daef36ec0d2c7b59 (diff) | |
- minimize autocomplete requests
git-svn-id: https://svn.roundcube.net/trunk@2670 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
| -rw-r--r-- | roundcubemail/program/js/app.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/roundcubemail/program/js/app.js b/roundcubemail/program/js/app.js index 93ee4d8bb..10b36756a 100644 --- a/roundcubemail/program/js/app.js +++ b/roundcubemail/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)); |
