r55173 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55172‎ | r55173 | r55174 >
Date:10:57, 17 August 2009
Author:catrope
Status:deferred
Tags:
Comment:
NavigableTOC: Fix section link structuring bug
Modified paths:
  • /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/js/plugins/jquery.wikiEditor.toc.js
@@ -187,7 +187,7 @@
188188 break;
189189 }
190190 }
191 - // Use the lowest common denominator as the actual level
 191+ // Use the lowest number of =s as the actual level
192192 var level = Math.min( startLevel, endLevel );
193193 text = $.trim( text.substr( level, text.length - ( level * 2 ) ) );
194194 // Add the heading data to the outline
@@ -212,7 +212,7 @@
213213 nLevel -= Math.max( 1, lastLevel - outline[i].level );
214214 }
215215 outline[i].nLevel = nLevel;
216 - lastLevel = nLevel;
 216+ lastLevel = outline[i].level;
217217 }
218218 // Recursively build the structure and add special item for
219219 // section 0, if needed
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -867,7 +867,7 @@
868868 break;
869869 }
870870 }
871 - // Use the lowest common denominator as the actual level
 871+ // Use the lowest number of =s as the actual level
872872 var level = Math.min( startLevel, endLevel );
873873 text = $.trim( text.substr( level, text.length - ( level * 2 ) ) );
874874 // Add the heading data to the outline
@@ -892,7 +892,7 @@
893893 nLevel -= Math.max( 1, lastLevel - outline[i].level );
894894 }
895895 outline[i].nLevel = nLevel;
896 - lastLevel = nLevel;
 896+ lastLevel = outline[i].level;
897897 }
898898 // Recursively build the structure and add special item for
899899 // section 0, if needed
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -68,7 +68,7 @@
6969 var level=Math.min(startLevel,endLevel);text=$.trim(text.substr(level,text.length-(level*2)));outline[h]={'text':text,'position':position,'level':level,'index':h+1};}
7070 var lastLevel=0;var nLevel=0;for(var i=0;i<outline.length;i++){if(outline[i].level>lastLevel){nLevel++;}
7171 else if(outline[i].level<lastLevel){nLevel-=Math.max(1,lastLevel-outline[i].level);}
72 -outline[i].nLevel=nLevel;lastLevel=nLevel;}
 72+outline[i].nLevel=nLevel;lastLevel=outline[i].level;}
7373 var structure=buildStructure(outline);if($('input[name=wpSection]').val()=='')
7474 structure.unshift({'text':wgPageName.replace(/_/g,' '),'level':1,'index':0,'position':0});context.modules.$toc.html(buildList(structure));context.data.outline=outline;}}};})(jQuery);(function($){$.wikiEditor.modules.toolbar={imgPath:wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/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;}
7575 $sections.append($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,data[type][section]));}

Status & tagging log