diff options
author | alecpl <alec@alec.pl> | 2011-09-27 07:29:49 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2011-09-27 07:29:49 +0000 |
commit | 5f47eda94b64b21b48ce95e329993c3ed50ef6db (patch) | |
tree | 8dcac8522943871530cc7c00a362d507d244e8c1 /program/js | |
parent | 075e9d5ba25ece5b7fed5470efb38272d519fa27 (diff) |
- Applied some fixes from trunk up to r5280
Diffstat (limited to 'program/js')
-rw-r--r-- | program/js/app.js | 11 | ||||
-rw-r--r-- | program/js/common.js | 4 |
2 files changed, 9 insertions, 6 deletions
diff --git a/program/js/app.js b/program/js/app.js index be42cc8b3..4f0509098 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3604,7 +3604,8 @@ function rcube_webmail() var cpos = this.get_caret_pos(this.ksearch_input), p = inp_value.lastIndexOf(',', cpos-1), q = inp_value.substring(p+1, cpos), - min = this.env.autocomplete_min_length; + min = this.env.autocomplete_min_length, + ac = this.ksearch_data; // trim query string q = $.trim(q); @@ -3633,8 +3634,8 @@ function rcube_webmail() 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) + // ...new search value contains old one and previous search was not finished or its result was empty + if (old_value && old_value.length && q.indexOf(old_value) == 0 && (!ac || !ac.num) && this.env.contacts && !this.env.contacts.length) return; var i, lock, source, xhr, reqid = new Date().getTime(), @@ -3642,7 +3643,8 @@ function rcube_webmail() sources = props && props.sources ? props.sources : [], action = props && props.action ? props.action : 'mail/autocomplete'; - this.ksearch_data = {id: reqid, sources: sources.slice(), action: action, locks: [], requests: []}; + this.ksearch_data = {id: reqid, sources: sources.slice(), action: action, + locks: [], requests: [], num: sources.length}; for (i=0; i<threads; i++) { source = this.ksearch_data.sources.shift(); @@ -3727,6 +3729,7 @@ function rcube_webmail() if (maxlen > 0 && this.ksearch_data.id == reqid && this.ksearch_data.sources.length) { var lock, xhr, props = this.ksearch_data, source = props.sources.shift(); if (source) { + data.num--; lock = this.display_message(this.get_label('searching'), 'loading'); xhr = this.http_post(props.action, '_search='+urlencode(s_val)+'&_id='+reqid +'&_source='+urlencode(source), lock); diff --git a/program/js/common.js b/program/js/common.js index c5f466ae7..c0c6ddae9 100644 --- a/program/js/common.js +++ b/program/js/common.js @@ -619,10 +619,10 @@ function getCookie(name) return null; } else { - begin += 2; + begin += 2; } - var end = document.cookie.indexOf(";", begin); + var end = dc.indexOf(";", begin); if (end == -1) end = dc.length; |