Changeset 5265 in subversion
- Timestamp:
- Sep 22, 2011 3:26:28 AM (20 months ago)
- File:
-
- 1 edited
-
trunk/roundcubemail/program/js/app.js (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/js/app.js
r5264 r5265 3620 3620 return; 3621 3621 3622 this.ksearch_destroy(); 3623 3622 3624 if (q.length && q.length < min) { 3623 3625 if (!this.ksearch_info) { … … 3630 3632 var old_value = this.ksearch_value; 3631 3633 this.ksearch_value = q; 3632 this.ksearch_destroy();3633 3634 3634 3635 // ...string is empty … … 3672 3673 3673 3674 // display search results 3674 var p, ul, li, text, init, s_val = this.ksearch_value, 3675 var ul, li, text, init, 3676 value = this.ksearch_value, 3677 data = this.ksearch_data, 3675 3678 maxlen = this.env.autocomplete_max ? this.env.autocomplete_max : 15; 3676 3679 … … 3705 3708 text = typeof results[i] === 'object' ? results[i].name : results[i]; 3706 3709 li = document.createElement('LI'); 3707 li.innerHTML = text.replace(new RegExp('('+RegExp.escape( s_val)+')', 'ig'), '##$1%%').replace(/</g, '<').replace(/>/g, '>').replace(/##([^%]+)%%/g, '<b>$1</b>');3710 li.innerHTML = text.replace(new RegExp('('+RegExp.escape(value)+')', 'ig'), '##$1%%').replace(/</g, '<').replace(/>/g, '>').replace(/##([^%]+)%%/g, '<b>$1</b>'); 3708 3711 li.onmouseover = function(){ ref.ksearch_select(this); }; 3709 3712 li.onmouseup = function(){ ref.ksearch_click(this) }; … … 3727 3730 3728 3731 // run next parallel search 3729 if ( this.ksearch_data.id == reqid) {3730 if (maxlen > 0 && this.ksearch_data.sources.length) {3731 var lock, xhr, props = this.ksearch_data, source = props.sources.shift();3732 if (data.id == reqid) { 3733 if (maxlen > 0 && data.sources.length) { 3734 var lock, xhr, source = data.sources.shift(); 3732 3735 if (source) { 3733 3736 lock = this.display_message(this.get_label('searching'), 'loading'); 3734 xhr = this.http_post( props.action, '_search='+urlencode(s_val)+'&_id='+reqid3737 xhr = this.http_post(data.action, '_search='+urlencode(value)+'&_id='+reqid 3735 3738 +'&_source='+urlencode(source), lock); 3736 3739 … … 3739 3742 } 3740 3743 } 3741 else if (!maxlen && !this.ksearch_msg) 3742 this.ksearch_msg = this.display_message(this.get_label('autocompletemore')); 3744 else if (!maxlen) { 3745 if (!this.ksearch_msg) 3746 this.ksearch_msg = this.display_message(this.get_label('autocompletemore')); 3747 // abort pending searches 3748 this.ksearch_abort(); 3749 } 3743 3750 } 3744 3751 }; … … 3773 3780 }; 3774 3781 3775 // Aborts pending autocompleterequests3782 // Clears autocomplete data/requests 3776 3783 this.ksearch_destroy = function() 3777 3784 { 3778 var i, len, ac = this.ksearch_data; 3779 3780 if (!ac) 3781 return; 3782 3783 for (i=0, len=ac.locks.length; i<len; i++) 3784 this.abort_request({request: ac.requests[i], lock: ac.locks[i]}); 3785 this.ksearch_abort(); 3785 3786 3786 3787 if (this.ksearch_info) … … 3794 3795 this.ksearch_msg = null; 3795 3796 } 3797 3798 // Aborts pending autocomplete requests 3799 this.ksearch_abort = function() 3800 { 3801 var i, len, ac = this.ksearch_data; 3802 3803 if (!ac) 3804 return; 3805 3806 for (i=0, len=ac.locks.length; i<len; i++) 3807 this.abort_request({request: ac.requests[i], lock: ac.locks[i]}); 3808 }; 3809 3796 3810 3797 3811 /*********************************************************/
Note: See TracChangeset
for help on using the changeset viewer.
