r60991 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60990‎ | r60991 | r60992 >
Date:22:35, 12 January 2010
Author:adam
Status:ok
Tags:
Comment:
NTOC - Repaired updating highlighted section on cursor move
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.toc.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -88,16 +88,16 @@
8989 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 12 ),
9090 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 40 ),
9191 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 10 ),
92 - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 58 ),
 92+ array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 59 ),
9393 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 9 ),
9494 array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 14 ),
9595 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 1 ),
9696 ),
9797 'combined' => array(
98 - array( 'src' => 'js/plugins.combined.js', 'version' => 137 ),
 98+ array( 'src' => 'js/plugins.combined.js', 'version' => 138 ),
9999 ),
100100 'minified' => array(
101 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 137 ),
 101+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 138 ),
102102 ),
103103 ),
104104 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js
@@ -22,6 +22,9 @@
2323 * Event handlers
2424 */
2525 evt: {
 26+ change: function( context, event ) {
 27+ $.wikiEditor.modules.toc.fn.update( context );
 28+ },
2629 ready: function( context, event ) {
2730 // Add the TOC to the document
2831 $.wikiEditor.modules.toc.fn.build( context );
@@ -145,7 +148,8 @@
146149 * @param {Object} event Event object with context as data
147150 */
148151 collapse: function( event ) {
149 - var $this = $( this ), context = $this.data( 'context' ),
 152+ var $this = $( this ),
 153+ context = $this.data( 'context' ),
150154 pT = $this.parent().position().top - 1;
151155 $this.parent()
152156 .css( {
@@ -247,7 +251,7 @@
248252 .addClass( 'section-' + structure[i].index )
249253 .data( 'wrapper', wrapper )
250254 .click( function( event ) {
251 - context.fn.scrollToTop( $(this).data( 'wrapper' ) );
 255+ context.fn.scrollToTop( $( this ).data( 'wrapper' ) );
252256 context.$textarea.textSelection( 'setSelection', {
253257 'start': 0,
254258 'startContainer': $(this).data( 'wrapper' )
@@ -255,7 +259,7 @@
256260
257261 // Highlight the clicked link
258262 $.wikiEditor.modules.toc.fn.unhighlight( context );
259 - $(this).addClass( 'current' );
 263+ $( this ).addClass( 'current' );
260264
261265 if ( typeof $.trackAction != 'undefined' )
262266 $.trackAction( 'ntoc.heading' );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -8352,6 +8352,9 @@
83538353 * Event handlers
83548354 */
83558355 evt: {
 8356+ change: function( context, event ) {
 8357+ $.wikiEditor.modules.toc.fn.update( context );
 8358+ },
83568359 ready: function( context, event ) {
83578360 // Add the TOC to the document
83588361 $.wikiEditor.modules.toc.fn.build( context );
@@ -8475,7 +8478,8 @@
84768479 * @param {Object} event Event object with context as data
84778480 */
84788481 collapse: function( event ) {
8479 - var $this = $( this ), context = $this.data( 'context' ),
 8482+ var $this = $( this ),
 8483+ context = $this.data( 'context' ),
84808484 pT = $this.parent().position().top - 1;
84818485 $this.parent()
84828486 .css( {
@@ -8577,7 +8581,7 @@
85788582 .addClass( 'section-' + structure[i].index )
85798583 .data( 'wrapper', wrapper )
85808584 .click( function( event ) {
8581 - context.fn.scrollToTop( $(this).data( 'wrapper' ) );
 8585+ context.fn.scrollToTop( $( this ).data( 'wrapper' ) );
85828586 context.$textarea.textSelection( 'setSelection', {
85838587 'start': 0,
85848588 'startContainer': $(this).data( 'wrapper' )
@@ -8585,7 +8589,7 @@
85868590
85878591 // Highlight the clicked link
85888592 $.wikiEditor.modules.toc.fn.unhighlight( context );
8589 - $(this).addClass( 'current' );
 8593+ $( this ).addClass( 'current' );
85908594
85918595 if ( typeof $.trackAction != 'undefined' )
85928596 $.trackAction( 'ntoc.heading' );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -553,7 +553,7 @@
554554 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;valueBegin=currentValue.match(/\S+/);if(valueBegin==null){continue;}
555555 valueBeginIndex=valueBegin.index+oldDivider+1;valueEnd=currentValue.match(/[^\s]\s*$/);if(valueEnd==null){continue;}
556556 valueEndIndex=valueEnd.index+oldDivider+2;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;}}
557 -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={cfg:{defaultWidth:'166px',minimumWidth:'70px',rtl:false},api:{},evt:{ready:function(context,event){$.wikiEditor.modules.toc.fn.build(context);context.$content.parent().blur(function(event){var context=event.data.context;$.wikiEditor.modules.toc.fn.unhighlight(context);});},resize:function(context,event){context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height()-
 557+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={cfg:{defaultWidth:'166px',minimumWidth:'70px',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(event){var context=event.data.context;$.wikiEditor.modules.toc.fn.unhighlight(context);});},resize:function(context,event){context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height()-
558558 context.$ui.find('.tab-toc').outerHeight());},mark:function(context,event){var markers=context.modules.highlight.markers;var tokenArray=context.modules.highlight.tokenArray;var outline=context.data.outline=[];var h=0;for(var i=0;i<tokenArray.length;i++){if(tokenArray[i].label!='TOC_HEADER'){continue;}
559559 h++;markers.push({index:h,start:tokenArray[i].tokenStart,end:tokenArray[i].offset,afterWrap:function(node){var marker=$(node).data('marker');$(node).addClass('wikiEditor-toc-header').addClass('wikiEditor-toc-section-'+marker.index).data('section',marker.index);},getWrapper:function(ca1,ca2){return $(ca1.parentNode).is('div.wikiEditor-toc-header')&&ca1.previousSibling==null&&ca1.nextSibling==null?ca1.parentNode:null;}});outline.push({'text':tokenArray[i].match[2],'level':tokenArray[i].match[1].length,'index':h});}
560560 $.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}},exp:[{'regex':/^(={1,6})(.+?)\1\s*$/m,'label':'TOC_HEADER','markAfter':true}],fn:{create:function(context,config){if('$toc'in context.modules.toc){return;}

Status & tagging log