r63837 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63836‎ | r63837 | r63838 >
Date:21:08, 16 March 2010
Author:tparscal
Status:ok
Tags:
Comment:
Removes empty markers and fixes an unsafe undefined test.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /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.highlight.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -73,7 +73,7 @@
7474 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ),
7575 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ),
7676 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 172 ),
77 - array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 46 ),
 77+ array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 47 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 52 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 21 ),
8080 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 97 ),
@@ -82,10 +82,10 @@
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 3 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 345 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 346 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 345 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 346 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.highlight.js
@@ -174,7 +174,7 @@
175175 // Store visited markers here so we know which markers should be removed
176176 var visited = [], v = 0;
177177 for ( var i = 0; i < markers.length; i++ ) {
178 - if ( markers[i].skipDivision && ( division == markers[i].skipDivision ) ) {
 178+ if ( typeof markers[i].skipDivision !== 'undefined' && ( division == markers[i].skipDivision ) ) {
179179 continue;
180180 }
181181
@@ -344,6 +344,10 @@
345345
346346 // Remove this marker
347347 var marker = $(this).data( 'marker' );
 348+ if ( typeof marker.skipDivision != 'undefined' && ( division == marker.skipDivision ) ) {
 349+ // Don't remove these either
 350+ return true;
 351+ }
348352 if ( marker && typeof marker.beforeUnwrap == 'function' )
349353 marker.beforeUnwrap( this );
350354 if ( ( marker && marker.anchor == 'tag' ) || $(this).is( 'p' ) ) {
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -8708,7 +8708,7 @@
87098709 // Store visited markers here so we know which markers should be removed
87108710 var visited = [], v = 0;
87118711 for ( var i = 0; i < markers.length; i++ ) {
8712 - if ( markers[i].skipDivision && ( division == markers[i].skipDivision ) ) {
 8712+ if ( typeof markers[i].skipDivision !== 'undefined' && ( division == markers[i].skipDivision ) ) {
87138713 continue;
87148714 }
87158715
@@ -8878,6 +8878,10 @@
88798879
88808880 // Remove this marker
88818881 var marker = $(this).data( 'marker' );
 8882+ if ( typeof marker.skipDivision != 'undefined' && ( division == marker.skipDivision ) ) {
 8883+ // Don't remove these either
 8884+ return true;
 8885+ }
88828886 if ( marker && typeof marker.beforeUnwrap == 'function' )
88838887 marker.beforeUnwrap( this );
88848888 if ( ( marker && marker.anchor == 'tag' ) || $(this).is( 'p' ) ) {
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -590,7 +590,7 @@
591591 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);}}}}
592592 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+',';}
593593 if(context.modules.highlight.markersStr==markersStr){return;}
594 -context.modules.highlight.markersStr=markersStr;var visited=[],v=0;for(var i=0;i<markers.length;i++){if(markers[i].skipDivision&&(division==markers[i].skipDivision)){continue;}
 594+context.modules.highlight.markersStr=markersStr;var visited=[],v=0;for(var i=0;i<markers.length;i++){if(typeof markers[i].skipDivision!=='undefined'&&(division==markers[i].skipDivision)){continue;}
595595 var start=markers[i].start;var s=context.fn.getOffset(start);if(!s){continue;}
596596 var startNode=s.node;while(startNode.nodeName=='BR'||s.offset==startNode.nodeValue.length){start++;s=context.fn.getOffset(start);startNode=s.node;}
597597 if(s.offset>0&&s.node.nodeName=='#text'){startNode=startNode.splitText(s.offset<s.node.nodeValue.length?s.offset:s.node.nodeValue.length-1);context.fn.purgeOffsets();}
@@ -608,7 +608,8 @@
609609 $(anchor).data('marker',markers[i]).addClass('wikiEditor-highlight');markers[i].afterWrap(anchor,markers[i]);}else{$(anchor).data('marker',markers[i]);markers[i].onSkip(anchor);}
610610 visited[v++]=anchor;}}
611611 var j=0;context.$content.find('.wikiEditor-highlight').each(function(){if(visited[j]==this){j++;return true;}
612 -var marker=$(this).data('marker');if(marker&&typeof marker.beforeUnwrap=='function')
 612+var marker=$(this).data('marker');if(typeof marker.skipDivision!='undefined'&&(division==marker.skipDivision)){return true;}
 613+if(marker&&typeof marker.beforeUnwrap=='function')
613614 marker.beforeUnwrap(this);if((marker&&marker.anchor=='tag')||$(this).is('p')){$(this).removeAttr('class');}else{$(this).replaceWith(this.childNodes);}
614615 context.fn.purgeOffsets();});}}};})(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;}
615616 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;}

Status & tagging log