r66708 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66707‎ | r66708 | r66709 >
Date:21:00, 20 May 2010
Author:catrope
Status:deferred
Tags:
Comment:
1.16wmf4: Merge SimpleSearch fixes from trunk: r66565, rr66623, r66631, r66642, r66643, r66644, r66655
Modified paths:
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/OptIn (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/PrefSwitch (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.js (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.js (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.min.js (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.hooks.php (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/css/combined.css (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/css/combined.min.css (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/css/suggestions.css (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins/jquery.autoEllipsis.js (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins/jquery.suggestions.js (modified) (history)
  • /branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js (modified) (history)

Diff [purge]

Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/css/suggestions.css
@@ -9,6 +9,7 @@
1010 border: none;
1111 z-index: 99;
1212 padding: 0;
 13+ margin: -1px 0 0 0;
1314 }
1415 .suggestions-special {
1516 position: relative;
@@ -29,7 +30,6 @@
3031 font-size: 0.8em;
3132 cursor: pointer;
3233 border: solid 1px #aaaaaa;
33 - border-top-width: 0;
3434 padding: 0;
3535 margin: 0;
3636 }
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/css/combined.css
@@ -9,6 +9,7 @@
1010 border: none;
1111 z-index: 99;
1212 padding: 0;
 13+ margin: -1px 0 0 0;
1314 }
1415 .suggestions-special {
1516 position: relative;
@@ -29,7 +30,6 @@
3031 font-size: 0.8em;
3132 cursor: pointer;
3233 border: solid 1px #aaaaaa;
33 - border-top-width: 0;
3434 padding: 0;
3535 margin: 0;
3636 }
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/css/combined.min.css
@@ -7,6 +7,7 @@
88 border:none;
99 z-index:99;
1010 padding:0;
 11+margin:-1px 0 0 0;
1112 }
1213 .suggestions-special{
1314 position:relative;
@@ -27,7 +28,6 @@
2829 font-size:0.8em;
2930 cursor:pointer;
3031 border:solid 1px #aaaaaa;
31 -border-top-width:0;
3232 padding:0;
3333 margin:0;
3434 }
Property changes on: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/OptIn
___________________________________________________________________
Name: svn:mergeinfo
3535 - /branches/REL1_15/phase3/extensions/UsabilityInitiative/OptIn:51646
/branches/wmf-deployment/extensions/UsabilityInitiative/OptIn:60970
/trunk/extensions/UsabilityInitiative/OptIn:56207,56209,56296,56333,56355,62041,62043,62127,62139-62140,62142-62143,62145-62146,62256,62263,62266-63865,63867-63877,63879-64124,64129-64645,64647-64648,64650-66321,66402
/trunk/phase3/extensions/UsabilityInitiative/OptIn:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816
3636 + /branches/REL1_15/phase3/extensions/UsabilityInitiative/OptIn:51646
/branches/wmf-deployment/extensions/UsabilityInitiative/OptIn:60970
/trunk/extensions/UsabilityInitiative/OptIn:56207,56209,56296,56333,56355,62041,62043,62127,62139-62140,62142-62143,62145-62146,62256,62263,62266-63865,63867-63877,63879-64124,64129-64645,64647-64648,64650-66321,66402,66565,66623,66631,66642-66644,66655
/trunk/phase3/extensions/UsabilityInitiative/OptIn:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.js
@@ -74,7 +74,8 @@
7575 $textbox.closest( 'form' ).submit();
7676 }
7777 },
78 - delay: 120
 78+ delay: 120,
 79+ positionFromLeft: $j( 'body' ).is( '.rtl' )
7980 } );
8081 $j( '#searchInput' ).suggestions( {
8182 result: {
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.hooks.php
@@ -16,13 +16,13 @@
1717 array( 'src' => 'Modules/CollapsibleTabs/CollapsibleTabs.js', 'version' => 8 ),
1818 array( 'src' => 'Modules/EditWarning/EditWarning.js', 'version' => 8 ),
1919 array( 'src' => 'Modules/FooterCleanup/FooterCleanup.js', 'version' => 5 ),
20 - array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 9 ),
 20+ array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 11 ),
2121 ),
2222 'combined' => array(
23 - array( 'src' => 'Vector.combined.js', 'version' => 29 ),
 23+ array( 'src' => 'Vector.combined.js', 'version' => 31 ),
2424 ),
2525 'minified' => array(
26 - array( 'src' => 'Vector.combined.min.js', 'version' => 29 ),
 26+ array( 'src' => 'Vector.combined.min.js', 'version' => 31 ),
2727 ),
2828 );
2929 static $modules = array(
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.js
@@ -335,7 +335,8 @@
336336 $textbox.closest( 'form' ).submit();
337337 }
338338 },
339 - delay: 120
 339+ delay: 120,
 340+ positionFromLeft: $j( 'body' ).is( '.rtl' )
340341 } );
341342 $j( '#searchInput' ).suggestions( {
342343 result: {
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/Vector/Vector.combined.min.js
@@ -14,5 +14,5 @@
1515 +transclusionCount
1616 +'</strong> other pages.</label>');$j('.mw-templatesUsedExplanation').remove();$j('.collapsible-list label').click(function(){$j(this).parent().toggleClass('expanded').toggleClass('collapsed').find('ul').slideToggle('fast');return false;}).trigger('click');$j('#wpPreview, #wpDiff, .editHelp, #editpage-specialchars').remove();$j('#mw-editform-cancel').remove().appendTo('.editButtons');});if(wgVectorEnabledModules.simplesearch&&skin=='vector'&&typeof os_autoload_inputs!=='undefined'&&os_autoload_forms!=='undefined'){os_autoload_inputs=[];os_autoload_forms=[];}
1717 $j(document).ready(function(){if(!wgVectorEnabledModules.simplesearch||skin!='vector'){return true;}
18 -$j('div#simpleSearch > input#searchInput').each(function(){$j('<label />').text(mw.usability.getMsg('vector-simplesearch-search')).css({'display':'none','position':'absolute','bottom':0,'padding':'0.25em','color':'#999999','cursor':'text'}).css(($j('body').is('.rtl')?'right':'left'),0).click(function(){$j(this).parent().find('input#searchInput').focus();}).appendTo($j(this).parent());if($j(this).val()==''){$j(this).parent().find('label').fadeIn(100);}}).focus(function(){$j(this).parent().find('label').fadeOut(100);}).blur(function(){if($j(this).val()==''){$j(this).parent().find('label').fadeIn(100);}});$j('#searchInput, #searchInput2, #powerSearchText, #searchText').suggestions({fetch:function(query){var $this=$j(this);var request=$j.ajax({url:wgScriptPath+'/api.php',data:{'action':'opensearch','search':query,'namespace':0,'suggest':''},dataType:'json',success:function(data){$this.suggestions('suggestions',data[1]);}});$j(this).data('request',request);},cancel:function(){var request=$j(this).data('request');if(request&&typeof request.abort=='function'){request.abort();$j(this).removeData('request');}},result:{select:function($textbox){$textbox.closest('form').submit();}},delay:120});$j('#searchInput').suggestions({result:{select:function($textbox){$textbox.closest('form').submit();}},special:{render:function(query){if($j(this).children().size()==0){$j(this).show()
 18+$j('div#simpleSearch > input#searchInput').each(function(){$j('<label />').text(mw.usability.getMsg('vector-simplesearch-search')).css({'display':'none','position':'absolute','bottom':0,'padding':'0.25em','color':'#999999','cursor':'text'}).css(($j('body').is('.rtl')?'right':'left'),0).click(function(){$j(this).parent().find('input#searchInput').focus();}).appendTo($j(this).parent());if($j(this).val()==''){$j(this).parent().find('label').fadeIn(100);}}).focus(function(){$j(this).parent().find('label').fadeOut(100);}).blur(function(){if($j(this).val()==''){$j(this).parent().find('label').fadeIn(100);}});$j('#searchInput, #searchInput2, #powerSearchText, #searchText').suggestions({fetch:function(query){var $this=$j(this);var request=$j.ajax({url:wgScriptPath+'/api.php',data:{'action':'opensearch','search':query,'namespace':0,'suggest':''},dataType:'json',success:function(data){$this.suggestions('suggestions',data[1]);}});$j(this).data('request',request);},cancel:function(){var request=$j(this).data('request');if(request&&typeof request.abort=='function'){request.abort();$j(this).removeData('request');}},result:{select:function($textbox){$textbox.closest('form').submit();}},delay:120,positionFromLeft:$j('body').is('.rtl')});$j('#searchInput').suggestions({result:{select:function($textbox){$textbox.closest('form').submit();}},special:{render:function(query){if($j(this).children().size()==0){$j(this).show()
1919 $label=$j('<div />').addClass('special-label').text(mw.usability.getMsg('vector-simplesearch-containing')).appendTo($j(this));$query=$j('<div />').addClass('special-query').text(query).appendTo($j(this));$query.autoEllipsis();}else{$j(this).find('.special-query').empty().text(query).autoEllipsis();}},select:function($textbox){$textbox.closest('form').append($j('<input />').attr({'type':'hidden','name':'fulltext','value':1}));$textbox.closest('form').submit();}},$region:$j('#simpleSearch')});});
\ No newline at end of file
Index: branches/wmf/1.16wmf4/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' => 12 ),
 22+ array( 'src' => 'css/suggestions.css', 'version' => 13 ),
2323 array( 'src' => 'css/vector.collapsibleNav.css', 'version' => 9 ),
2424 array( 'src' => 'css/vector.footerCleanup.css', 'version' => 2 ),
2525 array( 'src' => 'css/wikiEditor.css', 'version' => 13 ),
@@ -29,11 +29,11 @@
3030 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3131 ),
3232 'combined' => array(
33 - array( 'src' => 'css/combined.css', 'version' => 92 ),
 33+ array( 'src' => 'css/combined.css', 'version' => 93 ),
3434 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3535 ),
3636 'minified' => array(
37 - array( 'src' => 'css/combined.min.css', 'version' => 92 ),
 37+ array( 'src' => 'css/combined.min.css', 'version' => 93 ),
3838 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ),
3939 ),
4040 )
@@ -64,13 +64,14 @@
6565
6666 // Core functionality of extension scripts
6767 array( 'src' => 'js/plugins/jquery.async.js', 'version' => 3 ),
68 - array( 'src' => 'js/plugins/jquery.autoEllipsis.js', 'version' => 7 ),
 68+ array( 'src' => 'js/plugins/jquery.autoEllipsis.js', 'version' => 8 ),
6969 array( 'src' => 'js/plugins/jquery.browser.js', 'version' => 6 ),
7070 array( 'src' => 'js/plugins/jquery.collapsibleTabs.js', 'version' => 6 ),
7171 array( 'src' => 'js/plugins/jquery.color.js', 'version' => 1 ),
7272 array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 4 ),
7373 array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ),
74 - array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 14 ),
 74+ array( 'src' => 'js/plugins/jquery.expandableField.js', 'version' => 15 ),
 75+ array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 18 ),
