r62041 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62040‎ | r62041 | r62042 >
Date:18:56, 5 February 2010
Author:tparscal
Status:ok
Tags:
Comment:
Removed some of the paragraph collapsing that I thought was needed based on my testing method, but in fact it was my testing method that was flawed.
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.js (modified) (history)

Diff [purge]

Index: trunk/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' => 105 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 106 ),
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' => 223 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 224 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 223 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 224 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -446,11 +446,6 @@
447447 .replace( /\r?\n/g, "" ) // IE7 inserts newlines before block elements
448448 .replace( / /g, " " ) // We inserted these to prevent IE from collapsing spaces
449449 .replace( /\<br[^\>]*\>\<\/p\>/gi, '</p>' ) // Remove trailing <br> from <p>
450 - // Firefox ends up with one too many empty paragraphs, so this reduced consective strings of them by 1
451 - if ( $.browser.firefox ) {
452 - html = html.replace( /\<p[^\>]*\>\<\/p\>(\<p[^\>]*\>\<\/p\>)*/gi, '$1' );
453 - }
454 - html = html
455450 .replace( /\<\/p\>\s*\<p[^\>]*\>/gi, "\n" ) // Easy case for <p> conversion
456451 .replace( /\<br[^\>]*\>/gi, "\n" ) // <br> conversion
457452 .replace( /\<\/p\>(\n*)\<p[^\>]*\>/gi, "$1\n" );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -6879,11 +6879,6 @@
68806880 .replace( /\r?\n/g, "" ) // IE7 inserts newlines before block elements
68816881 .replace( /&nbsp;/g, " " ) // We inserted these to prevent IE from collapsing spaces
68826882 .replace( /\<br[^\>]*\>\<\/p\>/gi, '</p>' ) // Remove trailing <br> from <p>
6883 - // Firefox ends up with one too many empty paragraphs, so this reduced consective strings of them by 1
6884 - if ( $.browser.firefox ) {
6885 - html = html.replace( /\<p[^\>]*\>\<\/p\>(\<p[^\>]*\>\<\/p\>)*/gi, '$1' );
6886 - }
6887 - html = html
68886883 .replace( /\<\/p\>\s*\<p[^\>]*\>/gi, "\n" ) // Easy case for <p> conversion
68896884 .replace( /\<br[^\>]*\>/gi, "\n" ) // <br> conversion
68906885 .replace( /\<\/p\>(\n*)\<p[^\>]*\>/gi, "$1\n" );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -460,9 +460,7 @@
461461 event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);}
462462 if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});}
463463 addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'htmlToText':function(html){if(html in context.htmlToTextMap){return context.htmlToTextMap[html];}
464 -var origHTML=html;html=html.replace(/\r?\n/g,"").replace(/&nbsp;/g," ").replace(/\<br[^\>]*\>\<\/p\>/gi,'</p>')
465 -if($.browser.firefox){html=html.replace(/\<p[^\>]*\>\<\/p\>(\<p[^\>]*\>\<\/p\>)*/gi,'$1');}
466 -html=html.replace(/\<\/p\>\s*\<p[^\>]*\>/gi,"\n").replace(/\<br[^\>]*\>/gi,"\n").replace(/\<\/p\>(\n*)\<p[^\>]*\>/gi,"$1\n");var leading=html.match(/^\s*/)[0];var trailing=html.match(/\s*$/)[0];html=html.substr(leading.length,html.length-leading.length-trailing.length);var $pre=$('<pre>'+html+'</pre>');$pre.find('.wikiEditor-noinclude').each(function(){$(this).remove();});$pre.find('.wikiEditor-tab').each(function(){$(this).text("\t");});$pre.find('br').each(function(){$(this).replaceWith("\n");});$pre.find('p').each(function(){var text=$(this).text();var t=new context.fn.rawTraverser(this.firstChild,0,this,$pre.get(0)).prev();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.prev();}
 464+var origHTML=html;html=html.replace(/\r?\n/g,"").replace(/&nbsp;/g," ").replace(/\<br[^\>]*\>\<\/p\>/gi,'</p>').replace(/\<\/p\>\s*\<p[^\>]*\>/gi,"\n").replace(/\<br[^\>]*\>/gi,"\n").replace(/\<\/p\>(\n*)\<p[^\>]*\>/gi,"$1\n");var leading=html.match(/^\s*/)[0];var trailing=html.match(/\s*$/)[0];html=html.substr(leading.length,html.length-leading.length-trailing.length);var $pre=$('<pre>'+html+'</pre>');$pre.find('.wikiEditor-noinclude').each(function(){$(this).remove();});$pre.find('.wikiEditor-tab').each(function(){$(this).text("\t");});$pre.find('br').each(function(){$(this).replaceWith("\n");});$pre.find('p').each(function(){var text=$(this).text();var t=new context.fn.rawTraverser(this.firstChild,0,this,$pre.get(0)).prev();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.prev();}
467465 if(t){text="\n"+text;}
468466 t=new context.fn.rawTraverser(this.lastChild,0,this,$pre.get(0)).next();while(t&&t.node.nodeName!='#text'&&t.node.nodeName!='BR'&&t.node.nodeName!='P'){t=t.next();}
469467 if(t&&!t.inP&&t.node.nodeName=='#text'&&t.node.nodeValue.charAt(0)!='\n'&&t.node.nodeValue.charAt(0)!='\r'){text+="\n";}

Follow-up revisions

RevisionCommit summaryAuthorDate
r62055For usability initiative: merge r62041, r62043werdna00:44, 6 February 2010

Status & tagging log