Index: trunk/extensions/UsabilityInitiative/css/suggestions.css |
— | — | @@ -39,9 +39,8 @@ |
40 | 40 | margin: 0; |
41 | 41 | width: 100%; |
42 | 42 | } |
43 | | -.suggestions-result div { |
| 43 | +.suggestions-result span { |
44 | 44 | line-height: 1.5em; |
45 | | - display: inline; |
46 | 45 | padding: 0.25em 0.25em; |
47 | 46 | } |
48 | 47 | .suggestions-result-current { |
Index: trunk/extensions/UsabilityInitiative/css/combined.css |
— | — | @@ -39,9 +39,8 @@ |
40 | 40 | margin: 0; |
41 | 41 | width: 100%; |
42 | 42 | } |
43 | | -.suggestions-result div { |
| 43 | +.suggestions-result span { |
44 | 44 | line-height: 1.5em; |
45 | | - display: inline; |
46 | 45 | padding: 0.25em 0.25em; |
47 | 46 | } |
48 | 47 | .suggestions-result-current { |
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css |
— | — | @@ -37,9 +37,8 @@ |
38 | 38 | margin:0; |
39 | 39 | width:100%; |
40 | 40 | } |
41 | | -.suggestions-result div{ |
| 41 | +.suggestions-result span{ |
42 | 42 | line-height:1.5em; |
43 | | -display:inline; |
44 | 43 | padding:0.25em 0.25em; |
45 | 44 | } |
46 | 45 | .suggestions-result-current{ |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php |
— | — | @@ -20,10 +20,10 @@ |
21 | 21 | array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 15 ), |
22 | 22 | ), |
23 | 23 | 'combined' => array( |
24 | | - array( 'src' => 'Vector.combined.js', 'version' => 46 ), |
| 24 | + array( 'src' => 'Vector.combined.js', 'version' => 47 ), |
25 | 25 | ), |
26 | 26 | 'minified' => array( |
27 | | - array( 'src' => 'Vector.combined.min.js', 'version' => 46 ), |
| 27 | + array( 'src' => 'Vector.combined.min.js', 'version' => 47 ), |
28 | 28 | ), |
29 | 29 | ); |
30 | 30 | static $modules = array( |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php |
— | — | @@ -22,10 +22,10 @@ |
23 | 23 | array( 'src' => 'Modules/AddMediaWizard/AddMediaWizard.js', 'version' => 6 ), |
24 | 24 | ), |
25 | 25 | 'combined' => array( |
26 | | - array( 'src' => 'WikiEditor.combined.js', 'version' => 98 ), |
| 26 | + array( 'src' => 'WikiEditor.combined.js', 'version' => 99 ), |
27 | 27 | ), |
28 | 28 | 'minified' => array( |
29 | | - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 98 ), |
| 29 | + array( 'src' => 'WikiEditor.combined.min.js', 'version' => 99 ), |
30 | 30 | ), |
31 | 31 | ); |
32 | 32 | static $messages = array( |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.suggestions.js |
— | — | @@ -38,8 +38,6 @@ |
39 | 39 | * Type: Number, Range: 1 - infinity, Default: 3 |
40 | 40 | * positionFromLeft: Whether to position the suggestion box with the left attribute or the right |
41 | 41 | * Type: Boolean, Default: true |
42 | | - * highlightInput: Highlights the matched text in the suggestions |
43 | | - * Type: Boolean, Default: true |
44 | 42 | */ |
45 | 43 | ( function( $ ) { |
46 | 44 | |
— | — | @@ -148,7 +146,6 @@ |
149 | 147 | var expWidth = -1; |
150 | 148 | var $autoEllipseMe = $( [] ); |
151 | 149 | for ( var i = 0; i < context.config.suggestions.length; i++ ) { |
152 | | - var text = context.config.suggestions[i]; |
153 | 150 | var $result = $( '<div />' ) |
154 | 151 | .addClass( 'suggestions-result' ) |
155 | 152 | .attr( 'rel', i ) |
— | — | @@ -162,27 +159,17 @@ |
163 | 160 | |
164 | 161 | // Allow custom rendering |
165 | 162 | if ( typeof context.config.result.render == 'function' ) { |
166 | | - context.config.result.render.call( $result, text ); |
| 163 | + context.config.result.render.call( $result, context.config.suggestions[i] ); |
167 | 164 | } else { |
168 | 165 | // Add <span> with text |
169 | | - if( context.config.highlightInput ) { |
170 | | - var matchedText = text.substr( 0, context.data.prevText.length ); |
171 | | - text = text.substr( context.data.prevText.length, text.length ); |
172 | | - $result.append( $( '<div />' ) |
173 | | - .css( 'whiteSpace', 'nowrap' ) |
174 | | - .text( text ) |
175 | | - .prepend( $( '<strong />' ).text( matchedText ) ) |
176 | | - ); |
177 | | - } else { |
178 | | - $result.append( $( '<div />' ) |
179 | | - .css( 'whiteSpace', 'nowrap' ) |
180 | | - .text( text ) |
181 | | - ); |
182 | | - } |
| 166 | + $result.append( $( '<span />' ) |
| 167 | + .css( 'whiteSpace', 'nowrap' ) |
| 168 | + .text( context.config.suggestions[i] ) |
| 169 | + ); |
183 | 170 | |
184 | 171 | // Widen results box if needed |
185 | 172 | // New width is only calculated here, applied later |
186 | | - var $span = $result.children( 'div' ); |
| 173 | + var $span = $result.children( 'span' ); |
187 | 174 | if ( $span.outerWidth() > $result.width() && $span.outerWidth() > expWidth ) { |
188 | 175 | expWidth = $span.outerWidth(); |
189 | 176 | } |
— | — | @@ -195,7 +182,7 @@ |
196 | 183 | context.data.$container.width( Math.min( expWidth, maxWidth ) ); |
197 | 184 | } |
198 | 185 | // autoEllipse the results. Has to be done after changing the width |
199 | | - $autoEllipseMe.autoEllipsis( { hasSpan: true, tooltip: true, selector: 'div' } ); |
| 186 | + $autoEllipseMe.autoEllipsis( { hasSpan: true, tooltip: true } ); |
200 | 187 | } |
201 | 188 | } |
202 | 189 | break; |
— | — | @@ -210,7 +197,6 @@ |
211 | 198 | break; |
212 | 199 | case 'submitOnClick': |
213 | 200 | case 'positionFromLeft': |
214 | | - case 'highlightInput': |
215 | 201 | context.config[property] = value ? true : false; |
216 | 202 | break; |
217 | 203 | } |
— | — | @@ -362,8 +348,7 @@ |
363 | 349 | 'delay': 120, |
364 | 350 | 'submitOnClick': false, |
365 | 351 | 'maxExpandFactor': 3, |
366 | | - 'positionFromLeft': true, |
367 | | - 'highlightInput': true |
| 352 | + 'positionFromLeft': true |
368 | 353 | } |
369 | 354 | }; |
370 | 355 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.autoEllipsis.js |
— | — | @@ -10,7 +10,6 @@ |
11 | 11 | options = $.extend( { |
12 | 12 | 'position': 'center', |
13 | 13 | 'tooltip': false, |
14 | | - 'selector': 'span', |
15 | 14 | 'restoreText': false, |
16 | 15 | 'hasSpan': false |
17 | 16 | }, options ); |
— | — | @@ -27,7 +26,7 @@ |
28 | 27 | var w = $this.width(); |
29 | 28 | var $text; |
30 | 29 | if ( options.hasSpan ) { |
31 | | - $text = $this.children( options.selector ); |
| 30 | + $text = $this.children( 'span' ); |
32 | 31 | } else { |
33 | 32 | $text = $( '<span />' ).css( 'whiteSpace', 'nowrap' ); |
34 | 33 | $this.empty().append( $text ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -5182,7 +5182,6 @@ |
5183 | 5183 | options = $.extend( { |
5184 | 5184 | 'position': 'center', |
5185 | 5185 | 'tooltip': false, |
5186 | | - 'selector': 'span', |
5187 | 5186 | 'restoreText': false, |
5188 | 5187 | 'hasSpan': false |
5189 | 5188 | }, options ); |
— | — | @@ -5199,7 +5198,7 @@ |
5200 | 5199 | var w = $this.width(); |
5201 | 5200 | var $text; |
5202 | 5201 | if ( options.hasSpan ) { |
5203 | | - $text = $this.children( options.selector ); |
| 5202 | + $text = $this.children( 'span' ); |
5204 | 5203 | } else { |
5205 | 5204 | $text = $( '<span />' ).css( 'whiteSpace', 'nowrap' ); |
5206 | 5205 | $this.empty().append( $text ); |
— | — | @@ -5926,8 +5925,6 @@ |
5927 | 5926 | * Type: Number, Range: 1 - infinity, Default: 3 |
5928 | 5927 | * positionFromLeft: Whether to position the suggestion box with the left attribute or the right |
5929 | 5928 | * Type: Boolean, Default: true |
5930 | | - * highlightInput: Highlights the matched text in the suggestions |
5931 | | - * Type: Boolean, Default: true |
5932 | 5929 | */ |
5933 | 5930 | ( function( $ ) { |
5934 | 5931 | |
— | — | @@ -6036,7 +6033,6 @@ |
6037 | 6034 | var expWidth = -1; |
6038 | 6035 | var $autoEllipseMe = $( [] ); |
6039 | 6036 | for ( var i = 0; i < context.config.suggestions.length; i++ ) { |
6040 | | - var text = context.config.suggestions[i]; |
6041 | 6037 | var $result = $( '<div />' ) |
6042 | 6038 | .addClass( 'suggestions-result' ) |
6043 | 6039 | .attr( 'rel', i ) |
— | — | @@ -6050,27 +6046,17 @@ |
6051 | 6047 | |
6052 | 6048 | // Allow custom rendering |
6053 | 6049 | if ( typeof context.config.result.render == 'function' ) { |
6054 | | - context.config.result.render.call( $result, text ); |
| 6050 | + context.config.result.render.call( $result, context.config.suggestions[i] ); |
6055 | 6051 | } else { |
6056 | 6052 | // Add <span> with text |
6057 | | - if( context.config.highlightInput ) { |
6058 | | - var matchedText = text.substr( 0, context.data.prevText.length ); |
6059 | | - text = text.substr( context.data.prevText.length, text.length ); |
6060 | | - $result.append( $( '<div />' ) |
6061 | | - .css( 'whiteSpace', 'nowrap' ) |
6062 | | - .text( text ) |
6063 | | - .prepend( $( '<strong />' ).text( matchedText ) ) |
6064 | | - ); |
6065 | | - } else { |
6066 | | - $result.append( $( '<div />' ) |
6067 | | - .css( 'whiteSpace', 'nowrap' ) |
6068 | | - .text( text ) |
6069 | | - ); |
6070 | | - } |
| 6053 | + $result.append( $( '<span />' ) |
| 6054 | + .css( 'whiteSpace', 'nowrap' ) |
| 6055 | + .text( context.config.suggestions[i] ) |
| 6056 | + ); |
6071 | 6057 | |
6072 | 6058 | // Widen results box if needed |
6073 | 6059 | // New width is only calculated here, applied later |
6074 | | - var $span = $result.children( 'div' ); |
| 6060 | + var $span = $result.children( 'span' ); |
6075 | 6061 | if ( $span.outerWidth() > $result.width() && $span.outerWidth() > expWidth ) { |
6076 | 6062 | expWidth = $span.outerWidth(); |
6077 | 6063 | } |
— | — | @@ -6083,7 +6069,7 @@ |
6084 | 6070 | context.data.$container.width( Math.min( expWidth, maxWidth ) ); |
6085 | 6071 | } |
6086 | 6072 | // autoEllipse the results. Has to be done after changing the width |
6087 | | - $autoEllipseMe.autoEllipsis( { hasSpan: true, tooltip: true, selector: 'div' } ); |
| 6073 | + $autoEllipseMe.autoEllipsis( { hasSpan: true, tooltip: true } ); |
6088 | 6074 | } |
6089 | 6075 | } |
6090 | 6076 | break; |
— | — | @@ -6098,7 +6084,6 @@ |
6099 | 6085 | break; |
6100 | 6086 | case 'submitOnClick': |
6101 | 6087 | case 'positionFromLeft': |
6102 | | - case 'highlightInput': |
6103 | 6088 | context.config[property] = value ? true : false; |
6104 | 6089 | break; |
6105 | 6090 | } |
— | — | @@ -6250,8 +6235,7 @@ |
6251 | 6236 | 'delay': 120, |
6252 | 6237 | 'submitOnClick': false, |
6253 | 6238 | 'maxExpandFactor': 3, |
6254 | | - 'positionFromLeft': true, |
6255 | | - 'highlightInput': true |
| 6239 | + 'positionFromLeft': true |
6256 | 6240 | } |
6257 | 6241 | }; |
6258 | 6242 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -359,8 +359,8 @@ |
360 | 360 | {var i=0,l=array.length,loop=opts.loop||function(){};$.whileAsync($.extend(opts,{test:function(){return i<l;},loop:function() |
361 | 361 | {var val=array[i];return loop.call(val,i++,val);}}));} |
362 | 362 | $.fn.eachAsync=function(opts) |
363 | | -{$.eachAsync(this,opts);return this;}})(jQuery);(function($){var cache={};$.fn.autoEllipsis=function(options){options=$.extend({'position':'center','tooltip':false,'selector':'span','restoreText':false,'hasSpan':false},options);$(this).each(function(){var $this=$(this);if(options.restoreText){if(!$this.data('autoEllipsis.originalText')){$this.data('autoEllipsis.originalText',$this.text());}else{$this.text($this.data('autoEllipsis.originalText'));}} |
364 | | -var text=$this.text();var w=$this.width();var $text;if(options.hasSpan){$text=$this.children(options.selector);}else{$text=$('<span />').css('whiteSpace','nowrap');$this.empty().append($text);} |
| 363 | +{$.eachAsync(this,opts);return this;}})(jQuery);(function($){var cache={};$.fn.autoEllipsis=function(options){options=$.extend({'position':'center','tooltip':false,'restoreText':false,'hasSpan':false},options);$(this).each(function(){var $this=$(this);if(options.restoreText){if(!$this.data('autoEllipsis.originalText')){$this.data('autoEllipsis.originalText',$this.text());}else{$this.text($this.data('autoEllipsis.originalText'));}} |
| 364 | +var text=$this.text();var w=$this.width();var $text;if(options.hasSpan){$text=$this.children('span');}else{$text=$('<span />').css('whiteSpace','nowrap');$this.empty().append($text);} |
365 | 365 | if(!(text in cache)){cache[text]={};} |
366 | 366 | if(w in cache[text]){$text.text(cache[text][w]);if(options.tooltip) |
367 | 367 | $text.attr('title',text);return;} |
— | — | @@ -400,12 +400,11 @@ |
401 | 401 | if(delayed){context.data.timerID=setTimeout(maybeFetch,context.config.delay);}else{maybeFetch();} |
402 | 402 | $.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();var newCSS={'top':context.config.$region.offset().top+context.config.$region.outerHeight(),'bottom':'auto','width':context.config.$region.outerWidth(),'height':'auto'} |
403 | 403 | if(context.config.positionFromLeft){newCSS['left']=context.config.$region.offset().left;newCSS['right']='auto';}else{newCSS['left']='auto';newCSS['right']=$('body').width()-(context.config.$region.offset().left+context.config.$region.outerWidth());} |
404 | | -context.data.$container.css(newCSS);var $results=context.data.$container.children('.suggestions-results');$results.empty();var expWidth=-1;var $autoEllipseMe=$([]);for(var i=0;i<context.config.suggestions.length;i++){var text=context.config.suggestions[i];var $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,text);}else{if(context.config.highlightInput){var matchedText=text.substr(0,context.data.prevText.length);text=text.substr(context.data.prevText.length,text.length);$result.append($('<div />').css('whiteSpace','nowrap').text(text).prepend($('<strong />').text(matchedText)));}else{$result.append($('<div />').css('whiteSpace','nowrap').text(text));} |
405 | | -var $span=$result.children('div');if($span.outerWidth()>$result.width()&&$span.outerWidth()>expWidth){expWidth=$span.outerWidth();} |
| 404 | +context.data.$container.css(newCSS);var $results=context.data.$container.children('.suggestions-results');$results.empty();var expWidth=-1;var $autoEllipseMe=$([]);for(var i=0;i<context.config.suggestions.length;i++){var $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.append($('<span />').css('whiteSpace','nowrap').text(context.config.suggestions[i]));var $span=$result.children('span');if($span.outerWidth()>$result.width()&&$span.outerWidth()>expWidth){expWidth=$span.outerWidth();} |
406 | 405 | $autoEllipseMe=$autoEllipseMe.add($result);}} |
407 | 406 | if(expWidth>context.data.$container.width()){var maxWidth=context.config.maxExpandFactor*context.data.$textbox.width();context.data.$container.width(Math.min(expWidth,maxWidth));} |
408 | | -$autoEllipseMe.autoEllipsis({hasSpan:true,tooltip:true,selector:'div'});}} |
409 | | -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'maxExpandFactor':context.config[property]=Math.max(1,value);break;case'submitOnClick':case'positionFromLeft':case'highlightInput':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');}}} |
| 407 | +$autoEllipseMe.autoEllipsis({hasSpan:true,tooltip:true});}} |
| 408 | +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'maxExpandFactor':context.config[property]=Math.max(1,value);break;case'submitOnClick':case'positionFromLeft':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');}}} |
410 | 409 | selected.removeClass('suggestions-result-current');result.addClass('suggestions-result-current');} |
411 | 410 | if(updateTextbox){if(result.length==0){$.suggestions.restore(context);}else{context.data.$textbox.val(result.data('text'));context.data.$textbox.change();} |
412 | 411 | context.data.$textbox.trigger('change');} |
— | — | @@ -413,7 +412,7 @@ |
414 | 413 | preventDefault=true;break;case 38:if(wasVisible){$.suggestions.highlight(context,'prev',false);} |
415 | 414 | 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');if(selected.size()==0){$.suggestions.cancel(context);context.config.$region.closest('form').submit();}else 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);}else{$.suggestions.highlight(context,selected,true);}} |
416 | 415 | break;default:$.suggestions.update(context,true);break;} |
417 | | -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==null){context={config:{'fetch':function(){},'cancel':function(){},'special':{},'result':{},'$region':$(this),'suggestions':[],'maxRows':7,'delay':120,'submitOnClick':false,'maxExpandFactor':3,'positionFromLeft':true,'highlightInput':true}};} |
| 416 | +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==null){context={config:{'fetch':function(){},'cancel':function(){},'special':{},'result':{},'$region':$(this),'suggestions':[],'maxRows':7,'delay':120,'submitOnClick':false,'maxExpandFactor':3,'positionFromLeft':true}};} |
418 | 417 | 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]]);}}} |
419 | 418 | if(typeof context.data=='undefined'){context.data={'timerID':null,'prevText':null,'visibleResults':0,'mouseDownOn':$([]),'$textbox':$(this)};var newCSS={'top':Math.round(context.data.$textbox.offset().top+context.data.$textbox.outerHeight()),'width':context.data.$textbox.outerWidth(),'display':'none'} |
420 | 419 | if(context.config.positionFromLeft){newCSS['left']=context.config.$region.offset().left;newCSS['right']='auto';}else{newCSS['left']='auto';newCSS['right']=$('body').width()-(context.config.$region.offset().left+context.config.$region.outerWidth());} |