7576 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 33 ),
7677 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 187 ),
7778 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 53 ),
@@ -83,10 +84,10 @@
8485 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 5 ),
8586 ),
8687 'combined' => array(
87 - array( 'src' => 'js/plugins.combined.js', 'version' => 396 ),
 88+ array( 'src' => 'js/plugins.combined.js', 'version' => 402 ),
8889 ),
8990 'minified' => array(
90 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 396 ),
 91+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 402 ),
9192 ),
9293 ),
9394 );
Property changes on: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js
___________________________________________________________________
Name: svn:mergeinfo
9495 - /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js:60970
/trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js:62041,62043,62127,62139,62142-62143,62145-62146,62256,62263,62274,62341,62371,62380,62384,62392-62396,62458,62552,63864-63865,63867-63877,63879-64124,64129-64645,64647-64648,64650-66321,66331-66335,66402
9596 + /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js:60970
/trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js:62041,62043,62127,62139,62142-62143,62145-62146,62256,62263,62274,62341,62371,62380,62384,62392-62396,62458,62552,63864-63865,63867-63877,63879-64124,64129-64645,64647-64648,64650-66321,66331-66335,66402,66565,66623,66631,66642-66644,66655
Property changes on: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js
___________________________________________________________________
Name: svn:mergeinfo
9697 - /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js:60970
/trunk/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js:62041,62043,62127,62139,62142-62143,62145-62146,62256,62263,62274,62341,62371,62380,62384,62392-62396,62458,62552,63864-63865,63867-63877,63879-64124,64129-64645,64647-64648,64650-66321,66402
9798 + /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js:60970
/trunk/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js:62041,62043,62127,62139,62142-62143,62145-62146,62256,62263,62274,62341,62371,62380,62384,62392-62396,62458,62552,63864-63865,63867-63877,63879-64124,64129-64645,64647-64648,64650-66321,66402,66565,66623,66631,66642-66644,66655
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins/jquery.suggestions.js
@@ -31,6 +31,13 @@
3232 * Type: Number, Range: 1 - 100, Default: 7
3333 * delay: Number of ms to wait for the user to stop typing
3434 * Type: Number, Range: 0 - 1200, Default: 120
 35+ * submitOnClick: Whether to submit the form containing the textbox when a suggestion is clicked
 36+ * Type: Boolean, Default: false
 37+ * maxExpandFactor: Maximum suggestions box width relative to the textbox width. If set to e.g. 2, the suggestions box
 38+ * will never be grown beyond 2 times the width of the textbox.
 39+ * Type: Number, Range: 1 - infinity, Default: 3
 40+ * positionFromLeft: Whether to position the suggestion box with the left attribute or the right
 41+ * Type: Boolean, Default: true
3542 */
3643 ( function( $ ) {
3744
@@ -120,18 +127,26 @@
121128 // Rebuild the suggestions list
122129 context.data.$container.show();
123130 // Update the size and position of the list
124 - context.data.$container.css( {
 131+ var newCSS = {
125132 'top': context.config.$region.offset().top + context.config.$region.outerHeight(),
126133 'bottom': 'auto',
127134 'width': context.config.$region.outerWidth(),
128 - 'height': 'auto',
129 - 'left': context.config.$region.offset().left,
130 - 'right': 'auto'
131 - } );
 135+ 'height': 'auto'
 136+ }
 137+ if ( context.config.positionFromLeft ) {
 138+ newCSS['left'] = context.config.$region.offset().left;
 139+ newCSS['right'] = 'auto';
 140+ } else {
 141+ newCSS['left'] = 'auto';
 142+ newCSS['right'] = $( 'body' ).width() - ( context.config.$region.offset().left + context.config.$region.outerWidth() );
 143+ }
 144+ context.data.$container.css( newCSS );
132145 var $results = context.data.$container.children( '.suggestions-results' );
133146 $results.empty();
 147+ var expWidth = -1;
 148+ var $autoEllipseMe = $( [] );
134149 for ( var i = 0; i < context.config.suggestions.length; i++ ) {
135 - $result = $( '<div />' )
 150+ var $result = $( '<div />' )
136151 .addClass( 'suggestions-result' )
137152 .attr( 'rel', i )
138153 .data( 'text', context.config.suggestions[i] )
@@ -141,13 +156,33 @@
142157 );
143158 } )
144159 .appendTo( $results );
 160+
145161 // Allow custom rendering
146162 if ( typeof context.config.result.render == 'function' ) {
147163 context.config.result.render.call( $result, context.config.suggestions[i] );
148164 } else {
149 - $result.text( context.config.suggestions[i] ).autoEllipsis();
 165+ // Add <span> with text
 166+ $result.append( $( '<span />' )
 167+ .css( 'whiteSpace', 'nowrap' )
 168+ .text( context.config.suggestions[i] )
 169+ );
 170+
 171+ // Widen results box if needed
 172+ // New width is only calculated here, applied later
 173+ var $span = $result.children( 'span' );
 174+ if ( $span.outerWidth() > $result.width() && $span.outerWidth() > expWidth ) {
 175+ expWidth = $span.outerWidth();
 176+ }
 177+ $autoEllipseMe = $autoEllipseMe.add( $result );
150178 }
151179 }
 180+ // Apply new width for results box, if any
 181+ if ( expWidth > context.data.$container.width() ) {
 182+ var maxWidth = context.config.maxExpandFactor*context.data.$textbox.width();
 183+ context.data.$container.width( Math.min( expWidth, maxWidth ) );
 184+ }
 185+ // autoEllipse the results. Has to be done after changing the width
 186+ $autoEllipseMe.autoEllipsis( { hasSpan: true, tooltip: true } );
152187 }
153188 }
154189 break;
@@ -157,7 +192,11 @@
158193 case 'delay':
159194 context.config[property] = Math.max( 0, Math.min( 1200, value ) );
160195 break;
 196+ case 'maxExpandFactor':
 197+ context.config[property] = Math.max( 1, value );
 198+ break;
161199 case 'submitOnClick':
 200+ case 'positionFromLeft':
