r59905 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59904‎ | r59905 | r59906 >
Date:21:35, 9 December 2009
Author:tparscal
Status:ok
Tags:
Comment:
Cleaned up the use of context.modules and fixed a bug that cause events to be passed to modules which were not activated on that context.
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.wikiEditor.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.preview.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -72,7 +72,7 @@
7373 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 21 ),
7474 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 31 ),
7575 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 1 ),
76 - array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 35 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 36 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 9 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 48 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 7 ),
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.preview.js
@@ -17,14 +17,15 @@
1818 * @param config Configuration object to create module from
1919 */
2020 create: function( context, config ) {
21 - if ( 'preview' in context.modules ) {
 21+ if ( 'initialized' in context.modules.preview ) {
2222 return;
2323 }
2424 context.modules.preview = {
 25+ 'initialized': true,
2526 'previewText': null,
2627 'changesText': null
2728 };
28 - context.$preview = context.fn.addView( {
 29+ context.modules.preview.$preview = context.fn.addView( {
2930 'name': 'preview',
3031 'titleMsg': 'wikieditor-preview-tab',
3132 'init': function( context ) {
@@ -34,8 +35,8 @@
3536 if ( context.modules.preview.previewText == wikitext ) {
3637 return;
3738 }
38 - context.$preview.find( '.wikiEditor-preview-contents' ).empty();
39 - context.$preview.find( '.wikiEditor-preview-loading' ).show();
 39+ context.modules.preview.$preview.find( '.wikiEditor-preview-contents' ).empty();
 40+ context.modules.preview.$preview.find( '.wikiEditor-preview-loading' ).show();
4041 $.post(
4142 wgScriptPath + '/api.php',
4243 {
@@ -55,8 +56,8 @@
5657 return;
5758 }
5859 context.modules.preview.previewText = wikitext;
59 - context.$preview.find( '.wikiEditor-preview-loading' ).hide();
60 - context.$preview.find( '.wikiEditor-preview-contents' )
 60+ context.modules.preview.$preview.find( '.wikiEditor-preview-loading' ).hide();
 61+ context.modules.preview.$preview.find( '.wikiEditor-preview-contents' )
6162 .html( data.parse.text['*'] )
6263 .find( 'a:not([href^=#])' ).click( function() { return false; } );
6364 },
@@ -113,9 +114,9 @@
114115 );
115116 }
116117 } );
117 -
 118+
118119 var loadingMsg = gM( 'wikieditor-preview-loading' );
119 - context.$preview
 120+ context.modules.preview.$preview
120121 .add( context.$changesTab )
121122 .append( $( '<div />' )
122123 .addClass( 'wikiEditor-preview-loading' )
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js
@@ -21,11 +21,6 @@
2222 */
2323 evt: {
2424 ready: function( context, event ) {
25 - // Only run this code if this module is turned on
26 - if ( !( '$toc' in context.modules ) ) {
27 - return;
28 - }
29 -
3025 // Add the TOC to the document
3126 $.wikiEditor.modules.toc.fn.build( context );
3227 context.$content.parent()
@@ -58,18 +53,18 @@
5954 * @param {Object} config Configuration object to create module from
6055 */
6156 create: function( context, config ) {
62 - if ( '$toc' in context.modules ) {
 57+ if ( '$toc' in context.modules.toc ) {
6358 return;
6459 }
6560
6661 var height = context.$ui.find( '.wikiEditor-ui-left' ).height();
67 - context.modules.$toc = $( '<div />' )
 62+ context.modules.toc.$toc = $( '<div />' )
6863 .addClass( 'wikiEditor-ui-toc' )
6964 .data( 'context', context );
7065 context.$ui.find( '.wikiEditor-ui-right' )
7166 .css( 'width', $.wikiEditor.modules.toc.defaultWidth )
72 - .append( context.modules.$toc );
73 - context.modules.$toc.height(
 67+ .append( context.modules.toc.$toc );
 68+ context.modules.toc.$toc.height(
7469 context.$ui.find( '.wikiEditor-ui-left' ).height()
7570 );
7671 context.$ui.find( '.wikiEditor-ui-left' )
@@ -79,7 +74,7 @@
8075 },
8176
8277 unhighlight: function( context ) {
83 - context.modules.$toc.find( 'div' ).removeClass( 'current' );
 78+ context.modules.toc.$toc.find( 'div' ).removeClass( 'current' );
8479 },
8580 /**
8681 * Highlight the section the cursor is currently within
@@ -103,20 +98,20 @@
10499 }
105100 section = Math.max( 0, section );
106101 }
107 - var sectionLink = context.modules.$toc.find( 'div.section-' + section );
 102+ var sectionLink = context.modules.toc.$toc.find( 'div.section-' + section );
108103 sectionLink.addClass( 'current' );
109104
110105 // Scroll the highlighted link into view if necessary
111 - var relTop = sectionLink.offset().top - context.modules.$toc.offset().top;
112 - var scrollTop = context.modules.$toc.scrollTop();
113 - var divHeight = context.modules.$toc.height();
 106+ var relTop = sectionLink.offset().top - context.modules.toc.$toc.offset().top;
 107+ var scrollTop = context.modules.toc.$toc.scrollTop();
 108+ var divHeight = context.modules.toc.$toc.height();
114109 var sectionHeight = sectionLink.height();
115110 if ( relTop < 0 )
116111 // Scroll up
117 - context.modules.$toc.scrollTop( scrollTop + relTop );
 112+ context.modules.toc.$toc.scrollTop( scrollTop + relTop );
118113 else if ( relTop + sectionHeight > divHeight )
119114 // Scroll down
120 - context.modules.$toc.scrollTop( scrollTop + relTop + sectionHeight - divHeight );
 115+ context.modules.toc.$toc.scrollTop( scrollTop + relTop + sectionHeight - divHeight );
121116 }
122117 },
123118
@@ -155,7 +150,7 @@
156151 expand: function( event ) {
157152 var $this = $( this ),
158153 context = $this.data( 'context' ),
159 - openWidth = context.modules.$toc.data( 'openWidth' );
 154+ openWidth = context.modules.toc.$toc.data( 'openWidth' );
160155 context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).hide();
161156 $this.parent()
162157 .show()
@@ -171,7 +166,7 @@
172167 .children()
173168 .animate( { 'marginRight': openWidth }, 'fast' );
174169 $.cookie( 'wikiEditor-' + context.instance + '-toc-width',
175 - context.modules.$toc.data( 'openWidth' ) );
 170+ context.modules.toc.$toc.data( 'openWidth' ) );
176171 return false;
177172 },
178173 /**
@@ -245,7 +240,7 @@
246241 .addClass( 'tab-toc' )
247242 .append( '<a href="#" />' )
248243 .bind( 'click.wikiEditor-toc', function() {
249 - context.modules.$toc.trigger( 'collapse.wikiEditor-toc' ); return false;
 244+ context.modules.toc.$toc.trigger( 'collapse.wikiEditor-toc' ); return false;
250245 } )
251246 .find( 'a' )
252247 .text( gM( 'wikieditor-toc-hide' ) );
@@ -253,12 +248,12 @@
254249 .addClass( 'wikiEditor-ui-toc-expandControl' )
255250 .append( '<a href="#" />' )
256251 .bind( 'click.wikiEditor-toc', function() {
257 - context.modules.$toc.trigger( 'expand.wikiEditor-toc' ); return false;
 252+ context.modules.toc.$toc.trigger( 'expand.wikiEditor-toc' ); return false;
258253 } )
259254 .hide()
260255 .find( 'a' )
261256 .text( gM( 'wikieditor-toc-show' ) );
262 - $collapseControl.insertBefore( context.modules.$toc );
 257+ $collapseControl.insertBefore( context.modules.toc.$toc );
263258 context.$ui.find( '.wikiEditor-ui-left .wikiEditor-ui-top' ).append( $expandControl );
264259 }
265260 /**
@@ -294,9 +289,9 @@
295290 context.$ui.find( '.wikiEditor-ui-resize-mask' ).remove();
296291 context.$content.trigger( 'mouseup' );
297292 if( ui.size.width < parseFloat( $.wikiEditor.modules.toc.minimumWidth ) ) {
298 - context.modules.$toc.trigger( 'collapse' );
 293+ context.modules.toc.$toc.trigger( 'collapse' );
299294 } else {
300 - context.modules.$toc.data( 'openWidth', ui.size.width );
 295+ context.modules.toc.$toc.data( 'openWidth', ui.size.width );
301296 $.cookie( 'wikiEditor-' + context.instance + '-toc-width', ui.size.width );
302297 }
303298 // Let the UI know things have moved around
@@ -309,18 +304,18 @@
310305 .addClass( 'ui-resizable-w' )
311306 .addClass( 'wikiEditor-ui-toc-resize-grip' );
312307 // Bind collapse and expand event handlers to the TOC
313 - context.modules.$toc
 308+ context.modules.toc.$toc
314309 .bind( 'collapse.wikiEditor-toc', $.wikiEditor.modules.toc.fn.collapse )
315310 .bind( 'expand.wikiEditor-toc', $.wikiEditor.modules.toc.fn.expand );
316 - context.modules.$toc.data( 'openWidth', $.wikiEditor.modules.toc.defaultWidth );
 311+ context.modules.toc.$toc.data( 'openWidth', $.wikiEditor.modules.toc.defaultWidth );
317312 // If the toc-width cookie is set, reset the widths based upon that
318313 if ( $.cookie( 'wikiEditor-' + context.instance + '-toc-width' ) == 0 ) {
319 - context.modules.$toc.trigger( 'collapse.wikiEditor-toc', { data: context } );
 314+ context.modules.toc.$toc.trigger( 'collapse.wikiEditor-toc', { data: context } );
320315 } else if ( $.cookie( 'wikiEditor-' + context.instance + '-toc-width' ) > 0 ) {
321316 var initialWidth = $.cookie( 'wikiEditor-' + context.instance + '-toc-width' );
322317 if( initialWidth < parseFloat( $.wikiEditor.modules.toc.minimumWidth ) )
323318 initialWidth = parseFloat( $.wikiEditor.modules.toc.minimumWidth ) + 1;
324 - context.modules.$toc.data( 'openWidth', initialWidth + 'px' );
 319+ context.modules.toc.$toc.data( 'openWidth', initialWidth + 'px' );
325320 context.$ui.find( '.wikiEditor-ui-right' )
326321 .css( 'width', initialWidth + 'px' );
327322 context.$ui.find( '.wikiEditor-ui-left' )
@@ -431,13 +426,13 @@
432427 structure.unshift( { 'text': wgPageName.replace(/_/g, ' '), 'level': 1, 'index': 0,
433428 'wrapper': context.$content } );
434429 }
435 - context.modules.$toc.html( buildList( structure ) );
 430+ context.modules.toc.$toc.html( buildList( structure ) );
436431
437432 if ( wgNavigableTOCResizable && !context.$ui.data( 'resizableDone' ) ) {
438433 buildResizeControls();
439434 buildCollapseControls();
440435 }
441 - context.modules.$toc.find( 'div' ).autoEllipse( { 'position': 'right', 'tooltip': true } );
 436+ context.modules.toc.$toc.find( 'div' ).autoEllipse( { 'position': 'right', 'tooltip': true } );
442437 // Cache the outline for later use
443438 context.data.outline = outline;
444439 }
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -187,6 +187,9 @@
188188 'fn' in $.wikiEditor.modules[module] &&
189189 call in $.wikiEditor.modules[module].fn
190190 ) {
 191+ // Add a place for the module to put it's own stuff
 192+ context.modules[module] = {};
 193+ // Tell the module to create itself
191194 $.wikiEditor.modules[module].fn[call]( context, data );
192195 }
193196 }
@@ -265,8 +268,13 @@
266269 return false;
267270 }
268271 }
269 - for ( module in $.wikiEditor.modules ) {
270 - if ( 'evt' in $.wikiEditor.modules[module] && name in $.wikiEditor.modules[module].evt ) {
 272+ for ( module in context.modules ) {
 273+ // Pass the event around to all modules activated on this context
 274+ if (
 275+ module in $.wikiEditor.modules &&
 276+ 'evt' in $.wikiEditor.modules[module] &&
 277+ name in $.wikiEditor.modules[module].evt
 278+ ) {
271279 $.wikiEditor.modules[module].evt[name]( context, event );
272280 }
273281 }
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js
@@ -11,14 +11,14 @@
1212 for ( type in data ) {
1313 switch ( type ) {
1414 case 'sections':
15 - var $sections = context.modules.$toolbar
 15+ var $sections = context.modules.toolbar.$toolbar
1616 .find( 'div.sections' );
17 - var $tabs = context.modules.$toolbar
 17+ var $tabs = context.modules.toolbar.$toolbar
1818 .find( 'div.tabs' );
1919 for ( section in data[type] ) {
2020 if ( section == 'main' ) {
2121 // Section
22 - context.modules.$toolbar
 22+ context.modules.toolbar.$toolbar
2323 .prepend(
2424 $.wikiEditor.modules.toolbar.fn.buildSection(
2525 context, section, data[type][section]
@@ -45,7 +45,7 @@
4646 if ( ! ( 'section' in data ) ) {
4747 continue;
4848 }
49 - var $section = context.modules.$toolbar
 49+ var $section = context.modules.toolbar.$toolbar
5050 .find( 'div[rel=' + data.section + '].section' );
5151 for ( group in data[type] ) {
5252 // Group
@@ -57,7 +57,7 @@
5858 if ( ! ( 'section' in data && 'group' in data ) ) {
5959 continue;
6060 }
61 - var $group = context.modules.$toolbar
 61+ var $group = context.modules.toolbar.$toolbar
6262 .find( 'div[rel=' + data.section + '].section ' + 'div[rel=' + data.group + '].group' );
6363 for ( tool in data[type] ) {
6464 // Tool
@@ -68,9 +68,9 @@
6969 if ( ! ( 'section' in data ) ) {
7070 continue;
7171 }
72 - var $pages = context.modules.$toolbar
 72+ var $pages = context.modules.toolbar.$toolbar
7373 .find( 'div[rel=' + data.section + '].section .pages' );
74 - var $index = context.modules.$toolbar
 74+ var $index = context.modules.toolbar.$toolbar
7575 .find( 'div[rel=' + data.section + '].section .index' );
7676 for ( page in data[type] ) {
7777 // Page
@@ -86,7 +86,7 @@
8787 if ( ! ( 'section' in data && 'page' in data ) ) {
8888 continue;
8989 }
90 - var $table = context.modules.$toolbar.find(
 90+ var $table = context.modules.toolbar.$toolbar.find(
9191 'div[rel=' + data.section + '].section ' + 'div[rel=' + data.page + '].page table'
9292 );
9393 for ( row in data[type] ) {
@@ -98,7 +98,7 @@
9999 if ( ! ( 'section' in data && 'page' in data ) ) {
100100 continue;
101101 }
102 - $characters = context.modules.$toolbar.find(
 102+ $characters = context.modules.toolbar.$toolbar.find(
103103 'div[rel=' + data.section + '].section ' + 'div[rel=' + data.page + '].page div'
104104 );
105105 var actions = $characters.data( 'actions' );
@@ -144,20 +144,20 @@
145145 target += ' table tr:not(:has(th)):eq(' + data.row + ')';
146146 } else {
147147 // Just a page, remove the index too!
148 - context.modules.$toolbar.find( index ).remove();
 148+ context.modules.toolbar.$toolbar.find( index ).remove();
149149 $.wikiEditor.modules.toolbar.fn.updateBookletSelection(
150150 context,
151151 null,
152 - context.modules.$toolbar.find( target ),
153 - context.modules.$toolbar.find( index )
 152+ context.modules.toolbar.$toolbar.find( target ),
 153+ context.modules.toolbar.$toolbar.find( index )
154154 );
155155 }
156156 } else {
157157 // Just a section, remove the tab too!
158 - context.modules.$toolbar.find( tab ).remove();
 158+ context.modules.toolbar.$toolbar.find( tab ).remove();
159159 }
160160 js_log('target is: ' + target);
161 - context.modules.$toolbar.find( target ).remove();
 161+ context.modules.toolbar.$toolbar.find( target ).remove();
162162 }
163163 }
164164 },
@@ -180,14 +180,14 @@
181181 * @param {Object} config Configuration object to create module from
182182 */
183183 create : function( context, config ) {
184 - if ( '$toolbar' in context.modules ) {
 184+ if ( '$toolbar' in context.modules.toolbar ) {
185185 return;
186186 }
187 - context.modules.$toolbar = $( '<div />' )
 187+ context.modules.toolbar.$toolbar = $( '<div />' )
188188 .addClass( 'wikiEditor-ui-toolbar' )
189189 .attr( 'id', 'wikiEditor-ui-toolbar' );
190190 $.wikiEditor.modules.toolbar.fn.build( context, config );
191 - context.$ui.find( '.wikiEditor-ui-top' ).append( context.modules.$toolbar );
 191+ context.$ui.find( '.wikiEditor-ui-top' ).append( context.modules.toolbar.$toolbar );
192192 },
193193 /**
194194 * Performs an operation based on parameters
@@ -484,8 +484,8 @@
485485 if ( show ) {
486486 $section.fadeIn( 'fast' );
487487 dH = $section.outerHeight() - dH;
488 - if ( context.modules.$toc ) {
489 - context.modules.$toc.animate({'height': "+="+dH}, $section.outerHeight() * 2);
 488+ if ( 'toc' in context.modules ) {
 489+ context.modules.toc.$toc.animate({'height': "+="+dH}, $section.outerHeight() * 2);
490490 }
491491 $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function() {
492492 $(this).css('overflow', 'visible').css('height', 'auto');
@@ -496,8 +496,8 @@
497497 .animate( { 'height': 0 }, $section.outerHeight() * 2, function() {
498498 $(this).css('overflow', 'visible');
499499 } );
500 - if ( context.modules.$toc ) {
501 - context.modules.$toc.animate({'height': "-="+$section.outerHeight()}, $section.outerHeight() * 2);
 500+ if ( 'toc' in context.modules ) {
 501+ context.modules.toc.$toc.animate({'height': "-="+$section.outerHeight()}, $section.outerHeight() * 2);
502502 }
503503 }
504504 // Click tracking
@@ -567,13 +567,13 @@
568568 $selectedIndex.addClass( 'current' );
569569 },
570570 build : function( context, config ) {
571 - var $tabs = $( '<div />' ).addClass( 'tabs' ).appendTo( context.modules.$toolbar );
572 - var $sections = $( '<div />' ).addClass( 'sections' ).appendTo( context.modules.$toolbar );
573 - context.modules.$toolbar.append( $( '<div />' ).css( 'clear', 'both' ) );
 571+ var $tabs = $( '<div />' ).addClass( 'tabs' ).appendTo( context.modules.toolbar.$toolbar );
 572+ var $sections = $( '<div />' ).addClass( 'sections' ).appendTo( context.modules.toolbar.$toolbar );
 573+ context.modules.toolbar.$toolbar.append( $( '<div />' ).css( 'clear', 'both' ) );
574574 var sectionQueue = [];
575575 for ( section in config ) {
576576 if ( section == 'main' ) {
577 - context.modules.$toolbar.prepend(
 577+ context.modules.toolbar.$toolbar.prepend(
578578 $.wikiEditor.modules.toolbar.fn.buildSection( context, section, config[section] )
579579 );
580580 } else {
@@ -599,8 +599,8 @@
600600 var $section = s.$sections.find( '.section:visible' );
601601 if ( $section.size() ) {
602602 $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function( ) {
603 - if ( context.modules.$toc ) {
604 - context.modules.$toc.height(
 603+ if ( 'toc' in context.modules ) {
 604+ context.modules.toc.$toc.height(
605605 context.$ui.find( '.wikiEditor-ui-left' )
606606 .outerHeight() - context.$ui.find( '.tab-toc' ).outerHeight()
607607 )
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -1497,6 +1497,9 @@
14981498 'fn' in $.wikiEditor.modules[module] &&
14991499 call in $.wikiEditor.modules[module].fn
15001500 ) {
 1501+ // Add a place for the module to put it's own stuff
 1502+ context.modules[module] = {};
 1503+ // Tell the module to create itself
15011504 $.wikiEditor.modules[module].fn[call]( context, data );
15021505 }
15031506 }
@@ -1575,8 +1578,13 @@
15761579 return false;
15771580 }
15781581 }
1579 - for ( module in $.wikiEditor.modules ) {
1580 - if ( 'evt' in $.wikiEditor.modules[module] && name in $.wikiEditor.modules[module].evt ) {
 1582+ for ( module in context.modules ) {
 1583+ // Pass the event around to all modules activated on this context
 1584+ if (
 1585+ module in $.wikiEditor.modules &&
 1586+ 'evt' in $.wikiEditor.modules[module] &&
 1587+ name in $.wikiEditor.modules[module].evt
 1588+ ) {
15811589 $.wikiEditor.modules[module].evt[name]( context, event );
15821590 }
15831591 }
@@ -2181,14 +2189,15 @@
21822190 * @param config Configuration object to create module from
21832191 */
21842192 create: function( context, config ) {
2185 - if ( 'preview' in context.modules ) {
 2193+ if ( 'initialized' in context.modules.preview ) {
21862194 return;
21872195 }
21882196 context.modules.preview = {
 2197+ 'initialized': true,
21892198 'previewText': null,
21902199 'changesText': null
21912200 };
2192 - context.$preview = context.fn.addView( {
 2201+ context.modules.preview.$preview = context.fn.addView( {
21932202 'name': 'preview',
21942203 'titleMsg': 'wikieditor-preview-tab',
21952204 'init': function( context ) {
@@ -2198,8 +2207,8 @@
21992208 if ( context.modules.preview.previewText == wikitext ) {
22002209 return;
22012210 }
2202 - context.$preview.find( '.wikiEditor-preview-contents' ).empty();
2203 - context.$preview.find( '.wikiEditor-preview-loading' ).show();
 2211+ context.modules.preview.$preview.find( '.wikiEditor-preview-contents' ).empty();
 2212+ context.modules.preview.$preview.find( '.wikiEditor-preview-loading' ).show();
22042213 $.post(
22052214 wgScriptPath + '/api.php',
22062215 {
@@ -2219,8 +2228,8 @@
22202229 return;
22212230 }
22222231 context.modules.preview.previewText = wikitext;
2223 - context.$preview.find( '.wikiEditor-preview-loading' ).hide();
2224 - context.$preview.find( '.wikiEditor-preview-contents' )
 2232+ context.modules.preview.$preview.find( '.wikiEditor-preview-loading' ).hide();
 2233+ context.modules.preview.$preview.find( '.wikiEditor-preview-contents' )
22252234 .html( data.parse.text['*'] )
22262235 .find( 'a:not([href^=#])' ).click( function() { return false; } );
22272236 },
@@ -2277,9 +2286,9 @@
22782287 );
22792288 }
22802289 } );
2281 -
 2290+
22822291 var loadingMsg = gM( 'wikieditor-preview-loading' );
2283 - context.$preview
 2292+ context.modules.preview.$preview
22842293 .add( context.$changesTab )
22852294 .append( $( '<div />' )
22862295 .addClass( 'wikiEditor-preview-loading' )
@@ -2441,11 +2450,6 @@
24422451 */
24432452 evt: {
24442453 ready: function( context, event ) {
2445 - // Only run this code if this module is turned on
2446 - if ( !( '$toc' in context.modules ) ) {
2447 - return;
2448 - }
2449 -
24502454 // Add the TOC to the document
24512455 $.wikiEditor.modules.toc.fn.build( context );
24522456 context.$content.parent()
@@ -2478,18 +2482,18 @@
24792483 * @param {Object} config Configuration object to create module from
24802484 */
24812485 create: function( context, config ) {
2482 - if ( '$toc' in context.modules ) {
 2486+ if ( '$toc' in context.modules.toc ) {
24832487 return;
24842488 }
24852489
24862490 var height = context.$ui.find( '.wikiEditor-ui-left' ).height();
2487 - context.modules.$toc = $( '<div />' )
 2491+ context.modules.toc.$toc = $( '<div />' )
24882492 .addClass( 'wikiEditor-ui-toc' )
24892493 .data( 'context', context );
24902494 context.$ui.find( '.wikiEditor-ui-right' )
24912495 .css( 'width', $.wikiEditor.modules.toc.defaultWidth )
2492 - .append( context.modules.$toc );
2493 - context.modules.$toc.height(
 2496+ .append( context.modules.toc.$toc );
 2497+ context.modules.toc.$toc.height(
24942498 context.$ui.find( '.wikiEditor-ui-left' ).height()
24952499 );
24962500 context.$ui.find( '.wikiEditor-ui-left' )
@@ -2499,7 +2503,7 @@
25002504 },
25012505
25022506 unhighlight: function( context ) {
2503 - context.modules.$toc.find( 'div' ).removeClass( 'current' );
 2507+ context.modules.toc.$toc.find( 'div' ).removeClass( 'current' );
25042508 },
25052509 /**
25062510 * Highlight the section the cursor is currently within
@@ -2523,20 +2527,20 @@
25242528 }
25252529 section = Math.max( 0, section );
25262530 }
2527 - var sectionLink = context.modules.$toc.find( 'div.section-' + section );
 2531+ var sectionLink = context.modules.toc.$toc.find( 'div.section-' + section );
25282532 sectionLink.addClass( 'current' );
25292533
25302534 // Scroll the highlighted link into view if necessary
2531 - var relTop = sectionLink.offset().top - context.modules.$toc.offset().top;
2532 - var scrollTop = context.modules.$toc.scrollTop();
2533 - var divHeight = context.modules.$toc.height();
 2535+ var relTop = sectionLink.offset().top - context.modules.toc.$toc.offset().top;
 2536+ var scrollTop = context.modules.toc.$toc.scrollTop();
 2537+ var divHeight = context.modules.toc.$toc.height();
25342538 var sectionHeight = sectionLink.height();
25352539 if ( relTop < 0 )
25362540 // Scroll up
2537 - context.modules.$toc.scrollTop( scrollTop + relTop );
 2541+ context.modules.toc.$toc.scrollTop( scrollTop + relTop );
25382542 else if ( relTop + sectionHeight > divHeight )
25392543 // Scroll down
2540 - context.modules.$toc.scrollTop( scrollTop + relTop + sectionHeight - divHeight );
 2544+ context.modules.toc.$toc.scrollTop( scrollTop + relTop + sectionHeight - divHeight );
25412545 }
25422546 },
25432547
@@ -2575,7 +2579,7 @@
25762580 expand: function( event ) {
25772581 var $this = $( this ),
25782582 context = $this.data( 'context' ),
2579 - openWidth = context.modules.$toc.data( 'openWidth' );
 2583+ openWidth = context.modules.toc.$toc.data( 'openWidth' );
25802584 context.$ui.find( '.wikiEditor-ui-toc-expandControl' ).hide();
25812585 $this.parent()
25822586 .show()
@@ -2591,7 +2595,7 @@
25922596 .children()
25932597 .animate( { 'marginRight': openWidth }, 'fast' );
25942598 $.cookie( 'wikiEditor-' + context.instance + '-toc-width',
2595 - context.modules.$toc.data( 'openWidth' ) );
 2599+ context.modules.toc.$toc.data( 'openWidth' ) );
25962600 return false;
25972601 },
25982602 /**
@@ -2665,7 +2669,7 @@
26662670 .addClass( 'tab-toc' )
26672671 .append( '<a href="#" />' )
26682672 .bind( 'click.wikiEditor-toc', function() {
2669 - context.modules.$toc.trigger( 'collapse.wikiEditor-toc' ); return false;
 2673+ context.modules.toc.$toc.trigger( 'collapse.wikiEditor-toc' ); return false;
26702674 } )
26712675 .find( 'a' )
26722676 .text( gM( 'wikieditor-toc-hide' ) );
@@ -2673,12 +2677,12 @@
26742678 .addClass( 'wikiEditor-ui-toc-expandControl' )
26752679 .append( '<a href="#" />' )
26762680 .bind( 'click.wikiEditor-toc', function() {
2677 - context.modules.$toc.trigger( 'expand.wikiEditor-toc' ); return false;
 2681+ context.modules.toc.$toc.trigger( 'expand.wikiEditor-toc' ); return false;
26782682 } )
26792683 .hide()
26802684 .find( 'a' )
26812685 .text( gM( 'wikieditor-toc-show' ) );
2682 - $collapseControl.insertBefore( context.modules.$toc );
 2686+ $collapseControl.insertBefore( context.modules.toc.$toc );
26832687 context.$ui.find( '.wikiEditor-ui-left .wikiEditor-ui-top' ).append( $expandControl );
26842688 }
26852689 /**
@@ -2714,9 +2718,9 @@
27152719 context.$ui.find( '.wikiEditor-ui-resize-mask' ).remove();
27162720 context.$content.trigger( 'mouseup' );
27172721 if( ui.size.width < parseFloat( $.wikiEditor.modules.toc.minimumWidth ) ) {
2718 - context.modules.$toc.trigger( 'collapse' );
 2722+ context.modules.toc.$toc.trigger( 'collapse' );
27192723 } else {
2720 - context.modules.$toc.data( 'openWidth', ui.size.width );
 2724+ context.modules.toc.$toc.data( 'openWidth', ui.size.width );
27212725 $.cookie( 'wikiEditor-' + context.instance + '-toc-width', ui.size.width );
27222726 }
27232727 // Let the UI know things have moved around
@@ -2729,18 +2733,18 @@
27302734 .addClass( 'ui-resizable-w' )
27312735 .addClass( 'wikiEditor-ui-toc-resize-grip' );
27322736 // Bind collapse and expand event handlers to the TOC
2733 - context.modules.$toc
 2737+ context.modules.toc.$toc
27342738 .bind( 'collapse.wikiEditor-toc', $.wikiEditor.modules.toc.fn.collapse )
27352739 .bind( 'expand.wikiEditor-toc', $.wikiEditor.modules.toc.fn.expand );
2736 - context.modules.$toc.data( 'openWidth', $.wikiEditor.modules.toc.defaultWidth );
 2740+ context.modules.toc.$toc.data( 'openWidth', $.wikiEditor.modules.toc.defaultWidth );
27372741 // If the toc-width cookie is set, reset the widths based upon that
27382742 if ( $.cookie( 'wikiEditor-' + context.instance + '-toc-width' ) == 0 ) {
2739 - context.modules.$toc.trigger( 'collapse.wikiEditor-toc', { data: context } );
 2743+ context.modules.toc.$toc.trigger( 'collapse.wikiEditor-toc', { data: context } );
27402744 } else if ( $.cookie( 'wikiEditor-' + context.instance + '-toc-width' ) > 0 ) {
27412745 var initialWidth = $.cookie( 'wikiEditor-' + context.instance + '-toc-width' );
27422746 if( initialWidth < parseFloat( $.wikiEditor.modules.toc.minimumWidth ) )
27432747 initialWidth = parseFloat( $.wikiEditor.modules.toc.minimumWidth ) + 1;
2744 - context.modules.$toc.data( 'openWidth', initialWidth + 'px' );
 2748+ context.modules.toc.$toc.data( 'openWidth', initialWidth + 'px' );
27452749 context.$ui.find( '.wikiEditor-ui-right' )
27462750 .css( 'width', initialWidth + 'px' );
27472751 context.$ui.find( '.wikiEditor-ui-left' )
@@ -2851,13 +2855,13 @@
28522856 structure.unshift( { 'text': wgPageName.replace(/_/g, ' '), 'level': 1, 'index': 0,
28532857 'wrapper': context.$content } );
28542858 }
2855 - context.modules.$toc.html( buildList( structure ) );
 2859+ context.modules.toc.$toc.html( buildList( structure ) );
28562860
28572861 if ( wgNavigableTOCResizable && !context.$ui.data( 'resizableDone' ) ) {
28582862 buildResizeControls();
28592863 buildCollapseControls();
28602864 }
2861 - context.modules.$toc.find( 'div' ).autoEllipse( { 'position': 'right', 'tooltip': true } );
 2865+ context.modules.toc.$toc.find( 'div' ).autoEllipse( { 'position': 'right', 'tooltip': true } );
28622866 // Cache the outline for later use
28632867 context.data.outline = outline;
28642868 }
@@ -2888,14 +2892,14 @@
28892893 for ( type in data ) {
28902894 switch ( type ) {
28912895 case 'sections':
2892 - var $sections = context.modules.$toolbar
 2896+ var $sections = context.modules.toolbar.$toolbar
28932897 .find( 'div.sections' );
2894 - var $tabs = context.modules.$toolbar
 2898+ var $tabs = context.modules.toolbar.$toolbar
28952899 .find( 'div.tabs' );
28962900 for ( section in data[type] ) {
28972901 if ( section == 'main' ) {
28982902 // Section
2899 - context.modules.$toolbar
 2903+ context.modules.toolbar.$toolbar
29002904 .prepend(
29012905 $.wikiEditor.modules.toolbar.fn.buildSection(
29022906 context, section, data[type][section]
@@ -2922,7 +2926,7 @@
29232927 if ( ! ( 'section' in data ) ) {
29242928 continue;
29252929 }
2926 - var $section = context.modules.$toolbar
 2930+ var $section = context.modules.toolbar.$toolbar
29272931 .find( 'div[rel=' + data.section + '].section' );
29282932 for ( group in data[type] ) {
29292933 // Group
@@ -2934,7 +2938,7 @@
29352939 if ( ! ( 'section' in data && 'group' in data ) ) {
29362940 continue;
29372941 }
2938 - var $group = context.modules.$toolbar
 2942+ var $group = context.modules.toolbar.$toolbar
29392943 .find( 'div[rel=' + data.section + '].section ' + 'div[rel=' + data.group + '].group' );
29402944 for ( tool in data[type] ) {
29412945 // Tool
@@ -2945,9 +2949,9 @@
29462950 if ( ! ( 'section' in data ) ) {
29472951 continue;
29482952 }
2949 - var $pages = context.modules.$toolbar
 2953+ var $pages = context.modules.toolbar.$toolbar
29502954 .find( 'div[rel=' + data.section + '].section .pages' );
2951 - var $index = context.modules.$toolbar
 2955+ var $index = context.modules.toolbar.$toolbar
29522956 .find( 'div[rel=' + data.section + '].section .index' );
29532957 for ( page in data[type] ) {
29542958 // Page
@@ -2963,7 +2967,7 @@
29642968 if ( ! ( 'section' in data && 'page' in data ) ) {
29652969 continue;
29662970 }
2967 - var $table = context.modules.$toolbar.find(
 2971+ var $table = context.modules.toolbar.$toolbar.find(
29682972 'div[rel=' + data.section + '].section ' + 'div[rel=' + data.page + '].page table'
29692973 );
29702974 for ( row in data[type] ) {
@@ -2975,7 +2979,7 @@
29762980 if ( ! ( 'section' in data && 'page' in data ) ) {
29772981 continue;
29782982 }
2979 - $characters = context.modules.$toolbar.find(
 2983+ $characters = context.modules.toolbar.$toolbar.find(
29802984 'div[rel=' + data.section + '].section ' + 'div[rel=' + data.page + '].page div'
29812985 );
29822986 var actions = $characters.data( 'actions' );
@@ -3021,20 +3025,20 @@
30223026 target += ' table tr:not(:has(th)):eq(' + data.row + ')';
30233027 } else {
30243028 // Just a page, remove the index too!
3025 - context.modules.$toolbar.find( index ).remove();
 3029+ context.modules.toolbar.$toolbar.find( index ).remove();
30263030 $.wikiEditor.modules.toolbar.fn.updateBookletSelection(
30273031 context,
30283032 null,
3029 - context.modules.$toolbar.find( target ),
3030 - context.modules.$toolbar.find( index )
 3033+ context.modules.toolbar.$toolbar.find( target ),
 3034+ context.modules.toolbar.$toolbar.find( index )
30313035 );
30323036 }
30333037 } else {
30343038 // Just a section, remove the tab too!
3035 - context.modules.$toolbar.find( tab ).remove();
 3039+ context.modules.toolbar.$toolbar.find( tab ).remove();
30363040 }
30373041 js_log('target is: ' + target);
3038 - context.modules.$toolbar.find( target ).remove();
 3042+ context.modules.toolbar.$toolbar.find( target ).remove();
30393043 }
30403044 }
30413045 },
@@ -3057,14 +3061,14 @@
30583062 * @param {Object} config Configuration object to create module from
30593063 */
30603064 create : function( context, config ) {
3061 - if ( '$toolbar' in context.modules ) {
 3065+ if ( '$toolbar' in context.modules.toolbar ) {
30623066 return;
30633067 }
3064 - context.modules.$toolbar = $( '<div />' )
 3068+ context.modules.toolbar.$toolbar = $( '<div />' )
30653069 .addClass( 'wikiEditor-ui-toolbar' )
30663070 .attr( 'id', 'wikiEditor-ui-toolbar' );
30673071 $.wikiEditor.modules.toolbar.fn.build( context, config );
3068 - context.$ui.find( '.wikiEditor-ui-top' ).append( context.modules.$toolbar );
 3072+ context.$ui.find( '.wikiEditor-ui-top' ).append( context.modules.toolbar.$toolbar );
30693073 },
30703074 /**
30713075 * Performs an operation based on parameters
@@ -3361,8 +3365,8 @@
33623366 if ( show ) {
33633367 $section.fadeIn( 'fast' );
33643368 dH = $section.outerHeight() - dH;
3365 - if ( context.modules.$toc ) {
3366 - context.modules.$toc.animate({'height': "+="+dH}, $section.outerHeight() * 2);
 3369+ if ( 'toc' in context.modules ) {
 3370+ context.modules.toc.$toc.animate({'height': "+="+dH}, $section.outerHeight() * 2);
33673371 }
33683372 $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function() {
33693373 $(this).css('overflow', 'visible').css('height', 'auto');
@@ -3373,8 +3377,8 @@
33743378 .animate( { 'height': 0 }, $section.outerHeight() * 2, function() {
33753379 $(this).css('overflow', 'visible');
33763380 } );
3377 - if ( context.modules.$toc ) {
3378 - context.modules.$toc.animate({'height': "-="+$section.outerHeight()}, $section.outerHeight() * 2);
 3381+ if ( 'toc' in context.modules ) {
 3382+ context.modules.toc.$toc.animate({'height': "-="+$section.outerHeight()}, $section.outerHeight() * 2);
33793383 }
33803384 }
33813385 // Click tracking
@@ -3444,13 +3448,13 @@
34453449 $selectedIndex.addClass( 'current' );
34463450 },
34473451 build : function( context, config ) {
3448 - var $tabs = $( '<div />' ).addClass( 'tabs' ).appendTo( context.modules.$toolbar );
3449 - var $sections = $( '<div />' ).addClass( 'sections' ).appendTo( context.modules.$toolbar );
3450 - context.modules.$toolbar.append( $( '<div />' ).css( 'clear', 'both' ) );
 3452+ var $tabs = $( '<div />' ).addClass( 'tabs' ).appendTo( context.modules.toolbar.$toolbar );
 3453+ var $sections = $( '<div />' ).addClass( 'sections' ).appendTo( context.modules.toolbar.$toolbar );
 3454+ context.modules.toolbar.$toolbar.append( $( '<div />' ).css( 'clear', 'both' ) );
34513455 var sectionQueue = [];
34523456 for ( section in config ) {
34533457 if ( section == 'main' ) {
3454 - context.modules.$toolbar.prepend(
 3458+ context.modules.toolbar.$toolbar.prepend(
34553459 $.wikiEditor.modules.toolbar.fn.buildSection( context, section, config[section] )
34563460 );
34573461 } else {
@@ -3476,8 +3480,8 @@
34773481 var $section = s.$sections.find( '.section:visible' );
34783482 if ( $section.size() ) {
34793483 $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function( ) {
3480 - if ( context.modules.$toc ) {
3481 - context.modules.$toc.height(
 3484+ if ( 'toc' in context.modules ) {
 3485+ context.modules.toc.$toc.height(
34823486 context.$ui.find( '.wikiEditor-ui-left' )
34833487 .outerHeight() - context.$ui.find( '.tab-toc' ).outerHeight()
34843488 )
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -88,7 +88,7 @@
8989 return $.wikiEditor.supported=true;},'autoMsg':function(object,property){if(typeof property=='object'){for(i in property){if(property[i]in object||property[i]+'Msg'in object){property=property[i];break;}}}
9090 if(property in object){return object[property];}else if(property+'Msg'in object){return gM(object[property+'Msg']);}else{return'';}},'getIcon':function(icon,path,lang){lang=lang||wgUserLanguage;path=path||$.wikiEditor.imgPath;var src=icon[lang]||icon['default']||icon;if(src.substr(0,7)!='http://'&&src.substr(0,8)!='https://'&&src[0]!='/')
9191 src=path+src;return src+'?'+wgWikiEditorIconVersion;},'fixOperaBrokenness':function(s){return s;}};$.fn.wikiEditor=function(){if($j.wikiEditor.isSupportKnown()&&!$j.wikiEditor.isSupported()){return $(this);}
92 -var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){var instance=$.wikiEditor.instances.length;context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':instance};$.wikiEditor.instances[instance]=$(this);context.api={'addModule':function(context,data){function callModuleApi(module,call,data){if(module in $.wikiEditor.modules&&'fn'in $.wikiEditor.modules[module]&&call in $.wikiEditor.modules[module].fn){$.wikiEditor.modules[module].fn[call](context,data);}}
 92+var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){var instance=$.wikiEditor.instances.length;context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':instance};$.wikiEditor.instances[instance]=$(this);context.api={'addModule':function(context,data){function callModuleApi(module,call,data){if(module in $.wikiEditor.modules&&'fn'in $.wikiEditor.modules[module]&&call in $.wikiEditor.modules[module].fn){context.modules[module]={};$.wikiEditor.modules[module].fn[call](context,data);}}
9393 if(typeof data=='string'){callModuleApi(data,'create',{});}else if(typeof data=='object'){for(module in data){if(typeof module=='string'){callModuleApi(module,'create',data[module]);}}}}};for(module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}}
9494 context.evt={'change':function(event){switch(event.type){case'keypress':if(true){event.data.scope='division';}else{event.data.scope='character';}
9595 break;case'mousedown':if(true){event.data.scope='division';}else{return false;}
@@ -96,7 +96,7 @@
9797 return true;}};context.fn={'trigger':function(name,event){if(typeof event=='undefined'){event={'type':'custom'};}
9898 if(typeof event.data=='undefined'){event.data={};}
9999 if(name in context.evt){if(!context.evt[name](event)){return false;}}
100 -for(module in $.wikiEditor.modules){if('evt'in $.wikiEditor.modules[module]&&name in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt[name](context,event);}}},'addButton':function(options){context.$controls.show();context.$buttons.show();return $('<button />').text($.wikiEditor.autoMsg(options,'caption')).click(options.action).appendTo(context.$buttons);},'addView':function(options){function addTab(options){context.$controls.show();context.$tabs.show();return $('<div></div>').attr('rel','wikiEditor-ui-view-'+options.name).addClass(context.view==options.name?'current':null).append($('<a></a>').attr('href','#').click(function(event){context.$ui.find('.wikiEditor-ui-view').hide();context.$ui.find('.'+$(this).parent().attr('rel')).show();context.$tabs.find('div').removeClass('current');$(this).parent().addClass('current');$(this).blur();if('init'in options&&typeof options.init=='function'){options.init(context);}
 100+for(module in context.modules){if(module in $.wikiEditor.modules&&'evt'in $.wikiEditor.modules[module]&&name in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt[name](context,event);}}},'addButton':function(options){context.$controls.show();context.$buttons.show();return $('<button />').text($.wikiEditor.autoMsg(options,'caption')).click(options.action).appendTo(context.$buttons);},'addView':function(options){function addTab(options){context.$controls.show();context.$tabs.show();return $('<div></div>').attr('rel','wikiEditor-ui-view-'+options.name).addClass(context.view==options.name?'current':null).append($('<a></a>').attr('href','#').click(function(event){context.$ui.find('.wikiEditor-ui-view').hide();context.$ui.find('.'+$(this).parent().attr('rel')).show();context.$tabs.find('div').removeClass('current');$(this).parent().addClass('current');$(this).blur();if('init'in options&&typeof options.init=='function'){options.init(context);}
101101 event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);}
102102 if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});}
103103 addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'setup':function(){context.$iframe[0].contentWindow.document.designMode='on';context.$content=$(context.$iframe[0].contentWindow.document.body);context.$content.append($('<div />').text(context.$textarea.val()).html());if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');}
@@ -123,13 +123,13 @@
124124 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);});var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI)
125125 maxTI=ti;});var tabIndex=maxTI+1;$j('.ui-dialog input, .ui-dialog button').not('[tabindex]').each(function(){$j(this).attr('tabindex',tabIndex++);});}}});},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'))-
126126 (wrapper.width()-oldWidth)/2);}
127 -$(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={api:{},evt:{change:function(event){}},fn:{create:function(context,config){},divide:function(context){},isolate:function(context){return[];},strip:function(context,division){return $('<div />').html(division.html().replace(/\<br[^\>]*\>/g,"\n")).text();},scan:function(context,division){return[];},mark:function(context,division,tokens){}}};})(jQuery);(function($){$.wikiEditor.modules.preview={api:{},fn:{create:function(context,config){if('preview'in context.modules){return;}
128 -context.modules.preview={'previewText':null,'changesText':null};context.$preview=context.fn.addView({'name':'preview','titleMsg':'wikieditor-preview-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.previewText==wikitext){return;}
129 -context.$preview.find('.wikiEditor-preview-contents').empty();context.$preview.find('.wikiEditor-preview-loading').show();$.post(wgScriptPath+'/api.php',{'action':'parse','title':wgPageName,'text':wikitext,'prop':'text','pst':'','format':'json'},function(data){if(typeof data.parse=='undefined'||typeof data.parse.text=='undefined'||typeof data.parse.text['*']=='undefined'){return;}
130 -context.modules.preview.previewText=wikitext;context.$preview.find('.wikiEditor-preview-loading').hide();context.$preview.find('.wikiEditor-preview-contents').html(data.parse.text['*']).find('a:not([href^=#])').click(function(){return false;});},'json');}});context.$changesTab=context.fn.addView({'name':'changes','titleMsg':'wikieditor-preview-changes-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.changesText==wikitext){return;}
 127+$(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={api:{},evt:{change:function(event){}},fn:{create:function(context,config){},divide:function(context){},isolate:function(context){return[];},strip:function(context,division){return $('<div />').html(division.html().replace(/\<br[^\>]*\>/g,"\n")).text();},scan:function(context,division){return[];},mark:function(context,division,tokens){}}};})(jQuery);(function($){$.wikiEditor.modules.preview={api:{},fn:{create:function(context,config){if('initialized'in context.modules.preview){return;}
 128+context.modules.preview={'initialized':true,'previewText':null,'changesText':null};context.modules.preview.$preview=context.fn.addView({'name':'preview','titleMsg':'wikieditor-preview-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.previewText==wikitext){return;}
 129+context.modules.preview.$preview.find('.wikiEditor-preview-contents').empty();context.modules.preview.$preview.find('.wikiEditor-preview-loading').show();$.post(wgScriptPath+'/api.php',{'action':'parse','title':wgPageName,'text':wikitext,'prop':'text','pst':'','format':'json'},function(data){if(typeof data.parse=='undefined'||typeof data.parse.text=='undefined'||typeof data.parse.text['*']=='undefined'){return;}
 130+context.modules.preview.previewText=wikitext;context.modules.preview.$preview.find('.wikiEditor-preview-loading').hide();context.modules.preview.$preview.find('.wikiEditor-preview-contents').html(data.parse.text['*']).find('a:not([href^=#])').click(function(){return false;});},'json');}});context.$changesTab=context.fn.addView({'name':'changes','titleMsg':'wikieditor-preview-changes-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.changesText==wikitext){return;}
131131 context.$changesTab.find('table.diff tbody').empty();context.$changesTab.find('.wikiEditor-preview-loading').show();var postdata={'action':'query','indexpageids':'','prop':'revisions','titles':wgPageName,'rvdifftotext':wikitext,'rvprop':'','format':'json'};var section=$('[name=wpSection]').val();if(section!='')
132132 postdata['rvsection']=section;$.post(wgScriptPath+'/api.php',postdata,function(data){if($('link[href='+stylepath+'/common/diff.css]').size()==0){$('head').append($('<link />').attr({'rel':'stylesheet','type':'text/css','href':stylepath+'/common/diff.css'}));}
133 -try{var diff=data.query.pages[data.query.pageids[0]].revisions[0].diff['*'];context.$changesTab.find('table.diff tbody').html(diff);context.$changesTab.find('.wikiEditor-preview-loading').hide();context.modules.preview.changesText=wikitext;}catch(e){}},'json');}});var loadingMsg=gM('wikieditor-preview-loading');context.$preview.add(context.$changesTab).append($('<div />').addClass('wikiEditor-preview-loading').append($('<img />').addClass('wikiEditor-preview-spinner').attr({'src':$.wikiEditor.imgPath+'dialogs/loading.gif','valign':'absmiddle','alt':loadingMsg,'title':loadingMsg})).append($('<span></span>').text(loadingMsg))).append($('<div />').addClass('wikiEditor-preview-contents'));context.$changesTab.find('.wikiEditor-preview-contents').html('<table class="diff"><col class="diff-marker" /><col class="diff-content" />'+'<col class="diff-marker" /><col class="diff-content" /><tbody /></table>');}}};})(jQuery);(function($){$.wikiEditor.modules.publish={api:{},fn:{create:function(context,config){var dialogID='wikiEditor-'+context.instance+'-dialog';$.wikiEditor.modules.dialogs.fn.create(context,{previewsave:{id:dialogID,titleMsg:'wikieditor-publish-dialog-title',html:'\
 133+try{var diff=data.query.pages[data.query.pageids[0]].revisions[0].diff['*'];context.$changesTab.find('table.diff tbody').html(diff);context.$changesTab.find('.wikiEditor-preview-loading').hide();context.modules.preview.changesText=wikitext;}catch(e){}},'json');}});var loadingMsg=gM('wikieditor-preview-loading');context.modules.preview.$preview.add(context.$changesTab).append($('<div />').addClass('wikiEditor-preview-loading').append($('<img />').addClass('wikiEditor-preview-spinner').attr({'src':$.wikiEditor.imgPath+'dialogs/loading.gif','valign':'absmiddle','alt':loadingMsg,'title':loadingMsg})).append($('<span></span>').text(loadingMsg))).append($('<div />').addClass('wikiEditor-preview-contents'));context.$changesTab.find('.wikiEditor-preview-contents').html('<table class="diff"><col class="diff-marker" /><col class="diff-content" />'+'<col class="diff-marker" /><col class="diff-content" /><tbody /></table>');}}};})(jQuery);(function($){$.wikiEditor.modules.publish={api:{},fn:{create:function(context,config){var dialogID='wikiEditor-'+context.instance+'-dialog';$.wikiEditor.modules.dialogs.fn.create(context,{previewsave:{id:dialogID,titleMsg:'wikieditor-publish-dialog-title',html:'\
134134 <div class="wikiEditor-dialog-copywarn"></div>\
135135 <div class="wikiEditor-dialog-editoptions">\
136136 <form>\
@@ -153,13 +153,12 @@
154154 $('#wikiEditor-'+context.instance+'-dialog-minor').hide();else if($('#wpMinoredit').is(':checked'))
155155 $('#wikiEditor-'+context.instance+'-dialog-minor').attr('checked','checked');if($('#wpWatchthis').size()==0)
156156 $('#wikiEditor-'+context.instance+'-dialog-watch').hide();else if($('#wpWatchthis').is(':checked'))
157 -$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={defaultWidth:'166px',minimumWidth:'70px',api:{},evt:{ready:function(context,event){if(!('$toc'in context.modules)){return;}
158 -$.wikiEditor.modules.toc.fn.build(context);context.$content.parent().delayedBind(250,'mouseup scrollToTop keyup change',function(){$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(event){var context=event.data.context;context.$textarea.delayedBindCancel(250,'mouseup scrollToTop keyup change');$.wikiEditor.modules.toc.fn.unhighlight(context);});}},fn:{create:function(context,config){if('$toc'in context.modules){return;}
159 -var height=context.$ui.find('.wikiEditor-ui-left').height();context.modules.$toc=$('<div />').addClass('wikiEditor-ui-toc').data('context',context);context.$ui.find('.wikiEditor-ui-right').css('width',$.wikiEditor.modules.toc.defaultWidth).append(context.modules.$toc);context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-left').height());context.$ui.find('.wikiEditor-ui-left').css('marginRight',"-"+$.wikiEditor.modules.toc.defaultWidth).children().css('marginRight',$.wikiEditor.modules.toc.defaultWidth);},unhighlight:function(context){context.modules.$toc.find('div').removeClass('current');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var position=context.$textarea.textSelection('getCaretPosition');var section=0;if(context.data.outline.length>0){if(!(position<context.data.outline[0].position-1)){while(section<context.data.outline.length&&context.data.outline[section].position-1<position){section++;}
 157+$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={defaultWidth:'166px',minimumWidth:'70px',api:{},evt:{ready:function(context,event){$.wikiEditor.modules.toc.fn.build(context);context.$content.parent().delayedBind(250,'mouseup scrollToTop keyup change',function(){$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(event){var context=event.data.context;context.$textarea.delayedBindCancel(250,'mouseup scrollToTop keyup change');$.wikiEditor.modules.toc.fn.unhighlight(context);});}},fn:{create:function(context,config){if('$toc'in context.modules.toc){return;}
 158+var height=context.$ui.find('.wikiEditor-ui-left').height();context.modules.toc.$toc=$('<div />').addClass('wikiEditor-ui-toc').data('context',context);context.$ui.find('.wikiEditor-ui-right').css('width',$.wikiEditor.modules.toc.defaultWidth).append(context.modules.toc.$toc);context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height());context.$ui.find('.wikiEditor-ui-left').css('marginRight',"-"+$.wikiEditor.modules.toc.defaultWidth).children().css('marginRight',$.wikiEditor.modules.toc.defaultWidth);},unhighlight:function(context){context.modules.toc.$toc.find('div').removeClass('current');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var position=context.$textarea.textSelection('getCaretPosition');var section=0;if(context.data.outline.length>0){if(!(position<context.data.outline[0].position-1)){while(section<context.data.outline.length&&context.data.outline[section].position-1<position){section++;}
160159 section=Math.max(0,section);}
161 -var sectionLink=context.modules.$toc.find('div.section-'+section);sectionLink.addClass('current');var relTop=sectionLink.offset().top-context.modules.$toc.offset().top;var scrollTop=context.modules.$toc.scrollTop();var divHeight=context.modules.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0)
162 -context.modules.$toc.scrollTop(scrollTop+relTop);else if(relTop+sectionHeight>divHeight)
163 -context.modules.$toc.scrollTop(scrollTop+relTop+sectionHeight-divHeight);}},collapse:function(event){var $this=$(this),context=$this.data('context'),pT=$this.parent().position().top-1;$this.parent().css({'marginTop':'1px','position':'absolute','left':'auto','right':0,'top':pT}).fadeOut('fast',function(){$(this).hide().css({'marginTop':'0','width':'1px'});context.$ui.find('.wikiEditor-ui-toc-expandControl').fadeIn('fast');}).prev().animate({'marginRight':'-1px'},'fast',function(){$(this).css('marginRight',0);context.fn.trigger('resize');}).children().animate({'marginRight':'1px'},'fast',function(){$(this).css('marginRight',0);});$.cookie('wikiEditor-'+context.instance+'-toc-width',0);return false;},expand:function(event){var $this=$(this),context=$this.data('context'),openWidth=context.modules.$toc.data('openWidth');context.$ui.find('.wikiEditor-ui-toc-expandControl').hide();$this.parent().show().css('marginTop','1px').animate({'width':openWidth},'fast',function(){context.$content.trigger('mouseup');$(this).css({'marginTop':'0','position':'relative','right':'auto','top':'auto'});context.fn.trigger('resize');}).prev().animate({'marginRight':(parseFloat(openWidth)*-1)},'fast').children().animate({'marginRight':openWidth},'fast');$.cookie('wikiEditor-'+context.instance+'-toc-width',context.modules.$toc.data('openWidth'));return false;},build:function(context){function buildStructure(outline,offset,level){if(offset==undefined)offset=0;if(level==undefined)level=1;var sections=[];for(var i=offset;i<outline.length;i++){if(outline[i].nLevel==level){var sub=buildStructure(outline,i+1,level+1);if(sub.length){outline[i].sections=sub;}
 160+var sectionLink=context.modules.toc.$toc.find('div.section-'+section);sectionLink.addClass('current');var relTop=sectionLink.offset().top-context.modules.toc.$toc.offset().top;var scrollTop=context.modules.toc.$toc.scrollTop();var divHeight=context.modules.toc.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0)
 161+context.modules.toc.$toc.scrollTop(scrollTop+relTop);else if(relTop+sectionHeight>divHeight)
 162+context.modules.toc.$toc.scrollTop(scrollTop+relTop+sectionHeight-divHeight);}},collapse:function(event){var $this=$(this),context=$this.data('context'),pT=$this.parent().position().top-1;$this.parent().css({'marginTop':'1px','position':'absolute','left':'auto','right':0,'top':pT}).fadeOut('fast',function(){$(this).hide().css({'marginTop':'0','width':'1px'});context.$ui.find('.wikiEditor-ui-toc-expandControl').fadeIn('fast');}).prev().animate({'marginRight':'-1px'},'fast',function(){$(this).css('marginRight',0);context.fn.trigger('resize');}).children().animate({'marginRight':'1px'},'fast',function(){$(this).css('marginRight',0);});$.cookie('wikiEditor-'+context.instance+'-toc-width',0);return false;},expand:function(event){var $this=$(this),context=$this.data('context'),openWidth=context.modules.toc.$toc.data('openWidth');context.$ui.find('.wikiEditor-ui-toc-expandControl').hide();$this.parent().show().css('marginTop','1px').animate({'width':openWidth},'fast',function(){context.$content.trigger('mouseup');$(this).css({'marginTop':'0','position':'relative','right':'auto','top':'auto'});context.fn.trigger('resize');}).prev().animate({'marginRight':(parseFloat(openWidth)*-1)},'fast').children().animate({'marginRight':openWidth},'fast');$.cookie('wikiEditor-'+context.instance+'-toc-width',context.modules.toc.$toc.data('openWidth'));return false;},build:function(context){function buildStructure(outline,offset,level){if(offset==undefined)offset=0;if(level==undefined)level=1;var sections=[];for(var i=offset;i<outline.length;i++){if(outline[i].nLevel==level){var sub=buildStructure(outline,i+1,level+1);if(sub.length){outline[i].sections=sub;}
164163 sections[sections.length]=outline[i];}else if(outline[i].nLevel<level){break;}}
165164 return sections;}
166165 function buildList(structure){var list=$('<ul />');for(i in structure){var div=$('<div />').addClass('section-'+structure[i].index).data('wrapper',structure[i].wrapper).click(function(event){context.fn.scrollToTop($(this).data('wrapper'));context.$textarea.textSelection('setSelection',{'start':0,'startContainer':$(this).data('wrapper')});if(typeof $.trackAction!='undefined')
@@ -167,10 +166,10 @@
168167 div.html('&nbsp;');var item=$('<li />').append(div);if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));}
169168 list.append(item);}
170169 return list;}
171 -function buildCollapseControls(){var $collapseControl=$('<div />'),$expandControl=$('<div />');$collapseControl.addClass('tab').addClass('tab-toc').append('<a href="#" />').bind('click.wikiEditor-toc',function(){context.modules.$toc.trigger('collapse.wikiEditor-toc');return false;}).find('a').text(gM('wikieditor-toc-hide'));$expandControl.addClass('wikiEditor-ui-toc-expandControl').append('<a href="#" />').bind('click.wikiEditor-toc',function(){context.modules.$toc.trigger('expand.wikiEditor-toc');return false;}).hide().find('a').text(gM('wikieditor-toc-show'));$collapseControl.insertBefore(context.modules.$toc);context.$ui.find('.wikiEditor-ui-left .wikiEditor-ui-top').append($expandControl);}
172 -function buildResizeControls(){context.$ui.data('resizableDone',true).find('.wikiEditor-ui-right').data('wikiEditor-ui-left',context.$ui.find('.wikiEditor-ui-left')).resizable({handles:'w,e',preventPositionLeftChange:true,minWidth:50,start:function(e,ui){var $this=$(this);$('<div />').addClass('wikiEditor-ui-resize-mask').css({'position':'absolute','z-index':2,'left':0,'top':0,'bottom':0,'right':0}).appendTo(context.$ui.find('.wikiEditor-ui-left'));$this.resizable('option','maxWidth',$this.parent().width()-450);},resize:function(e,ui){$(this).css({'width':ui.size.width,'top':'auto','height':'auto'}).data('wikiEditor-ui-left').css('marginRight',(-1*ui.size.width)).children().css('marginRight',ui.size.width);context.fn.trigger('resize');},stop:function(e,ui){context.$ui.find('.wikiEditor-ui-resize-mask').remove();context.$content.trigger('mouseup');if(ui.size.width<parseFloat($.wikiEditor.modules.toc.minimumWidth)){context.modules.$toc.trigger('collapse');}else{context.modules.$toc.data('openWidth',ui.size.width);$.cookie('wikiEditor-'+context.instance+'-toc-width',ui.size.width);}
173 -context.fn.trigger('resize');}});context.$ui.find('.ui-resizable-e').removeClass('ui-resizable-e').addClass('ui-resizable-w').addClass('wikiEditor-ui-toc-resize-grip');context.modules.$toc.bind('collapse.wikiEditor-toc',$.wikiEditor.modules.toc.fn.collapse).bind('expand.wikiEditor-toc',$.wikiEditor.modules.toc.fn.expand);context.modules.$toc.data('openWidth',$.wikiEditor.modules.toc.defaultWidth);if($.cookie('wikiEditor-'+context.instance+'-toc-width')==0){context.modules.$toc.trigger('collapse.wikiEditor-toc',{data:context});}else if($.cookie('wikiEditor-'+context.instance+'-toc-width')>0){var initialWidth=$.cookie('wikiEditor-'+context.instance+'-toc-width');if(initialWidth<parseFloat($.wikiEditor.modules.toc.minimumWidth))
174 -initialWidth=parseFloat($.wikiEditor.modules.toc.minimumWidth)+1;context.modules.$toc.data('openWidth',initialWidth+'px');context.$ui.find('.wikiEditor-ui-right').css('width',initialWidth+'px');context.$ui.find('.wikiEditor-ui-left').css('marginRight',(parseFloat(initialWidth)*-1)+'px').children().css('marginRight',initialWidth+'px');}}
 170+function buildCollapseControls(){var $collapseControl=$('<div />'),$expandControl=$('<div />');$collapseControl.addClass('tab').addClass('tab-toc').append('<a href="#" />').bind('click.wikiEditor-toc',function(){context.modules.toc.$toc.trigger('collapse.wikiEditor-toc');return false;}).find('a').text(gM('wikieditor-toc-hide'));$expandControl.addClass('wikiEditor-ui-toc-expandControl').append('<a href="#" />').bind('click.wikiEditor-toc',function(){context.modules.toc.$toc.trigger('expand.wikiEditor-toc');return false;}).hide().find('a').text(gM('wikieditor-toc-show'));$collapseControl.insertBefore(context.modules.toc.$toc);context.$ui.find('.wikiEditor-ui-left .wikiEditor-ui-top').append($expandControl);}
 171+function buildResizeControls(){context.$ui.data('resizableDone',true).find('.wikiEditor-ui-right').data('wikiEditor-ui-left',context.$ui.find('.wikiEditor-ui-left')).resizable({handles:'w,e',preventPositionLeftChange:true,minWidth:50,start:function(e,ui){var $this=$(this);$('<div />').addClass('wikiEditor-ui-resize-mask').css({'position':'absolute','z-index':2,'left':0,'top':0,'bottom':0,'right':0}).appendTo(context.$ui.find('.wikiEditor-ui-left'));$this.resizable('option','maxWidth',$this.parent().width()-450);},resize:function(e,ui){$(this).css({'width':ui.size.width,'top':'auto','height':'auto'}).data('wikiEditor-ui-left').css('marginRight',(-1*ui.size.width)).children().css('marginRight',ui.size.width);context.fn.trigger('resize');},stop:function(e,ui){context.$ui.find('.wikiEditor-ui-resize-mask').remove();context.$content.trigger('mouseup');if(ui.size.width<parseFloat($.wikiEditor.modules.toc.minimumWidth)){context.modules.toc.$toc.trigger('collapse');}else{context.modules.toc.$toc.data('openWidth',ui.size.width);$.cookie('wikiEditor-'+context.instance+'-toc-width',ui.size.width);}
 172+context.fn.trigger('resize');}});context.$ui.find('.ui-resizable-e').removeClass('ui-resizable-e').addClass('ui-resizable-w').addClass('wikiEditor-ui-toc-resize-grip');context.modules.toc.$toc.bind('collapse.wikiEditor-toc',$.wikiEditor.modules.toc.fn.collapse).bind('expand.wikiEditor-toc',$.wikiEditor.modules.toc.fn.expand);context.modules.toc.$toc.data('openWidth',$.wikiEditor.modules.toc.defaultWidth);if($.cookie('wikiEditor-'+context.instance+'-toc-width')==0){context.modules.toc.$toc.trigger('collapse.wikiEditor-toc',{data:context});}else if($.cookie('wikiEditor-'+context.instance+'-toc-width')>0){var initialWidth=$.cookie('wikiEditor-'+context.instance+'-toc-width');if(initialWidth<parseFloat($.wikiEditor.modules.toc.minimumWidth))
 173+initialWidth=parseFloat($.wikiEditor.modules.toc.minimumWidth)+1;context.modules.toc.$toc.data('openWidth',initialWidth+'px');context.$ui.find('.wikiEditor-ui-right').css('width',initialWidth+'px');context.$ui.find('.wikiEditor-ui-left').css('marginRight',(parseFloat(initialWidth)*-1)+'px').children().css('marginRight',initialWidth+'px');}}
175174 var outline=[],h=0;function traverseTextNodes(){if(this.nodeName!='#text'){$(this.childNodes).each(traverseTextNodes);return;}
176175 var text=this.nodeValue;var p=this;while(!p.previousSibling)
177176 p=p.parentNode;var prev=p?p.previousSibling:null;p=this;while(p&&!p.nextSibling)
@@ -190,22 +189,22 @@
191190 if(nLevel<=0){nLevel=1;}
192191 outline[i].nLevel=nLevel;lastLevel=outline[i].level;}
193192 var structure=buildStructure(outline);if($('input[name=wpSection]').val()==''){structure.unshift({'text':wgPageName.replace(/_/g,' '),'level':1,'index':0,'wrapper':context.$content});}
194 -context.modules.$toc.html(buildList(structure));if(wgNavigableTOCResizable&&!context.$ui.data('resizableDone')){buildResizeControls();buildCollapseControls();}
195 -context.modules.$toc.find('div').autoEllipse({'position':'right','tooltip':true});context.data.outline=outline;}}};$.ui.plugin.add("resizable","preventPositionLeftChange",{resize:function(event,ui){$(this).data("resizable").position.left=0;}});})(jQuery);(function($){$.wikiEditor.modules.toolbar={api:{addToToolbar:function(context,data){for(type in data){switch(type){case'sections':var $sections=context.modules.$toolbar.find('div.sections');var $tabs=context.modules.$toolbar.find('div.tabs');for(section in data[type]){if(section=='main'){context.modules.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));continue;}
 193+context.modules.toc.$toc.html(buildList(structure));if(wgNavigableTOCResizable&&!context.$ui.data('resizableDone')){buildResizeControls();buildCollapseControls();}
 194+context.modules.toc.$toc.find('div').autoEllipse({'position':'right','tooltip':true});context.data.outline=outline;}}};$.ui.plugin.add("resizable","preventPositionLeftChange",{resize:function(event,ui){$(this).data("resizable").position.left=0;}});})(jQuery);(function($){$.wikiEditor.modules.toolbar={api:{addToToolbar:function(context,data){for(type in data){switch(type){case'sections':var $sections=context.modules.toolbar.$toolbar.find('div.sections');var $tabs=context.modules.toolbar.$toolbar.find('div.tabs');for(section in data[type]){if(section=='main'){context.modules.toolbar.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));continue;}
196195 $sections.append($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,data[type][section]));$section=$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},'fast');}}
197196 break;case'groups':if(!('section'in data)){continue;}
198 -var $section=context.modules.$toolbar.find('div[rel='+data.section+'].section');for(group in data[type]){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,data[type][group]));}
 197+var $section=context.modules.toolbar.$toolbar.find('div[rel='+data.section+'].section');for(group in data[type]){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,data[type][group]));}
199198 break;case'tools':if(!('section'in data&&'group'in data)){continue;}
200 -var $group=context.modules.$toolbar.find('div[rel='+data.section+'].section '+'div[rel='+data.group+'].group');for(tool in data[type]){$group.append($.wikiEditor.modules.toolbar.fn.buildTool(context,tool,data[type][tool]));}
 199+var $group=context.modules.toolbar.$toolbar.find('div[rel='+data.section+'].section '+'div[rel='+data.group+'].group');for(tool in data[type]){$group.append($.wikiEditor.modules.toolbar.fn.buildTool(context,tool,data[type][tool]));}
201200 break;case'pages':if(!('section'in data)){continue;}
202 -var $pages=context.modules.$toolbar.find('div[rel='+data.section+'].section .pages');var $index=context.modules.$toolbar.find('div[rel='+data.section+'].section .index');for(page in data[type]){$pages.append($.wikiEditor.modules.toolbar.fn.buildPage(context,page,data[type][page]));$index.append($.wikiEditor.modules.toolbar.fn.buildBookmark(context,page,data[type][page]));}
 201+var $pages=context.modules.toolbar.$toolbar.find('div[rel='+data.section+'].section .pages');var $index=context.modules.toolbar.$toolbar.find('div[rel='+data.section+'].section .index');for(page in data[type]){$pages.append($.wikiEditor.modules.toolbar.fn.buildPage(context,page,data[type][page]));$index.append($.wikiEditor.modules.toolbar.fn.buildBookmark(context,page,data[type][page]));}
203202 $.wikiEditor.modules.toolbar.fn.updateBookletSelection(context,page,$pages,$index);break;case'rows':if(!('section'in data&&'page'in data)){continue;}
204 -var $table=context.modules.$toolbar.find('div[rel='+data.section+'].section '+'div[rel='+data.page+'].page table');for(row in data[type]){$table.append($.wikiEditor.modules.toolbar.fn.buildRow(context,data[type][row]));}
 203+var $table=context.modules.toolbar.$toolbar.find('div[rel='+data.section+'].section '+'div[rel='+data.page+'].page table');for(row in data[type]){$table.append($.wikiEditor.modules.toolbar.fn.buildRow(context,data[type][row]));}
205204 break;case'characters':if(!('section'in data&&'page'in data)){continue;}
206 -$characters=context.modules.$toolbar.find('div[rel='+data.section+'].section '+'div[rel='+data.page+'].page div');var actions=$characters.data('actions');for(character in data[type]){$characters.append($($.wikiEditor.modules.toolbar.fn.buildCharacter(data[type][character],actions)).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).parent().data('context'),$(this).parent().data('actions')[$(this).attr('rel')]);return false;}));}
207 -break;default:break;}}},removeFromToolbar:function(context,data){js_log("f:removeFromToolbar");if(typeof data.section=='string'){var tab='div.tabs span[rel='+data.section+'].tab';var target='div[rel='+data.section+'].section';if(typeof data.group=='string'){target+=' div[rel='+data.group+'].group';if(typeof data.tool=='string'){target+=' div[rel='+data.tool+'].tool';}}else if(typeof data.page=='string'){var index=target+' div.index div[rel='+data.page+']';target+=' div.pages div[rel='+data.page+'].page';if(typeof data.character=='string'){target+=' a[rel='+data.character+']';}else if(typeof data.row=='number'){target+=' table tr:not(:has(th)):eq('+data.row+')';}else{context.modules.$toolbar.find(index).remove();$.wikiEditor.modules.toolbar.fn.updateBookletSelection(context,null,context.modules.$toolbar.find(target),context.modules.$toolbar.find(index));}}else{context.modules.$toolbar.find(tab).remove();}
208 -js_log('target is: '+target);context.modules.$toolbar.find(target).remove();}}},evt:{resize:function(context,event){context.$ui.find('.sections').height(context.$ui.find('.sections .section:visible').outerHeight());}},fn:{create:function(context,config){if('$toolbar'in context.modules){return;}
209 -context.modules.$toolbar=$('<div />').addClass('wikiEditor-ui-toolbar').attr('id','wikiEditor-ui-toolbar');$.wikiEditor.modules.toolbar.fn.build(context,config);context.$ui.find('.wikiEditor-ui-top').append(context.modules.$toolbar);},doAction:function(context,action,source){if($.trackAction!=undefined&&source.closest('.wikiEditor-ui-toolbar').size()){var rels=[];var step=source;var i=0;while(!step.hasClass('wikiEditor-ui-toolbar')){if(i>25){break;}
 205+$characters=context.modules.toolbar.$toolbar.find('div[rel='+data.section+'].section '+'div[rel='+data.page+'].page div');var actions=$characters.data('actions');for(character in data[type]){$characters.append($($.wikiEditor.modules.toolbar.fn.buildCharacter(data[type][character],actions)).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).parent().data('context'),$(this).parent().data('actions')[$(this).attr('rel')]);return false;}));}
 206+break;default:break;}}},removeFromToolbar:function(context,data){js_log("f:removeFromToolbar");if(typeof data.section=='string'){var tab='div.tabs span[rel='+data.section+'].tab';var target='div[rel='+data.section+'].section';if(typeof data.group=='string'){target+=' div[rel='+data.group+'].group';if(typeof data.tool=='string'){target+=' div[rel='+data.tool+'].tool';}}else if(typeof data.page=='string'){var index=target+' div.index div[rel='+data.page+']';target+=' div.pages div[rel='+data.page+'].page';if(typeof data.character=='string'){target+=' a[rel='+data.character+']';}else if(typeof data.row=='number'){target+=' table tr:not(:has(th)):eq('+data.row+')';}else{context.modules.toolbar.$toolbar.find(index).remove();$.wikiEditor.modules.toolbar.fn.updateBookletSelection(context,null,context.modules.toolbar.$toolbar.find(target),context.modules.toolbar.$toolbar.find(index));}}else{context.modules.toolbar.$toolbar.find(tab).remove();}
 207+js_log('target is: '+target);context.modules.toolbar.$toolbar.find(target).remove();}}},evt:{resize:function(context,event){context.$ui.find('.sections').height(context.$ui.find('.sections .section:visible').outerHeight());}},fn:{create:function(context,config){if('$toolbar'in context.modules.toolbar){return;}
 208+context.modules.toolbar.$toolbar=$('<div />').addClass('wikiEditor-ui-toolbar').attr('id','wikiEditor-ui-toolbar');$.wikiEditor.modules.toolbar.fn.build(context,config);context.$ui.find('.wikiEditor-ui-top').append(context.modules.toolbar.$toolbar);},doAction:function(context,action,source){if($.trackAction!=undefined&&source.closest('.wikiEditor-ui-toolbar').size()){var rels=[];var step=source;var i=0;while(!step.hasClass('wikiEditor-ui-toolbar')){if(i>25){break;}
210209 i++;var rel=step.attr('rel');if(rel){rels.push(step.attr('rel'));}
211210 step=step.parent();}
212211 rels.reverse();var id=rels.join('.');$.trackAction(id);}
@@ -229,13 +228,13 @@
230229 return html;},buildRow:function(context,row){var html='<tr>';for(cell in row){html+='<td class="cell cell-'+cell+'" valign="top"><span>'+
231230 $.wikiEditor.autoMsg(row[cell],['html','text'])+'</span></td>';}
232231 html+='</tr>';return html;},buildCharacter:function(character,actions){if(typeof character=='string'){character={'label':character,'action':{'type':'encapsulate','options':{'pre':character}}};}else if(0 in character&&1 in character){character={'label':character[0],'action':{'type':'encapsulate','options':{'pre':character[1]}}};}
233 -if('action'in character&&'label'in character){actions[character.label]=character.action;return'<a rel="'+character.label+'" href="#">'+character.label+'</a>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).bind('mouseup',function(e){$(this).blur();}).bind('click',function(e){var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));var show=$section.css('display')=='none';$previousSections=$section.parent().find('.section:visible');var dH=$previousSections.outerHeight();$previousSections.css('position','absolute');$previousSections.fadeOut('fast',function(){$(this).css('position','relative');});$(this).parent().parent().find('a').removeClass('current');$sections.css('overflow','hidden');if(show){$section.fadeIn('fast');dH=$section.outerHeight()-dH;if(context.modules.$toc){context.modules.$toc.animate({'height':"+="+dH},$section.outerHeight()*2);}
234 -$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){$(this).css('overflow','visible').css('height','auto');});$(this).addClass('current');}else{$sections.css('height',$section.outerHeight()).animate({'height':0},$section.outerHeight()*2,function(){$(this).css('overflow','visible');});if(context.modules.$toc){context.modules.$toc.animate({'height':"-="+$section.outerHeight()},$section.outerHeight()*2);}}
 232+if('action'in character&&'label'in character){actions[character.label]=character.action;return'<a rel="'+character.label+'" href="#">'+character.label+'</a>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).bind('mouseup',function(e){$(this).blur();}).bind('click',function(e){var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));var show=$section.css('display')=='none';$previousSections=$section.parent().find('.section:visible');var dH=$previousSections.outerHeight();$previousSections.css('position','absolute');$previousSections.fadeOut('fast',function(){$(this).css('position','relative');});$(this).parent().parent().find('a').removeClass('current');$sections.css('overflow','hidden');if(show){$section.fadeIn('fast');dH=$section.outerHeight()-dH;if('toc'in context.modules){context.modules.toc.$toc.animate({'height':"+="+dH},$section.outerHeight()*2);}
 233+$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){$(this).css('overflow','visible').css('height','auto');});$(this).addClass('current');}else{$sections.css('height',$section.outerHeight()).animate({'height':0},$section.outerHeight()*2,function(){$(this).css('overflow','visible');});if('toc'in context.modules){context.modules.toc.$toc.animate({'height':"-="+$section.outerHeight()},$section.outerHeight()*2);}}
235234 if($.trackAction!=undefined){$.trackAction($section.attr('rel')+'.'+(show?'show':'hide'));}
236235 $.cookie('wikiEditor-'+$(this).data('context').instance+'-toolbar-section',show?$section.attr('rel'):null);return false;}));},buildSection:function(context,id,section){context.$textarea.trigger('wikiEditor-toolbar-buildSection-'+id,[section]);var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');var $section;switch(section.type){case'toolbar':var $section=$('<div />').attr({'class':'toolbar section section-'+id,'rel':id});if('groups'in section){for(group in section.groups){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,section.groups[group]));}}
237236 break;case'booklet':var $pages=$('<div />').addClass('pages');var $index=$('<div />').addClass('index');if('pages'in section){for(page in section.pages){$pages.append($.wikiEditor.modules.toolbar.fn.buildPage(context,page,section.pages[page]));$index.append($.wikiEditor.modules.toolbar.fn.buildBookmark(context,page,section.pages[page]));}}
238237 $section=$('<div />').attr({'class':'booklet section section-'+id,'rel':id}).append($index).append($pages);$.wikiEditor.modules.toolbar.fn.updateBookletSelection(context,page,$pages,$index);break;}
239238 if($section!==null&&id!=='main'){var show=selected==id;$section.css('display',show?'block':'none');}
240239 return $section;},updateBookletSelection:function(context,id,$pages,$index){var cookie='wikiEditor-'+context.instance+'-booklet-'+id+'-page';var selected=$.cookie(cookie);var $selectedIndex=$index.find('*[rel='+selected+']');if($selectedIndex.size()==0){selected=$index.children().eq(0).attr('rel');$.cookie(cookie,selected);}
241 -$pages.children().hide();$pages.find('*[rel='+selected+']').show();$index.children().removeClass('current');$selectedIndex.addClass('current');},build:function(context,config){var $tabs=$('<div />').addClass('tabs').appendTo(context.modules.$toolbar);var $sections=$('<div />').addClass('sections').appendTo(context.modules.$toolbar);context.modules.$toolbar.append($('<div />').css('clear','both'));var sectionQueue=[];for(section in config){if(section=='main'){context.modules.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,config[section]));}else{sectionQueue.push({'$sections':$sections,'context':context,'id':section,'config':config[section]});$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,config[section]));}}
242 -$.eachAsync(sectionQueue,{'bulk':0,'end':function(){$('body').css('position','static');$('body').css('position','relative');},'loop':function(i,s){s.$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(s.context,s.id,s.config));var $section=s.$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){if(context.modules.$toc){context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-left').outerHeight()-context.$ui.find('.tab-toc').outerHeight())}});}}});}}};})(jQuery);
\ No newline at end of file
 240+$pages.children().hide();$pages.find('*[rel='+selected+']').show();$index.children().removeClass('current');$selectedIndex.addClass('current');},build:function(context,config){var $tabs=$('<div />').addClass('tabs').appendTo(context.modules.toolbar.$toolbar);var $sections=$('<div />').addClass('sections').appendTo(context.modules.toolbar.$toolbar);context.modules.toolbar.$toolbar.append($('<div />').css('clear','both'));var sectionQueue=[];for(section in config){if(section=='main'){context.modules.toolbar.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,config[section]));}else{sectionQueue.push({'$sections':$sections,'context':context,'id':section,'config':config[section]});$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,config[section]));}}
 241+$.eachAsync(sectionQueue,{'bulk':0,'end':function(){$('body').css('position','static');$('body').css('position','relative');},'loop':function(i,s){s.$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(s.context,s.id,s.config));var $section=s.$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){if('toc'in context.modules){context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').outerHeight()-context.$ui.find('.tab-toc').outerHeight())}});}}});}}};})(jQuery);
\ No newline at end of file

Status & tagging log