Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -155,7 +155,7 @@ |
156 | 156 | array( |
157 | 157 | 'src' => 'js/plugins/jquery.wikiEditor.toc.js', |
158 | 158 | 'class' => 'j.wikiEditor.modules.toc', |
159 | | - 'version' => 70 |
| 159 | + 'version' => 71 |
160 | 160 | ), |
161 | 161 | array( |
162 | 162 | 'src' => 'js/plugins/jquery.wikiEditor.preview.js', |
— | — | @@ -173,10 +173,10 @@ |
174 | 174 | 'version' => 1 ), |
175 | 175 | ), |
176 | 176 | 'combined' => array( |
177 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 173 ), |
| 177 | + array( 'src' => 'js/plugins.combined.js', 'version' => 172 ), |
178 | 178 | ), |
179 | 179 | 'minified' => array( |
180 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 173 ), |
| 180 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 172 ), |
181 | 181 | ), |
182 | 182 | ), |
183 | 183 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js |
— | — | @@ -242,7 +242,11 @@ |
243 | 243 | } |
244 | 244 | }, |
245 | 245 | unhighlight: function( context ) { |
246 | | - context.modules.toc.$toc.find( 'div' ).removeClass( 'current' ); |
| 246 | + // FIXME: In IE, sometimes the context is undefined here - investigate this when you have time please! In the |
| 247 | + // mean time, the user interaction is working just fine |
| 248 | + if ( context ) { |
| 249 | + context.modules.toc.$toc.find( 'div' ).removeClass( 'current' ); |
| 250 | + } |
247 | 251 | }, |
248 | 252 | /** |
249 | 253 | * Highlight the section the cursor is currently within |
— | — | @@ -398,7 +402,6 @@ |
399 | 403 | 'start': 0, |
400 | 404 | 'startContainer': $(this).data( 'wrapper' ) |
401 | 405 | } ); |
402 | | - |
403 | 406 | // Highlight the clicked link |
404 | 407 | $.wikiEditor.modules.toc.fn.unhighlight( context ); |
405 | 408 | $( this ).addClass( 'current' ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -8134,6 +8134,7 @@ |
8135 | 8135 | $( this ).html() |
8136 | 8136 | .replace( /\{\{/, '<span class="wikiEditor-template-start">{{</span><span class="wikiEditor-template-inner-text">' ) |
8137 | 8137 | .replace( /\}\}$/, '</span><span class="wikiEditor-template-end">}}</span>' ) ) //grab the *last* {{ |
| 8138 | + .css('visibility', 'hidden') |
8138 | 8139 | .parent() |
8139 | 8140 | .addClass( 'wikiEditor-template-collapsed' ) |
8140 | 8141 | .data( 'model', model ); |
— | — | @@ -8157,8 +8158,7 @@ |
8158 | 8159 | .append( $( '<span>F</span>' ) ) |
8159 | 8160 | .mousedown( function(){createDialog($template); return false;} )); |
8160 | 8161 | |
8161 | | - |
8162 | | - |
| 8162 | + |
8163 | 8163 | // Expand |
8164 | 8164 | function expandTemplate( $displayDiv ) { |
8165 | 8165 | // Housekeeping |
— | — | @@ -8515,7 +8515,7 @@ |
8516 | 8516 | doneParsing = true; |
8517 | 8517 | } |
8518 | 8518 | nameMatch = sanatizedStr.substring( 0, divider ).match( /[^\s]/ ); |
8519 | | - if ( nameMatch != undefined ) { |
| 8519 | + if ( nameMatch != null ) { |
8520 | 8520 | ranges.push( new Range( 0 ,nameMatch.index ) ); //whitespace and squiggles upto the name |
8521 | 8521 | nameEndMatch = sanatizedStr.substring( 0 , divider ).match( /[^\s]\s*$/ ); //last nonwhitespace character |
8522 | 8522 | templateNameIndex = ranges.push( new Range( nameMatch.index, |
— | — | @@ -8524,6 +8524,10 @@ |
8525 | 8525 | ranges[templateNameIndex].old = wikitext.substring( ranges[templateNameIndex].begin, |
8526 | 8526 | ranges[templateNameIndex].end ); |
8527 | 8527 | } |
| 8528 | + else{ |
| 8529 | + ranges.push(new Range(0,0)); |
| 8530 | + ranges[templateNameIndex].old = ""; |
| 8531 | + } |
8528 | 8532 | params.push( ranges[templateNameIndex].old ); //put something in params (0) |
8529 | 8533 | /* |
8530 | 8534 | * Start looping over params |
— | — | @@ -8871,7 +8875,11 @@ |
8872 | 8876 | } |
8873 | 8877 | }, |
8874 | 8878 | unhighlight: function( context ) { |
8875 | | - context.modules.toc.$toc.find( 'div' ).removeClass( 'current' ); |
| 8879 | + // FIXME: In IE, sometimes the context is undefined here - investigate this when you have time please! In the |
| 8880 | + // mean time, the user interaction is working just fine |
| 8881 | + if ( context ) { |
| 8882 | + context.modules.toc.$toc.find( 'div' ).removeClass( 'current' ); |
| 8883 | + } |
8876 | 8884 | }, |
8877 | 8885 | /** |
8878 | 8886 | * Highlight the section the cursor is currently within |
— | — | @@ -9027,7 +9035,6 @@ |
9028 | 9036 | 'start': 0, |
9029 | 9037 | 'startContainer': $(this).data( 'wrapper' ) |
9030 | 9038 | } ); |
9031 | | - |
9032 | 9039 | // Highlight the clicked link |
9033 | 9040 | $.wikiEditor.modules.toc.fn.unhighlight( context ); |
9034 | 9041 | $( this ).addClass( 'current' ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -544,7 +544,7 @@ |
545 | 545 | $('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.templateEditor={evt:{mark:function(context,event){var markers=context.modules.highlight.markers;var tokenArray=context.modules.highlight.tokenArray;var level=0;var tokenIndex=0;while(tokenIndex<tokenArray.length){while(tokenIndex<tokenArray.length&&tokenArray[tokenIndex].label!='TEMPLATE_BEGIN'){tokenIndex++;} |
546 | 546 | if(tokenIndex<tokenArray.length){var beginIndex=tokenIndex;var endIndex=-1;var openTemplates=1;var templatesMatched=false;while(tokenIndex<tokenArray.length-1&&endIndex==-1){tokenIndex++;if(tokenArray[tokenIndex].label=='TEMPLATE_BEGIN'){openTemplates++;}else if(tokenArray[tokenIndex].label=='TEMPLATE_END'){openTemplates--;if(openTemplates==0){endIndex=tokenIndex;}}} |
547 | 547 | if(endIndex!=-1){markers.push({start:tokenArray[beginIndex].offset,end:tokenArray[endIndex].offset,anchor:'wrap',afterWrap:$.wikiEditor.modules.templateEditor.fn.stylize,beforeUnwrap:function(node){$(node).data('display').remove();},onSkip:function(){},getAnchor:function(ca1,ca2){return $(ca1.parentNode).is('div.wikiEditor-template-text')&&$(ca1.parentNode.previousSibling).is('ul.wikiEditor-template-modes')&&ca1.parentNode.nextSibling==null?ca1.parentNode:null;}});}else{tokenArray[beginIndex].label='TEMPLATE_FALSE_BEGIN';tokenIndex=beginIndex;}}}}},exp:[{'regex':/{{/,'label':"TEMPLATE_BEGIN"},{'regex':/}}/,'label':"TEMPLATE_END",'markAfter':true}],cfg:{},fn:{create:function(context,config){context.modules.templateEditor={};},stylize:function(wrappedTemplate){$(wrappedTemplate).each(function(){if(typeof $(this).data('model')!='undefined'){return;} |
548 | | -var model=new $.wikiEditor.modules.templateEditor.fn.model($(this).text());var $template=$(this).wrap('<div class="wikiEditor-template"></div>').addClass('wikiEditor-template-text wikiEditor-nodisplay').html($(this).html().replace(/\{\{/,'<span class="wikiEditor-template-start">{{</span><span class="wikiEditor-template-inner-text">').replace(/\}\}$/,'</span><span class="wikiEditor-template-end">}}</span>')).parent().addClass('wikiEditor-template-collapsed').data('model',model);$('<span />').addClass('wikiEditor-template-name wikiEditor-noinclude').text(model.getName()).mousedown(noEdit).prependTo($template);$template.find('.wikiEditor-template-end, .wikiEditor-template-start').mousedown(toggleWikiText);var $options=$('<ul />').addClass('wikiEditor-template-modes wikiEditor-noinclude').append($('<li />').addClass('wikiEditor-template-action-wikiText').append($('<img />').attr('src',$.wikiEditor.imgPath+'templateEditor/'+'wiki-text.png')).mousedown(toggleWikiText)).insertAfter($template.find('.wikiEditor-template-name'));$options.append($('<li />').addClass('wikiEditor-template-action-form').append($('<span>F</span>')).mousedown(function(){createDialog($template);return false;}));function expandTemplate($displayDiv){$displayDiv.removeClass('wikiEditor-template-collapsed');$displayDiv.addClass('wikiEditor-template-expanded');$displayDiv.unbind('mousedown');$keyValueTable=$('<table />').appendTo($displayDiv);$header_row=$('<tr />').appendTo($keyValueTable);$('<th />').attr('colspan','2').text(model.getName()).appendTo($header_row);for(param in model.getAllParamNames()){$keyVal_row=$('<tr />').appendTo($keyValueTable);$('<td />').text(param).appendTo($keyVal_row);$('<td />').text(model.getValue(param)).appendTo($keyVal_row);}};function collapseTemplate($displayDiv){$displayDiv.addClass('wikiEditor-template-collapsed');$displayDiv.removeClass('wikiEditor-template-expanded');$displayDiv.text(model.getName());};function createDialog($templateDiv){var templateModel=$templateDiv.data('model');var $dialog=$("<div></div>");var $title=$("<div>"+templateModel.getName()+"</div>").addClass('wikiEditor-template-dialog-title');var $table=$("<table></table>").addClass('wikiEditor-template-dialog-table').appendTo($dialog);var allInitialParams=templateModel.getAllInitialParams();for(var paramIndex in allInitialParams){var param=allInitialParams[paramIndex];if(typeof param.name=='undefined'){continue;} |
| 548 | +var model=new $.wikiEditor.modules.templateEditor.fn.model($(this).text());var $template=$(this).wrap('<div class="wikiEditor-template"></div>').addClass('wikiEditor-template-text wikiEditor-nodisplay').html($(this).html().replace(/\{\{/,'<span class="wikiEditor-template-start">{{</span><span class="wikiEditor-template-inner-text">').replace(/\}\}$/,'</span><span class="wikiEditor-template-end">}}</span>')).css('visibility','hidden').parent().addClass('wikiEditor-template-collapsed').data('model',model);$('<span />').addClass('wikiEditor-template-name wikiEditor-noinclude').text(model.getName()).mousedown(noEdit).prependTo($template);$template.find('.wikiEditor-template-end, .wikiEditor-template-start').mousedown(toggleWikiText);var $options=$('<ul />').addClass('wikiEditor-template-modes wikiEditor-noinclude').append($('<li />').addClass('wikiEditor-template-action-wikiText').append($('<img />').attr('src',$.wikiEditor.imgPath+'templateEditor/'+'wiki-text.png')).mousedown(toggleWikiText)).insertAfter($template.find('.wikiEditor-template-name'));$options.append($('<li />').addClass('wikiEditor-template-action-form').append($('<span>F</span>')).mousedown(function(){createDialog($template);return false;}));function expandTemplate($displayDiv){$displayDiv.removeClass('wikiEditor-template-collapsed');$displayDiv.addClass('wikiEditor-template-expanded');$displayDiv.unbind('mousedown');$keyValueTable=$('<table />').appendTo($displayDiv);$header_row=$('<tr />').appendTo($keyValueTable);$('<th />').attr('colspan','2').text(model.getName()).appendTo($header_row);for(param in model.getAllParamNames()){$keyVal_row=$('<tr />').appendTo($keyValueTable);$('<td />').text(param).appendTo($keyVal_row);$('<td />').text(model.getValue(param)).appendTo($keyVal_row);}};function collapseTemplate($displayDiv){$displayDiv.addClass('wikiEditor-template-collapsed');$displayDiv.removeClass('wikiEditor-template-expanded');$displayDiv.text(model.getName());};function createDialog($templateDiv){var templateModel=$templateDiv.data('model');var $dialog=$("<div></div>");var $title=$("<div>"+templateModel.getName()+"</div>").addClass('wikiEditor-template-dialog-title');var $table=$("<table></table>").addClass('wikiEditor-template-dialog-table').appendTo($dialog);var allInitialParams=templateModel.getAllInitialParams();for(var paramIndex in allInitialParams){var param=allInitialParams[paramIndex];if(typeof param.name=='undefined'){continue;} |
549 | 549 | var $paramRow=$("<tr></tr>").addClass('wikiEditor-template-dialog-row');var $paramName=$("<td></td>").addClass('wikiEditor-template-dialog-name').text(param.name);var $paramVal=$("<td></td>").addClass('wikiEditor-template-dialog-value');var $paramInput=$("<input></input>").data('name',param.name).val(templateModel.getValue(param.name));$paramVal.append($paramInput);$paramRow.append($paramName).append($paramVal);$table.append($paramRow);} |
550 | 550 | $("<button></button>").click(function(){$('.wikiEditor-template-dialog-value input').each(function(){templateModel.setValue($(this).data('name'),$(this).val());});$dialog.dialog('close');}).text("OK").appendTo($dialog);$dialog.dialog();};function toggleWikiText(){var $template=$(this).closest('.wikiEditor-template');$template.toggleClass('wikiEditor-template-collapsed').toggleClass('wikiEditor-template-expanded').children('.wikiEditor-template-text, .wikiEditor-template-name, .wikiEditor-template-modes').toggleClass('wikiEditor-nodisplay');if($template.hasClass('wikiEditor-template-collapsed')){var model=new $.wikiEditor.modules.templateEditor.fn.model($template.children('.wikiEditor-template-text').text());$template.data('model',model);$template.children('.wikiEditor-template-name').text(model.getName());} |
551 | 551 | else{$template.children('.wikiEditor-template-text').children('.wikiEditor-template-inner-text').text($template.data('model').getText().replace(/\{\{/,'').replace(/\}\}$/,''));} |
— | — | @@ -568,7 +568,8 @@ |
569 | 569 | while(sanatizedStr.indexOf('[[')!=-1){startIndex=sanatizedStr.indexOf('[[')+1;openBraces=2;endIndex=startIndex;while((openBraces>0)&&(endIndex<sanatizedStr.length)){var brace=sanatizedStr[++endIndex];openBraces+=brace==']'?-1:brace=='['?1:0;} |
570 | 570 | sanatizedSegment=sanatizedStr.substring(startIndex,endIndex).replace(/[\[\]|=]/g,'X');sanatizedStr=sanatizedStr.substring(0,startIndex)+sanatizedSegment+sanatizedStr.substring(endIndex);} |
571 | 571 | var ranges=[];var params=[];var templateNameIndex=0;var doneParsing=false;oldDivider=0;divider=sanatizedStr.indexOf('|',oldDivider);if(divider==-1){divider=sanatizedStr.length;doneParsing=true;} |
572 | | -nameMatch=sanatizedStr.substring(0,divider).match(/[^\s]/);if(nameMatch!=undefined){ranges.push(new Range(0,nameMatch.index));nameEndMatch=sanatizedStr.substring(0,divider).match(/[^\s]\s*$/);templateNameIndex=ranges.push(new Range(nameMatch.index,nameEndMatch.index+1));templateNameIndex--;ranges[templateNameIndex].old=wikitext.substring(ranges[templateNameIndex].begin,ranges[templateNameIndex].end);} |
| 572 | +nameMatch=sanatizedStr.substring(0,divider).match(/[^\s]/);if(nameMatch!=null){ranges.push(new Range(0,nameMatch.index));nameEndMatch=sanatizedStr.substring(0,divider).match(/[^\s]\s*$/);templateNameIndex=ranges.push(new Range(nameMatch.index,nameEndMatch.index+1));templateNameIndex--;ranges[templateNameIndex].old=wikitext.substring(ranges[templateNameIndex].begin,ranges[templateNameIndex].end);} |
| 573 | +else{ranges.push(new Range(0,0));ranges[templateNameIndex].old="";} |
573 | 574 | params.push(ranges[templateNameIndex].old);var currentParamNumber=0;var valueEndIndex=ranges[templateNameIndex].end;var paramsByName=[];while(!doneParsing){currentParamNumber++;oldDivider=divider;divider=sanatizedStr.indexOf('|',oldDivider+1);if(divider==-1){divider=sanatizedStr.length;doneParsing=true;} |
574 | 575 | currentField=sanatizedStr.substring(oldDivider+1,divider);if(currentField.indexOf('=')==-1){valueBegin=currentField.match(/\S+/);if(valueBegin==null){continue;} |
575 | 576 | valueBeginIndex=valueBegin.index+oldDivider+1;valueEnd=currentField.match(/[^\s]\s*$/);if(valueEnd==null){continue;} |
— | — | @@ -588,7 +589,7 @@ |
589 | 590 | context.$wikitext.css({'position':'','height':''});context.$ui.find('.wikiEditor-ui-right').css({'marginRight':'','position':'','left':'','right':'','float':'','top':'','height':''});context.$ui.find('.wikiEditor-ui-left').css({'width':'','position':'','left':'','float':'','right':''});} |
590 | 591 | $.wikiEditor.modules.toc.fn.redraw(context,width);},disable:function(context){if(context.modules.toc.$toc.data('collapsed')){context.$ui.find('.wikiEditor-ui-toc-expandControl').hide();}else{if(context.modules.toc.$toc.data('positionMode')=='goofy'){$.wikiEditor.modules.toc.fn.switchLayout(context);} |
591 | 592 | context.$ui.find('.wikiEditor-ui-right').hide();context.$ui.find('.wikiEditor-ui-left').css('marginRight','').children().css('marginRight','');} |
592 | | -context.modules.toc.$toc.data('positionMode','disabled');},enable:function(context){context.modules.toc.$toc.data('positionMode','regular');if(context.modules.toc.$toc.data('collapsed')){context.$ui.find('.wikiEditor-ui-toc-expandControl').show();}else{context.$ui.find('.wikiEditor-ui-right').show();$.wikiEditor.modules.toc.fn.redraw(context,$.wikiEditor.modules.toc.cfg.minimumWidth);context.modules.toc.$toc.find('div').autoEllipsis({'position':'right','tooltip':true,'restoreText':true});}},unhighlight:function(context){context.modules.toc.$toc.find('div').removeClass('current');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var div=context.fn.beforeSelection('div.wikiEditor-toc-header');var section=div.data('section')||0;if(context.data.outline.length>0){var sectionLink=context.modules.toc.$toc.find('div.section-'+section);sectionLink.addClass('current');var relTop=sectionLink.offset().top-context.modules.toc.$toc.offset().top;var scrollTop=context.modules.toc.$toc.scrollTop();var divHeight=context.modules.toc.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0) |
| 593 | +context.modules.toc.$toc.data('positionMode','disabled');},enable:function(context){context.modules.toc.$toc.data('positionMode','regular');if(context.modules.toc.$toc.data('collapsed')){context.$ui.find('.wikiEditor-ui-toc-expandControl').show();}else{context.$ui.find('.wikiEditor-ui-right').show();$.wikiEditor.modules.toc.fn.redraw(context,$.wikiEditor.modules.toc.cfg.minimumWidth);context.modules.toc.$toc.find('div').autoEllipsis({'position':'right','tooltip':true,'restoreText':true});}},unhighlight:function(context){if(context){context.modules.toc.$toc.find('div').removeClass('current');}},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var div=context.fn.beforeSelection('div.wikiEditor-toc-header');var section=div.data('section')||0;if(context.data.outline.length>0){var sectionLink=context.modules.toc.$toc.find('div.section-'+section);sectionLink.addClass('current');var relTop=sectionLink.offset().top-context.modules.toc.$toc.offset().top;var scrollTop=context.modules.toc.$toc.scrollTop();var divHeight=context.modules.toc.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0) |
593 | 594 | context.modules.toc.$toc.scrollTop(scrollTop+relTop);else if(relTop+sectionHeight>divHeight) |
594 | 595 | context.modules.toc.$toc.scrollTop(scrollTop+relTop+sectionHeight-divHeight);}},collapse:function(event){var $this=$(this),context=$this.data('context');if(context.modules.toc.$toc.data('positionMode')=='goofy'){$.wikiEditor.modules.toc.fn.switchLayout(context);} |
595 | 596 | var pT=$this.parent().position().top-1;context.modules.toc.$toc.data('collapsed',true);context.$ui.find('.wikiEditor-ui-left').animate({'marginRight':'-1px'},'fast',function(){$(this).css('marginRight',0);}).children().animate({'marginRight':'1px'},'fast',function(){$(this).css('marginRight',0);});context.$ui.find('.wikiEditor-ui-right').css({'marginTop':'1px','position':'absolute','left':$.wikiEditor.modules.toc.cfg.rtl?0:'auto','right':$.wikiEditor.modules.toc.cfg.rtl?'auto':0,'top':pT}).fadeOut('fast',function(){$(this).hide().css({'marginTop':'0','width':'1px'});context.$ui.find('.wikiEditor-ui-toc-expandControl').fadeIn('fast');context.fn.trigger('tocCollapse');context.fn.trigger('resize');});$.cookie('wikiEditor-'+context.instance+'-toc-width',0);return false;},expand:function(event){var $this=$(this),context=$this.data('context'),openWidth=parseFloat(context.modules.toc.$toc.data('openWidth')),availableSpace=context.$wikitext.width()-parseFloat($.wikiEditor.modules.toc.cfg.textMinimumWidth);if(availableSpace<$.wikiEditor.modules.toc.cfg.textMinmumWidth)return false;context.modules.toc.$toc.data('collapsed',false);if(availableSpace<openWidth)openWidth=availableSpace;context.$ui.find('.wikiEditor-ui-toc-expandControl').hide();context.$ui.find('.wikiEditor-ui-left').animate({'marginRight':(parseFloat(openWidth)*-1)},'fast').children().animate({'marginRight':openWidth},'fast');context.$ui.find('.wikiEditor-ui-right').show().css('marginTop','1px').animate({'width':openWidth},'fast',function(){context.$content.trigger('mouseup');$(this).css({'marginTop':'0','position':'relative','right':'auto','left':'auto','top':'auto'});context.fn.trigger('tocExpand');context.fn.trigger('resize');});$.cookie('wikiEditor-'+context.instance+'-toc-width',context.modules.toc.$toc.data('openWidth'));return false;},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;} |