r62181 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62180‎ | r62181 | r62182 >
Date:14:17, 9 February 2010
Author:catrope
Status:ok
Tags:
Comment:
wmf-deployment: Merge r62143, r62146 (UsabilityInitiative fixes) from trunk
Modified paths:
  • /branches/wmf-deployment/extensions/UsabilityInitiative (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/OptIn (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -72,7 +72,7 @@
7373 array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ),
7474 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 7 ),
7575 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 27 ),
76 - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 107 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 111 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 29 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 47 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 12 ),
@@ -82,10 +82,10 @@
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 2 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 225 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 229 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 225 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 229 ),
9090 ),
9191 ),
9292 );
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/OptIn
___________________________________________________________________
Name: svn:mergeinfo
9393 - /branches/REL1_15/phase3/extensions/UsabilityInitiative/OptIn:51646
/trunk/extensions/UsabilityInitiative/OptIn:56207,56209,56296,56333,56355,62041,62043,62140
/trunk/phase3/extensions/UsabilityInitiative/OptIn:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816
9494 + /branches/REL1_15/phase3/extensions/UsabilityInitiative/OptIn:51646
/trunk/extensions/UsabilityInitiative/OptIn:56207,56209,56296,56333,56355,62041,62043,62140,62143,62146
/trunk/phase3/extensions/UsabilityInitiative/OptIn:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js
___________________________________________________________________
Name: svn:mergeinfo
9595 - /trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js:62041,62043
9696 + /trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js:62041,62043,62143,62146
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js
___________________________________________________________________
Name: svn:mergeinfo
9797 - /trunk/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js:62041,62043
9898 + /trunk/extensions/UsabilityInitiative/js/plugins/jquery.cookie.js:62041,62043,62143,62146
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -1188,25 +1188,26 @@
11891189 // If we just do "context.$content.text( context.$textarea.val() )", Internet Explorer will strip out the
11901190 // whitespace charcters, specifically "\n" - so we must manually encode the text and append it
11911191 // TODO: Refactor this into a textToHtml() function
1192 - // Because we're gonna insert instances of <br>, &nbsp; and <span class="wikiEditor-tab"></span>,
1193 - // we have to escape existing instances first. This'll cause them to be double-escaped, which we
1194 - // fix later on
11951192 var html = context.$textarea.val()
1196 - .replace( /&nbsp;/g, '&amp;nbsp;' )
1197 - .replace( /\<br\>/g, '&lt;br&gt;' )
1198 - .replace( /\<span class="wikiEditor-tab"\>\<\/span\>/g, '&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;/span&gt;' );
 1193+ // We're gonna use &esc; as an escape sequence
 1194+ .replace( /&esc;/g, '&esc;esc;' )
 1195+ // Escape existing uses of <p>, </p>, &nbsp; and <span class="wikiEditor-tab"></span>
 1196+ .replace( /\<p\>/g, '&esc;&lt;p&gt;' )
 1197+ .replace (/\<\/p\>/g, '&esc;&lt;/p&gt;' )
 1198+ .replace( /\<span class="wikiEditor-tab"\>\<\/span\>/g, '&esc;&lt;span&nbsp;class=&quot;wikiEditor-tab&quot;&gt;&lt;/span&gt;' )
 1199+ .replace( /&nbsp;/g, '&esc;&amp;nbsp;' );
11991200 // We must do some extra processing on IE to avoid dirty diffs, specifically IE will collapse leading spaces
 1201+ // Browser sniffing is not ideal, but executing this code on a non-broken browser doesn't cause harm
