r60187 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60186‎ | r60187 | r60188 >
Date:22:52, 17 December 2009
Author:catrope
Status:deferred
Tags:
Comment:
UsabilityInitiative: ...and some stylistic changes for r60184
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.templateEditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -77,14 +77,14 @@
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 10 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 52 ),
8080 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 8 ),
81 - array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 9 ),
 81+ array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 10 ),
8282 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 1 ),
8383 ),
8484 'combined' => array(
85 - array( 'src' => 'js/plugins.combined.js', 'version' => 120 ),
 85+ array( 'src' => 'js/plugins.combined.js', 'version' => 121 ),
8686 ),
8787 'minified' => array(
88 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 120 ),
 88+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 121 ),
8989 ),
9090 ),
9191 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js
@@ -90,22 +90,22 @@
9191 $displayDiv.addClass( 'wikiEditor-template-expanded' );
9292
9393 //$displayDiv.text( model.getText() );
94 - $keyValueTable = $("<table></table>")
 94+ $keyValueTable = $( '<table />' )
9595 .appendTo( $displayDiv );
96 - $header_row = $("<tr></tr>")
 96+ $header_row = $( '<tr />' )
9797 .appendTo( $keyValueTable );
98 - $("<th></th>")
99 - .attr('colspan', '2');
 98+ $( '<th />' )
 99+ .attr( 'colspan', '2' )
