r58374 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58373‎ | r58374 | r58375 >
Date:20:19, 30 October 2009
Author:catrope
Status:deferred
Tags:
Comment:
NavigableTOC: (bug 21177) Empty headers show up weird (very small height)
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
@@ -72,13 +72,13 @@
7373 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 12 ),
7474 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 17 ),
7575 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 7 ),
76 - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 23 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 24 ),
7777 ),
7878 'combined' => array(
79 - array( 'src' => 'js/plugins.combined.js', 'version' => 54 ),
 79+ array( 'src' => 'js/plugins.combined.js', 'version' => 55 ),
8080 ),
8181 'minified' => array(
82 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 54 ),
 82+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 55 ),
8383 ),
8484 ),
8585 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js
@@ -136,24 +136,24 @@
137137 function buildList( structure ) {
138138 var list = $( '<ul></ul>' );
139139 for ( i in structure ) {
140 - var item = $( '<li></li>' )
141 - .append(
142 - $( '<div></div>' )
143 - .attr( 'href', '#' )
144 - .addClass( 'section-' + structure[i].index )
145 - .data( 'textbox', context.$textarea )
146 - .data( 'position', structure[i].position )
147 - .bind( 'mousedown', function( event ) {
148 - $(this).data( 'textbox' )
149 - .focus()
150 - .setSelection( $(this).data( 'position' ) )
151 - .scrollToCaretPosition( true );
152 - if ( typeof $.trackAction != 'undefined' )
153 - $.trackAction( 'ntoc.heading' );
154 - event.preventDefault();
155 - } )
156 - .text( structure[i].text )
157 - );
 140+ var div = $( '<div></div>' )
 141+ .attr( 'href', '#' )
 142+ .addClass( 'section-' + structure[i].index )
 143+ .data( 'textbox', context.$textarea )
 144+ .data( 'position', structure[i].position )
 145+ .bind( 'mousedown', function( event ) {
 146+ $(this).data( 'textbox' )
 147+ .focus()
 148+ .setSelection( $(this).data( 'position' ) )
 149+ .scrollToCaretPosition( true );
 150+ if ( typeof $.trackAction != 'undefined' )
 151+ $.trackAction( 'ntoc.heading' );
 152+ event.preventDefault();
 153+ } )
 154+ .text( structure[i].text );
 155+ if ( structure[i].text == '' )
 156+ div.html( '&nbsp;' );
 157+ var item = $( '<li></li>' ).append( div );
158158 if ( structure[i].sections !== undefined ) {
159159 item.append( buildList( structure[i].sections ) );
160160 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -2363,24 +2363,24 @@
23642364 function buildList( structure ) {
23652365 var list = $( '<ul></ul>' );
23662366 for ( i in structure ) {
2367 - var item = $( '<li></li>' )
2368 - .append(
2369 - $( '<div></div>' )
2370 - .attr( 'href', '#' )
2371 - .addClass( 'section-' + structure[i].index )
2372 - .data( 'textbox', context.$textarea )
2373 - .data( 'position', structure[i].position )
2374 - .bind( 'mousedown', function( event ) {
2375 - $(this).data( 'textbox' )
2376 - .focus()
2377 - .setSelection( $(this).data( 'position' ) )
2378 - .scrollToCaretPosition( true );
2379 - if ( typeof $.trackAction != 'undefined' )
2380 - $.trackAction( 'ntoc.heading' );
2381 - event.preventDefault();
2382 - } )
2383 - .text( structure[i].text )
2384 - );
 2367+ var div = $( '<div></div>' )
 2368+ .attr( 'href', '#' )
 2369+ .addClass( 'section-' + structure[i].index )
 2370+ .data( 'textbox', context.$textarea )
 2371+ .data( 'position', structure[i].position )
 2372+ .bind( 'mousedown', function( event ) {
 2373+ $(this).data( 'textbox' )
 2374+ .focus()
 2375+ .setSelection( $(this).data( 'position' ) )
 2376+ .scrollToCaretPosition( true );
 2377+ if ( typeof $.trackAction != 'undefined' )
 2378+ $.trackAction( 'ntoc.heading' );
 2379+ event.preventDefault();
 2380+ } )
 2381+ .text( structure[i].text );
 2382+ if ( structure[i].text == '' )
 2383+ div.html( '&nbsp;' );
 2384+ var item = $( '<li></li>' ).append( div );
23852385 if ( structure[i].sections !== undefined ) {
23862386 item.append( buildList( structure[i].sections ) );
23872387 }
@@ -2402,7 +2402,7 @@
24032403 $(this).find('ul:first').hide();
24042404 } )
24052405 .prev()
2406 - .animate( {'marginRight': $e.outerWidth()+1}, 'fast', function(){
 2406+ .animate( {'marginRight': $e.outerWidth() + 1 }, 'fast', function(){
24072407 $('#wikiEditor-ui-toc-collapse')
24082408 .removeClass('wikiEditor-ui-toc-collapse-open')
24092409 .addClass('wikiEditor-ui-toc-collapse-closed');
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -149,8 +149,9 @@
150150 context.modules.$toc.scrollTop(scrollTop+relTop+sectionHeight-divHeight);}},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;}
151151 sections[sections.length]=outline[i];}else if(outline[i].nLevel<level){break;}}
152152 return sections;}
153 -function buildList(structure){var list=$('<ul></ul>');for(i in structure){var item=$('<li></li>').append($('<div></div>').attr('href','#').addClass('section-'+structure[i].index).data('textbox',context.$textarea).data('position',structure[i].position).bind('mousedown',function(event){$(this).data('textbox').focus().setSelection($(this).data('position')).scrollToCaretPosition(true);if(typeof $.trackAction!='undefined')
154 -$.trackAction('ntoc.heading');event.preventDefault();}).text(structure[i].text));if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));}
 153+function buildList(structure){var list=$('<ul></ul>');for(i in structure){var div=$('<div></div>').attr('href','#').addClass('section-'+structure[i].index).data('textbox',context.$textarea).data('position',structure[i].position).bind('mousedown',function(event){$(this).data('textbox').focus().setSelection($(this).data('position')).scrollToCaretPosition(true);if(typeof $.trackAction!='undefined')
 154+$.trackAction('ntoc.heading');event.preventDefault();}).text(structure[i].text);if(structure[i].text=='')
 155+div.html('&nbsp;');var item=$('<li></li>').append(div);if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));}
