Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -76,16 +76,16 @@ |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 25 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 45 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 11 ), |
80 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 74 ), |
| 80 | + array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 75 ), |
81 | 81 | array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 10 ), |
82 | 82 | array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 16 ), |
83 | 83 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 2 ), |
84 | 84 | ), |
85 | 85 | 'combined' => array( |
86 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 189 ), |
| 86 | + array( 'src' => 'js/plugins.combined.js', 'version' => 190 ), |
87 | 87 | ), |
88 | 88 | 'minified' => array( |
89 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 189 ), |
| 89 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 190 ), |
90 | 90 | ), |
91 | 91 | ), |
92 | 92 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js |
— | — | @@ -73,6 +73,7 @@ |
74 | 74 | context.modules.toc.$toc.data( 'previousWidth', context.$wikitext.width() ); |
75 | 75 | }, |
76 | 76 | mark: function( context, event ) { |
| 77 | + var hash = ''; |
77 | 78 | var markers = context.modules.highlight.markers; |
78 | 79 | var tokenArray = context.modules.highlight.tokenArray; |
79 | 80 | var outline = context.data.outline = []; |
— | — | @@ -105,14 +106,20 @@ |
106 | 107 | ca1.previousSibling : null; |
107 | 108 | } |
108 | 109 | } ); |
| 110 | + hash += tokenArray[i].match[2] + '\n'; |
109 | 111 | outline.push ( { |
110 | 112 | 'text': tokenArray[i].match[2], |
111 | 113 | 'level': tokenArray[i].match[1].length, |
112 | 114 | 'index': h |
113 | 115 | } ); |
114 | 116 | } |
115 | | - $.wikiEditor.modules.toc.fn.build( context ); |
116 | | - $.wikiEditor.modules.toc.fn.update( context ); |
| 117 | + // Only update the TOC if it's been changed - we do this by comparing a hash of the headings this time to last |
| 118 | + if ( typeof context.modules.toc.lastHash == 'undefined' || context.modules.toc.lastHash !== hash ) { |
| 119 | + $.wikiEditor.modules.toc.fn.build( context ); |
| 120 | + $.wikiEditor.modules.toc.fn.update( context ); |
| 121 | + // Remember the changed version |
| 122 | + context.modules.toc.lastHash = hash; |
| 123 | + } |
117 | 124 | } |
118 | 125 | }, |
119 | 126 | exp: [ |
— | — | @@ -488,7 +495,9 @@ |
489 | 496 | if( ui.size.width <= parseFloat( $.wikiEditor.modules.toc.cfg.minimumWidth ) ) { |
490 | 497 | context.modules.toc.$toc.trigger( 'collapse.wikiEditor-toc' ); |
491 | 498 | } else { |
492 | | - context.modules.toc.$toc.find( 'div' ).autoEllipsis( { 'position': 'right', 'tooltip': true, 'restoreText': true } ); |
| 499 | + context.modules.toc.$toc.find( 'div' ).autoEllipsis( |
| 500 | + { 'position': 'right', 'tooltip': true, 'restoreText': true } |
| 501 | + ); |
493 | 502 | context.modules.toc.$toc.data( 'openWidth', ui.size.width ); |
494 | 503 | $.cookie( 'wikiEditor-' + context.instance + '-toc-width', ui.size.width ); |
495 | 504 | } |
— | — | @@ -552,7 +561,9 @@ |
553 | 562 | buildResizeControls(); |
554 | 563 | buildCollapseControls(); |
555 | 564 | } |
556 | | - context.modules.toc.$toc.find( 'div' ).autoEllipsis( { 'position': 'right', 'tooltip': true, 'restoreText': true } ); |
| 565 | + context.modules.toc.$toc.find( 'div' ).autoEllipsis( |
| 566 | + { 'position': 'right', 'tooltip': true, 'restoreText': true } |
| 567 | + ); |
557 | 568 | } |
558 | 569 | } |
559 | 570 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -6793,7 +6793,7 @@ |
6794 | 6794 | .replace( / /g, " " ) // We inserted these to prevent IE from collapsing spaces |
6795 | 6795 | .replace( /\<p[^\>]*\>/gi, "\n" ) // IE uses </p><p> for user-inserted line breaks |
6796 | 6796 | .replace( /\<\/p[^\>]*\>/gi, "" ) |
6797 | | - .replace( /\<div[^\>]*\>/gi, "\n" ) // Webkit uses </p><p> for user-inserted line breaks |
| 6797 | + .replace( /\<div[^\>]*\>/gi, "\n" ) // Webkit uses </div><div> for user-inserted line breaks |
6798 | 6798 | .replace( /\<\/div[^\>]*\>/gi, "" ) |
6799 | 6799 | + '</pre>' ); |
6800 | 6800 | // Get rid of the noincludes when getting text |
— | — | @@ -8822,6 +8822,7 @@ |
8823 | 8823 | context.modules.toc.$toc.data( 'previousWidth', context.$wikitext.width() ); |
8824 | 8824 | }, |
8825 | 8825 | mark: function( context, event ) { |
| 8826 | + var hash = ''; |
8826 | 8827 | var markers = context.modules.highlight.markers; |
8827 | 8828 | var tokenArray = context.modules.highlight.tokenArray; |
8828 | 8829 | var outline = context.data.outline = []; |
— | — | @@ -8854,14 +8855,20 @@ |
8855 | 8856 | ca1.previousSibling : null; |
8856 | 8857 | } |
8857 | 8858 | } ); |
| 8859 | + hash += tokenArray[i].match[2] + '\n'; |
8858 | 8860 | outline.push ( { |
8859 | 8861 | 'text': tokenArray[i].match[2], |
8860 | 8862 | 'level': tokenArray[i].match[1].length, |
8861 | 8863 | 'index': h |
8862 | 8864 | } ); |
8863 | 8865 | } |
8864 | | - $.wikiEditor.modules.toc.fn.build( context ); |
8865 | | - $.wikiEditor.modules.toc.fn.update( context ); |
| 8866 | + // Only update the TOC if it's been changed - we do this by comparing a hash of the headings this time to last |
| 8867 | + if ( typeof context.modules.toc.lastHash == 'undefined' || context.modules.toc.lastHash !== hash ) { |
| 8868 | + $.wikiEditor.modules.toc.fn.build( context ); |
| 8869 | + $.wikiEditor.modules.toc.fn.update( context ); |
| 8870 | + // Remember the changed version |
| 8871 | + context.modules.toc.lastHash = hash; |
| 8872 | + } |
8866 | 8873 | } |
8867 | 8874 | }, |
8868 | 8875 | exp: [ |
— | — | @@ -9237,7 +9244,9 @@ |
9238 | 9245 | if( ui.size.width <= parseFloat( $.wikiEditor.modules.toc.cfg.minimumWidth ) ) { |
9239 | 9246 | context.modules.toc.$toc.trigger( 'collapse.wikiEditor-toc' ); |
9240 | 9247 | } else { |
9241 | | - context.modules.toc.$toc.find( 'div' ).autoEllipsis( { 'position': 'right', 'tooltip': true, 'restoreText': true } ); |
| 9248 | + context.modules.toc.$toc.find( 'div' ).autoEllipsis( |
| 9249 | + { 'position': 'right', 'tooltip': true, 'restoreText': true } |
| 9250 | + ); |
9242 | 9251 | context.modules.toc.$toc.data( 'openWidth', ui.size.width ); |
9243 | 9252 | $.cookie( 'wikiEditor-' + context.instance + '-toc-width', ui.size.width ); |
9244 | 9253 | } |
— | — | @@ -9301,7 +9310,9 @@ |
9302 | 9311 | buildResizeControls(); |
9303 | 9312 | buildCollapseControls(); |
9304 | 9313 | } |
9305 | | - context.modules.toc.$toc.find( 'div' ).autoEllipsis( { 'position': 'right', 'tooltip': true, 'restoreText': true } ); |
| 9314 | + context.modules.toc.$toc.find( 'div' ).autoEllipsis( |
| 9315 | + { 'position': 'right', 'tooltip': true, 'restoreText': true } |
| 9316 | + ); |
9306 | 9317 | } |
9307 | 9318 | } |
9308 | 9319 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -594,9 +594,9 @@ |
595 | 595 | if(context.modules.toc.$toc.data('positionMode')=='goofy'){context.modules.toc.$toc.find('div').autoEllipsis({'position':'right','tooltip':true,'restoreText':true});} |
596 | 596 | if(!context.modules.toc.$toc.data('collapsed')){context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height()- |
597 | 597 | context.$ui.find('.tab-toc').outerHeight());} |
598 | | -context.modules.toc.$toc.data('previousWidth',context.$wikitext.width());},mark:function(context,event){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;} |
599 | | -h++;markers.push({index:h,start:tokenArray[i].tokenStart,end:tokenArray[i].offset,anchor:'before',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');$(node).removeClass('wikiEditor-toc-section-'+$(node).data('section')).addClass('wikiEditor-toc-section-'+marker.index).data('section',marker.index);},getAnchor:function(ca1,ca2){return $(ca1.previousSibling).is('div.wikiEditor-toc-header')?ca1.previousSibling:null;}});outline.push({'text':tokenArray[i].match[2],'level':tokenArray[i].match[1].length,'index':h});} |
600 | | -$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}},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;} |
| 598 | +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;} |
| 599 | +h++;markers.push({index:h,start:tokenArray[i].tokenStart,end:tokenArray[i].offset,anchor:'before',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');$(node).removeClass('wikiEditor-toc-section-'+$(node).data('section')).addClass('wikiEditor-toc-section-'+marker.index).data('section',marker.index);},getAnchor:function(ca1,ca2){return $(ca1.previousSibling).is('div.wikiEditor-toc-header')?ca1.previousSibling:null;}});hash+=tokenArray[i].match[2]+'\n';outline.push({'text':tokenArray[i].match[2],'level':tokenArray[i].match[1].length,'index':h});} |
| 600 | +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;} |
601 | 601 | $.wikiEditor.modules.toc.cfg.rtl=config.rtl;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('marginRight',(-1*fixedWidth)+'px').children().css('marginRight',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({'marginRight':'','position':'absolute','float':'none','left':$.wikiEditor.modules.toc.cfg.rtl?'auto':0,'right':$.wikiEditor.modules.toc.cfg.rtl?0:'auto'}).children().css('marginRight','');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');} |
602 | 602 | 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':''});} |
603 | 603 | $.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);} |