r68360 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68359‎ | r68360 | r68361 >
Date:14:56, 21 June 2010
Author:adam
Status:ok
Tags:
Comment:
AutoEllipsis - Fixing a bug introduced in r68359
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (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.autoEllipsis.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -57,7 +57,7 @@
5858
5959 // Core functionality of extension scripts
6060 array( 'src' => 'js/plugins/jquery.async.js', 'version' => 3 ),
61 - array( 'src' => 'js/plugins/jquery.autoEllipsis.js', 'version' => 13 ),
 61+ array( 'src' => 'js/plugins/jquery.autoEllipsis.js', 'version' => 14 ),
6262 array( 'src' => 'js/plugins/jquery.browser.js', 'version' => 8 ),
6363 array( 'src' => 'js/plugins/jquery.collapsibleTabs.js', 'version' => 6 ),
6464 array( 'src' => 'js/plugins/jquery.color.js', 'version' => 1 ),
@@ -80,10 +80,10 @@
8181 array( 'src' => 'js/thirdparty/contentCollector.js', 'version' => 2 ),
8282 ),
8383 'combined' => array(
84 - array( 'src' => 'js/plugins.combined.js', 'version' => 439 ),
 84+ array( 'src' => 'js/plugins.combined.js', 'version' => 440 ),
8585 ),
8686 'minified' => array(
87 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 443 ),
 87+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 444 ),
8888 ),
8989 ),
9090 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.autoEllipsis.js
@@ -69,6 +69,9 @@
7070 if ( !( text in cache ) ) {
7171 cache[text] = {};
7272 }
 73+ if ( !( text in matchTextCache ) ) {
 74+ matchTextCache[text] = {};
 75+ }
7376 if ( options.matchText && !( options.matchText in matchTextCache[text] ) ) {
7477 matchTextCache[text][options.matchText] = {};
7578 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -277,6 +277,9 @@
278278 if ( !( text in cache ) ) {
279279 cache[text] = {};
280280 }
 281+ if ( !( text in matchTextCache ) ) {
 282+ matchTextCache[text] = {};
 283+ }
281284 if ( options.matchText && !( options.matchText in matchTextCache[text] ) ) {
282285 matchTextCache[text][options.matchText] = {};
283286 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -21,6 +21,7 @@
2222 {$.eachAsync(this,opts);return this;}})(jQuery);(function($){var cache={};var matchTextCache={};$.fn.autoEllipsis=function(options){options=$.extend({'position':'center','tooltip':false,'restoreText':false,'hasSpan':false,'matchText':null},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'));}}
2323 var $container=$this;var $trimmableText=null;var $protectedText=null;if(options.matchText){var text=$this.text();var matchedText=options.matchText;$trimmableText=$('<span />').css('whiteSpace','nowrap').addClass('autoellipsis-trimmed').text($this.text().substr(matchedText.length,$this.text().length));$protectedText=$('<span />').addClass('autoellipsis-matched').css('whiteSpace','nowrap').text(options.matchText);$container.empty().append($protectedText).append($trimmableText);}else{if(options.hasSpan){$trimmableText=$this.children(options.selector);}else{$trimmableText=$('<span />').css('whiteSpace','nowrap').text($this.text());$this.empty().append($trimmableText);}}
2424 var text=$container.text();var trimmableText=$trimmableText.text();var w=$container.width();var pw=$protectedText?$protectedText.width():0;if(!(text in cache)){cache[text]={};}
 25+if(!(text in matchTextCache)){matchTextCache[text]={};}
2526 if(options.matchText&&!(options.matchText in matchTextCache[text])){matchTextCache[text][options.matchText]={};}
2627 if(!options.matchText&&w in cache[text]){$container.html(cache[text][w]);if(options.tooltip)
2728 $container.attr('title',text);return;}

Follow-up revisions

RevisionCommit summaryAuthorDate
r68363AutoEllipsis - adding an extra conditional to the code committed in r68360adam15:27, 21 June 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r68359AutoEllipsis - Follow up to rr67755. Segregating caches as Roan suggested, to...adam14:44, 21 June 2010

Status & tagging log