Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 | 'base_sets' => array( |
63 | 63 | 'raw' => array( |
64 | 64 | array( 'src' => 'js/plugins/jquery.async.js', 'version' => 3 ), |
65 | | - array( 'src' => 'js/plugins/jquery.autoEllipse.js', 'version' => 3 ), |
| 65 | + array( 'src' => 'js/plugins/jquery.autoEllipse.js', 'version' => 4 ), |
66 | 66 | array( 'src' => 'js/plugins/jquery.browser.js', 'version' => 3 ), |
67 | 67 | array( 'src' => 'js/plugins/jquery.collapsibleTabs.js', 'version' => 5 ), |
68 | 68 | array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 3 ), |
— | — | @@ -75,10 +75,10 @@ |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 25 ), |
77 | 77 | ), |
78 | 78 | 'combined' => array( |
79 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 58 ), |
| 79 | + array( 'src' => 'js/plugins.combined.js', 'version' => 59 ), |
80 | 80 | ), |
81 | 81 | 'minified' => array( |
82 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 58 ), |
| 82 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 59 ), |
83 | 83 | ), |
84 | 84 | ), |
85 | 85 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.autoEllipse.js |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | var text = $(this).text(); |
14 | 14 | var $text = $( '<span />' ).text( text ).css( 'whiteSpace', 'nowrap' ); |
15 | 15 | $(this).empty().append( $text ); |
16 | | - if ( $text.outerWidth() > $(this).innerWidth() ) { |
| 16 | + if ( $text.width() > $(this).width() ) { |
17 | 17 | switch ( options.position ) { |
18 | 18 | case 'right': |
19 | 19 | // Use binary search-like technique for efficiency |
— | — | @@ -20,13 +20,14 @@ |
21 | 21 | do { |
22 | 22 | var m = Math.ceil( ( l + r ) / 2 ); |
23 | 23 | $text.text( text.substr( 0, m ) + '...' ); |
24 | | - if ( $text.outerWidth() > $(this).width() ) { |
| 24 | + if ( $text.width() > $(this).width() ) { |
25 | 25 | // Text is too long |
26 | 26 | r = m - 1; |
27 | 27 | } else { |
28 | 28 | l = m; |
29 | 29 | } |
30 | 30 | } while ( l < r ); |
| 31 | + $text.text( text.substr( 0, l ) + '...' ); |
31 | 32 | break; |
32 | 33 | case 'center': |
33 | 34 | // TODO: Use binary search like for 'right' |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | var text = $(this).text(); |
92 | 92 | var $text = $( '<span />' ).text( text ).css( 'whiteSpace', 'nowrap' ); |
93 | 93 | $(this).empty().append( $text ); |
94 | | - if ( $text.outerWidth() > $(this).innerWidth() ) { |
| 94 | + if ( $text.width() > $(this).width() ) { |
95 | 95 | switch ( options.position ) { |
96 | 96 | case 'right': |
97 | 97 | // Use binary search-like technique for efficiency |
— | — | @@ -98,13 +98,14 @@ |
99 | 99 | do { |
100 | 100 | var m = Math.ceil( ( l + r ) / 2 ); |
101 | 101 | $text.text( text.substr( 0, m ) + '...' ); |
102 | | - if ( $text.outerWidth() > $(this).width() ) { |
| 102 | + if ( $text.width() > $(this).width() ) { |
103 | 103 | // Text is too long |
104 | 104 | r = m - 1; |
105 | 105 | } else { |
106 | 106 | l = m; |
107 | 107 | } |
108 | 108 | } while ( l < r ); |
| 109 | + $text.text( text.substr( 0, l ) + '...' ); |
109 | 110 | break; |
110 | 111 | case 'center': |
111 | 112 | // TODO: Use binary search like for 'right' |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | {var i=0,l=array.length,loop=opts.loop||function(){};$.whileAsync($.extend(opts,{test:function(){return i<l;},loop:function() |
13 | 13 | {var val=array[i];return loop.call(val,i++,val);}}));} |
14 | 14 | $.fn.eachAsync=function(opts) |
15 | | -{$.eachAsync(this,opts);return this;}})(jQuery);(function($){$.fn.autoEllipse=function(options){$(this).each(function(){options=$.extend({'position':'center','tooltip':false},options);var text=$(this).text();var $text=$('<span />').text(text).css('whiteSpace','nowrap');$(this).empty().append($text);if($text.outerWidth()>$(this).innerWidth()){switch(options.position){case'right':var l=0,r=text.length;do{var m=Math.ceil((l+r)/2);$text.text(text.substr(0,m)+'...');if($text.outerWidth()>$(this).width()){r=m-1;}else{l=m;}}while(l<r);break;case'center':var i=[Math.round(text.length/2),Math.round(text.length/2)];var side=1;while($text.outerWidth()>($(this).width())&&i[0]>0){$text.text(text.substr(0,i[0])+'...'+text.substr(i[1]));if(side==0){i[0]--;side=1;}else{i[1]++;side=0;}} |
| 15 | +{$.eachAsync(this,opts);return this;}})(jQuery);(function($){$.fn.autoEllipse=function(options){$(this).each(function(){options=$.extend({'position':'center','tooltip':false},options);var text=$(this).text();var $text=$('<span />').text(text).css('whiteSpace','nowrap');$(this).empty().append($text);if($text.width()>$(this).width()){switch(options.position){case'right':var l=0,r=text.length;do{var m=Math.ceil((l+r)/2);$text.text(text.substr(0,m)+'...');if($text.width()>$(this).width()){r=m-1;}else{l=m;}}while(l<r);$text.text(text.substr(0,l)+'...');break;case'center':var i=[Math.round(text.length/2),Math.round(text.length/2)];var side=1;while($text.outerWidth()>($(this).width())&&i[0]>0){$text.text(text.substr(0,i[0])+'...'+text.substr(i[1]));if(side==0){i[0]--;side=1;}else{i[1]++;side=0;}} |
16 | 16 | break;case'left':var r=0;while($text.outerWidth()>$(this).width()&&r<text.length){$text.text('...'+text.substr(r));r++;} |
17 | 17 | break;} |
18 | 18 | if(options.tooltip) |