r58424 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58423‎ | r58424 | r58425 >
Date:10:22, 2 November 2009
Author:catrope
Status:deferred
Tags:
Comment:
NavigableTOC: Make sure the left/right arrow hidden while the NTOC is being collapsed/expanded so it doesn't jump up and down. Also fix coding style in that area
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' => 18 ),
7575 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 8 ),
76 - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 24 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 25 ),
7777 ),
7878 'combined' => array(
79 - array( 'src' => 'js/plugins.combined.js', 'version' => 56 ),
 79+ array( 'src' => 'js/plugins.combined.js', 'version' => 57 ),
8080 ),
8181 'minified' => array(
82 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 56 ),
 82+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 57 ),
8383 ),
8484 ),
8585 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js
@@ -166,29 +166,31 @@
167167 .addClass( 'wikiEditor-ui-toc-collapse-open' )
168168 .attr( 'id', 'wikiEditor-ui-toc-collapse' )
169169 .data( 'oWidth', $.wikiEditor.modules.toc.defaults.width)
170 - .bind('mouseup', function(){
 170+ .bind( 'mouseup', function() {
171171 var $e = $(this);
172 - var close = $e.hasClass('wikiEditor-ui-toc-collapse-open');
173 - if(close) {
 172+ var close = $e.hasClass( 'wikiEditor-ui-toc-collapse-open' );
 173+ if( close ) {
 174+ $( '#wikiEditor-ui-toc-collapse' )
 175+ .removeClass( 'wikiEditor-ui-toc-collapse-open' );
174176 $e.parent()
175 - .animate( {'width': $e.outerWidth()}, 'fast', function() {
176 - $(this).find('ul:first').hide();
 177+ .animate( { 'width': $e.outerWidth() }, 'fast', function() {
 178+ $(this).find( 'ul:first' ).hide();
177179 } )
178180 .prev()
179 - .animate( {'marginRight': $e.outerWidth() + 1 }, 'fast', function(){
180 - $('#wikiEditor-ui-toc-collapse')
181 - .removeClass('wikiEditor-ui-toc-collapse-open')
182 - .addClass('wikiEditor-ui-toc-collapse-closed');
 181+ .animate( { 'marginRight': $e.outerWidth() + 1 }, 'fast', function() {
 182+ $( '#wikiEditor-ui-toc-collapse' )
 183+ .addClass( 'wikiEditor-ui-toc-collapse-closed' );
183184 });
184185 } else {
 186+ $( '#wikiEditor-ui-toc-collapse' )
 187+ .removeClass( 'wikiEditor-ui-toc-collapse-closed' );
185188 $e.siblings().show()
186189 .parent()
187 - .animate( {'width': $e.data('oWidth')}, 'fast' )
 190+ .animate( { 'width': $e.data('oWidth') }, 'fast' )
188191 .prev()
189 - .animate( {'marginRight': $e.data('oWidth')}, 'fast', function(){
190 - $('#wikiEditor-ui-toc-collapse')
191 - .removeClass('wikiEditor-ui-toc-collapse-closed')
192 - .addClass('wikiEditor-ui-toc-collapse-open');
 192+ .animate( { 'marginRight': $e.data('oWidth') }, 'fast', function() {
 193+ $( '#wikiEditor-ui-toc-collapse' )
 194+ .addClass( 'wikiEditor-ui-toc-collapse-open' );
193195 });
194196 }
195197
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -2393,29 +2393,31 @@
23942394 .addClass( 'wikiEditor-ui-toc-collapse-open' )
23952395 .attr( 'id', 'wikiEditor-ui-toc-collapse' )
23962396 .data( 'oWidth', $.wikiEditor.modules.toc.defaults.width)
2397 - .bind('mouseup', function(){
 2397+ .bind( 'mouseup', function() {
23982398 var $e = $(this);
2399 - var close = $e.hasClass('wikiEditor-ui-toc-collapse-open');
2400 - if(close) {
 2399+ var close = $e.hasClass( 'wikiEditor-ui-toc-collapse-open' );
 2400+ if( close ) {
 2401+ $( '#wikiEditor-ui-toc-collapse' )
 2402+ .removeClass( 'wikiEditor-ui-toc-collapse-open' );
24012403 $e.parent()
2402 - .animate( {'width': $e.outerWidth()}, 'fast', function() {
2403 - $(this).find('ul:first').hide();
 2404+ .animate( { 'width': $e.outerWidth() }, 'fast', function() {
 2405+ $(this).find( 'ul:first' ).hide();
24042406 } )
24052407 .prev()
2406 - .animate( {'marginRight': $e.outerWidth() + 1 }, 'fast', function(){
2407 - $('#wikiEditor-ui-toc-collapse')
2408 - .removeClass('wikiEditor-ui-toc-collapse-open')
2409 - .addClass('wikiEditor-ui-toc-collapse-closed');
 2408+ .animate( { 'marginRight': $e.outerWidth() + 1 }, 'fast', function() {
 2409+ $( '#wikiEditor-ui-toc-collapse' )
 2410+ .addClass( 'wikiEditor-ui-toc-collapse-closed' );
24102411 });
24112412 } else {
 2413+ $( '#wikiEditor-ui-toc-collapse' )
 2414+ .removeClass( 'wikiEditor-ui-toc-collapse-closed' );
24122415 $e.siblings().show()
24132416 .parent()
2414 - .animate( {'width': $e.data('oWidth')}, 'fast' )
 2417+ .animate( { 'width': $e.data('oWidth') }, 'fast' )
24152418 .prev()
2416 - .animate( {'marginRight': $e.data('oWidth')}, 'fast', function(){
2417 - $('#wikiEditor-ui-toc-collapse')
2418 - .removeClass('wikiEditor-ui-toc-collapse-closed')
2419 - .addClass('wikiEditor-ui-toc-collapse-open');
 2419+ .animate( { 'marginRight': $e.data('oWidth') }, 'fast', function() {
 2420+ $( '#wikiEditor-ui-toc-collapse' )
 2421+ .addClass( 'wikiEditor-ui-toc-collapse-open' );
24202422 });
24212423 }
24222424
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -154,7 +154,7 @@
155155 div.html('&nbsp;');var item=$('<li></li>').append(div);if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));}
156156 list.append(item);}
157157 return list;}
158 -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;}
 158+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){$('#wikiEditor-ui-toc-collapse').removeClass('wikiEditor-ui-toc-collapse-open');$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').addClass('wikiEditor-ui-toc-collapse-closed');});}else{$('#wikiEditor-ui-toc-collapse').removeClass('wikiEditor-ui-toc-collapse-closed');$e.siblings().show().parent().animate({'width':$e.data('oWidth')},'fast').prev().animate({'marginRight':$e.data('oWidth')},'fast',function(){$('#wikiEditor-ui-toc-collapse').addClass('wikiEditor-ui-toc-collapse-open');});}});return $collapseBar;}
159159 var outline=[];var wikitext=$.wikiEditor.fixOperaBrokenness(context.$textarea.val());var headings=wikitext.match(/^={1,6}[^=\n][^\n]*={1,6}\s*$/gm);var offset=0;headings=$.makeArray(headings);for(var h=0;h<headings.length;h++){text=$.trim(headings[h]);var position=wikitext.indexOf(text,offset);if(position>=offset){offset=position+text.length;}else if(position==-1){continue;}
160160 var startLevel=0;for(var c=0;c<text.length;c++){if(text.charAt(c)=='='){startLevel++;}else{break;}}
161161 var endLevel=0;for(var c=text.length-1;c>=0;c--){if(text.charAt(c)=='='){endLevel++;}else{break;}}

Status & tagging log