r63159 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63158‎ | r63159 | r63160 >
Date:00:47, 2 March 2010
Author:tparscal
Status:ok
Tags:
Comment:
Was missing a semi-colon, plus I added a failsafe that garantees the line turns white after 1 sec.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js (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.delayedBind.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' => 157 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 158 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 36 ),
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 52 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 19 ),
@@ -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' => 300 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 301 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 300 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 301 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js
@@ -1848,6 +1848,10 @@
18491849 if ( !wgWikiEditorEnabledModules.templateEditor ) {
18501850 return true;
18511851 }
 1852+ //disable if in template namespace
 1853+ if( wgNamespaceNumber == wgNamespaceIds['template']){
 1854+ return true;
 1855+ }
18521856 // Add the templateEditor module
18531857 if ( $j.fn.wikiEditor ) {
18541858 $j( 'textarea#wpTextbox1' ).wikiEditor( 'addModule', 'templateEditor' );
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js
@@ -177,4 +177,5 @@
178178 $j('#wikieditor-toolbar-replace-success').text(u.getMsg('wikieditor-toolbar-tool-replace-success',match.length)).show();$j(this).data('offset',0);}else{var start=match.index+offset;var end=start+match[0].length;var newEnd=start+replaceStr.length;$textarea.textSelection('setSelection',{'start':start,'end':end});if(mode=='replace'){$textarea.textSelection('encapsulateSelection',{'peri':replaceStr,'replace':true}).textSelection('setSelection',{'start':start,'end':newEnd});}
179179 $textarea.textSelection('scrollToCaretPosition');$j(this).data('offset',mode=='replace'?newEnd:end);}});},dialog:{width:500,dialogClass:'wikiEditor-toolbar-dialog',buttons:{'wikieditor-toolbar-tool-replace-button-findnext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'find');},'wikieditor-toolbar-tool-replace-button-replacenext':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replace');},'wikieditor-toolbar-tool-replace-button-replaceall':function(e){$j(this).closest('.ui-dialog').data('dialogaction',e.target);$j(this).data('replaceCallback').call(this,'replaceAll');},'wikieditor-toolbar-tool-replace-close':function(){$j(this).dialog('close');}},open:function(){$j(this).data('offset',0);$j('#wikieditor-toolbar-replace-search').focus();$j('#wikieditor-toolbar-replace-nomatch, #wikieditor-toolbar-replace-success, #wikieditor-toolbar-replace-emptysearch, #wikieditor-toolbar-replace-invalidregex').hide();if(!($j(this).data('onetimeonlystuff'))){$j(this).data('onetimeonlystuff',true);$j(this).closest('.ui-dialog').keypress(function(e){if((e.keyCode||e.which)==13){var button=$j(this).data('dialogaction')||$j(this).find('button:first');button.click();e.preventDefault();}});$j(this).closest('.ui-dialog').find('button').focus(function(){$j(this).closest('.ui-dialog').data('dialogaction',this);});}
180180 var dialog=$j(this).closest('.ui-dialog');var that=this;$j($j(this).data('context').$iframe[0].contentWindow.document).bind('keypress.srdialog',function(e){if((e.keyCode||e.which)==13){var button=dialog.data('dialogaction')||dialog.find('button:first');button.click();e.preventDefault();}else if((e.keyCode||e.which)==27){$j(that).dialog('close');}});},close:function(){$j($j(this).data('context').$iframe[0].contentWindow.document).unbind('keypress.srdialog');$j(this).closest('.ui-dialog').data('dialogaction',false);}}}}});}});$j(document).ready(function(){if(!wgWikiEditorEnabledModules.templateEditor){return true;}
 181+if(wgNamespaceNumber==wgNamespaceIds['template']){return true;}
181182 if($j.fn.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','templateEditor');}});
\ No newline at end of file
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -593,7 +593,8 @@
594594 $element = $element.closest( 'p' );
595595 }
596596 $element.css( 'backgroundColor', '#AACCFF' );
597 - setTimeout( function() { $element.animate( { 'backgroundColor': 'white' }, 'slow' ); }, 100 )
 597+ setTimeout( function() { $element.animate( { 'backgroundColor': 'white' }, 'slow' ); }, 100 );
 598+ setTimeout( function() { $element.css( 'backgroundColor', 'white' ); }, 1000 );
598599 },
599600 'htmlToText': function( html ) {
600601 // This function is slow for large inputs, so aggressively cache input/output pairs
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -7136,7 +7136,8 @@
71377137 $element = $element.closest( 'p' );
71387138 }
71397139 $element.css( 'backgroundColor', '#AACCFF' );
7140 - setTimeout( function() { $element.animate( { 'backgroundColor': 'white' }, 'slow' ); }, 100 )
 7140+ setTimeout( function() { $element.animate( { 'backgroundColor': 'white' }, 'slow' ); }, 100 );
 7141+ setTimeout( function() { $element.css( 'backgroundColor', 'white' ); }, 1000 );
71417142 },
71427143 'htmlToText': function( html ) {
71437144 // This function is slow for large inputs, so aggressively cache input/output pairs
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -479,7 +479,7 @@
480480 event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);}
481481 if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});}
482482 addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'highlightLine':function($element,mode){if(!$element.is('p')){$element=$element.closest('p');}
483 -$element.css('backgroundColor','#AACCFF');setTimeout(function(){$element.animate({'backgroundColor':'white'},'slow');},100)},'htmlToText':function(html){if(html in context.htmlToTextMap){return context.htmlToTextMap[html];}
 483+$element.css('backgroundColor','#AACCFF');setTimeout(function(){$element.animate({'backgroundColor':'white'},'slow');},100);setTimeout(function(){$element.css('backgroundColor','white');},1000);},'htmlToText':function(html){if(html in context.htmlToTextMap){return context.htmlToTextMap[html];}
484484 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").replace(/\<p[^\>]*\><p[^\>]*\>/gi,'<p>').replace(/\<\/p\><\/p\>/gi,'</p>');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();}
485485 if(t){text="\n"+text;}
486486 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();}

Status & tagging log