r63165 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63164‎ | r63165 | r63166 >
Date:10:29, 2 March 2010
Author:catrope
Status:deferred
Tags:
Comment:
UsabilityInitiative: Remove template namespace check added in r63141 in favor of the one added in r63158, and fix up the latter to work on wikis whose content language is not English
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/Modules/TemplateEditor/TemplateEditor.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.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.templateEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -78,14 +78,14 @@
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 19 ),
8080 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 96 ),
8181 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 11 ),
82 - array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 33 ),
 82+ array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 34 ),
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 3 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 301 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 302 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 301 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 302 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php
@@ -17,13 +17,13 @@
1818 array( 'src' => 'Modules/Publish/Publish.js', 'version' => 6 ),
1919 array( 'src' => 'Modules/Toc/Toc.js', 'version' => 7 ),
2020 array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 51 ),
21 - array( 'src' => 'Modules/TemplateEditor/TemplateEditor.js', 'version' => 4 ),
 21+ array( 'src' => 'Modules/TemplateEditor/TemplateEditor.js', 'version' => 5 ),
2222 ),
2323 'combined' => array(
24 - array( 'src' => 'WikiEditor.combined.js', 'version' => 53 ),
 24+ array( 'src' => 'WikiEditor.combined.js', 'version' => 54 ),
2525 ),
2626 'minified' => array(
27 - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 53 ),
 27+ array( 'src' => 'WikiEditor.combined.min.js', 'version' => 54 ),
2828 ),
2929 );
3030 static $messages = array(
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js
@@ -1849,7 +1849,7 @@
18501850 return true;
18511851 }
18521852 //disable if in template namespace
1853 - if( wgNamespaceNumber == wgNamespaceIds['template']){
 1853+ if ( wgNamespaceNumber == 10 ) {
18541854 return true;
18551855 }
18561856 // Add the templateEditor module
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js
@@ -177,5 +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;}
 181+if(wgNamespaceNumber==10){return true;}
