r68899 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68898‎ | r68899 | r68900 >
Date:18:52, 2 July 2010
Author:adam
Status:ok
Tags:
Comment:
SimpleSearch - Fix for the width expansion of results being used with autoellipsis. Previously there was a problem where the width required to render a result in its entirety was being miscalcualted, causing the results box to expand, but without preventing ellipsising
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.min.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/suggestions.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.suggestions.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/css/suggestions.css
@@ -37,7 +37,6 @@
3838 color: black;
3939 color: WindowText;
4040 margin: 0;
41 - width: 100%;
4241 line-height: 1.5em;
4342 padding: 0.01em 0.25em;
4443 }
Index: trunk/extensions/UsabilityInitiative/css/combined.css
@@ -37,7 +37,6 @@
3838 color: black;
3939 color: WindowText;
4040 margin: 0;
41 - width: 100%;
4241 line-height: 1.5em;
4342 padding: 0.01em 0.25em;
4443 }
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css
@@ -35,7 +35,6 @@
3636 color:black;
3737 color:WindowText;
3838 margin:0;
39 -width:100%;
4039 line-height:1.5em;
4140 padding:0.01em 0.25em;
4241 }
Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -18,7 +18,7 @@
1919 private static $styleFiles = array(
2020 'base_sets' => array(
2121 'raw' => array(
22 - array( 'src' => 'css/suggestions.css', 'version' => 15 ),
 22+ array( 'src' => 'css/suggestions.css', 'version' => 16 ),
2323 array( 'src' => 'css/vector.collapsibleNav.css', 'version' => 12 ),
2424 array( 'src' => 'css/vector.expandableSearch.css', 'version' => 8 ),
2525 array( 'src' => 'css/vector.footerCleanup.css', 'version' => 2 ),
@@ -31,11 +31,11 @@
3232 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3333 ),
3434 'combined' => array(
35 - array( 'src' => 'css/combined.css', 'version' => 112 ),
 35+ array( 'src' => 'css/combined.css', 'version' => 113 ),
3636 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3737 ),
3838 'minified' => array(
39 - array( 'src' => 'css/combined.min.css', 'version' => 112 ),
 39+ array( 'src' => 'css/combined.min.css', 'version' => 113 ),
4040 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
4141 ),
4242 )
@@ -58,14 +58,14 @@
5959
6060 // Core functionality of extension scripts
6161 array( 'src' => 'js/plugins/jquery.async.js', 'version' => 3 ),
62 - array( 'src' => 'js/plugins/jquery.autoEllipsis.js', 'version' => 14 ),
 62+ array( 'src' => 'js/plugins/jquery.autoEllipsis.js', 'version' => 15 ),
6363 array( 'src' => 'js/plugins/jquery.browser.js', 'version' => 8 ),
6464 array( 'src' => 'js/plugins/jquery.collapsibleTabs.js', 'version' => 6 ),
6565 array( 'src' => 'js/plugins/jquery.color.js', 'version' => 1 ),
6666 array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 4 ),
6767 array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ),
6868 array( 'src' => 'js/plugins/jquery.expandableField.js', 'version' => 17 ),
69 - array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 30 ),
 69+ array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 31 ),
7070 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 36 ),
7171 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 195 ),
7272 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 53 ),
@@ -82,10 +82,10 @@
8383 array( 'src' => 'js/thirdparty/contentCollector.js', 'version' => 2 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 446 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 447 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 456 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 457 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.suggestions.js
@@ -178,7 +178,8 @@
179179 // New width is only calculated here, applied later
180180 var $span = $result.children( 'span' );
181181 if ( $span.outerWidth() > $result.width() && $span.outerWidth() > expWidth ) {
182 - expWidth = $span.outerWidth();
 182+ // factor in any padding, margin, or border space on the parent
 183+ expWidth = $span.outerWidth() + ( context.data.$container.width() - $span.parent().width());
183184 }
184185 $autoEllipseMe = $autoEllipseMe.add( $result );
185186 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -1152,7 +1152,8 @@
11531153 // New width is only calculated here, applied later
11541154 var $span = $result.children( 'span' );
11551155 if ( $span.outerWidth() > $result.width() && $span.outerWidth() > expWidth ) {
1156 - expWidth = $span.outerWidth();
 1156+ // factor in any padding, margin, or border space on the parent
 1157+ expWidth = $span.outerWidth() + ( context.data.$container.width() - $span.parent().width());
11571158 }
11581159 $autoEllipseMe = $autoEllipseMe.add( $result );
11591160 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -64,7 +64,7 @@
6565 $.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'}
6666 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());}
6767 context.data.$container.css(newCSS);var $results=context.data.$container.children('.suggestions-results');$results.empty();var expWidth=-1;var $autoEllipseMe=$([]);var matchedText=null;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]).mousemove(function(e){context.data.selectedWithMouse=true;$.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{if(context.config.highlightInput){matchedText=text.substr(0,context.data.prevText.length);}
68 -$result.append($('<span />').css('whiteSpace','nowrap').text(text));var $span=$result.children('span');if($span.outerWidth()>$result.width()&&$span.outerWidth()>expWidth){expWidth=$span.outerWidth();}
 68+$result.append($('<span />').css('whiteSpace','nowrap').text(text));var $span=$result.children('span');if($span.outerWidth()>$result.width()&&$span.outerWidth()>expWidth){expWidth=$span.outerWidth()+(context.data.$container.width()-$span.parent().width());}
6969 $autoEllipseMe=$autoEllipseMe.add($result);}}
7070 if(expWidth>context.data.$container.width()){var maxWidth=context.config.maxExpandFactor*context.data.$textbox.width();context.data.$container.width(Math.min(expWidth,maxWidth));}
7171 $autoEllipseMe.autoEllipsis({hasSpan:true,tooltip:true,matchText:matchedText});}}

Status & tagging log