Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -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' => 11 ), |
| 74 | + array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 12 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 30 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 185 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 53 ), |
— | — | @@ -83,10 +83,10 @@ |
84 | 84 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 5 ), |
85 | 85 | ), |
86 | 86 | 'combined' => array( |
87 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 389 ), |
| 87 | + array( 'src' => 'js/plugins.combined.js', 'version' => 390 ), |
88 | 88 | ), |
89 | 89 | 'minified' => array( |
90 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 389 ), |
| 90 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 390 ), |
91 | 91 | ), |
92 | 92 | ), |
93 | 93 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.suggestions.js |
— | — | @@ -175,7 +175,7 @@ |
176 | 176 | result = context.data.$container.find( '.suggestions-results div:last' ) |
177 | 177 | } else { |
178 | 178 | result = selected.prev(); |
179 | | - if ( selected.size() == 0 ) { |
| 179 | + if ( selected.length == 0 ) { |
180 | 180 | // we are at the begginning, so lets jump to the last item |
181 | 181 | if ( context.data.$container.find( '.suggestions-special' ).html() != "" ) { |
182 | 182 | result = context.data.$container.find( '.suggestions-special' ); |
— | — | @@ -185,14 +185,21 @@ |
186 | 186 | } |
187 | 187 | } |
188 | 188 | } else if ( result == 'next' ) { |
189 | | - if ( selected.size() == 0 ) |
| 189 | + if ( selected.length == 0 ) { |
190 | 190 | // No item selected, go to the first one |
191 | 191 | result = context.data.$container.find( '.suggestions-results div:first' ); |
192 | | - else { |
| 192 | + if ( result.length == 0 && context.data.$container.find( '.suggestions-special' ).html() != "" ) { |
| 193 | + // No suggestion exists, use the |
| 194 | + result = context.data.$container.find( '.suggestions-special' ); |
| 195 | + } |
| 196 | + } else { |
193 | 197 | result = selected.next(); |
194 | 198 | if ( selected.is( '.suggestions-special' ) ) { |
195 | 199 | result = $( [] ); |
196 | | - } else if ( result.size() == 0 && context.data.$container.find( '.suggestions-special' ).html() != "" ) { |
| 200 | + } else if ( |
| 201 | + result.length == 0 && |
| 202 | + context.data.$container.find( '.suggestions-special' ).html() != "" |
| 203 | + ) { |
197 | 204 | // We were at the last item, jump to the specials! |
198 | 205 | result = context.data.$container.find( '.suggestions-special' ); |
199 | 206 | } |
— | — | @@ -202,7 +209,7 @@ |
203 | 210 | result.addClass( 'suggestions-result-current' ); |
204 | 211 | } |
205 | 212 | if ( updateTextbox ) { |
206 | | - if ( result.size() == 0 ) { |
| 213 | + if ( result.length == 0 ) { |
207 | 214 | $.suggestions.restore( context ); |
208 | 215 | } else { |
209 | 216 | context.data.$textbox.val( result.data( 'text' ) ); |
— | — | @@ -428,7 +435,7 @@ |
429 | 436 | .blur( function() { |
430 | 437 | // When losing focus because of a mousedown |
431 | 438 | // on a suggestion, don't hide the suggestions |
432 | | - if ( context.data.mouseDownOn.size() > 0 ) { |
| 439 | + if ( context.data.mouseDownOn.length > 0 ) { |
433 | 440 | return; |
434 | 441 | } |
435 | 442 | context.data.$container.hide(); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -5926,7 +5926,7 @@ |
5927 | 5927 | result = context.data.$container.find( '.suggestions-results div:last' ) |
5928 | 5928 | } else { |
5929 | 5929 | result = selected.prev(); |
5930 | | - if ( selected.size() == 0 ) { |
| 5930 | + if ( selected.length == 0 ) { |
5931 | 5931 | // we are at the begginning, so lets jump to the last item |
5932 | 5932 | if ( context.data.$container.find( '.suggestions-special' ).html() != "" ) { |
5933 | 5933 | result = context.data.$container.find( '.suggestions-special' ); |
— | — | @@ -5936,14 +5936,21 @@ |
5937 | 5937 | } |
5938 | 5938 | } |
5939 | 5939 | } else if ( result == 'next' ) { |
5940 | | - if ( selected.size() == 0 ) |
| 5940 | + if ( selected.length == 0 ) { |
5941 | 5941 | // No item selected, go to the first one |
5942 | 5942 | result = context.data.$container.find( '.suggestions-results div:first' ); |
5943 | | - else { |
| 5943 | + if ( result.length == 0 && context.data.$container.find( '.suggestions-special' ).html() != "" ) { |
| 5944 | + // No suggestion exists, use the |
| 5945 | + result = context.data.$container.find( '.suggestions-special' ); |
| 5946 | + } |
| 5947 | + } else { |
5944 | 5948 | result = selected.next(); |
5945 | 5949 | if ( selected.is( '.suggestions-special' ) ) { |
5946 | 5950 | result = $( [] ); |
5947 | | - } else if ( result.size() == 0 && context.data.$container.find( '.suggestions-special' ).html() != "" ) { |
| 5951 | + } else if ( |
| 5952 | + result.length == 0 && |
| 5953 | + context.data.$container.find( '.suggestions-special' ).html() != "" |
| 5954 | + ) { |
5948 | 5955 | // We were at the last item, jump to the specials! |
5949 | 5956 | result = context.data.$container.find( '.suggestions-special' ); |
5950 | 5957 | } |
— | — | @@ -5953,7 +5960,7 @@ |
5954 | 5961 | result.addClass( 'suggestions-result-current' ); |
5955 | 5962 | } |
5956 | 5963 | if ( updateTextbox ) { |
5957 | | - if ( result.size() == 0 ) { |
| 5964 | + if ( result.length == 0 ) { |
5958 | 5965 | $.suggestions.restore( context ); |
5959 | 5966 | } else { |
5960 | 5967 | context.data.$textbox.val( result.data( 'text' ) ); |
— | — | @@ -6179,7 +6186,7 @@ |
6180 | 6187 | .blur( function() { |
6181 | 6188 | // When losing focus because of a mousedown |
6182 | 6189 | // on a suggestion, don't hide the suggestions |
6183 | | - if ( context.data.mouseDownOn.size() > 0 ) { |
| 6190 | + if ( context.data.mouseDownOn.length > 0 ) { |
6184 | 6191 | return; |
6185 | 6192 | } |
6186 | 6193 | context.data.$container.hide(); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -395,10 +395,9 @@ |
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 | 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();}}}} |
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) |
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');}}} |
| 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.length==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.length==0){result=context.data.$container.find('.suggestions-results div:first');if(result.length==0&&context.data.$container.find('.suggestions-special').html()!=""){result=context.data.$container.find('.suggestions-special');}}else{result=selected.next();if(selected.is('.suggestions-special')){result=$([]);}else if(result.length==0&&context.data.$container.find('.suggestions-special').html()!=""){result=context.data.$container.find('.suggestions-special');}}} |
401 | 400 | selected.removeClass('suggestions-result-current');result.addClass('suggestions-result-current');} |
402 | | -if(updateTextbox){if(result.size()==0){$.suggestions.restore(context);}else{context.data.$textbox.val(result.data('text'));context.data.$textbox.change();} |
| 401 | +if(updateTextbox){if(result.length==0){$.suggestions.restore(context);}else{context.data.$textbox.val(result.data('text'));context.data.$textbox.change();} |
403 | 402 | context.data.$textbox.trigger('change');} |
404 | 403 | $.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 | 404 | preventDefault=true;break;case 38:if(wasVisible){$.suggestions.highlight(context,'prev',false);} |
— | — | @@ -411,7 +410,7 @@ |
412 | 411 | $.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 | 412 | 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 | 413 | 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();}).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;} |
| 414 | +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.length>0){return;} |
416 | 415 | context.data.$container.hide();$.suggestions.cancel(context);});} |
417 | 416 | $(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 | 417 | 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+=' ';}} |