12001202 if ( $.browser.msie ) {
1201 - // Browser sniffing is not ideal, but executing this code on a non-broken browser doesn't cause harm
 1203+ html = html.replace( /\t/g, '<span class="wikiEditor-tab"></span>' );
12021204 if ( $.browser.versionNumber <= 7 ) {
12031205 // Replace all spaces matching &nbsp; - IE <= 7 needs this because of its overzealous
1204 - // whitespace collapsing;
 1206+ // whitespace collapsing
12051207 html = html.replace( / /g, "&nbsp;" );
12061208 } else {
12071209 // IE8 is happy if we just convert the first leading space to &nbsp;
12081210 html = html.replace( /(^|\n) /g, "$1&nbsp;" );
12091211 }
1210 - html = html.replace( /\t/g, '<span class="wikiEditor-tab"></span>' );
12111212 }
12121213 // Use a dummy div to escape all entities
12131214 // This'll also escape <br>, <span> and &nbsp; , so we unescape those after
@@ -1218,10 +1219,12 @@
12191220 .replace( /&lt;\/p&gt;/g, '</p>' )
12201221 // Empty p tags should just be br tags
12211222 .replace( /<p><\/p>/g, '<br>' )
1222 - .replace( /&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;\/span&gt;/g, '<span class="wikiEditor-tab"></span>' )
1223 - .replace( /&amp;amp;nbsp;/g, '&amp;nbsp;' )
1224 - .replace( /&amp;lt;br&amp;gt;/g, '&lt;br&gt;' )
1225 - .replace( /&amp;lt;span class=&amp;quot;wikiEditor-tab&amp;quot;&amp;gt;&amp;lt;\/span&amp;gt;/g, '&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;/span&gt;' );
 1223+ // Unescape &esc; stuff
 1224+ .replace( /&amp;esc;&amp;amp;nbsp;/g, '&amp;nbsp;' )
 1225+ .replace( /&amp;esc;&amp;lt;p&amp;gt;/g, '&lt;p&gt;' )
 1226+ .replace( /&amp;esc;&amp;lt;\/p&amp;gt;/g, '&lt;/p&gt;' )
 1227+ .replace( /&amp;esc;&amp;lt;span&amp;nbsp;class=&amp;quot;wikiEditor-tab&amp;quot;&amp;gt;&amp;lt;\/span&amp;gt;/g, '&lt;span class="wikiEditor-tab"&gt;&lt;\/span&gt;' )
 1228+ .replace( /&amp;esc;esc;/g, '&amp;esc;' );
12261229 context.$content.html( html );
12271230 context.oldHTML = html;
12281231 // FIXME: This needs to be merged somehow with the oldHTML thing
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -7621,25 +7621,26 @@
76227622 // If we just do "context.$content.text( context.$textarea.val() )", Internet Explorer will strip out the
76237623 // whitespace charcters, specifically "\n" - so we must manually encode the text and append it
76247624 // TODO: Refactor this into a textToHtml() function
7625 - // Because we're gonna insert instances of <br>, &nbsp; and <span class="wikiEditor-tab"></span>,
7626 - // we have to escape existing instances first. This'll cause them to be double-escaped, which we
7627 - // fix later on
76287625 var html = context.$textarea.val()
7629 - .replace( /&nbsp;/g, '&amp;nbsp;' )
7630 - .replace( /\<br\>/g, '&lt;br&gt;' )
7631 - .replace( /\<span class="wikiEditor-tab"\>\<\/span\>/g, '&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;/span&gt;' );
 7626+ // We're gonna use &esc; as an escape sequence
 7627+ .replace( /&esc;/g, '&esc;esc;' )
 7628+ // Escape existing uses of <p>, </p>, &nbsp; and <span class="wikiEditor-tab"></span>
 7629+ .replace( /\<p\>/g, '&esc;&lt;p&gt;' )
 7630+ .replace (/\<\/p\>/g, '&esc;&lt;/p&gt;' )
 7631+ .replace( /\<span class="wikiEditor-tab"\>\<\/span\>/g, '&esc;&lt;span&nbsp;class=&quot;wikiEditor-tab&quot;&gt;&lt;/span&gt;' )
 7632+ .replace( /&nbsp;/g, '&esc;&amp;nbsp;' );
76327633 // We must do some extra processing on IE to avoid dirty diffs, specifically IE will collapse leading spaces
 7634+ // Browser sniffing is not ideal, but executing this code on a non-broken browser doesn't cause harm
76337635 if ( $.browser.msie ) {
7634 - // Browser sniffing is not ideal, but executing this code on a non-broken browser doesn't cause harm
 7636+ html = html.replace( /\t/g, '<span class="wikiEditor-tab"></span>' );
76357637 if ( $.browser.versionNumber <= 7 ) {
76367638 // Replace all spaces matching &nbsp; - IE <= 7 needs this because of its overzealous
7637 - // whitespace collapsing;
 7639+ // whitespace collapsing
76387640 html = html.replace( / /g, "&nbsp;" );
76397641 } else {
76407642 // IE8 is happy if we just convert the first leading space to &nbsp;
76417643 html = html.replace( /(^|\n) /g, "$1&nbsp;" );
76427644 }
7643 - html = html.replace( /\t/g, '<span class="wikiEditor-tab"></span>' );
76447645 }
76457646 // Use a dummy div to escape all entities
76467647 // This'll also escape <br>, <span> and &nbsp; , so we unescape those after
@@ -7651,10 +7652,12 @@
76527653 .replace( /&lt;\/p&gt;/g, '</p>' )
76537654 // Empty p tags should just be br tags
76547655 .replace( /<p><\/p>/g, '<br>' )
7655 - .replace( /&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;\/span&gt;/g, '<span class="wikiEditor-tab"></span>' )
7656 - .replace( /&amp;amp;nbsp;/g, '&amp;nbsp;' )
7657 - .replace( /&amp;lt;br&amp;gt;/g, '&lt;br&gt;' )
7658 - .replace( /&amp;lt;span class=&amp;quot;wikiEditor-tab&amp;quot;&amp;gt;&amp;lt;\/span&amp;gt;/g, '&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;/span&gt;' );
 7656+ // Unescape &esc; stuff
 7657+ .replace( /&amp;esc;&amp;amp;nbsp;/g, '&amp;nbsp;' )
 7658+ .replace( /&amp;esc;&amp;lt;p&amp;gt;/g, '&lt;p&gt;' )
 7659+ .replace( /&amp;esc;&amp;lt;\/p&amp;gt;/g, '&lt;/p&gt;' )
 7660+ .replace( /&amp;esc;&amp;lt;span&amp;nbsp;class=&amp;quot;wikiEditor-tab&amp;quot;&amp;gt;&amp;lt;\/span&amp;gt;/g, '&lt;span class="wikiEditor-tab"&gt;&lt;\/span&gt;' )
 7661+ .replace( /&amp;esc;esc;/g, '&amp;esc;' );