155156 list.append(item);}
156157 return list;}
157158 function buildCollapseBar(){var $collapseBar=$('<div />').addClass('wikiEditor-ui-toc-collapse-open').attr('id','wikiEditor-ui-toc-collapse').data('oWidth',$.wikiEditor.modules.toc.defaults.width).bind('mouseup',function(){var $e=$(this);var close=$e.hasClass('wikiEditor-ui-toc-collapse-open');if(close){$e.parent().animate({'width':$e.outerWidth()},'fast',function(){$(this).find('ul:first').hide();}).prev().animate({'marginRight':$e.outerWidth()+1},'fast',function(){$('#wikiEditor-ui-toc-collapse').removeClass('wikiEditor-ui-toc-collapse-open').addClass('wikiEditor-ui-toc-collapse-closed');});}else{$e.siblings().show().parent().animate({'width':$e.data('oWidth')},'fast').prev().animate({'marginRight':$e.data('oWidth')},'fast',function(){$('#wikiEditor-ui-toc-collapse').removeClass('wikiEditor-ui-toc-collapse-closed').addClass('wikiEditor-ui-toc-collapse-open');});}});return $collapseBar;}

Follow-up revisions

RevisionCommit summaryAuthorDate
r59204wmf-deployment: Merging usability changes from trunk...catrope18:53, 18 November 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r57906NavigableTOC: (bug 21177) Empty headers (like "====") treated weird. The NTOC...catrope18:28, 19 October 2009

Status & tagging log