100100 .text( model.getName() )
101101 .appendTo( $header_row );
102102 for( param in model.getAllParamNames() ){
103 - $keyVal_row = $("<tr></tr>")
 103+ $keyVal_row = $( '<tr />' )
104104 .appendTo( $keyValueTable );
105 - $("<td></td>")
 105+
 106+ $( '<td />' )
106107 .text( param )
107108 .appendTo( $keyVal_row );
108 -
109 - $("<td></td>")
 109+ $( '<td />' )
110110 .text( model.getValue( param ) )
111111 .appendTo( $keyVal_row );
112112 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -2742,7 +2742,27 @@
27432743 // Housekeeping
27442744 $displayDiv.removeClass( 'wikiEditor-template-collapsed' );
27452745 $displayDiv.addClass( 'wikiEditor-template-expanded' );
2746 - $displayDiv.text( model.getText() );
 2746+
 2747+ //$displayDiv.text( model.getText() );
 2748+ $keyValueTable = $( '<table />' )
 2749+ .appendTo( $displayDiv );
 2750+ $header_row = $( '<tr />' )
 2751+ .appendTo( $keyValueTable );
 2752+ $( '<th />' )
 2753+ .attr( 'colspan', '2' )
 2754+ .text( model.getName() )
 2755+ .appendTo( $header_row );
 2756+ for( param in model.getAllParamNames() ){
 2757+ $keyVal_row = $( '<tr />' )
 2758+ .appendTo( $keyValueTable );
 2759+
 2760+ $( '<td />' )
 2761+ .text( param )
 2762+ .appendTo( $keyVal_row );
 2763+ $( '<td />' )
 2764+ .text( model.getValue( param ) )
 2765+ .appendTo( $keyVal_row );
 2766+ }
27472767 };
27482768 // Collapse
27492769 function collapseTemplate( $displayDiv ) {
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -172,7 +172,7 @@
173173 $('#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={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++;}
174174 if(tokenIndex<tokenArray.length){var beginIndex=tokenIndex;var endIndex=-1;var openTemplates=1;var templatesMatched=false;while(tokenIndex<tokenArray.length&&endIndex==-1){tokenIndex++;if(tokenArray[tokenIndex].label=='TEMPLATE_BEGIN'){openTemplates++;}else if(tokenArray[tokenIndex].label=='TEMPLATE_END'){openTemplates--;if(openTemplates==0){endIndex=tokenIndex;}}}
175175 if(endIndex!=-1){markers.push({start:tokenArray[beginIndex].offset,end:tokenArray[endIndex].offset,needsWrap:function(ca1,ca2){return!$(ca1.parentNode).is('div.wikiEditor-template')||ca1.previousSibling!=null||ca1.nextSibling!=null;},afterWrap:$.wikiEditor.modules.templateEditor.fn.stylize});}else{tokenArray[beginIndex].label='TEMPLATE_FALSE_BEGIN';tokenIndex=beginIndex;}}}}},exp:[{'regex':/{{/,'label':"TEMPLATE_BEGIN"},{'regex':/}}/,'label':"TEMPLATE_END",'markAfter':true}],fn:{create:function(context,config){context.modules.templateEditor={};},stylize:function(wrappedTemplate){$(wrappedTemplate).each(function(){if(typeof $(this).data('model')!='undefined'){return;}
176 -$(this).addClass('wikiEditor-nodisplay wikiEditor-template');$(this).data('model',new $.wikiEditor.modules.templateEditor.fn.model($(this).text()));var model=$(this).data('model');function expandTemplate($displayDiv){$displayDiv.removeClass('wikiEditor-template-collapsed');$displayDiv.addClass('wikiEditor-template-expanded');$displayDiv.text(model.getText());};function collapseTemplate($displayDiv){$displayDiv.addClass('wikiEditor-template-collapsed');$displayDiv.removeClass('wikiEditor-template-expanded');$displayDiv.text(model.getName());};var $visibleDiv=$("<div />").addClass('wikiEditor-noinclude');$(this).data('display',$visibleDiv);$visibleDiv.data('wikitext',$(this));$(this).after($visibleDiv);$visibleDiv.mousedown(function(){if($(this).hasClass('wikiEditor-template-collapsed')){expandTemplate($(this));}else{collapseTemplate($(this));}});collapseTemplate($visibleDiv);});},model:function(wikitext){function Param(name,value,number,nameIndex,equalsIndex,valueIndex){this.name=name;this.value=value;this.number=number;this.nameIndex=nameIndex;this.equalsIndex=equalsIndex;this.valueIndex=valueIndex;}
 176+$(this).addClass('wikiEditor-nodisplay wikiEditor-template');$(this).data('model',new $.wikiEditor.modules.templateEditor.fn.model($(this).text()));var model=$(this).data('model');function expandTemplate($displayDiv){$displayDiv.removeClass('wikiEditor-template-collapsed');$displayDiv.addClass('wikiEditor-template-expanded');$keyValueTable=$('<table />').appendTo($displayDiv);$header_row=$('<tr />').appendTo($keyValueTable);$('<th />').attr('colspan','2').text(model.getName()).appendTo($header_row);for(param in model.getAllParamNames()){$keyVal_row=$('<tr />').appendTo($keyValueTable);$('<td />').text(param).appendTo($keyVal_row);$('<td />').text(model.getValue(param)).appendTo($keyVal_row);}};function collapseTemplate($displayDiv){$displayDiv.addClass('wikiEditor-template-collapsed');$displayDiv.removeClass('wikiEditor-template-expanded');$displayDiv.text(model.getName());};var $visibleDiv=$("<div />").addClass('wikiEditor-noinclude');$(this).data('display',$visibleDiv);$visibleDiv.data('wikitext',$(this));$(this).after($visibleDiv);$visibleDiv.mousedown(function(){if($(this).hasClass('wikiEditor-template-collapsed')){expandTemplate($(this));}else{collapseTemplate($(this));}});collapseTemplate($visibleDiv);});},model:function(wikitext){function Param(name,value,number,nameIndex,equalsIndex,valueIndex){this.name=name;this.value=value;this.number=number;this.nameIndex=nameIndex;this.equalsIndex=equalsIndex;this.valueIndex=valueIndex;}
177177 function Range(begin,end){this.begin=begin;this.end=end;}
178178 function getSetValue(name,value,original){var valueRange;var rangeIndex;var retVal;if(isNaN(name)){if(typeof paramsByName[name]=='undefined'){return"";}
179179 rangeIndex=paramsByName[name];}else{rangeIndex=parseInt(name);}

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r60184made a little table appear with key/valuesnimishg22:35, 17 December 2009

Status & tagging log