182182 if($j.fn.wikiEditor){$j('textarea#wpTextbox1').wikiEditor('addModule','templateEditor');}});
\ No newline at end of file
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/TemplateEditor/TemplateEditor.js
@@ -6,7 +6,7 @@
77 return true;
88 }
99 //disable if in template namespace
10 - if( wgNamespaceNumber == wgNamespaceIds['template']){
 10+ if ( wgNamespaceNumber == 10 ) {
1111 return true;
1212 }
1313 // Add the templateEditor module
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js
@@ -28,10 +28,6 @@
2929 */
3030 evt: {
3131 mark: function( context, event ) {
32 - if ( $( 'body' ).hasClass( 'ns-10' ) ) {
33 - // We're in the template namespace, don't collapse any templates
34 - return;
35 - }
3632 // Get references to the markers and tokens from the current context
3733 var markers = context.modules.highlight.markers;
3834 var tokenArray = context.modules.highlight.tokenArray;
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -9136,10 +9136,6 @@
91379137 */
91389138 evt: {
91399139 mark: function( context, event ) {
9140 - if ( $( 'body' ).hasClass( 'ns-10' ) ) {
9141 - // We're in the template namespace, don't collapse any templates
9142 - return;
9143 - }
91449140 // Get references to the markers and tokens from the current context
91459141 var markers = context.modules.highlight.markers;
91469142 var tokenArray = context.modules.highlight.tokenArray;
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -637,8 +637,7 @@
638638 $('#wikiEditor-'+context.instance+'-dialog-minor').hide();else if($('#wpMinoredit').is(':checked'))
639639 $('#wikiEditor-'+context.instance+'-dialog-minor').attr('checked','checked');if($('#wpWatchthis').size()==0)
640640 $('#wikiEditor-'+context.instance+'-dialog-watch').hide();else if($('#wpWatchthis').is(':checked'))
641 -$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.templateEditor={'browsers':{'ltr':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]}},'req':['iframe'],evt:{mark:function(context,event){if($('body').hasClass('ns-10')){return;}
642 -var markers=context.modules.highlight.markers;var tokenArray=context.modules.highlight.tokenArray;var level=0;var tokenIndex=0;while(tokenIndex<tokenArray.length){while(tokenIndex<tokenArray.length&&tokenArray[tokenIndex].label!='TEMPLATE_BEGIN'){tokenIndex++;}
 641+$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.templateEditor={'browsers':{'ltr':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]},'rtl':{'msie':[['>=',8]],'firefox':[['>=',3]],'opera':[['>=',10]],'safari':[['>=',4]]}},'req':['iframe'],evt:{mark:function(context,event){var markers=context.modules.highlight.markers;var tokenArray=context.modules.highlight.tokenArray;var level=0;var tokenIndex=0;while(tokenIndex<tokenArray.length){while(tokenIndex<tokenArray.length&&tokenArray[tokenIndex].label!='TEMPLATE_BEGIN'){tokenIndex++;}
643642 if(tokenIndex<tokenArray.length){var beginIndex=tokenIndex;var endIndex=-1;var openTemplates=1;var templatesMatched=false;while(tokenIndex<tokenArray.length-1&&endIndex==-1){tokenIndex++;if(tokenArray[tokenIndex].label=='TEMPLATE_BEGIN'){openTemplates++;}else if(tokenArray[tokenIndex].label=='TEMPLATE_END'){openTemplates--;if(openTemplates==0){endIndex=tokenIndex;}}}
644643 if(endIndex!=-1){markers.push({start:tokenArray[beginIndex].offset,end:tokenArray[endIndex].offset,type:'template',anchor:'wrap',splitPs:false,afterWrap:function(node){var model=new $.wikiEditor.modules.templateEditor.fn.model($(node).text());$(node).data('model',model);if(model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.wrapTemplate($(node));}else{$(node).addClass('wikiEditor-template-text');}},beforeUnwrap:function(node){if($(node).parent().hasClass('wikiEditor-template')){$.wikiEditor.modules.templateEditor.fn.unwrapTemplate($(node));}},onSkip:function(node){if($(node).data('model').getText()==$(node).text()){return;}
645644 var model=new $.wikiEditor.modules.templateEditor.fn.model($(node).text());$(node).data('model',model);if($(node).parent().hasClass('wikiEditor-template')&&!model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.unwrapTemplate($(node));}else if(!$(node).parent().hasClass('wikiEditor-template')&&model.isCollapsible()){$.wikiEditor.modules.templateEditor.fn.wrapTemplate($(node));}},getAnchor:function(ca1,ca2){return $(ca1.parentNode).is('span.wikiEditor-template-text')?ca1.parentNode:null;},context:context});}else{tokenArray[beginIndex].label='TEMPLATE_FALSE_BEGIN';tokenIndex=beginIndex;}}}}},exp:[{'regex':/{{/,'label':"TEMPLATE_BEGIN"},{'regex':/}}/,'label':"TEMPLATE_END",'markAfter':true}],cfg:{},fn:{create:function(context,config){context.modules.templateEditor={};},wrapTemplate:function($wrapper){var model=$wrapper.data('model');var context=$wrapper.data('marker').context;var $template=$wrapper.wrap('<span class="wikiEditor-template"></span>').addClass('wikiEditor-template-text wikiEditor-nodisplay').parent().addClass('wikiEditor-template-collapsed').data('model',model);var $templateName=$('<span />').addClass('wikiEditor-template-name wikiEditor-noinclude').text(model.getName()).mousedown(toggleWikiTextEditor).prependTo($template);var $templateExpand=$('<span />').addClass('wikiEditor-template-expand wikiEditor-noinclude').append('<img src="'+$.wikiEditor.autoIcon('templateEditor/expand.png')+'" width="12" height="16" />').append('<img src="'+$.wikiEditor.autoIcon('templateEditor/collapse.png')+'" width="12" height="16" style="display:none;" />').mousedown(toggleWikiTextEditor).prependTo($template);var $templateDialog=$('<span />').addClass('wikiEditor-template-dialog wikiEditor-noinclude').append('<img src="'+$.wikiEditor.autoIcon('templateEditor/dialog-collapsed.png')+'" width="22" height="16" />').append('<img src="'+$.wikiEditor.autoIcon('templateEditor/dialog-expanded.png')+'" width="22" height="16" style="display:none;" />').mousedown(function(){createDialog($template);return false;}).insertAfter($templateName);function toggleWikiTextEditor(){context.fn.purgeOffsets();var $template=$(this).closest('.wikiEditor-template');$template.toggleClass('wikiEditor-template-expanded').toggleClass('wikiEditor-template-collapsed').find('img').each(function(){$(this).toggle();});var $wikitext=$template.children('.wikiEditor-template-text');$wikitext.toggleClass('wikiEditor-nodisplay');if($template.hasClass('wikiEditor-template-collapsed')){var model=new $.wikiEditor.modules.templateEditor.fn.model($template.children('.wikiEditor-template-text').text());$template.children('.wikiEditor-template-text').data('model',model);$template.children('.wikiEditor-template-name').text(model.getName());}else{$wikitext.text($template.children('.wikiEditor-template-text').data('model').getText());}

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r63141UsabilityInitiative: Some performance improvements...catrope22:34, 1 March 2010
r63158no template editor while editing template namespacenimishg00:07, 2 March 2010

Status & tagging log