http://www.mediawiki.org/wiki/Special:Code/MediaWiki/62702
Revision: 62702 Author: catrope Date: 2010-02-19 12:20:43 +0000 (Fri, 19 Feb 2010) Log Message: ----------- UsabilityInitiative: (bug 22570) Headings get unwrapped in IE. Multiple things going on here: * JS error in template unwrapping because .data( 'display' ) was missing. Commented out the relevant line * When unwrapping headings, don't remove the <p>, just remove the classes * Remove display: inline; on p.wikiEditor-toc-header , fixes weird display bugs concatenating headings * Fix tracking of visited nodes, broke when markers were skipped * Fix bug where pressing Enter at the end of a header removed the newline shortly after inserting it in IE. This is because IE copies the <p> verbatim, TOC classes included. Make the unwrap algorithm assume that .wikiEditor-highlight nodes without associated markers should simply have their classes removed instead of being destroyed Modified Paths: -------------- trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js trunk/extensions/UsabilityInitiative/js/plugins.combined.js trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js Modified: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php =================================================================== --- trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php 2010-02-19 11:31:37 UTC (rev 62701) +++ trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php 2010-02-19 12:20:43 UTC (rev 62702) @@ -73,19 +73,19 @@ array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ), array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ), array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 143 ), - array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 33 ), + array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 34 ), array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 49 ), array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 17 ), - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 91 ), + array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 92 ), array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 11 ), - array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 20 ), + array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 21 ), array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 3 ), ), 'combined' => array( - array( 'src' => 'js/plugins.combined.js', 'version' => 269 ), + array( 'src' => 'js/plugins.combined.js', 'version' => 270 ), ), 'minified' => array( - array( 'src' => 'js/plugins.combined.min.js', 'version' => 269 ), + array( 'src' => 'js/plugins.combined.min.js', 'version' => 270 ), ), ), ); Modified: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js =================================================================== --- trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js 2010-02-19 11:31:37 UTC (rev 62701) +++ trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js 2010-02-19 12:20:43 UTC (rev 62702) @@ -170,7 +170,7 @@ // Traverse the iframe DOM, inserting markers where they're needed. // Store visited markers here so we know which markers should be removed - var visited = []; + var visited = [], v = 0; for ( var i = 0; i < markers.length; i++ ) { // We want to isolate each marker, so we may need to split textNodes // if a marker starts or ends halfway one. @@ -306,7 +306,7 @@ commonAncestor.appendChild( newNode ); } - anchor = newNode; + anchor = newNode; } else if ( markers[i].anchor == 'tag' ) { anchor = commonAncestor; } @@ -321,7 +321,7 @@ $( anchor ).data( 'marker', markers[i] ); markers[i].onSkip( anchor ); } - visited[i] = anchor; + visited[v++] = anchor; } } @@ -337,12 +337,19 @@ } // Remove this marker - if ( $(this).data( 'marker' ) && typeof $(this).data( 'marker' ).unwrap == 'function' ) - $(this).data( 'marker' ).unwrap( this ); - if ( $(this).children().size() > 0 ) { - $(this).replaceWith( $(this).children() ); + var marker = $(this).data( 'marker' ); + if ( marker && typeof marker.beforeUnwrap == 'function' ) + marker.beforeUnwrap( this ); + if ( ( marker && marker.anchor == 'tag' ) || $(this).is( 'p' ) ) { + // Remove all classes + $(this).removeAttr( 'class' ); } else { - $(this).replaceWith( $(this).html() ); + // Assume anchor == 'wrap' + if ( $(this).children().size() > 0 ) { + $(this).replaceWith( $(this).children() ); + } else { + $(this).replaceWith( $(this).html() ); + } } }); } Modified: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html =================================================================== --- trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html 2010-02-19 11:31:37 UTC (rev 62701) +++ trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html 2010-02-19 12:20:43 UTC (rev 62702) @@ -111,10 +111,9 @@ padding:0 0.25em; }*/ /* == Header == */ - .wikiEditor-toc-header { /* TODO: move parsing to highlight module and rename this */ - display: inline; + .wikiEditor-toc-header { /* Fix for Webkit Browsers resistence to give these elements an offsetTop value */ - display: -webkit-box; + /*display: -webkit-box; -- presumably not needed now that this is a <p> without display: inline; */ /*font-weight: bold; -- not sure about this styling just yet */ } </style> Modified: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js =================================================================== --- trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js 2010-02-19 11:31:37 UTC (rev 62701) +++ trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js 2010-02-19 12:20:43 UTC (rev 62702) @@ -71,7 +71,8 @@ splitPs: model.isCollapsible(), afterWrap: $.wikiEditor.modules.templateEditor.fn.stylize, beforeUnwrap: function( node ) { - $( node ).data( 'display' ).remove(); + // FIXME: $( node ).data( 'display' ) doesn't exist any more + //$( node ).data( 'display' ).remove(); }, onSkip: function() { }, // TODO update template info getAnchor: function( ca1, ca2 ) { Modified: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js =================================================================== --- trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js 2010-02-19 11:31:37 UTC (rev 62701) +++ trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js 2010-02-19 12:20:43 UTC (rev 62702) @@ -125,6 +125,10 @@ .addClass( 'wikiEditor-toc-section-' + marker.index ) .data( 'section', marker.index ); }, + beforeUnwrap: function( node ) { + $( node ).removeClass( 'wikiEditor-toc-header' ) + .removeClass( 'wikiEditor-toc-section-' + $( node ).data( 'section' ) ); + }, onSkip: function( node ) { var marker = $( node ).data( 'marker' ); if ( $( node ).data( 'section' ) != marker.index ) { Modified: trunk/extensions/UsabilityInitiative/js/plugins.combined.js =================================================================== --- trunk/extensions/UsabilityInitiative/js/plugins.combined.js 2010-02-19 11:31:37 UTC (rev 62701) +++ trunk/extensions/UsabilityInitiative/js/plugins.combined.js 2010-02-19 12:20:43 UTC (rev 62702) @@ -8474,7 +8474,7 @@ // Traverse the iframe DOM, inserting markers where they're needed. // Store visited markers here so we know which markers should be removed - var visited = []; + var visited = [], v = 0; for ( var i = 0; i < markers.length; i++ ) { // We want to isolate each marker, so we may need to split textNodes // if a marker starts or ends halfway one. @@ -8610,7 +8610,7 @@ commonAncestor.appendChild( newNode ); } - anchor = newNode; + anchor = newNode; } else if ( markers[i].anchor == 'tag' ) { anchor = commonAncestor; } @@ -8625,7 +8625,7 @@ $( anchor ).data( 'marker', markers[i] ); markers[i].onSkip( anchor ); } - visited[i] = anchor; + visited[v++] = anchor; } } @@ -8641,12 +8641,19 @@ } // Remove this marker - if ( $(this).data( 'marker' ) && typeof $(this).data( 'marker' ).unwrap == 'function' ) - $(this).data( 'marker' ).unwrap( this ); - if ( $(this).children().size() > 0 ) { - $(this).replaceWith( $(this).children() ); + var marker = $(this).data( 'marker' ); + if ( marker && typeof marker.beforeUnwrap == 'function' ) + marker.beforeUnwrap( this ); + if ( ( marker && marker.anchor == 'tag' ) || $(this).is( 'p' ) ) { + // Remove all classes + $(this).removeAttr( 'class' ); } else { - $(this).replaceWith( $(this).html() ); + // Assume anchor == 'wrap' + if ( $(this).children().size() > 0 ) { + $(this).replaceWith( $(this).children() ); + } else { + $(this).replaceWith( $(this).html() ); + } } }); } @@ -9024,7 +9031,8 @@ splitPs: model.isCollapsible(), afterWrap: $.wikiEditor.modules.templateEditor.fn.stylize, beforeUnwrap: function( node ) { - $( node ).data( 'display' ).remove(); + // FIXME: $( node ).data( 'display' ) doesn't exist any more + //$( node ).data( 'display' ).remove(); }, onSkip: function() { }, // TODO update template info getAnchor: function( ca1, ca2 ) { @@ -9753,6 +9761,10 @@ .addClass( 'wikiEditor-toc-section-' + marker.index ) .data( 'section', marker.index ); }, + beforeUnwrap: function( node ) { + $( node ).removeClass( 'wikiEditor-toc-header' ) + .removeClass( 'wikiEditor-toc-section-' + $( node ).data( 'section' ) ); + }, onSkip: function( node ) { var marker = $( node ).data( 'marker' ); if ( $( node ).data( 'section' ) != marker.index ) { Modified: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js =================================================================== --- trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js 2010-02-19 11:31:37 UTC (rev 62701) +++ trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js 2010-02-19 12:20:43 UTC (rev 62702) @@ -574,7 +574,7 @@ tokenArray.push(new Token(match.index+oldOffset+markOffset,label,tokenStart,match));oldOffset+=match.index+match[0].length;newSubstring=text.substring(oldOffset);match=newSubstring.match(regex);}}}} tokenArray.sort(function(a,b){return a.offset-b.offset||a.tokenStart-b.tokenStart;});context.fn.trigger('scan');},mark:function(context,division,tokens){var markers=context.modules.highlight.markers=[];context.fn.trigger('mark');markers.sort(function(a,b){return a.start-b.start||a.end-b.end;});var markersStr='';for(var i=0;i<markers.length;i++){markersStr+=markers[i].start+','+markers[i].end+','+markers[i].type+',';} if(context.modules.highlight.markersStr==markersStr){return;} -context.modules.highlight.markersStr=markersStr;var visited=[];for(var i=0;i<markers.length;i++){var start=markers[i].start;var s=context.fn.getOffset(start);if(!s){continue;} +context.modules.highlight.markersStr=markersStr;var visited=[],v=0;for(var i=0;i<markers.length;i++){var start=markers[i].start;var s=context.fn.getOffset(start);if(!s){continue;} var startNode=s.node;var startDepth=s.depth;while(startNode.nodeName=='BR'||s.offset==startNode.nodeValue.length){start++;s=context.fn.getOffset(start);startNode=s.node;startDepth=s.depth;} if(s.offset>0&&s.node.nodeName=='#text'){startNode=startNode.splitText(s.offset);context.fn.purgeOffsets();} if(markers[i].splitPs&&startNode.parentNode.nodeName=='P'){var startP=startNode.ownerDocument.createElement('p');while(startNode.parentNode.firstChild!=startNode){startP.appendChild(startNode.parentNode.firstChild);} @@ -591,10 +591,10 @@ if(nextNode){commonAncestor.insertBefore(newNode,nextNode);}else{commonAncestor.appendChild(newNode);} anchor=newNode;}else if(markers[i].anchor=='tag'){anchor=commonAncestor;} $(anchor).data('marker',markers[i]).addClass('wikiEditor-highlight');markers[i].afterWrap(anchor,markers[i]);}else{$(anchor).data('marker',markers[i]);markers[i].onSkip(anchor);} -visited[i]=anchor;}} +visited[v++]=anchor;}} var j=0;context.$content.find('.wikiEditor-highlight').each(function(){if(visited[j]==this){j++;return true;} -if($(this).data('marker')&&typeof $(this).data('marker').unwrap=='function') -$(this).data('marker').unwrap(this);if($(this).children().size()>0){$(this).replaceWith($(this).children());}else{$(this).replaceWith($(this).html());}});}}};})(jQuery);(function($){$.wikiEditor.modules.preview={'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',3]],'opera':[['>=',9.6]],'safari':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',9.6]],'safari':[['>=',4]]}},fn:{create:function(context,config){if('initialized'in context.modules.preview){return;} +var marker=$(this).data('marker');if(marker&&typeof marker.beforeUnwrap=='function') +marker.beforeUnwrap(this);if((marker&&marker.anchor=='tag')||$(this).is('p')){$(this).removeAttr('class');}else{if($(this).children().size()>0){$(this).replaceWith($(this).children());}else{$(this).replaceWith($(this).html());}}});}}};})(jQuery);(function($){$.wikiEditor.modules.preview={'browsers':{'ltr':{'msie':[['>=',7]],'firefox':[['>=',3]],'opera':[['>=',9.6]],'safari':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',9.6]],'safari':[['>=',4]]}},fn:{create:function(context,config){if('initialized'in context.modules.preview){return;} context.modules.preview={'initialized':true,'previewText':null,'changesText':null};context.modules.preview.$preview=context.fn.addView({'name':'preview','titleMsg':'wikieditor-preview-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.previewText==wikitext){return;} context.modules.preview.$preview.find('.wikiEditor-preview-contents').empty();context.modules.preview.$preview.find('.wikiEditor-preview-loading').show();$.post(wgScriptPath+'/api.php',{'action':'parse','title':wgPageName,'text':wikitext,'prop':'text','pst':'','format':'json'},function(data){if(typeof data.parse=='undefined'||typeof data.parse.text=='undefined'||typeof data.parse.text['*']=='undefined'){return;} context.modules.preview.previewText=wikitext;context.modules.preview.$preview.find('.wikiEditor-preview-loading').hide();context.modules.preview.$preview.find('.wikiEditor-preview-contents').html(data.parse.text['*']).find('a:not([href^=#])').click(function(){return false;});},'json');}});context.$changesTab=context.fn.addView({'name':'changes','titleMsg':'wikieditor-preview-changes-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.changesText==wikitext){return;} @@ -626,7 +626,7 @@ $('#wikiEditor-'+context.instance+'-dialog-watch').hide();else if($('#wpWatchthis').is(':checked')) $('#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={'browsers':{'ltr':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]}},'req':['iframe'],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++;} 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;}}} -if(endIndex!=-1){var model=new $.wikiEditor.modules.templateEditor.fn.model(context.fn.getContents().substring(tokenArray[beginIndex].offset,tokenArray[endIndex].offset));markers.push({start:tokenArray[beginIndex].offset,end:tokenArray[endIndex].offset,type:'template',anchor:'wrap',splitPs:model.isCollapsible(),afterWrap:$.wikiEditor.modules.templateEditor.fn.stylize,beforeUnwrap:function(node){$(node).data('display').remove();},onSkip:function(){},getAnchor:function(ca1,ca2){return $(ca1.parentNode).is('span.wikiEditor-template-text')?ca1.parentNode:null;},model:model});}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('setupDone')!='undefined'){return;} +if(endIndex!=-1){var model=new $.wikiEditor.modules.templateEditor.fn.model(context.fn.getContents().substring(tokenArray[beginIndex].offset,tokenArray[endIndex].offset));markers.push({start:tokenArray[beginIndex].offset,end:tokenArray[endIndex].offset,type:'template',anchor:'wrap',splitPs:model.isCollapsible(),afterWrap:$.wikiEditor.modules.templateEditor.fn.stylize,beforeUnwrap:function(node){},onSkip:function(){},getAnchor:function(ca1,ca2){return $(ca1.parentNode).is('span.wikiEditor-template-text')?ca1.parentNode:null;},model:model});}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('setupDone')!='undefined'){return;} var model=$(this).data('marker').model;if(!model.isCollapsible()){$(this).addClass('wikiEditor-template-text');return;} var $template=$(this).wrap('<div class="wikiEditor-template"></div>').addClass('wikiEditor-template-text wikiEditor-nodisplay').parent().addClass('wikiEditor-template-collapsed').data('model',model);$('<span />').addClass('wikiEditor-template-name wikiEditor-noinclude').text(model.getName()).mousedown(function(){createDialog($template);}).prependTo($template);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(toggleWikiTextEditor)).insertAfter($template.find('.wikiEditor-template-name'));$(this).data('setupDone',true);function toggleWikiTextEditor(){var $template=$(this).closest('.wikiEditor-template');$template.toggleClass('wikiEditor-template-expanded').toggleClass('wikiEditor-template-collapsed');var $wikitext=$template.children('.wikiEditor-template-text');$wikitext.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());} else{$wikitext.text($template.data('model').getText());} @@ -670,7 +670,7 @@ if(!context.modules.toc.$toc.data('collapsed')){context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height()- context.$ui.find('.tab-toc').outerHeight());} context.modules.toc.$toc.data('previousWidth',context.$wikitext.width());},mark:function(context,event){var hash='';var markers=context.modules.highlight.markers;var tokenArray=context.modules.highlight.tokenArray;var outline=context.data.outline=[];var h=0;for(var i=0;i<tokenArray.length;i++){if(tokenArray[i].label!='TOC_HEADER'){continue;} -h++;markers.push({index:h,start:tokenArray[i].tokenStart,end:tokenArray[i].offset,type:'toc',anchor:'tag',splitPs:false,afterWrap:function(node){var marker=$(node).data('marker');$(node).addClass('wikiEditor-toc-header').addClass('wikiEditor-toc-section-'+marker.index).data('section',marker.index);},onSkip:function(node){var marker=$(node).data('marker');if($(node).data('section')!=marker.index){$(node).removeClass('wikiEditor-toc-section-'+$(node).data('section')).addClass('wikiEditor-toc-section-'+marker.index).data('section',marker.index);}},getAnchor:function(ca1,ca2){return $(ca1.parentNode).is('.wikiEditor-toc-header')?ca1.parentNode:null;}});hash+=tokenArray[i].match[2]+'\n';outline.push({'text':tokenArray[i].match[2],'level':tokenArray[i].match[1].length,'index':h});} +h++;markers.push({index:h,start:tokenArray[i].tokenStart,end:tokenArray[i].offset,type:'toc',anchor:'tag',splitPs:false,afterWrap:function(node){var marker=$(node).data('marker');$(node).addClass('wikiEditor-toc-header').addClass('wikiEditor-toc-section-'+marker.index).data('section',marker.index);},beforeUnwrap:function(node){$(node).removeClass('wikiEditor-toc-header').removeClass('wikiEditor-toc-section-'+$(node).data('section'));},onSkip:function(node){var marker=$(node).data('marker');if($(node).data('section')!=marker.index){$(node).removeClass('wikiEditor-toc-section-'+$(node).data('section')).addClass('wikiEditor-toc-section-'+marker.index).data('section',marker.index);}},getAnchor:function(ca1,ca2){return $(ca1.parentNode).is('.wikiEditor-toc-header')?ca1.parentNode:null;}});hash+=tokenArray[i].match[2]+'\n';outline.push({'text':tokenArray[i].match[2],'level':tokenArray[i].match[1].length,'index':h});} if(typeof context.modules.toc.lastHash=='undefined'||context.modules.toc.lastHash!==hash){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);context.modules.toc.lastHash=hash;}}},exp:[{'regex':/^(={1,6})([^\r\n]+?)\1\s*$/m,'label':'TOC_HEADER','markAfter':true}],fn:{create:function(context,config){if('$toc'in context.modules.toc){return;} $.wikiEditor.modules.toc.cfg.rtl=config.rtl;$.wikiEditor.modules.toc.cfg.flexProperty=config.rtl?'marginLeft':'marginRight';var height=context.$ui.find('.wikiEditor-ui-left').height();context.modules.toc.$toc=$('<div />').addClass('wikiEditor-ui-toc').data('context',context).data('positionMode','regular').data('collapsed',false);context.$ui.find('.wikiEditor-ui-right').append(context.modules.toc.$toc);context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height());$.wikiEditor.modules.toc.fn.redraw(context,$.wikiEditor.modules.toc.cfg.defaultWidth);},redraw:function(context,fixedWidth){var fixedWidth=parseFloat(fixedWidth);if(context.modules.toc.$toc.data('positionMode')=='regular'){context.$ui.find('.wikiEditor-ui-right').css('width',fixedWidth+'px');context.$ui.find('.wikiEditor-ui-left').css($.wikiEditor.modules.toc.cfg.flexProperty,(-1*fixedWidth)+'px').children().css($.wikiEditor.modules.toc.cfg.flexProperty,fixedWidth+'px');}else if(context.modules.toc.$toc.data('positionMode')=='goofy'){context.$ui.find('.wikiEditor-ui-left').css('width',fixedWidth);context.$ui.find('.wikiEditor-ui-right').css($.wikiEditor.modules.toc.cfg.rtl?'right':'left',fixedWidth);context.$wikitext.css('height',context.$ui.find('.wikiEditor-ui-right').height());}},switchLayout:function(context){var width,height=context.$ui.find('.wikiEditor-ui-right').height();if(context.modules.toc.$toc.data('positionMode')=='regular'&&!context.modules.toc.$toc.data('collapsed')){context.modules.toc.$toc.data('positionMode','goofy');context.modules.toc.$toc.data('positionModeChangeAt',context.$ui.find('.wikiEditor-ui-right').width());width=$.wikiEditor.modules.toc.cfg.textMinimumWidth;context.$ui.find('.wikiEditor-ui-left').css($.wikiEditor.modules.toc.cfg.flexProperty,'').css({'position':'absolute','float':'none','left':$.wikiEditor.modules.toc.cfg.rtl?'auto':0,'right':$.wikiEditor.modules.toc.cfg.rtl?0:'auto'}).children().css($.wikiEditor.modules.toc.cfg.flexProperty,'');context.$ui.find('.wikiEditor-ui-right').css({'width':'auto','position':'absolute','float':'none','right':$.wikiEditor.modules.toc.cfg.rtl?'auto':0,'left':$.wikiEditor.modules.toc.cfg.rtl?0:'auto'});context.$wikitext.css('position','relative');}else if(context.modules.toc.$toc.data('positionMode')=='goofy'){context.modules.toc.$toc.data('positionMode','regular');width=context.$wikitext.width()-context.$ui.find('.wikiEditor-ui-left').width();if(width>context.modules.toc.$toc.data('positionModeChangeAt')){width=context.modules.toc.$toc.data('positionModeChangeAt');} context.$wikitext.css({'position':'','height':''});context.$ui.find('.wikiEditor-ui-right').css($.wikiEditor.modules.toc.cfg.flexProperty,'').css({'position':'','left':'','right':'','float':'','top':'','height':''});context.$ui.find('.wikiEditor-ui-left').css({'width':'','position':'','left':'','float':'','right':''});} _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs