Index: trunk/extensions/Translate/resources/ext.translate.special.pagetranslation.js |
— | — | @@ -22,47 +22,46 @@ |
23 | 23 | return val.split( /,\s*/ ); |
24 | 24 | } |
25 | 25 | |
26 | | - var input = this.input = $( options.inputbox ) |
27 | | - .autocomplete( { |
28 | | - delay: 0, |
29 | | - minLength: 0, |
30 | | - source: function( request, response ) { |
| 26 | + var input = this.input = $( options.inputbox ).autocomplete( { |
| 27 | + delay: 0, |
| 28 | + minLength: 0, |
| 29 | + source: function( request, response ) { |
| 30 | + var term = split( request.term ).pop(); |
| 31 | + var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" ); |
| 32 | + response( select.children( "option" ).map( function() { |
| 33 | + var text = $( this ).text(); |
| 34 | + var value = $( this ).val(); |
31 | 35 | var term = split( request.term ).pop(); |
32 | | - var matcher = new RegExp( $.ui.autocomplete.escapeRegex( term ), "i" ); |
33 | | - response( select.children( "option" ).map( function() { |
34 | | - var text = $( this ).text(); |
35 | | - var value = $( this ).val(); |
36 | | - var term = split( request.term ).pop(); |
37 | | - if ( this.value && ( !request.term || matcher.test(text) ) ) { |
38 | | - return { |
39 | | - label: text.replace( |
40 | | - new RegExp( |
41 | | - "(?![^&;]+;)(?!<[^<>]*)(" + |
42 | | - $.ui.autocomplete.escapeRegex( term ) + |
43 | | - ")(?![^<>]*>)(?![^&;]+;)", "gi" |
44 | | - ), "<strong>$1</strong>" ), |
45 | | - value: value, |
46 | | - option: this |
47 | | - }; |
48 | | - } |
49 | | - } ) ); |
50 | | - }, |
51 | | - select: function( event, ui ) { |
52 | | - ui.item.option.selected = true; |
53 | | - self._trigger( "selected", event, { |
54 | | - item: ui.item.option |
55 | | - }); |
56 | | - var terms = split( $(this).val() ); |
57 | | - // remove the current input |
58 | | - terms.pop(); |
59 | | - // add the selected item |
60 | | - terms.push( ui.item.value ); |
61 | | - // add placeholder to get the comma-and-space at the end |
62 | | - terms.push( "" ); |
63 | | - $( this ).val( terms.join( ", " ) ); |
64 | | - return false; |
65 | | - } |
66 | | - } ); |
| 36 | + if ( this.value && ( !request.term || matcher.test(text) ) ) { |
| 37 | + return { |
| 38 | + label: text.replace( |
| 39 | + new RegExp( |
| 40 | + "(?![^&;]+;)(?!<[^<>]*)(" + |
| 41 | + $.ui.autocomplete.escapeRegex( term ) + |
| 42 | + ")(?![^<>]*>)(?![^&;]+;)", "gi" |
| 43 | + ), "<strong>$1</strong>" ), |
| 44 | + value: value, |
| 45 | + option: this |
| 46 | + }; |
| 47 | + } |
| 48 | + } ) ); |
| 49 | + }, |
| 50 | + select: function( event, ui ) { |
| 51 | + ui.item.option.selected = true; |
| 52 | + self._trigger( "selected", event, { |
| 53 | + item: ui.item.option |
| 54 | + }); |
| 55 | + var terms = split( $(this).val() ); |
| 56 | + // remove the current input |
| 57 | + terms.pop(); |
| 58 | + // add the selected item |
| 59 | + terms.push( ui.item.value ); |
| 60 | + // add placeholder to get the comma-and-space at the end |
| 61 | + terms.push( "" ); |
| 62 | + $( this ).val( terms.join( ", " ) ); |
| 63 | + return false; |
| 64 | + } |
| 65 | + } ); |
67 | 66 | |
68 | 67 | input.data( "autocomplete" )._renderItem = function( ul, item ) { |
69 | 68 | return $( "<li>" ) |