162201 context.config[property] = value ? true : false;
163202 break;
164203 }
@@ -258,7 +297,11 @@
259298 context.data.$container.hide();
260299 preventDefault = wasVisible;
261300 selected = context.data.$container.find( '.suggestions-result-current' );
262 - if ( selected.is( '.suggestions-special' ) ) {
 301+ if ( selected.size() == 0 ) {
 302+ // if nothing is selected, cancel any current requests and submit the form
 303+ $.suggestions.cancel( context );
 304+ context.config.$region.closest( 'form' ).submit();
 305+ } else if ( selected.is( '.suggestions-special' ) ) {
263306 if ( typeof context.config.special.select == 'function' ) {
264307 context.config.special.select.call( selected, context.data.$textbox );
265308 }
@@ -292,10 +335,10 @@
293336 /* Construction / Loading */
294337
295338 var context = $(this).data( 'suggestions-context' );
296 - if ( typeof context == 'undefined' ) {
 339+ if ( typeof context == 'undefined' || context == null ) {
297340 context = {
298341 config: {
299 - 'fetch' : function() {},
 342+ 'fetch' : function() {},
300343 'cancel': function() {},
301344 'special': {},
302345 'result': {},
@@ -303,7 +346,9 @@
304347 'suggestions': [],
305348 'maxRows': 7,
306349 'delay': 120,
307 - 'submitOnClick': false
 350+ 'submitOnClick': false,
 351+ 'maxExpandFactor': 3,
 352+ 'positionFromLeft': true
308353 }
309354 };
310355 }
@@ -342,13 +387,22 @@
343388 'mouseDownOn': $( [] ),
344389 '$textbox': $(this)
345390 };
 391+ // Setup the css for positioning the results box
 392+ var newCSS = {
 393+ 'top': Math.round( context.data.$textbox.offset().top + context.data.$textbox.outerHeight() ),
 394+ 'width': context.data.$textbox.outerWidth(),
 395+ 'display': 'none'
 396+ }
 397+ if ( context.config.positionFromLeft ) {
 398+ newCSS['left'] = context.config.$region.offset().left;
 399+ newCSS['right'] = 'auto';
 400+ } else {
 401+ newCSS['left'] = 'auto';
 402+ newCSS['right'] = $( 'body' ).width() - ( context.config.$region.offset().left + context.config.$region.outerWidth() );
 403+ }
 404+
346405 context.data.$container = $( '<div />' )
347 - .css( {
348 - 'top': Math.round( context.data.$textbox.offset().top + context.data.$textbox.outerHeight() ),
349 - 'left': Math.round( context.data.$textbox.offset().left ),
350 - 'width': context.data.$textbox.outerWidth(),
351 - 'display': 'none'
352 - } )
 406+ .css( newCSS )
353407 .addClass( 'suggestions' )
354408 .append(
355409 $( '<div />' ).addClass( 'suggestions-results' )
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins/jquery.autoEllipsis.js
@@ -10,7 +10,8 @@
1111 options = $.extend( {
1212 'position': 'center',
1313 'tooltip': false,
14 - 'restoreText': false
 14+ 'restoreText': false,
 15+ 'hasSpan': false
1516 }, options );
1617 $(this).each( function() {
1718 var $this = $(this);
@@ -23,8 +24,13 @@
2425 }
2526 var text = $this.text();
2627 var w = $this.width();
27 - var $text = $( '<span />' ).css( 'whiteSpace', 'nowrap' );
28 - $this.empty().append( $text );
 28+ var $text;
 29+ if ( options.hasSpan ) {
 30+ $text = $this.children( 'span' );
 31+ } else {
 32+ $text = $( '<span />' ).css( 'whiteSpace', 'nowrap' );
 33+ $this.empty().append( $text );
 34+ }
2935
3036 // Try cache
3137 if ( !( text in cache ) ) {
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -5182,7 +5182,8 @@
51835183 options = $.extend( {
51845184 'position': 'center',
51855185 'tooltip': false,
5186 - 'restoreText': false
 5186+ 'restoreText': false,
 5187+ 'hasSpan': false
51875188 }, options );
51885189 $(this).each( function() {
51895190 var $this = $(this);
@@ -5195,8 +5196,13 @@
51965197 }
51975198 var text = $this.text();
51985199 var w = $this.width();
5199 - var $text = $( '<span />' ).css( 'whiteSpace', 'nowrap' );
5200 - $this.empty().append( $text );
 5200+ var $text;
 5201+ if ( options.hasSpan ) {
 5202+ $text = $this.children( 'span' );
 5203+ } else {
 5204+ $text = $( '<span />' ).css( 'whiteSpace', 'nowrap' );
 5205+ $this.empty().append( $text );
 5206+ }
52015207
52025208 // Try cache
52035209 if ( !( text in cache ) ) {
@@ -5782,6 +5788,13 @@
57835789 * Type: Number, Range: 1 - 100, Default: 7
57845790 * delay: Number of ms to wait for the user to stop typing
57855791 * Type: Number, Range: 0 - 1200, Default: 120
 5792+ * submitOnClick: Whether to submit the form containing the textbox when a suggestion is clicked
 5793+ * Type: Boolean, Default: false
 5794+ * maxExpandFactor: Maximum suggestions box width relative to the textbox width. If set to e.g. 2, the suggestions box
 5795+ * will never be grown beyond 2 times the width of the textbox.
 5796+ * Type: Number, Range: 1 - infinity, Default: 3
 5797+ * positionFromLeft: Whether to position the suggestion box with the left attribute or the right
 5798+ * Type: Boolean, Default: true
57865799 */
57875800 ( function( $ ) {
57885801
@@ -5871,18 +5884,26 @@
58725885 // Rebuild the suggestions list
58735886 context.data.$container.show();
58745887 // Update the size and position of the list
5875 - context.data.$container.css( {
 5888+ var newCSS = {
58765889 'top': context.config.$region.offset().top + context.config.$region.outerHeight(),
58775890 'bottom': 'auto',
58785891 'width': context.config.$region.outerWidth(),
5879 - 'height': 'auto',
5880 - 'left': context.config.$region.offset().left,
5881 - 'right': 'auto'
5882 - } );
 5892+ 'height': 'auto'
 5893+ }
 5894+ if ( context.config.positionFromLeft ) {
 5895+ newCSS['left'] = context.config.$region.offset().left;
 5896+ newCSS['right'] = 'auto';
 5897+ } else {
 5898+ newCSS['left'] = 'auto';
 5899+ newCSS['right'] = $( 'body' ).width() - ( context.config.$region.offset().left + context.config.$region.outerWidth() );
 5900+ }
 5901+ context.data.$container.css( newCSS );
58835902 var $results = context.data.$container.children( '.suggestions-results' );
58845903 $results.empty();
 5904+ var expWidth = -1;
 5905+ var $autoEllipseMe = $( [] );
58855906 for ( var i = 0; i < context.config.suggestions.length; i++ ) {
5886 - $result = $( '<div />' )
 5907+ var $result = $( '<div />' )
58875908 .addClass( 'suggestions-result' )
58885909 .attr( 'rel', i )
58895910 .data( 'text', context.config.suggestions[i] )
@@ -5892,13 +5913,33 @@
58935914 );
58945915 } )
58955916 .appendTo( $results );
 5917+
58965918 // Allow custom rendering
58975919 if ( typeof context.config.result.render == 'function' ) {
58985920 context.config.result.render.call( $result, context.config.suggestions[i] );
58995921 } else {
5900 - $result.text( context.config.suggestions[i] ).autoEllipsis();
 5922+ // Add <span> with text
 5923+ $result.append( $( '<span />' )
 5924+ .css( 'whiteSpace', 'nowrap' )
 5925+ .text( context.config.suggestions[i] )
 5926+ );
 5927+
 5928+ // Widen results box if needed
 5929+ // New width is only calculated here, applied later
 5930+ var $span = $result.children( 'span' );
 5931+ if ( $span.outerWidth() > $result.width() && $span.outerWidth() > expWidth ) {
 5932+ expWidth = $span.outerWidth();
 5933+ }
 5934+ $autoEllipseMe = $autoEllipseMe.add( $result );
59015935 }
59025936 }
 5937+ // Apply new width for results box, if any
 5938+ if ( expWidth > context.data.$container.width() ) {
 5939+ var maxWidth = context.config.maxExpandFactor*context.data.$textbox.width();
 5940+ context.data.$container.width( Math.min( expWidth, maxWidth ) );
 5941+ }
 5942+ // autoEllipse the results. Has to be done after changing the width
 5943+ $autoEllipseMe.autoEllipsis( { hasSpan: true, tooltip: true } );
59035944 }
59045945 }
59055946 break;
@@ -5908,7 +5949,11 @@
59095950 case 'delay':
59105951 context.config[property] = Math.max( 0, Math.min( 1200, value ) );
59115952 break;
 5953+ case 'maxExpandFactor':
 5954+ context.config[property] = Math.max( 1, value );
 5955+ break;
59125956 case 'submitOnClick':
 5957+ case 'positionFromLeft':
59135958 context.config[property] = value ? true : false;
59145959 break;
59155960 }
@@ -6009,7 +6054,11 @@
60106055 context.data.$container.hide();
60116056 preventDefault = wasVisible;
60126057 selected = context.data.$container.find( '.suggestions-result-current' );
6013 - if ( selected.is( '.suggestions-special' ) ) {
 6058+ if ( selected.size() == 0 ) {
 6059+ // if nothing is selected, cancel any current requests and submit the form
 6060+ $.suggestions.cancel( context );
 6061+ context.config.$region.closest( 'form' ).submit();
 6062+ } else if ( selected.is( '.suggestions-special' ) ) {
60146063 if ( typeof context.config.special.select == 'function' ) {
60156064 context.config.special.select.call( selected, context.data.$textbox );
60166065 }
@@ -6043,10 +6092,10 @@
60446093 /* Construction / Loading */
60456094
60466095 var context = $(this).data( 'suggestions-context' );
6047 - if ( typeof context == 'undefined' ) {
 6096+ if ( typeof context == 'undefined' || context == null ) {
60486097 context = {
60496098 config: {
6050 - 'fetch' : function() {},
 6099+ 'fetch' : function() {},
60516100 'cancel': function() {},
60526101 'special': {},
60536102 'result': {},
@@ -6054,7 +6103,9 @@
60556104 'suggestions': [],
60566105 'maxRows': 7,
60576106 'delay': 120,
6058 - 'submitOnClick': false
 6107+ 'submitOnClick': false,
 6108+ 'maxExpandFactor': 3,
 6109+ 'positionFromLeft': true
60596110 }
60606111 };
60616112 }
@@ -6093,13 +6144,22 @@
60946145 'mouseDownOn': $( [] ),
60956146 '$textbox': $(this)
60966147 };
 6148+ // Setup the css for positioning the results box
 6149+ var newCSS = {
 6150+ 'top': Math.round( context.data.$textbox.offset().top + context.data.$textbox.outerHeight() ),
 6151+ 'width': context.data.$textbox.outerWidth(),
 6152+ 'display': 'none'
 6153+ }
 6154+ if ( context.config.positionFromLeft ) {
 6155+ newCSS['left'] = context.config.$region.offset().left;
 6156+ newCSS['right'] = 'auto';
 6157+ } else {
 6158+ newCSS['left'] = 'auto';
 6159+ newCSS['right'] = $( 'body' ).width() - ( context.config.$region.offset().left + context.config.$region.outerWidth() );
 6160+ }
 6161+
60976162 context.data.$container = $( '<div />' )
6098 - .css( {
6099 - 'top': Math.round( context.data.$textbox.offset().top + context.data.$textbox.outerHeight() ),
6100 - 'left': Math.round( context.data.$textbox.offset().left ),
6101 - 'width': context.data.$textbox.outerWidth(),
6102 - 'display': 'none'
6103 - } )
 6163+ .css( newCSS )
61046164 .addClass( 'suggestions' )
61056165 .append(
61066166 $( '<div />' ).addClass( 'suggestions-results' )
@@ -6689,6 +6749,7 @@
66906750 return module.supported = false;
66916751 }
66926752 var mod = module && 'browsers' in module ? module : $.wikiEditor;
 6753+ return mod.supported = true;
66936754 // Check for and make use of cached value and early opportunities to bail
66946755 if ( typeof mod.supported !== 'undefined' ) {
66956756 // Cache hit
@@ -7025,8 +7086,12 @@
70267087 'paste': function( event ) {
70277088 // Save the cursor position to restore it after all this voodoo
70287089 var cursorPos = context.fn.getCaretPosition();
7029 - var oldLength = context.fn.getContents().length - ( cursorPos[1] - cursorPos[0] );
7030 - context.$content.find( ':not(.wikiEditor)' ).addClass( 'wikiEditor' );
 7090+ if ( !context.$content.text() ) {
 7091+ context.$content.empty();
 7092+ }
 7093+ var oldLength = context.fn.getContents().length;
 7094+
 7095+ context.$content.find( '*' ).addClass( 'wikiEditor' );
70317096 if ( $.layout.name !== 'webkit' ) {
70327097 context.$content.addClass( 'pasting' );
70337098 }
@@ -7046,58 +7111,82 @@
70477112 var outerParent = $(this).parent();
70487113 outerParent.replaceWith( outerParent.childNodes );
70497114 } );
 7115+
70507116 // Unwrap the span found in webkit copies (Apple Richtext)
7051 - context.$content.find( 'span.Apple-style-span' ).each( function() {
7052 - $(this).replaceWith( this.childNodes );
7053 - } );
 7117+ if ( ! $.browser.msie ) {
 7118+ context.$content.find( 'span.Apple-style-span' ).each( function() {
 7119+ $(this).replaceWith( this.childNodes );
 7120+ } );
 7121+ }
70547122
7055 - // If the pasted content is plain text then wrap it in a <p> and adjust the <br> accordingly
7056 - var pasteContent = context.fn.getOffset( cursorPos[0] ).node;
7057 - var removeNextBR = false;
7058 - while ( pasteContent != null && !$( pasteContent ).hasClass( 'wikiEditor' ) ) {
7059 - var currentNode = pasteContent;
7060 - pasteContent = pasteContent.nextSibling;
7061 - if ( currentNode.nodeName == '#text' && currentNode.nodeValue == currentNode.wholeText ) {
7062 - var pWrapper = $( '<p />' ).addClass( 'wikiEditor' );
7063 - $( currentNode ).wrap( pWrapper );
7064 - $( currentNode ).addClass( 'wikiEditor' );
7065 - removeNextBR = true;
7066 - } else if ( currentNode.nodeName == 'BR' && removeNextBR ) {
7067 - $( currentNode ).remove();
7068 - removeNextBR = false;
7069 - } else {
7070 - removeNextBR = false;
7071 - }
7072 - }
70737123 var $selection = context.$content.find( ':not(.wikiEditor)' );
 7124+ var $previousElement;
70747125 while ( $selection.length && $selection.length > 0 ) {
70757126 var $currentElement = $selection.eq( 0 );
 7127+
 7128+ //go up till we find the first pasted element
70767129 while ( !$currentElement.parent().is( 'body' ) && !$currentElement.parent().is( '.wikiEditor' ) ) {
70777130 $currentElement = $currentElement.parent();
70787131 }
 7132+ //go to the previous element till we find the first pasted element
 7133+ while ( $currentElement[0] != null &&
 7134+ $currentElement[0].previousSibling != null &&
 7135+ !$( $currentElement[0].previousSibling ).hasClass( 'wikiEditor' ) ) {
 7136+ $currentElement = $( $currentElement[0].previousSibling );
 7137+ }
70797138
 7139+ //each pasted element is always wrapped in a <p>
70807140 var $newElement;
7081 - if ( $currentElement.is( 'p' ) || $currentElement.is( 'div' ) || $currentElement.is( 'pre' ) ) {
7082 - //Convert all <div>, <p> and <pre> that was pasted into a <p> element
7083 - $newElement = $( '<p />' );
 7141+ var textNode = false;
 7142+ if ( $currentElement[0].nodeName == '#text' ) {
 7143+ $newElement = $( '<p></p>' );
 7144+ textNode = true;
 7145+ } else if ( $currentElement.is( 'p' ) || $currentElement.is( 'pre' ) || $currentElement.is( 'br' ) ) {
 7146+ $newElement = $( '<p></p>' );
70847147 } else {
7085 - // everything else becomes a <span>
7086 - $newElement = $( '<span />' ).addClass( 'wikiEditor' );
 7148+ $newElement = $( '<span></span>' );
70877149 }
 7150+ var newElementHTML = '';
 7151+ var currentHTML = '';
70887152
7089 - // If the pasted content was html, just convert it into text and <br>
7090 - var pieces = $.trim( $currentElement.text() ).split( '\n' );
7091 - var newElementHTML = '';
 7153+
 7154+ if ( $currentElement[0].nodeName == '#text' ) {
 7155+ //if it is a text node then just append it
 7156+ currentHTML = $currentElement[0].nodeValue;
 7157+ } else {
 7158+ currentHTML = $currentElement.html();
 7159+ //replace all forms of <p> tags with a \n. All other tags get removed.
 7160+ currentHTML = currentHTML.replace(/(<[\s]*p[^>]*>)|(<[\s]*\/p[^>]*>)|(<[\s]*p[^\/>]*\/>)/gi, '\n');
 7161+ currentHTML = currentHTML.replace(/(<[^>]*>)|(<[^\>]*\>)/gi, '');
 7162+
 7163+ }
 7164+
 7165+ //wrap each piece in a <p> with a <br> in between.
 7166+ var pieces = currentHTML.split( '\n' );
70927167 for ( var i = 0; i < pieces.length; i++ ) {
70937168 if ( pieces[i] ) {
7094 - newElementHTML += $.trim( pieces[i] );
7095 - } else {
7096 - newElementHTML += '<span><br class="wikiEditor" /></span>';
 7169+ if ( textNode || ! $newElement.is( 'p' ) ) {
 7170+ newElementHTML += '<p class="wikiEditor">' + pieces[i] + '</p>';
 7171+ } else {
 7172+ newElementHTML += pieces[i];
 7173+ }
 7174+ } else if ( textNode || ! $newElement.is( 'p' ) ) {
 7175+ newElementHTML += '<br class="wikiEditor" >';
70977176 }
 7177+
 7178+ if ( !textNode ) {
 7179+ newElementHTML += '<br class="wikiEditor" >';
 7180+ }
70987181 }
7099 - $newElement.html( newElementHTML )
7100 - .addClass( 'wikiEditor' )
7101 - .insertAfter( $currentElement );
 7182+
 7183+ $newElement.html( newElementHTML ).addClass( 'wikiEditor' );
 7184+
 7185+ //remove extra <br>s
 7186+ if ( $newElement.is( 'p' ) && $currentElement[0].nextSibling != null && $( $currentElement[0].nextSibling ).is( 'br' ) ) {
 7187+ $( $currentElement[0].nextSibling ).remove();
 7188+ }
 7189+ //swap out the original content with with newly sanitized one
 7190+ $newElement.insertAfter( $currentElement );
71027191 $currentElement.remove();
71037192
71047193 $selection = context.$content.find( ':not(.wikiEditor)' );
@@ -7108,10 +7197,14 @@
71097198 context.$content.removeClass( 'pasting' );
71107199 }
71117200
 7201+
71127202 // Restore cursor position
71137203 context.fn.purgeOffsets();
71147204 var newLength = context.fn.getContents().length;
71157205 var restoreTo = cursorPos[0] + newLength - oldLength;
 7206+ if ( restoreTo > newLength ) {
 7207+ restoreTo = newLength;
 7208+ }
71167209 context.fn.setSelection( { start: restoreTo, end: restoreTo } );
71177210 }, 0 );
71187211 return true;
@@ -8233,10 +8326,10 @@
82348327 end = e ? e.offset : null;
82358328 // Don't try to set the selection past the end of a node, causes errors
82368329 // Just put the selection at the end of the node in this case
8237 - if ( sc.nodeName == '#text' && start > sc.nodeValue.length ) {
 8330+ if ( sc != null && sc.nodeName == '#text' && start > sc.nodeValue.length ) {
82388331 start = sc.nodeValue.length - 1;
82398332 }
8240 - if ( ec.nodeName == '#text' && end > ec.nodeValue.length ) {
 8333+ if ( ec != null && ec.nodeName == '#text' && end > ec.nodeValue.length ) {
82418334 end = ec.nodeValue.length - 1;
82428335 }
82438336 }
Index: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -359,8 +359,9 @@
360360 {var i=0,l=array.length,loop=opts.loop||function(){};$.whileAsync($.extend(opts,{test:function(){return i<l;},loop:function()
361361 {var val=array[i];return loop.call(val,i++,val);}}));}
362362 $.fn.eachAsync=function(opts)
363 -{$.eachAsync(this,opts);return this;}})(jQuery);(function($){var cache={};$.fn.autoEllipsis=function(options){options=$.extend({'position':'center','tooltip':false,'restoreText':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=$('<span />').css('whiteSpace','nowrap');$this.empty().append($text);if(!(text in cache)){cache[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+if(!(text in cache)){cache[text]={};}
365366 if(w in cache[text]){$text.text(cache[text][w]);return;}
366367 $text.text(text);if($text.width()>w){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()>w){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()>w&&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;}}
367368 break;case'left':var r=0;while($text.outerWidth()>w&&r<text.length){$text.text('...'+text.substr(r));r++;}
@@ -394,18 +395,25 @@
395396 if(typeof context.config.cancel=='function'){context.config.cancel.call(context.data.$textbox);}},restore:function(context){context.data.$textbox.val(context.data.prevText);},update:function(context,delayed){function maybeFetch(){if(context.data.$textbox.val()!==context.data.prevText){context.data.prevText=context.data.$textbox.val();if(typeof context.config.fetch=='function'){context.config.fetch.call(context.data.$textbox,context.data.$textbox.val());}}}
396397 if(context.data.timerID!=null){clearTimeout(context.data.timerID);}
397398 if(delayed){context.data.timerID=setTimeout(maybeFetch,context.config.delay);}else{maybeFetch();}
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.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');}}}
 399+$.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'}
 400+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());}
 401+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();}
 402+$autoEllipseMe=$autoEllipseMe.add($result);}}
 403+if(expWidth>context.data.$container.width()){var maxWidth=context.config.maxExpandFactor*context.data.$textbox.width();context.data.$container.width(Math.min(expWidth,maxWidth));}
 404+$autoEllipseMe.autoEllipsis({hasSpan:true,tooltip:true});}}
 405+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');}}}
400406 selected.removeClass('suggestions-result-current');result.addClass('suggestions-result-current');}
401407 if(updateTextbox){if(result.length==0){$.suggestions.restore(context);}else{context.data.$textbox.val(result.data('text'));context.data.$textbox.change();}
402408 context.data.$textbox.trigger('change');}
403409 $.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);}
404410 preventDefault=true;break;case 38:if(wasVisible){$.suggestions.highlight(context,'prev',false);}
405 -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.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);}}
 411+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);}}