76597662 context.$content.html( html );
76607663 context.oldHTML = html;
76617664 // FIXME: This needs to be merged somehow with the oldHTML thing
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -520,9 +520,8 @@
521521 t=nextT;}},'saveSelection':function(){if(!$.browser.msie){return;}
522522 context.$iframe[0].contentWindow.focus();context.savedSelection=context.$iframe[0].contentWindow.document.selection.createRange();},'restoreSelection':function(){if(!$.browser.msie||context.savedSelection===null){return;}
523523 context.$iframe[0].contentWindow.focus();context.savedSelection.select();context.savedSelection=null;}};context.$textarea.wrap($('<div></div>').addClass('wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-wikitext')).wrap($('<div></div>').addClass('wikiEditor-ui-left')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text'));context.$ui=context.$textarea.parent().parent().parent().parent().parent();context.$wikitext=context.$textarea.parent().parent().parent().parent();context.$wikitext.before($('<div></div>').addClass('wikiEditor-ui-controls').append($('<div></div>').addClass('wikiEditor-ui-tabs').hide()).append($('<div></div>').addClass('wikiEditor-ui-buttons'))).before($('<div style="clear:both;"></div>'));context.$controls=context.$ui.find('.wikiEditor-ui-buttons').hide();context.$buttons=context.$ui.find('.wikiEditor-ui-buttons');context.$tabs=context.$ui.find('.wikiEditor-ui-tabs');context.$ui.after($('<div style="clear:both;"></div>'));context.$wikitext.append($('<div></div>').addClass('wikiEditor-ui-right'));context.$wikitext.find('.wikiEditor-ui-left').prepend($('<div></div>').addClass('wikiEditor-ui-top'));context.view='wikitext';$(window).resize(function(event){context.fn.trigger('resize',event);});context.$iframe=$('<iframe></iframe>').attr({'frameBorder':0,'border':0,'src':wgScriptPath+'/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html?'+'instance='+context.instance+'&ts='+(new Date()).getTime(),'id':'wikiEditor-iframe-'+context.instance}).css({'backgroundColor':'white','width':'100%','height':context.$textarea.height(),'display':'none','overflow-y':'scroll','overflow-x':'hidden'}).insertAfter(context.$textarea).load(function(){if(!this.isSecondRun){context.$iframe[0].contentWindow.document.designMode='on';if($.browser.msie){this.isSecondRun=true;return;}}
524 -context.$content=$(context.$iframe[0].contentWindow.document.body);var html=context.$textarea.val().replace(/&nbsp;/g,'&amp;nbsp;').replace(/\<br\>/g,'&lt;br&gt;').replace(/\<span class="wikiEditor-tab"\>\<\/span\>/g,'&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;/span&gt;');if($.browser.msie){if($.browser.versionNumber<=7){html=html.replace(/ /g,"&nbsp;");}else{html=html.replace(/(^|\n) /g,"$1&nbsp;");}
525 -html=html.replace(/\t/g,'<span class="wikiEditor-tab"></span>');}
526 -html=$('<div />').text('<p>'+html.replace(/\r?\n/g,'</p><p>')+'</p>').html().replace(/&amp;nbsp;/g,'&nbsp;').replace(/&lt;p&gt;/g,'<p>').replace(/&lt;\/p&gt;/g,'</p>').replace(/<p><\/p>/g,'<br>').replace(/&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;\/span&gt;/g,'<span class="wikiEditor-tab"></span>').replace(/&amp;amp;nbsp;/g,'&amp;nbsp;').replace(/&amp;lt;br&amp;gt;/g,'&lt;br&gt;').replace(/&amp;lt;span class=&amp;quot;wikiEditor-tab&amp;quot;&amp;gt;&amp;lt;\/span&amp;gt;/g,'&lt;span class=&quot;wikiEditor-tab&quot;&gt;&lt;/span&gt;');context.$content.html(html);context.oldHTML=html;context.history.push({'html':html});if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');}
 524+context.$content=$(context.$iframe[0].contentWindow.document.body);var html=context.$textarea.val().replace(/&esc;/g,'&esc;esc;').replace(/\<p\>/g,'&esc;&lt;p&gt;').replace(/\<\/p\>/g,'&esc;&lt;/p&gt;').replace(/\<span class="wikiEditor-tab"\>\<\/span\>/g,'&esc;&lt;span&nbsp;class=&quot;wikiEditor-tab&quot;&gt;&lt;/span&gt;').replace(/&nbsp;/g,'&esc;&amp;nbsp;');if($.browser.msie){html=html.replace(/\t/g,'<span class="wikiEditor-tab"></span>');if($.browser.versionNumber<=7){html=html.replace(/ /g,"&nbsp;");}else{html=html.replace(/(^|\n) /g,"$1&nbsp;");}}
 525+html=$('<div />').text('<p>'+html.replace(/\r?\n/g,'</p><p>')+'</p>').html().replace(/&amp;nbsp;/g,'&nbsp;').replace(/&lt;p&gt;/g,'<p>').replace(/&lt;\/p&gt;/g,'</p>').replace(/<p><\/p>/g,'<br>').replace(/&amp;esc;&amp;amp;nbsp;/g,'&amp;nbsp;').replace(/&amp;esc;&amp;lt;p&amp;gt;/g,'&lt;p&gt;').replace(/&amp;esc;&amp;lt;\/p&amp;gt;/g,'&lt;/p&gt;').replace(/&amp;esc;&amp;lt;span&amp;nbsp;class=&amp;quot;wikiEditor-tab&amp;quot;&amp;gt;&amp;lt;\/span&amp;gt;/g,'&lt;span class="wikiEditor-tab"&gt;&lt;\/span&gt;').replace(/&amp;esc;esc;/g,'&amp;esc;');context.$content.html(html);context.oldHTML=html;context.history.push({'html':html});if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');}
527526 context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');$(context.$iframe[0].contentWindow.document).bind('keydown',function(event){return context.fn.trigger('keydown',event);}).bind('keyup mouseup paste cut encapsulateSelection',function(event){return context.fn.trigger('change',event);}).delayedBind(250,'keyup mouseup paste cut encapsulateSelection',function(event){context.fn.trigger('delayedChange',event);});});context.$textarea.closest('form').submit(function(){context.$textarea.attr('disabled',false);context.$textarea.val(context.$textarea.textSelection('getContents'));});context.fallbackWindowOnBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){context.$textarea.val(context.$textarea.textSelection('getContents'));if(context.fallbackWindowOnBeforeUnload){return context.fallbackWindowOnBeforeUnload();}};}
528527 var args=$.makeArray(arguments);if(args.length>0){var call=args.shift();if(call in context.api){context.api[call](context,typeof args[0]=='undefined'?{}:args[0]);}}
529528 return $(this).data('wikiEditor-context',context);};})(jQuery);RegExp.escape=function(s){return s.replace(/([.*+?^${}()|\/\\[\]])/g,'\\$1');};(function($){$.wikiEditor.modules.dialogs={api:{addDialog:function(context,data){$.wikiEditor.modules.dialogs.fn.create(context,data)},openDialog:function(context,module){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('open');}},closeDialog:function(context,data){if(module in $.wikiEditor.modules.dialogs.modules){$('#'+$.wikiEditor.modules.dialogs.modules[module].id).dialog('close');}}},fn:{create:function(context,config){for(module in config){$.wikiEditor.modules.dialogs.modules[module]=config[module];}
Property changes on: branches/wmf-deployment/extensions/UsabilityInitiative
___________________________________________________________________
Name: svn:mergeinfo
530529 - /branches/REL1_15/phase3/extensions/UsabilityInitiative:51646
/trunk/extensions/UsabilityInitiative:56207,56209,56296,56333,56355,62041,62043
/trunk/phase3/extensions/UsabilityInitiative:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816
531530 + /branches/REL1_15/phase3/extensions/UsabilityInitiative:51646
/trunk/extensions/UsabilityInitiative:56207,56209,56296,56333,56355,62041,62043,62143,62146
/trunk/phase3/extensions/UsabilityInitiative:56213,56215-56216,56218,56325,56334-56336,56338,56340,56343,56345,56347,56350,57154-57447,57541,57916,58151,58219,58633,58816

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r62143UsabilityInitiative: (bug 22435) Stuff like <p> and &nbsp; in the original wi...catrope22:51, 8 February 2010
r62146UsabilityInitiative: Fix for r62143: make stuff work in IE7catrope23:34, 8 February 2010

Status & tagging log