r60108 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60107‎ | r60108 | r60109 >
Date:23:47, 15 December 2009
Author:tparscal
Status:ok
Tags:
Comment:
Aie quant spale.
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' => 6 ),
 81+ array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 7 ),
8282 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 1 ),
8383 ),
8484 'combined' => array(
85 - array( 'src' => 'js/plugins.combined.js', 'version' => 116 ),
 85+ array( 'src' => 'js/plugins.combined.js', 'version' => 117 ),
8686 ),
8787 'minified' => array(
88 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 116 ),
 88+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 117 ),
8989 ),
9090 ),
9191 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js
@@ -9,34 +9,34 @@
1010 // Get refrences to the markers and tokens from the current context
1111 var markers = context.modules.highlight.markers;
1212 var tokenArray = context.modules.highlight.tokenArray;
13 - // Collect matching level 0 template call boundries from the tokenArrray
 13+ // Collect matching level 0 template call boundaries from the tokenArrray
1414 var level = 0;
15 - var boundries = [];
16 - var boundry = 0;
 15+ var boundaries = [];
 16+ var boundary = 0;
1717 for ( token in tokenArray ) {
1818 if ( tokenArray[token].label == 'TEMPLATE_BEGIN' ) {
1919 if ( level++ == 0 ) {
20 - boundry = boundries.push( { 'begin': tokenArray[token].offset } ) - 1;
 20+ boundary = boundaries.push( { 'begin': tokenArray[token].offset } ) - 1;
2121 }
2222 } else if ( tokenArray[token].label == 'TEMPLATE_END' ) {
2323 if ( --level == 0 ) {
24 - boundries[boundry].end = tokenArray[token].offset;
 24+ boundaries[boundary].end = tokenArray[token].offset;
2525 }
2626 }
2727 }
28 - // Add encapsulations to markers at the offsets of matching sets of level 0 template call boundries
29 - for ( boundry in boundries ) {
30 - if ( 'begin' in boundries[boundry] && 'end' in boundries[boundry] ) {
31 - // Ensure arrays exist at the begining and ending offsets for boundry
32 - if ( !( boundries[boundry].begin in markers ) ) {
33 - markers[boundries[boundry].begin] = [];
 28+ // Add encapsulations to markers at the offsets of matching sets of level 0 template call boundaries
 29+ for ( boundary in boundaries ) {
 30+ if ( 'begin' in boundaries[boundary] && 'end' in boundaries[boundary] ) {
 31+ // Ensure arrays exist at the begining and ending offsets for boundary
 32+ if ( !( boundaries[boundary].begin in markers ) ) {
 33+ markers[boundaries[boundary].begin] = [];
3434 }
35 - if ( !( boundries[boundry].end in markers ) ) {
36 - markers[boundries[boundry].end] = [];
 35+ if ( !( boundaries[boundary].end in markers ) ) {
 36+ markers[boundaries[boundary].end] = [];
3737 }
38 - // Append boundry markers
39 - markers[boundries[boundry].begin].push( "<div class='wiki-template'>" );
40 - markers[boundries[boundry].end].push( "</div>" );
 38+ // Append boundary markers
 39+ markers[boundaries[boundary].begin].push( "<div class='wiki-template'>" );
 40+ markers[boundaries[boundary].end].push( "</div>" );
4141
4242 }
4343 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -2656,34 +2656,34 @@
26572657 // Get refrences to the markers and tokens from the current context
26582658 var markers = context.modules.highlight.markers;
26592659 var tokenArray = context.modules.highlight.tokenArray;
2660 - // Collect matching level 0 template call boundries from the tokenArrray
 2660+ // Collect matching level 0 template call boundaries from the tokenArrray
26612661 var level = 0;
2662 - var boundries = [];
2663 - var boundry = 0;
 2662+ var boundaries = [];
 2663+ var boundary = 0;
26642664 for ( token in tokenArray ) {
26652665 if ( tokenArray[token].label == 'TEMPLATE_BEGIN' ) {
26662666 if ( level++ == 0 ) {
2667 - boundry = boundries.push( { 'begin': tokenArray[token].offset } ) - 1;
 2667+ boundary = boundaries.push( { 'begin': tokenArray[token].offset } ) - 1;
26682668 }
26692669 } else if ( tokenArray[token].label == 'TEMPLATE_END' ) {
26702670 if ( --level == 0 ) {
2671 - boundries[boundry].end = tokenArray[token].offset;
 2671+ boundaries[boundary].end = tokenArray[token].offset;
26722672 }
26732673 }
26742674 }
2675 - // Add encapsulations to markers at the offsets of matching sets of level 0 template call boundries
2676 - for ( boundry in boundries ) {
2677 - if ( 'begin' in boundries[boundry] && 'end' in boundries[boundry] ) {
2678 - // Ensure arrays exist at the begining and ending offsets for boundry
2679 - if ( !( boundries[boundry].begin in markers ) ) {
2680 - markers[boundries[boundry].begin] = [];
 2675+ // Add encapsulations to markers at the offsets of matching sets of level 0 template call boundaries
 2676+ for ( boundary in boundaries ) {
 2677+ if ( 'begin' in boundaries[boundary] && 'end' in boundaries[boundary] ) {
 2678+ // Ensure arrays exist at the begining and ending offsets for boundary
 2679+ if ( !( boundaries[boundary].begin in markers ) ) {
 2680+ markers[boundaries[boundary].begin] = [];
26812681 }
2682 - if ( !( boundries[boundry].end in markers ) ) {
2683 - markers[boundries[boundry].end] = [];
 2682+ if ( !( boundaries[boundary].end in markers ) ) {
 2683+ markers[boundaries[boundary].end] = [];
26842684 }
2685 - // Append boundry markers
2686 - markers[boundries[boundry].begin].push( "<div class='wiki-template'>" );
2687 - markers[boundries[boundry].end].push( "</div>" );
 2685+ // Append boundary markers
 2686+ markers[boundaries[boundary].begin].push( "<div class='wiki-template'>" );
 2687+ markers[boundaries[boundary].end].push( "</div>" );
26882688
26892689 }
26902690 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -169,10 +169,10 @@
170170 $('#wikiEditor-'+context.instance+'-dialog-minor').hide();else if($('#wpMinoredit').is(':checked'))
171171 $('#wikiEditor-'+context.instance+'-dialog-minor').attr('checked','checked');if($('#wpWatchthis').size()==0)
172172 $('#wikiEditor-'+context.instance+'-dialog-watch').hide();else if($('#wpWatchthis').is(':checked'))
173 -$('#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 boundries=[];var boundry=0;for(token in tokenArray){if(tokenArray[token].label=='TEMPLATE_BEGIN'){if(level++==0){boundry=boundries.push({'begin':tokenArray[token].offset})-1;}}else if(tokenArray[token].label=='TEMPLATE_END'){if(--level==0){boundries[boundry].end=tokenArray[token].offset;}}}
174 -for(boundry in boundries){if('begin'in boundries[boundry]&&'end'in boundries[boundry]){if(!(boundries[boundry].begin in markers)){markers[boundries[boundry].begin]=[];}
175 -if(!(boundries[boundry].end in markers)){markers[boundries[boundry].end]=[];}
176 -markers[boundries[boundry].begin].push("<div class='wiki-template'>");markers[boundries[boundry].end].push("</div>");}}}},exp:[{'regex':/{{/,'label':"TEMPLATE_BEGIN"},{'regex':/}}/,'label':"TEMPLATE_END",'markAfter':true}],fn:{create:function(context,config){},stylize:function(context){var $templates=context.$content.find('.wiki-template');$templates.each(function(){if(typeof $(this).data('model')!='undefined'){return;}
 173+$('#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 boundaries=[];var boundary=0;for(token in tokenArray){if(tokenArray[token].label=='TEMPLATE_BEGIN'){if(level++==0){boundary=boundaries.push({'begin':tokenArray[token].offset})-1;}}else if(tokenArray[token].label=='TEMPLATE_END'){if(--level==0){boundaries[boundary].end=tokenArray[token].offset;}}}
 174+for(boundary in boundaries){if('begin'in boundaries[boundary]&&'end'in boundaries[boundary]){if(!(boundaries[boundary].begin in markers)){markers[boundaries[boundary].begin]=[];}
 175+if(!(boundaries[boundary].end in markers)){markers[boundaries[boundary].end]=[];}
 176+markers[boundaries[boundary].begin].push("<div class='wiki-template'>");markers[boundaries[boundary].end].push("</div>");}}}},exp:[{'regex':/{{/,'label':"TEMPLATE_BEGIN"},{'regex':/}}/,'label':"TEMPLATE_END",'markAfter':true}],fn:{create:function(context,config){},stylize:function(context){var $templates=context.$content.find('.wiki-template');$templates.each(function(){if(typeof $(this).data('model')!='undefined'){return;}
177177 $(this).addClass('wikieditor-nodisplay');$(this).data('model',new model($(this).text()));var model=$(this).data('model');function expandTemplate($displayDiv){$displayDiv.removeClass('wiki-collapsed-template');$displayDiv.addClass('wiki-expanded-template');$displayDiv.data('mode')="expanded";$displayDiv.text(model.getText());};function collapseTemplate($displayDiv){$displayDiv.addClass('wiki-collapsed-template');$displayDiv.removeClass('wiki-expanded-template');$displayDiv.data('mode')="collapsed";$displayDiv.text(model.getName());};var $visibleDiv=$("<div></div>").addClass('wikieditor-noinclude');$(this).data('display',$visibleDiv);$visibleDiv.data('wikitext-node',$(this));$(this).after($visibleDiv);$visibleDiv.click(function(){if($(this).data('mode')=='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;}
178178 function Range(begin,end){this.begin=begin;this.end=end;}
179179 function getSetValue(name,value,original){var valueRange;var rangeIndex;var retVal;if(isNaN(name)){if(typeof paramsByName[name]=='undefined'){return"";}

Status & tagging log