406412 break;default:$.suggestions.update(context,true);break;}
407 -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={config:{'fetch':function(){},'cancel':function(){},'special':{},'result':{},'$region':$(this),'suggestions':[],'maxRows':7,'delay':120,'submitOnClick':false}};}
 413+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}};}
408414 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]]);}}}
409 -if(typeof context.data=='undefined'){context.data={'timerID':null,'prevText':null,'visibleResults':0,'mouseDownOn':$([]),'$textbox':$(this)};context.data.$container=$('<div />').css({'top':Math.round(context.data.$textbox.offset().top+context.data.$textbox.outerHeight()),'left':Math.round(context.data.$textbox.offset().left),'width':context.data.$textbox.outerWidth(),'display':'none'}).addClass('suggestions').append($('<div />').addClass('suggestions-results').mousedown(function(e){context.data.mouseDownOn=$(e.target).closest('.suggestions-results div');}).mouseup(function(e){var $result=$(e.target).closest('.suggestions-results div');var $other=context.data.mouseDownOn;context.data.mouseDownOn=$([]);if($result.get(0)!=$other.get(0)){return;}
 415+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'}
 416+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());}
 417+context.data.$container=$('<div />').css(newCSS).addClass('suggestions').append($('<div />').addClass('suggestions-results').mousedown(function(e){context.data.mouseDownOn=$(e.target).closest('.suggestions-results div');}).mouseup(function(e){var $result=$(e.target).closest('.suggestions-results div');var $other=context.data.mouseDownOn;context.data.mouseDownOn=$([]);if($result.get(0)!=$other.get(0)){return;}
410418 $.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);}
411419 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;}
412420 context.data.$container.hide();if(typeof context.config.special.select=='function'){context.config.special.select.call($special,context.data.$textbox);}
@@ -444,8 +452,7 @@
445453 options.endContainer=options.startContainer;break;case'scrollToCaretPosition':options=$.extend({'force':false},options);break;}
446454 var context=$(this).data('wikiEditor-context');var hasIframe=context!==undefined&&context.$iframe!==undefined;var needSave=false;if(hasIframe&&context.savedSelection!==null){context.fn.restoreSelection();needSave=true;}
447455 retval=(hasIframe?context.fn:fn)[command].call(this,options);if(hasIframe&&needSave){context.fn.saveSelection();}
448 -return retval;};})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2]],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]],'blackberry':false,'ipod':false,'iphone':false},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2]],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]],'blackberry':false,'ipod':false,'iphone':false}},'imgPath':wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/','isSupported':function(module){if(module&&typeof module.name!='undefined'&&(module.name=='toc'||module.name=='highlight')&&typeof wgReallyGiveMeTOC=='undefined'){return module.supported=false;}
449 -var mod=module&&'browsers'in module?module:$.wikiEditor;if(typeof mod.supported!=='undefined'){return mod.supported;}
 456+return retval;};})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',2]],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]],'blackberry':false,'ipod':false,'iphone':false},'rtl':{'msie':[['>=',8]],'firefox':[['>=',2]],'opera':[['>=',9.6]],'safari':[['>=',3]],'chrome':[['>=',3]],'blackberry':false,'ipod':false,'iphone':false}},'imgPath':wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/','isSupported':function(module){var mod=module&&'browsers'in module?module:$.wikiEditor;return mod.supported=true;if(typeof mod.supported!=='undefined'){return mod.supported;}
450457 if(!($.browser.name in mod.browsers[$('body').is('.rtl')?'rtl':'ltr'])){return mod.supported=true;}
451458 var browser=mod.browsers[$('body').is('.rtl')?'rtl':'ltr'][$.browser.name];if(typeof browser!='object'){return mod.supported=false;}
452459 for(var condition in browser){var op=browser[condition][0];var val=browser[condition][1];if(val===false){return mod.supported=false;}else if(typeof val=='string'){if(!(eval('$.browser.version'+op+'"'+val+'"'))){return mod.supported=false;}}else if(typeof val=='number'){if(!(eval('$.browser.versionNumber'+op+val))){return mod.supported=false;}}}
@@ -455,21 +462,30 @@
456463 return src+'?'+wgWikiEditorIconVersion;}};$.fn.wikiEditor=function(){if(!$j.wikiEditor.isSupported()){return $(this);}
457464 var context=$(this).data('wikiEditor-context');if(!context||typeof context=='undefined'){context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':$.wikiEditor.instances.push($(this))-1,'offsets':null,'htmlToTextMap':{},'oldHTML':null,'oldDelayedHTML':null,'oldDelayedSel':null,'savedSelection':null,'history':[],'historyPosition':-1,'oldDelayedHistoryPosition':-1};context.api={'addModule':function(context,data){var modules={};if(typeof data=='string'){modules[data]={};}else if(typeof data=='object'){modules=data;}
458465 for(var module in modules){if(typeof module=='string'&&$.wikiEditor.isSupported($.wikiEditor.modules[module])){if('api'in $.wikiEditor.modules[module]){for(var call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}
459 -if('fn'in $.wikiEditor.modules[module]&&'create'in $.wikiEditor.modules[module].fn){context.modules[module]={};$.wikiEditor.modules[module].fn.create(context,modules[module]);}}}}};context.evt={'keydown':function(event){switch(event.which){case 9:if(event.ctrlKey||event.altKey||event.shiftKey){return true;}else{var $tabindexList=$j('[tabindex]:visible').sort(function(a,b){return a.tabIndex-b.tabIndex;});for(var i=0;i<$tabindexList.length;i++){if($tabindexList.eq(i).attr('id')==context.$iframe.attr('id')){$tabindexList.get(i+1).focus();break;}}
 466+if('fn'in $.wikiEditor.modules[module]&&'create'in $.wikiEditor.modules[module].fn){context.modules[module]={};$.wikiEditor.modules[module].fn.create(context,modules[module]);}}}}};context.evt={'keydown':function(event){switch(event.which){case 90:case 89:if(event.which==89&&!$.browser.msie){return true;}else if((event.ctrlKey||event.metaKey)&&context.history.length){var newPosition;if(event.shiftKey||event.which==89){newPosition=context.historyPosition+1;}else{newPosition=context.historyPosition-1;}
 467+if(newPosition>=(context.history.length*-1)&&newPosition<0){context.fn.updateHistory(context.oldDelayedHTML!=context.$content.html());context.oldDelayedHistoryPosition=context.historyPosition;context.historyPosition=newPosition;context.$content.html(context.history[context.history.length+context.historyPosition].html);context.fn.purgeOffsets();if(context.history[context.history.length+context.historyPosition].sel){context.fn.setSelection({start:context.history[context.history.length+context.historyPosition].sel[0],end:context.history[context.history.length+context.historyPosition].sel[1]});}}
460468 return false;}
 469+break;case 9:if(event.ctrlKey||event.altKey||event.shiftKey){return true;}else{var $tabindexList=$j('[tabindex]:visible').sort(function(a,b){return a.tabIndex-b.tabIndex;});for(var i=0;i<$tabindexList.length;i++){if($tabindexList.eq(i).attr('id')==context.$iframe.attr('id')){$tabindexList.get(i+1).focus();break;}}
 470+return false;}
461471 break;case 86:if(event.ctrlKey&&$.browser.msie){context.evt.paste(event);}
462472 break;}
463473 return true;},'change':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldHTML!=newHTML){context.fn.purgeOffsets();context.oldHTML=newHTML;event.data.scope='realchange';}
464474 if(context.$content.children().length==0){context.$content.append('<p></p>');}
465475 return true;},'delayedChange':function(event){event.data.scope='division';var newHTML=context.$content.html();if(context.oldDelayedHTML!=newHTML){context.oldDelayedHTML=newHTML;event.data.scope='realchange';var cursorPos=context.fn.getCaretPosition();var t=context.fn.getOffset(cursorPos[0]);if(t&&t.node.nodeName=='#text'&&t.node.parentNode.nodeName.toLowerCase()=='body'){$(t.node).wrap("<p></p>");context.fn.purgeOffsets();context.fn.setSelection({start:cursorPos[0],end:cursorPos[1]});}}
466 -context.fn.updateHistory(event.data.scope=='realchange');return true;},'cut':function(event){setTimeout(function(){context.$content.find('br').each(function(){if($(this).parent().is('body')){$(this).wrap($('<p></p>'));}});},100);return true;},'paste':function(event){var cursorPos=context.fn.getCaretPosition();var oldLength=context.fn.getContents().length-(cursorPos[1]-cursorPos[0]);context.$content.find(':not(.wikiEditor)').addClass('wikiEditor');if($.layout.name!=='webkit'){context.$content.addClass('pasting');}
467 -setTimeout(function(){context.$content.find('script,style,img,input,select,textarea,hr,button,link,meta').remove();context.$content.find('*').each(function(){if($(this).children().length==0&&this.childNodes.length>0){$(this).text($(this).text());}});context.$content.find('p:not(.wikiEditor) p:not(.wikiEditor)').each(function(){var outerParent=$(this).parent();outerParent.replaceWith(outerParent.childNodes);});context.$content.find('span.Apple-style-span').each(function(){$(this).replaceWith(this.childNodes);});var pasteContent=context.fn.getOffset(cursorPos[0]).node;var removeNextBR=false;while(pasteContent!=null&&!$(pasteContent).hasClass('wikiEditor')){var currentNode=pasteContent;pasteContent=pasteContent.nextSibling;if(currentNode.nodeName=='#text'&&currentNode.nodeValue==currentNode.wholeText){var pWrapper=$('<p />').addClass('wikiEditor');$(currentNode).wrap(pWrapper);$(currentNode).addClass('wikiEditor');removeNextBR=true;}else if(currentNode.nodeName=='BR'&&removeNextBR){$(currentNode).remove();removeNextBR=false;}else{removeNextBR=false;}}
468 -var $selection=context.$content.find(':not(.wikiEditor)');while($selection.length&&$selection.length>0){var $currentElement=$selection.eq(0);while(!$currentElement.parent().is('body')&&!$currentElement.parent().is('.wikiEditor')){$currentElement=$currentElement.parent();}
469 -var $newElement;if($currentElement.is('p')||$currentElement.is('div')||$currentElement.is('pre')){$newElement=$('<p />');}else{$newElement=$('<span />').addClass('wikiEditor');}
470 -var pieces=$.trim($currentElement.text()).split('\n');var newElementHTML='';for(var i=0;i<pieces.length;i++){if(pieces[i]){newElementHTML+=$.trim(pieces[i]);}else{newElementHTML+='<span><br class="wikiEditor" /></span>';}}
471 -$newElement.html(newElementHTML).addClass('wikiEditor').insertAfter($currentElement);$currentElement.remove();$selection=context.$content.find(':not(.wikiEditor)');}
 476+context.fn.updateHistory(event.data.scope=='realchange');return true;},'cut':function(event){setTimeout(function(){context.$content.find('br').each(function(){if($(this).parent().is('body')){$(this).wrap($('<p></p>'));}});},100);return true;},'paste':function(event){var cursorPos=context.fn.getCaretPosition();if(!context.$content.text()){context.$content.empty();}
 477+var oldLength=context.fn.getContents().length;context.$content.find('*').addClass('wikiEditor');if($.layout.name!=='webkit'){context.$content.addClass('pasting');}
 478+setTimeout(function(){context.$content.find('script,style,img,input,select,textarea,hr,button,link,meta').remove();context.$content.find('*').each(function(){if($(this).children().length==0&&this.childNodes.length>0){$(this).text($(this).text());}});context.$content.find('p:not(.wikiEditor) p:not(.wikiEditor)').each(function(){var outerParent=$(this).parent();outerParent.replaceWith(outerParent.childNodes);});if(!$.browser.msie){context.$content.find('span.Apple-style-span').each(function(){$(this).replaceWith(this.childNodes);});}
 479+var $selection=context.$content.find(':not(.wikiEditor)');var $previousElement;while($selection.length&&$selection.length>0){var $currentElement=$selection.eq(0);while(!$currentElement.parent().is('body')&&!$currentElement.parent().is('.wikiEditor')){$currentElement=$currentElement.parent();}
 480+while($currentElement[0]!=null&&$currentElement[0].previousSibling!=null&&!$($currentElement[0].previousSibling).hasClass('wikiEditor')){$currentElement=$($currentElement[0].previousSibling);}
 481+var $newElement;var textNode=false;if($currentElement[0].nodeName=='#text'){$newElement=$('<p></p>');textNode=true;}else if($currentElement.is('p')||$currentElement.is('pre')||$currentElement.is('br')){$newElement=$('<p></p>');}else{$newElement=$('<span></span>');}
 482+var newElementHTML='';var currentHTML='';if($currentElement[0].nodeName=='#text'){currentHTML=$currentElement[0].nodeValue;}else{currentHTML=$currentElement.html();currentHTML=currentHTML.replace(/(<[\s]*p[^>]*>)|(<[\s]*\/p[^>]*>)|(<[\s]*p[^\/>]*\/>)/gi,'\n');currentHTML=currentHTML.replace(/(<[^>]*>)|(<[^\>]*\>)/gi,'');}
 483+var pieces=currentHTML.split('\n');for(var i=0;i<pieces.length;i++){if(pieces[i]){if(textNode||!$newElement.is('p')){newElementHTML+='<p class="wikiEditor">'+pieces[i]+'</p>';}else{newElementHTML+=pieces[i];}}else if(textNode||!$newElement.is('p')){newElementHTML+='<br class="wikiEditor" >';}
 484+if(!textNode){newElementHTML+='<br class="wikiEditor" >';}}
 485+$newElement.html(newElementHTML).addClass('wikiEditor');if($newElement.is('p')&&$currentElement[0].nextSibling!=null&&$($currentElement[0].nextSibling).is('br')){$($currentElement[0].nextSibling).remove();}
 486+$newElement.insertAfter($currentElement);$currentElement.remove();$selection=context.$content.find(':not(.wikiEditor)');}
472487 context.$content.find('.wikiEditor').removeClass('wikiEditor');if($.layout.name!=='webkit'){context.$content.removeClass('pasting');}
473 -context.fn.purgeOffsets();var newLength=context.fn.getContents().length;var restoreTo=cursorPos[0]+newLength-oldLength;context.fn.setSelection({start:restoreTo,end:restoreTo});},0);return true;},'ready':function(event){context.history.push({'html':context.$content.html(),'sel':context.fn.getCaretPosition()});return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};}
 488+context.fn.purgeOffsets();var newLength=context.fn.getContents().length;var restoreTo=cursorPos[0]+newLength-oldLength;if(restoreTo>newLength){restoreTo=newLength;}
 489+context.fn.setSelection({start:restoreTo,end:restoreTo});},0);return true;},'ready':function(event){context.history.push({'html':context.$content.html(),'sel':context.fn.getCaretPosition()});return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};}
