Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -59,13 +59,13 @@ |
60 | 60 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 9 ), |
61 | 61 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 4 ), |
62 | 62 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 10 ), |
63 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 4 ), |
| 63 | + array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 5 ), |
64 | 64 | ), |
65 | 65 | 'combined' => array( |
66 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 14 ), |
| 66 | + array( 'src' => 'js/plugins.combined.js', 'version' => 15 ), |
67 | 67 | ), |
68 | 68 | 'minified' => array( |
69 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 14 ), |
| 69 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 15 ), |
70 | 70 | ), |
71 | 71 | ), |
72 | 72 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js |
— | — | @@ -214,11 +214,16 @@ |
215 | 215 | outline[i].nLevel = nLevel; |
216 | 216 | lastLevel = nLevel; |
217 | 217 | } |
218 | | - // Recursively build the structure and adds special item for section 0 |
| 218 | + // Recursively build the structure and add special item for |
| 219 | + // section 0, if needed |
219 | 220 | var structure = buildStructure( outline ); |
220 | | - structure.unshift( |
221 | | - { 'text': wgPageName.replace(/_/g, ' '), 'level': 1, 'index': 0, 'position': 0 } |
222 | | - ); |
| 221 | + if ( $( 'input[name=wpSection]' ).val() == '' ) |
| 222 | + structure.unshift( { |
| 223 | + 'text': wgPageName.replace(/_/g, ' '), |
| 224 | + 'level': 1, |
| 225 | + 'index': 0, |
| 226 | + 'position': 0 |
| 227 | + }); |
223 | 228 | context.modules.$toc.html( buildList( structure ) ); |
224 | 229 | // Cache the outline for later use |
225 | 230 | context.data.outline = outline; |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -894,11 +894,16 @@ |
895 | 895 | outline[i].nLevel = nLevel; |
896 | 896 | lastLevel = nLevel; |
897 | 897 | } |
898 | | - // Recursively build the structure and adds special item for section 0 |
| 898 | + // Recursively build the structure and add special item for |
| 899 | + // section 0, if needed |
899 | 900 | var structure = buildStructure( outline ); |
900 | | - structure.unshift( |
901 | | - { 'text': wgPageName.replace(/_/g, ' '), 'level': 1, 'index': 0, 'position': 0 } |
902 | | - ); |
| 901 | + if ( $( 'input[name=wpSection]' ).val() == '' ) |
| 902 | + structure.unshift( { |
| 903 | + 'text': wgPageName.replace(/_/g, ' '), |
| 904 | + 'level': 1, |
| 905 | + 'index': 0, |
| 906 | + 'position': 0 |
| 907 | + }); |
903 | 908 | context.modules.$toc.html( buildList( structure ) ); |
904 | 909 | // Cache the outline for later use |
905 | 910 | context.data.outline = outline; |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -69,7 +69,8 @@ |
70 | 70 | var lastLevel=0;var nLevel=0;for(var i=0;i<outline.length;i++){if(outline[i].level>lastLevel){nLevel++;} |
71 | 71 | else if(outline[i].level<lastLevel){nLevel-=Math.max(1,lastLevel-outline[i].level);} |
72 | 72 | outline[i].nLevel=nLevel;lastLevel=nLevel;} |
73 | | -var structure=buildStructure(outline);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;} |
| 73 | +var structure=buildStructure(outline);if($('input[name=wpSection]').val()=='') |
| 74 | +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;} |
74 | 75 | $sections.append($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,data[type][section]));} |
75 | 76 | break;case'groups':if(!('section'in data)){continue;} |
76 | 77 | 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]));} |