Index: trunk/extensions/UsabilityInitiative/css/suggestions.css |
— | — | @@ -23,15 +23,6 @@ |
24 | 24 | padding: 0.25em 0.25em; |
25 | 25 | line-height: 1.25em; |
26 | 26 | } |
27 | | -.suggestions-special:hover { |
28 | | - background-color: #4C59A6; |
29 | | - background-color: Highlight; |
30 | | -} |
31 | | -.suggestions-special:hover .special-label, |
32 | | -.suggestions-special:hover .special-query { |
33 | | - color: white; |
34 | | - color: HighlightText; |
35 | | -} |
36 | 27 | .suggestions-results { |
37 | 28 | background-color: white; |
38 | 29 | background-color: Window; |
— | — | @@ -58,3 +49,19 @@ |
59 | 50 | color: white; |
60 | 51 | color: HighlightText; |
61 | 52 | } |
| 53 | +.suggestions-special .special-label { |
| 54 | + font-size: 0.8em; |
| 55 | + color: gray; |
| 56 | +} |
| 57 | +.suggestions-special .special-query { |
| 58 | + color: black; |
| 59 | + font-style: italic; |
| 60 | +} |
| 61 | +.suggestions-special .special-hover { |
| 62 | + background-color: silver; |
| 63 | +} |
| 64 | +.suggestions-result-current .special-label, |
| 65 | +.suggestions-result-current .special-query { |
| 66 | + color: white !important; |
| 67 | + color: HighlightText !important; |
| 68 | +} |
\ No newline at end of file |
Index: trunk/extensions/UsabilityInitiative/css/combined.css |
— | — | @@ -23,15 +23,6 @@ |
24 | 24 | padding: 0.25em 0.25em; |
25 | 25 | line-height: 1.25em; |
26 | 26 | } |
27 | | -.suggestions-special:hover { |
28 | | - background-color: #4C59A6; |
29 | | - background-color: Highlight; |
30 | | -} |
31 | | -.suggestions-special:hover .special-label, |
32 | | -.suggestions-special:hover .special-query { |
33 | | - color: white; |
34 | | - color: HighlightText; |
35 | | -} |
36 | 27 | .suggestions-results { |
37 | 28 | background-color: white; |
38 | 29 | background-color: Window; |
— | — | @@ -58,7 +49,22 @@ |
59 | 50 | color: white; |
60 | 51 | color: HighlightText; |
61 | 52 | } |
62 | | -/* Prototype code to show collapsing left nav options */ |
| 53 | +.suggestions-special .special-label { |
| 54 | + font-size: 0.8em; |
| 55 | + color: gray; |
| 56 | +} |
| 57 | +.suggestions-special .special-query { |
| 58 | + color: black; |
| 59 | + font-style: italic; |
| 60 | +} |
| 61 | +.suggestions-special .special-hover { |
| 62 | + background-color: silver; |
| 63 | +} |
| 64 | +.suggestions-result-current .special-label, |
| 65 | +.suggestions-result-current .special-query { |
| 66 | + color: white !important; |
| 67 | + color: HighlightText !important; |
| 68 | +}/* Prototype code to show collapsing left nav options */ |
63 | 69 | #panel.collapsible-nav div.portal { |
64 | 70 | background-image:url(../images/vector/collapsibleNav/portal-break.png); |
65 | 71 | background-position:left top; |
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css |
— | — | @@ -21,15 +21,6 @@ |
22 | 22 | padding:0.25em 0.25em; |
23 | 23 | line-height:1.25em; |
24 | 24 | } |
25 | | -.suggestions-special:hover{ |
26 | | -background-color:#4C59A6; |
27 | | -background-color:Highlight; |
28 | | -} |
29 | | -.suggestions-special:hover .special-label, |
30 | | -.suggestions-special:hover .special-query{ |
31 | | -color:white; |
32 | | -color:HighlightText; |
33 | | -} |
34 | 25 | .suggestions-results{ |
35 | 26 | background-color:white; |
36 | 27 | background-color:Window; |
— | — | @@ -56,6 +47,22 @@ |
57 | 48 | color:white; |
58 | 49 | color:HighlightText; |
59 | 50 | } |
| 51 | +.suggestions-special .special-label{ |
| 52 | +font-size:0.8em; |
| 53 | +color:gray; |
| 54 | +} |
| 55 | +.suggestions-special .special-query{ |
| 56 | +color:black; |
| 57 | +font-style:italic; |
| 58 | +} |
| 59 | +.suggestions-special .special-hover{ |
| 60 | +background-color:silver; |
| 61 | +} |
| 62 | +.suggestions-result-current .special-label, |
| 63 | +.suggestions-result-current .special-query{ |
| 64 | +color:white !important; |
| 65 | +color:HighlightText !important; |
| 66 | +} |
60 | 67 | #panel.collapsible-nav div.portal{ |
61 | 68 | background-image:url(../images/vector/collapsibleNav/portal-break.png); |
62 | 69 | background-position:left top; |
Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -18,7 +18,7 @@ |
19 | 19 | private static $styleFiles = array( |
20 | 20 | 'base_sets' => array( |
21 | 21 | 'raw' => array( |
22 | | - array( 'src' => 'css/suggestions.css', 'version' => 10 ), |
| 22 | + array( 'src' => 'css/suggestions.css', 'version' => 11 ), |
23 | 23 | array( 'src' => 'css/vector.collapsibleNav.css', 'version' => 7 ), |
24 | 24 | array( 'src' => 'css/vector.footerCleanup.css', 'version' => 1 ), |
25 | 25 | array( 'src' => 'css/wikiEditor.css', 'version' => 12 ), |
— | — | @@ -29,11 +29,11 @@ |
30 | 30 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
31 | 31 | ), |
32 | 32 | 'combined' => array( |
33 | | - array( 'src' => 'css/combined.css', 'version' => 85 ), |
| 33 | + array( 'src' => 'css/combined.css', 'version' => 86 ), |
34 | 34 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
35 | 35 | ), |
36 | 36 | 'minified' => array( |
37 | | - array( 'src' => 'css/combined.min.css', 'version' => 85 ), |
| 37 | + array( 'src' => 'css/combined.min.css', 'version' => 86 ), |
38 | 38 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
39 | 39 | ), |
40 | 40 | ) |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | array( 'src' => 'js/plugins/jquery.color.js', 'version' => 1 ), |
72 | 72 | array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 4 ), |
73 | 73 | array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ), |
74 | | - array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 10 ), |
| 74 | + array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 11 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 30 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 181 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 52 ), |
— | — | @@ -82,10 +82,10 @@ |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 5 ), |
84 | 84 | ), |
85 | 85 | 'combined' => array( |
86 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 382 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 383 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 382 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 383 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.suggestions.js |
— | — | @@ -90,12 +90,6 @@ |
91 | 91 | setTimeout( function() { |
92 | 92 | // Render special |
93 | 93 | $special = context.data.$container.find( '.suggestions-special' ); |
94 | | - // Only hook this up the first time |
95 | | - if ( $special.children().length == 0 ) { |
96 | | - $special.mousemove( function() { |
97 | | - $.suggestions.highlight( context, $( [] ), false ); |
98 | | - } ); |
99 | | - } |
100 | 94 | context.config.special.render.call( $special, context.data.$textbox.val() ); |
101 | 95 | }, 1 ); |
102 | 96 | } |
— | — | @@ -188,7 +182,6 @@ |
189 | 183 | } else { |
190 | 184 | result = context.data.$container.find( '.suggestions-results div:last' ); |
191 | 185 | } |
192 | | - |
193 | 186 | } |
194 | 187 | } |
195 | 188 | } else if ( result == 'next' ) { |
— | — | @@ -198,7 +191,7 @@ |
199 | 192 | else { |
200 | 193 | result = selected.next(); |
201 | 194 | if ( selected.is( '.suggestions-special' ) ) { |
202 | | - result = []; |
| 195 | + result = $( [] ); |
203 | 196 | } else if ( result.size() == 0 && context.data.$container.find( '.suggestions-special' ).html() != "" ) { |
204 | 197 | // We were at the last item, jump to the specials! |
205 | 198 | result = context.data.$container.find( '.suggestions-special' ); |
— | — | @@ -217,6 +210,7 @@ |
218 | 211 | // let the world know what happened |
219 | 212 | context.data.$textbox.change(); |
220 | 213 | } |
| 214 | + context.data.$textbox.trigger( 'change' ); |
221 | 215 | } |
222 | 216 | $.suggestions.special( context ); |
223 | 217 | }, |
— | — | @@ -235,7 +229,6 @@ |
236 | 230 | } else { |
237 | 231 | $.suggestions.update( context, false ); |
238 | 232 | } |
239 | | - context.data.$textbox.trigger( 'change' ); |
240 | 233 | preventDefault = true; |
241 | 234 | break; |
242 | 235 | // Arrow up |
— | — | @@ -243,7 +236,6 @@ |
244 | 237 | if ( wasVisible ) { |
245 | 238 | $.suggestions.highlight( context, 'prev', false ); |
246 | 239 | } |
247 | | - context.data.$textbox.trigger( 'change' ); |
248 | 240 | preventDefault = wasVisible; |
249 | 241 | break; |
250 | 242 | // Escape |
— | — | @@ -265,7 +257,7 @@ |
266 | 258 | } |
267 | 259 | } else { |
268 | 260 | if ( typeof context.config.result.select == 'function' ) { |
269 | | - context.data.$textbox.val( selected.text() ); |
| 261 | + $.suggestions.highlight( context, selected, true ); |
270 | 262 | context.config.result.select.call( selected, context.data.$textbox ); |
271 | 263 | } |
272 | 264 | } |
— | — | @@ -341,9 +333,6 @@ |
342 | 334 | 'mouseDownOn': $( [] ), |
343 | 335 | '$textbox': $(this) |
344 | 336 | }; |
345 | | - context.data.$textbox.mousemove( function() { |
346 | | - $.suggestions.highlight( context, $( [] ), false ); |
347 | | - } ); |
348 | 337 | context.data.$container = $( '<div />' ) |
349 | 338 | .css( { |
350 | 339 | 'top': Math.round( context.data.$textbox.offset().top + context.data.$textbox.outerHeight() ), |
— | — | @@ -394,6 +383,11 @@ |
395 | 384 | } |
396 | 385 | context.data.$textbox.focus(); |
397 | 386 | } ) |
| 387 | + .mouseover( function( e ) { |
| 388 | + $.suggestions.highlight( |
| 389 | + context, $( e.target ).closest( '.suggestions-special' ), false |
| 390 | + ); |
| 391 | + } ) |
398 | 392 | ) |
399 | 393 | .appendTo( $( 'body' ) ); |
400 | 394 | $(this) |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -5841,12 +5841,6 @@ |
5842 | 5842 | setTimeout( function() { |
5843 | 5843 | // Render special |
5844 | 5844 | $special = context.data.$container.find( '.suggestions-special' ); |
5845 | | - // Only hook this up the first time |
5846 | | - if ( $special.children().length == 0 ) { |
5847 | | - $special.mousemove( function() { |
5848 | | - $.suggestions.highlight( context, $( [] ), false ); |
5849 | | - } ); |
5850 | | - } |
5851 | 5845 | context.config.special.render.call( $special, context.data.$textbox.val() ); |
5852 | 5846 | }, 1 ); |
5853 | 5847 | } |
— | — | @@ -5939,7 +5933,6 @@ |
5940 | 5934 | } else { |
5941 | 5935 | result = context.data.$container.find( '.suggestions-results div:last' ); |
5942 | 5936 | } |
5943 | | - |
5944 | 5937 | } |
5945 | 5938 | } |
5946 | 5939 | } else if ( result == 'next' ) { |
— | — | @@ -5949,7 +5942,7 @@ |
5950 | 5943 | else { |
5951 | 5944 | result = selected.next(); |
5952 | 5945 | if ( selected.is( '.suggestions-special' ) ) { |
5953 | | - result = []; |
| 5946 | + result = $( [] ); |
5954 | 5947 | } else if ( result.size() == 0 && context.data.$container.find( '.suggestions-special' ).html() != "" ) { |
5955 | 5948 | // We were at the last item, jump to the specials! |
5956 | 5949 | result = context.data.$container.find( '.suggestions-special' ); |
— | — | @@ -5968,6 +5961,7 @@ |
5969 | 5962 | // let the world know what happened |
5970 | 5963 | context.data.$textbox.change(); |
5971 | 5964 | } |
| 5965 | + context.data.$textbox.trigger( 'change' ); |
5972 | 5966 | } |
5973 | 5967 | $.suggestions.special( context ); |
5974 | 5968 | }, |
— | — | @@ -5986,7 +5980,6 @@ |
5987 | 5981 | } else { |
5988 | 5982 | $.suggestions.update( context, false ); |
5989 | 5983 | } |
5990 | | - context.data.$textbox.trigger( 'change' ); |
5991 | 5984 | preventDefault = true; |
5992 | 5985 | break; |
5993 | 5986 | // Arrow up |
— | — | @@ -5994,7 +5987,6 @@ |
5995 | 5988 | if ( wasVisible ) { |
5996 | 5989 | $.suggestions.highlight( context, 'prev', false ); |
5997 | 5990 | } |
5998 | | - context.data.$textbox.trigger( 'change' ); |
5999 | 5991 | preventDefault = wasVisible; |
6000 | 5992 | break; |
6001 | 5993 | // Escape |
— | — | @@ -6016,7 +6008,7 @@ |
6017 | 6009 | } |
6018 | 6010 | } else { |
6019 | 6011 | if ( typeof context.config.result.select == 'function' ) { |
6020 | | - context.data.$textbox.val( selected.text() ); |
| 6012 | + $.suggestions.highlight( context, selected, true ); |
6021 | 6013 | context.config.result.select.call( selected, context.data.$textbox ); |
6022 | 6014 | } |
6023 | 6015 | } |
— | — | @@ -6092,9 +6084,6 @@ |
6093 | 6085 | 'mouseDownOn': $( [] ), |
6094 | 6086 | '$textbox': $(this) |
6095 | 6087 | }; |
6096 | | - context.data.$textbox.mousemove( function() { |
6097 | | - $.suggestions.highlight( context, $( [] ), false ); |
6098 | | - } ); |
6099 | 6088 | context.data.$container = $( '<div />' ) |
6100 | 6089 | .css( { |
6101 | 6090 | 'top': Math.round( context.data.$textbox.offset().top + context.data.$textbox.outerHeight() ), |
— | — | @@ -6145,6 +6134,11 @@ |
6146 | 6135 | } |
6147 | 6136 | context.data.$textbox.focus(); |
6148 | 6137 | } ) |
| 6138 | + .mouseover( function( e ) { |
| 6139 | + $.suggestions.highlight( |
| 6140 | + context, $( e.target ).closest( '.suggestions-special' ), false |
| 6141 | + ); |
| 6142 | + } ) |
6149 | 6143 | ) |
6150 | 6144 | .appendTo( $( 'body' ) ); |
6151 | 6145 | $(this) |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -394,24 +394,24 @@ |
395 | 395 | if(typeof context.config.cancel=='function'){context.config.cancel.call(context.data.$textbox);}},restore:function(context){context.data.$textbox.val(context.data.prevText);},update:function(context,delayed){function maybeFetch(){if(context.data.$textbox.val()!==context.data.prevText){context.data.prevText=context.data.$textbox.val();if(typeof context.config.fetch=='function'){context.config.fetch.call(context.data.$textbox,context.data.$textbox.val());}}} |
396 | 396 | if(context.data.timerID!=null){clearTimeout(context.data.timerID);} |
397 | 397 | if(delayed){context.data.timerID=setTimeout(maybeFetch,context.config.delay);}else{maybeFetch();} |
398 | | -$.suggestions.special(context);},special:function(context){if(typeof context.config.special.render=='function'){setTimeout(function(){$special=context.data.$container.find('.suggestions-special');if($special.children().length==0){$special.mousemove(function(){$.suggestions.highlight(context,$([]),false);});} |
399 | | -context.config.special.render.call($special,context.data.$textbox.val());},1);}},configure:function(context,property,value){switch(property){case'fetch':case'cancel':case'special':case'result':case'$region':context.config[property]=value;break;case'suggestions':context.config[property]=value;if(typeof context.data!=='undefined'){if(context.data.$textbox.val().length==0){context.data.$container.hide();}else{context.data.$container.show();context.data.$container.css({'top':context.config.$region.offset().top+context.config.$region.outerHeight(),'bottom':'auto','width':context.config.$region.outerWidth(),'height':'auto','left':context.config.$region.offset().left,'right':'auto'});var $results=context.data.$container.children('.suggestions-results');$results.empty();for(var i=0;i<context.config.suggestions.length;i++){$result=$('<div />').addClass('suggestions-result').attr('rel',i).data('text',context.config.suggestions[i]).mouseover(function(e){$.suggestions.highlight(context,$(this).closest('.suggestions-results div'),false);}).appendTo($results);if(typeof context.config.result.render=='function'){context.config.result.render.call($result,context.config.suggestions[i]);}else{$result.text(context.config.suggestions[i]).autoEllipsis();}}}} |
| 398 | +$.suggestions.special(context);},special:function(context){if(typeof context.config.special.render=='function'){setTimeout(function(){$special=context.data.$container.find('.suggestions-special');context.config.special.render.call($special,context.data.$textbox.val());},1);}},configure:function(context,property,value){switch(property){case'fetch':case'cancel':case'special':case'result':case'$region':context.config[property]=value;break;case'suggestions':context.config[property]=value;if(typeof context.data!=='undefined'){if(context.data.$textbox.val().length==0){context.data.$container.hide();}else{context.data.$container.show();context.data.$container.css({'top':context.config.$region.offset().top+context.config.$region.outerHeight(),'bottom':'auto','width':context.config.$region.outerWidth(),'height':'auto','left':context.config.$region.offset().left,'right':'auto'});var $results=context.data.$container.children('.suggestions-results');$results.empty();for(var i=0;i<context.config.suggestions.length;i++){$result=$('<div />').addClass('suggestions-result').attr('rel',i).data('text',context.config.suggestions[i]).mouseover(function(e){$.suggestions.highlight(context,$(this).closest('.suggestions-results div'),false);}).appendTo($results);if(typeof context.config.result.render=='function'){context.config.result.render.call($result,context.config.suggestions[i]);}else{$result.text(context.config.suggestions[i]).autoEllipsis();}}}} |
400 | 399 | break;case'maxRows':context.config[property]=Math.max(1,Math.min(100,value));break;case'delay':context.config[property]=Math.max(0,Math.min(1200,value));break;case'submitOnClick':context.config[property]=value?true:false;break;}},highlight:function(context,result,updateTextbox){var selected=context.data.$container.find('.suggestions-result-current');if(!result.get||selected.get(0)!=result.get(0)){if(result=='prev'){if(selected.is('.suggestions-special')){result=context.data.$container.find('.suggestions-results div:last')}else{result=selected.prev();if(selected.size()==0){if(context.data.$container.find('.suggestions-special').html()!=""){result=context.data.$container.find('.suggestions-special');}else{result=context.data.$container.find('.suggestions-results div:last');}}}}else if(result=='next'){if(selected.size()==0) |
401 | | -result=context.data.$container.find('.suggestions-results div:first');else{result=selected.next();if(selected.is('.suggestions-special')){result=[];}else if(result.size()==0&&context.data.$container.find('.suggestions-special').html()!=""){result=context.data.$container.find('.suggestions-special');}}} |
| 400 | +result=context.data.$container.find('.suggestions-results div:first');else{result=selected.next();if(selected.is('.suggestions-special')){result=$([]);}else if(result.size()==0&&context.data.$container.find('.suggestions-special').html()!=""){result=context.data.$container.find('.suggestions-special');}}} |
402 | 401 | selected.removeClass('suggestions-result-current');result.addClass('suggestions-result-current');} |
403 | | -if(updateTextbox){if(result.size()==0){$.suggestions.restore(context);}else{context.data.$textbox.val(result.data('text'));context.data.$textbox.change();}} |
| 402 | +if(updateTextbox){if(result.size()==0){$.suggestions.restore(context);}else{context.data.$textbox.val(result.data('text'));context.data.$textbox.change();} |
| 403 | +context.data.$textbox.trigger('change');} |
404 | 404 | $.suggestions.special(context);},keypress:function(e,context,key){var wasVisible=context.data.$container.is(':visible');var preventDefault=false;switch(key){case 40:if(wasVisible){$.suggestions.highlight(context,'next',false);}else{$.suggestions.update(context,false);} |
405 | | -context.data.$textbox.trigger('change');preventDefault=true;break;case 38:if(wasVisible){$.suggestions.highlight(context,'prev',false);} |
406 | | -context.data.$textbox.trigger('change');preventDefault=wasVisible;break;case 27:context.data.$container.hide();$.suggestions.restore(context);$.suggestions.cancel(context);context.data.$textbox.trigger('change');preventDefault=wasVisible;break;case 13:context.data.$container.hide();preventDefault=wasVisible;selected=context.data.$container.find('.suggestions-result-current') |
407 | | -if(selected.is('.suggestions-special')){if(typeof context.config.special.select=='function'){context.config.special.select.call(selected,context.data.$textbox);}}else{if(typeof context.config.result.select=='function'){context.data.$textbox.val(selected.text());context.config.result.select.call(selected,context.data.$textbox);}} |
| 405 | +preventDefault=true;break;case 38:if(wasVisible){$.suggestions.highlight(context,'prev',false);} |
| 406 | +preventDefault=wasVisible;break;case 27:context.data.$container.hide();$.suggestions.restore(context);$.suggestions.cancel(context);context.data.$textbox.trigger('change');preventDefault=wasVisible;break;case 13:context.data.$container.hide();preventDefault=wasVisible;selected=context.data.$container.find('.suggestions-result-current') |
| 407 | +if(selected.is('.suggestions-special')){if(typeof context.config.special.select=='function'){context.config.special.select.call(selected,context.data.$textbox);}}else{if(typeof context.config.result.select=='function'){$.suggestions.highlight(context,selected,true);context.config.result.select.call(selected,context.data.$textbox);}} |
408 | 408 | break;default:$.suggestions.update(context,true);break;} |
409 | 409 | if(preventDefault){e.preventDefault();e.stopImmediatePropagation();}}};$.fn.suggestions=function(){var returnValue=null;var args=arguments;$(this).each(function(){var context=$(this).data('suggestions-context');if(typeof context=='undefined'){context={config:{'fetch':function(){},'cancel':function(){},'special':{},'result':{},'$region':$(this),'suggestions':[],'maxRows':7,'delay':120,'submitOnClick':false}};} |
410 | 410 | if(args.length>0){if(typeof args[0]=='object'){for(var key in args[0]){$.suggestions.configure(context,key,args[0][key]);}}else if(typeof args[0]=='string'){if(args.length>1){$.suggestions.configure(context,args[0],args[1]);}else if(returnValue==null){returnValue=(args[0]in context.config?undefined:context.config[args[0]]);}}} |
411 | | -if(typeof context.data=='undefined'){context.data={'timerID':null,'prevText':null,'visibleResults':0,'mouseDownOn':$([]),'$textbox':$(this)};context.data.$textbox.mousemove(function(){$.suggestions.highlight(context,$([]),false);});context.data.$container=$('<div />').css({'top':Math.round(context.data.$textbox.offset().top+context.data.$textbox.outerHeight()),'left':Math.round(context.data.$textbox.offset().left),'width':context.data.$textbox.outerWidth(),'display':'none'}).addClass('suggestions').append($('<div />').addClass('suggestions-results').mousedown(function(e){context.data.mouseDownOn=$(e.target).closest('.suggestions-results div');}).mouseup(function(e){var $result=$(e.target).closest('.suggestions-results div');var $other=context.data.mouseDownOn;context.data.mouseDownOn=$([]);if($result.get(0)!=$other.get(0)){return;} |
| 411 | +if(typeof context.data=='undefined'){context.data={'timerID':null,'prevText':null,'visibleResults':0,'mouseDownOn':$([]),'$textbox':$(this)};context.data.$container=$('<div />').css({'top':Math.round(context.data.$textbox.offset().top+context.data.$textbox.outerHeight()),'left':Math.round(context.data.$textbox.offset().left),'width':context.data.$textbox.outerWidth(),'display':'none'}).addClass('suggestions').append($('<div />').addClass('suggestions-results').mousedown(function(e){context.data.mouseDownOn=$(e.target).closest('.suggestions-results div');}).mouseup(function(e){var $result=$(e.target).closest('.suggestions-results div');var $other=context.data.mouseDownOn;context.data.mouseDownOn=$([]);if($result.get(0)!=$other.get(0)){return;} |
412 | 412 | $.suggestions.highlight(context,$result,true);context.data.$container.hide();if(typeof context.config.result.select=='function'){context.config.result.select.call($result,context.data.$textbox);} |
413 | 413 | context.data.$textbox.focus();})).append($('<div />').addClass('suggestions-special').mousedown(function(e){context.data.mouseDownOn=$(e.target).closest('.suggestions-special');}).mouseup(function(e){var $special=$(e.target).closest('.suggestions-special');var $other=context.data.mouseDownOn;context.data.mouseDownOn=$([]);if($special.get(0)!=$other.get(0)){return;} |
414 | 414 | context.data.$container.hide();if(typeof context.config.special.select=='function'){context.config.special.select.call($special,context.data.$textbox);} |
415 | | -context.data.$textbox.focus();})).appendTo($('body'));$(this).attr('autocomplete','off').keydown(function(e){context.data.keypressed=(e.keyCode==undefined)?e.which:e.keyCode;context.data.keypressedCount=0;switch(context.data.keypressed){case 40:e.preventDefault();e.stopImmediatePropagation();break;case 38:case 27:case 13:if(context.data.$container.is(':visible')){e.preventDefault();e.stopImmediatePropagation();}}}).keypress(function(e){context.data.keypressedCount++;$.suggestions.keypress(e,context,context.data.keypressed);}).keyup(function(e){if(context.data.keypressedCount==0){$.suggestions.keypress(e,context,context.data.keypressed);}}).blur(function(){if(context.data.mouseDownOn.size()>0){return;} |
| 415 | +context.data.$textbox.focus();}).mouseover(function(e){$.suggestions.highlight(context,$(e.target).closest('.suggestions-special'),false);})).appendTo($('body'));$(this).attr('autocomplete','off').keydown(function(e){context.data.keypressed=(e.keyCode==undefined)?e.which:e.keyCode;context.data.keypressedCount=0;switch(context.data.keypressed){case 40:e.preventDefault();e.stopImmediatePropagation();break;case 38:case 27:case 13:if(context.data.$container.is(':visible')){e.preventDefault();e.stopImmediatePropagation();}}}).keypress(function(e){context.data.keypressedCount++;$.suggestions.keypress(e,context,context.data.keypressed);}).keyup(function(e){if(context.data.keypressedCount==0){$.suggestions.keypress(e,context,context.data.keypressed);}}).blur(function(){if(context.data.mouseDownOn.size()>0){return;} |
416 | 416 | context.data.$container.hide();$.suggestions.cancel(context);});} |
417 | 417 | $(this).data('suggestions-context',context);});return returnValue!==null?returnValue:$(this);};})(jQuery);(function($){$.fn.textSelection=function(command,options){var fn={getContents:function(){return this.val();},getSelection:function(){var e=this.get(0);var retval='';if($(e).is(':hidden')){}else if(document.selection&&document.selection.createRange){e.focus();var range=document.selection.createRange();retval=range.text;}else if(e.selectionStart||e.selectionStart=='0'){retval=e.value.substring(e.selectionStart,e.selectionEnd);} |
418 | 418 | return retval;},encapsulateSelection:function(options){return this.each(function(){function checkSelectedText(){if(!selText){selText=options.peri;isSample=true;}else if(options.replace){selText=options.peri;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);options.post+=' ';}} |