474490 if(typeof event.data=='undefined'){event.data={};}
475491 if(name in context.evt){if(!context.evt[name](event)){return false;}}
476492 var returnFromModules=null;for(var module in context.modules){if(module in $.wikiEditor.modules&&'evt'in $.wikiEditor.modules[module]&&name in $.wikiEditor.modules[module].evt){var ret=$.wikiEditor.modules[module].evt[name](context,event);if(ret!=null){if(returnFromModules==null){returnFromModules=ret;}else{returnFromModules=returnFromModules&&ret;}}}}
@@ -559,8 +575,8 @@
560576 if(periRange.text==periText){rawPeriText+="\r\n";}else{periFinished=true;}}}
561577 if(!postFinished){if(postRange.compareEndPoints("StartToEnd",postRange)==0){postFinished=true;}else{postRange.moveEnd("character",-1)
562578 if(postRange.text==postText){rawPostText+="\r\n";}else{postFinished=true;}}}}while((!postFinished||!periFinished||!postFinished));startPos=rawPreText.replace(/\r\n/g,"\n").length;endPos=startPos+rawPeriText.replace(/\r\n/g,"\n").length;}catch(e){startPos=endPos=0;}}
563 -return[startPos,endPos];},'setSelection':function(options){var sc=options.startContainer,ec=options.endContainer;sc=sc&&sc.jquery?sc[0]:sc;ec=ec&&ec.jquery?ec[0]:ec;if(context.$iframe[0].contentWindow.getSelection){var start=options.start,end=options.end;if(!sc||!ec){var s=context.fn.getOffset(start);var e=context.fn.getOffset(end);sc=s?s.node:null;ec=e?e.node:null;start=s?s.offset:null;end=e?e.offset:null;if(sc.nodeName=='#text'&&start>sc.nodeValue.length){start=sc.nodeValue.length-1;}
564 -if(ec.nodeName=='#text'&&end>ec.nodeValue.length){end=ec.nodeValue.length-1;}}
 579+return[startPos,endPos];},'setSelection':function(options){var sc=options.startContainer,ec=options.endContainer;sc=sc&&sc.jquery?sc[0]:sc;ec=ec&&ec.jquery?ec[0]:ec;if(context.$iframe[0].contentWindow.getSelection){var start=options.start,end=options.end;if(!sc||!ec){var s=context.fn.getOffset(start);var e=context.fn.getOffset(end);sc=s?s.node:null;ec=e?e.node:null;start=s?s.offset:null;end=e?e.offset:null;if(sc!=null&&sc.nodeName=='#text'&&start>sc.nodeValue.length){start=sc.nodeValue.length-1;}
 580+if(ec!=null&&ec.nodeName=='#text'&&end>ec.nodeValue.length){end=ec.nodeValue.length-1;}}
565581 if(!sc||!ec){return context.$textarea;}
566582 var sel=context.$iframe[0].contentWindow.getSelection();while(sc.firstChild&&sc.nodeName!='#text'){sc=sc.firstChild;}
567583 while(ec.firstChild&&ec.nodeName!='#text'){ec=ec.firstChild;}
@@ -587,7 +603,7 @@
588604 configuration.newButtons[mw.usability.getMsg(msg)]=configuration.buttons[msg];configuration.buttons=configuration.newButtons;var dialogDiv=$('<div />').attr('id',module.id).html(module.html).data('context',context).appendTo($('body')).each(module.init).dialog(configuration);$.wikiEditor.modules.dialogs.fn.setTabindexes(dialogDiv.closest('.ui-dialog').find('button').not('[tabindex]'));if(!('resizeme'in module)||module.resizeme){dialogDiv.bind('dialogopen',$.wikiEditor.modules.dialogs.fn.resize).find('.ui-tabs').bind('tabsshow',function(){$(this).closest('.ui-dialog-content').each($.wikiEditor.modules.dialogs.fn.resize);});}
589605 dialogDiv.bind('dialogclose',function(){context.fn.restoreSelection();});context.$textarea.trigger('wikiEditor-dialogs-loaded-'+mod);});},resize:function(){var wrapper=$(this).closest('.ui-dialog');var oldWidth=wrapper.width();var oldHidden=$(this).find('*').not(':visible');oldHidden.each(function(){$(this).data('oldstyle',$(this).attr('style'));});oldHidden.show();var oldWS=$(this).css('white-space');$(this).css('white-space','nowrap');if(wrapper.width()<=$(this).get(0).scrollWidth){var thisWidth=$(this).data('thisWidth')?$(this).data('thisWidth'):0;thisWidth=Math.max($(this).get(0).scrollWidth,thisWidth);$(this).width(thisWidth);$(this).data('thisWidth',thisWidth);var wrapperWidth=$(this).data('wrapperWidth')?$(this).data('wrapperWidth'):0;wrapperWidth=Math.max(wrapper.get(0).scrollWidth,wrapperWidth);wrapper.width(wrapperWidth);$(this).data('wrapperWidth',wrapperWidth);$(this).dialog({'width':wrapper.width()});wrapper.css('left',parseInt(wrapper.css('left'))-(wrapper.width()-oldWidth)/2);}
590606 $(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});},setTabindexes:function($elements){var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI)
591 -maxTI=ti;});var tabIndex=maxTI+1;$elements.each(function(){$j(this).attr('tabindex',tabIndex++);});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={'req':['iframe'],'name':'highlight','cfg':{'styleVersion':3},'evt':{'delayedChange':function(context,event){if(event.data.scope=='realchange'){$.wikiEditor.modules.highlight.fn.scan(context);$.wikiEditor.modules.highlight.fn.mark(context,event.data.scope);}},'ready':function(context,event){$.wikiEditor.modules.highlight.fn.scan(context);$.wikiEditor.modules.highlight.fn.mark(context,'ready');}},'fn':{'create':function(context,config){context.modules.highlight.markersStr='';},'scan':function(context,division){var tokenArray=context.modules.highlight.tokenArray=[];var text=context.fn.getContents();for(var module in context.modules){if(module in $.wikiEditor.modules&&'exp'in $.wikiEditor.modules[module]){for(var exp in $.wikiEditor.modules[module].exp){var regex=$.wikiEditor.modules[module].exp[exp].regex;var label=$.wikiEditor.modules[module].exp[exp].label;var markAfter=$.wikiEditor.modules[module].exp[exp].markAfter||false;var offset=0,left,right,match;while((match=text.substr(offset).match(regex))!=null){right=(left=offset+match.index)+match[0].length;tokenArray[tokenArray.length]={'offset':markAfter?right:left,'label':label,'tokenStart':left,'match':match};offset=right;}}}}
 607+maxTI=ti;});var tabIndex=maxTI+1;$elements.each(function(){$j(this).attr('tabindex',tabIndex++);});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={'req':['iframe'],'cfg':{'styleVersion':3},'evt':{'delayedChange':function(context,event){if(event.data.scope=='realchange'){$.wikiEditor.modules.highlight.fn.scan(context);$.wikiEditor.modules.highlight.fn.mark(context,event.data.scope);}},'ready':function(context,event){$.wikiEditor.modules.highlight.fn.scan(context);$.wikiEditor.modules.highlight.fn.mark(context,'ready');}},'fn':{'create':function(context,config){context.modules.highlight.markersStr='';},'scan':function(context,division){var tokenArray=context.modules.highlight.tokenArray=[];var text=context.fn.getContents();for(var module in context.modules){if(module in $.wikiEditor.modules&&'exp'in $.wikiEditor.modules[module]){for(var exp in $.wikiEditor.modules[module].exp){var regex=$.wikiEditor.modules[module].exp[exp].regex;var label=$.wikiEditor.modules[module].exp[exp].label;var markAfter=$.wikiEditor.modules[module].exp[exp].markAfter||false;var offset=0,left,right,match;while((match=text.substr(offset).match(regex))!=null){right=(left=offset+match.index)+match[0].length;tokenArray[tokenArray.length]={'offset':markAfter?right:left,'label':label,'tokenStart':left,'match':match};offset=right;}}}}
592608 tokenArray.sort(function(a,b){return a.tokenStart-b.tokenStart;});context.fn.trigger('scan');},'mark':function(context,division,tokens){var markers=[];if(context.modules.highlight.markers&&division!=''){for(var i=0;i<context.modules.highlight.markers.length;i++){if(context.modules.highlight.markers[i].skipDivision==division){markers.push(context.modules.highlight.markers[i]);}}}
593609 context.modules.highlight.markers=markers;context.fn.trigger('mark');markers.sort(function(a,b){return a.start-b.start||a.end-b.end;});var markersStr='';for(var i=0;i<markers.length;i++){markersStr+=markers[i].start+','+markers[i].end+','+markers[i].type+',';}
594610 if(context.modules.highlight.markersStr==markersStr){return;}
@@ -698,7 +714,7 @@
699715 nameEndIndex=nameEnd.index+oldDivider+2;ranges.push(new Range(ranges[ranges.length-1].end,nameBeginIndex));nameIndex=ranges.push(new Range(nameBeginIndex,nameEndIndex))-1;currentValue=currentField.substring(currentField.indexOf('=')+1);oldDivider+=currentField.indexOf('=')+1;valueBeginIndex=oldDivider+1;valueEndIndex=oldDivider+1;valueBegin=currentValue.match(/\S+/);if(valueBegin!=null){valueBeginIndex=valueBegin.index+oldDivider+1;valueEnd=currentValue.match(/[^\s]\s*$/);if(valueEnd==null){continue;}
700716 valueEndIndex=valueEnd.index+oldDivider+2;}
701717 equalsIndex=ranges.push(new Range(ranges[ranges.length-1].end,valueBeginIndex))-1;valueIndex=ranges.push(new Range(valueBeginIndex,valueEndIndex))-1;params.push(new Param(wikitext.substring(nameBeginIndex,nameEndIndex),wikitext.substring(valueBeginIndex,valueEndIndex),currentParamNumber,nameIndex,equalsIndex,valueIndex));paramsByName[wikitext.substring(nameBeginIndex,nameEndIndex)]=currentParamNumber;}}
702 -ranges.push(new Range(valueEndIndex,wikitext.length));this.ranges=ranges;this.wikitext=wikitext;this.params=params;this.paramsByName=paramsByName;this.templateNameIndex=templateNameIndex;}}};})(jQuery);(function($){$.wikiEditor.modules.toc={'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]],'chrome':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]],'chrome':[['>=',4]]}},'req':['iframe'],'name':'toc',cfg:{defaultWidth:'166px',minimumWidth:'70px',textMinimumWidth:'450px',flexProperty:'marginRight',rtl:false},api:{},evt:{change:function(context,event){$.wikiEditor.modules.toc.fn.update(context);},ready:function(context,event){$.wikiEditor.modules.toc.fn.build(context);context.$content.parent().blur(function(){var context=event.data.context;$.wikiEditor.modules.toc.fn.unhighlight(context);});$.wikiEditor.modules.toc.evt.resize(context);},resize:function(context,event){var availableWidth=context.$wikitext.width()-parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth),totalMinWidth=parseFloat($.wikiEditor.modules.toc.cfg.minimumWidth)+
 718+ranges.push(new Range(valueEndIndex,wikitext.length));this.ranges=ranges;this.wikitext=wikitext;this.params=params;this.paramsByName=paramsByName;this.templateNameIndex=templateNameIndex;}}};})(jQuery);(function($){$.wikiEditor.modules.toc={'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]],'chrome':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]],'chrome':[['>=',4]]}},'req':['iframe'],cfg:{defaultWidth:'166px',minimumWidth:'70px',textMinimumWidth:'450px',flexProperty:'marginRight',rtl:false},api:{},evt:{change:function(context,event){$.wikiEditor.modules.toc.fn.update(context);},ready:function(context,event){$.wikiEditor.modules.toc.fn.build(context);context.$content.parent().blur(function(){var context=event.data.context;$.wikiEditor.modules.toc.fn.unhighlight(context);});$.wikiEditor.modules.toc.evt.resize(context);},resize:function(context,event){var availableWidth=context.$wikitext.width()-parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth),totalMinWidth=parseFloat($.wikiEditor.modules.toc.cfg.minimumWidth)+
703719 parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth);context.$ui.find('.wikiEditor-ui-right').resizable('option','maxWidth',availableWidth);if(context.modules.toc.$toc.data('positionMode')!='disabled'&&context.$wikitext.width()<totalMinWidth){$.wikiEditor.modules.toc.fn.disable(context);}else if(context.modules.toc.$toc.data('positionMode')=='disabled'&&context.$wikitext.width()>totalMinWidth){$.wikiEditor.modules.toc.fn.enable(context);}else if(context.modules.toc.$toc.data('positionMode')=='regular'&&context.$ui.find('.wikiEditor-ui-right').width()>availableWidth){$.wikiEditor.modules.toc.fn.switchLayout(context);}else if(context.modules.toc.$toc.data('positionMode')=='goofy'&&context.modules.toc.$toc.data('previousWidth')<context.$wikitext.width()){$.wikiEditor.modules.toc.fn.switchLayout(context);}
704720 if(context.modules.toc.$toc.data('positionMode')=='goofy'){context.modules.toc.$toc.find('div').autoEllipsis({'position':'right','tooltip':true,'restoreText':true});}
705721 if(!context.modules.toc.$toc.data('collapsed')){context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height()-
Property changes on: branches/wmf/1.16wmf4/extensions/UsabilityInitiative/PrefSwitch
___________________________________________________________________
Name: svn:mergeinfo
706722 - /branches/REL1_15/phase3/extensions/UsabilityInitiative/PrefSwitch:51646
/branches/wmf-deployment/extensions/UsabilityInitiative/PrefSwitch:60970
/trunk/extensions/UsabilityInitiative/PrefSwitch:56207,56209,56296,56333,56355,62041,62043,62127,62139,62142-62143,62145-62146,62256,62263,62266-63865,63867-63877,63879-64124,64129-64645,64647-64648,64650-66321,66331-66335,66402
/trunk/phase3/extensions/UsabilityInitiative/PrefSwitch:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816
707723 + /branches/REL1_15/phase3/extensions/UsabilityInitiative/PrefSwitch:51646
/branches/wmf-deployment/extensions/UsabilityInitiative/PrefSwitch:60970
/trunk/extensions/UsabilityInitiative/PrefSwitch:56207,56209,56296,56333,56355,62041,62043,62127,62139,62142-62143,62145-62146,62256,62263,62266-63865,63867-63877,63879-64124,64129-64645,64647-64648,64650-66321,66331-66335,66402,66565,66623,66631,66642-66644,66655
/trunk/phase3/extensions/UsabilityInitiative/PrefSwitch:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816
Property changes on: branches/wmf/1.16wmf4/extensions/UsabilityInitiative
___________________________________________________________________
Name: svn:mergeinfo
708724 - /branches/REL1_15/phase3/extensions/UsabilityInitiative:51646
/branches/wmf-deployment/extensions/UsabilityInitiative:60970
/trunk/extensions/UsabilityInitiative:56207,56209,56296,56333,56355,62041,62043,62127,62139,62142-62143,62145-62146,62256,62263,62266-63865,63867-63877,63879-64124,64129-64645,64647-64648,64650-66321,66324,66331-66335,66402
/trunk/phase3/extensions/UsabilityInitiative:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816,65387,65391,65555,65590
709725 + /branches/REL1_15/phase3/extensions/UsabilityInitiative:51646
/branches/wmf-deployment/extensions/UsabilityInitiative:60970
/trunk/extensions/UsabilityInitiative:56207,56209,56296,56333,56355,62041,62043,62127,62139,62142-62143,62145-62146,62256,62263,62266-63865,63867-63877,63879-64124,64129-64645,64647-64648,64650-66321,66324,66331-66335,66402,66565,66623,66631,66642-66644,66655
/trunk/phase3/extensions/UsabilityInitiative:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816,65387,65391,65555,65590

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r66565Fix for bug 23498 and an unreported bug where context was not being setup cor...adam15:14, 17 May 2010
r66631CSS change to compliment r66623adam22:07, 18 May 2010
r66642Improvements to SimpleSearch. Adding an option to switch between right/left o...adam17:48, 19 May 2010
r66643Followup to r66642. Removing console code and a spelling mistakeadam17:51, 19 May 2010
r66644UsabilityInitiative: Remove maxExpandFactor in suggestions plugin, width of s...catrope18:42, 19 May 2010
r66655Suggestions plugin: Go back to using maxExpandFactor, but set it to 3catrope20:46, 19 May 2010

Status & tagging log