r67721 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67720‎ | r67721 | r67722 >
Date:14:28, 9 June 2010
Author:catrope
Status:deferred
Tags:
Comment:
UsabilityInitiative: Fix various JS errors in IE caused by trailing commas and console.log() calls
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Modules/CollapsibleNav/CollapsibleNav.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.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.expandableField.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/thirdparty/contentCollector.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/Vector/Modules/CollapsibleNav/CollapsibleNav.js
@@ -43,7 +43,6 @@
4444 version = $j.cookie( 'vector-nav-pref-version' );
4545 // If the cookie didn't exist, or the value is out of range, generate a new one and save it
4646 if ( version == null ) {
47 - console.log( version );
4847 // 50% of the people will get the new version
4948 version = Math.round( Math.random() + 1 );
5049 $j.cookie( 'vector-nav-pref-version', version, { 'expires': 30, 'path': '/' } );
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php
@@ -12,7 +12,7 @@
1313
1414 static $scripts = array(
1515 'raw' => array(
16 - array( 'src' => 'Modules/CollapsibleNav/CollapsibleNav.js', 'version' => 21 ),
 16+ array( 'src' => 'Modules/CollapsibleNav/CollapsibleNav.js', 'version' => 22 ),
1717 array( 'src' => 'Modules/CollapsibleTabs/CollapsibleTabs.js', 'version' => 8 ),
1818 array( 'src' => 'Modules/ExpandableSearch/ExpandableSearch.js', 'version' => 3 ),
1919 array( 'src' => 'Modules/EditWarning/EditWarning.js', 'version' => 8 ),
@@ -20,10 +20,10 @@
2121 array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 15 ),
2222 ),
2323 'combined' => array(
24 - array( 'src' => 'Vector.combined.js', 'version' => 44 ),
 24+ array( 'src' => 'Vector.combined.js', 'version' => 45 ),
2525 ),
2626 'minified' => array(
27 - array( 'src' => 'Vector.combined.min.js', 'version' => 44 ),
 27+ array( 'src' => 'Vector.combined.min.js', 'version' => 45 ),
2828 ),
2929 );
3030 static $modules = array(
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js
@@ -43,7 +43,6 @@
4444 version = $j.cookie( 'vector-nav-pref-version' );
4545 // If the cookie didn't exist, or the value is out of range, generate a new one and save it
4646 if ( version == null ) {
47 - console.log( version );
4847 // 50% of the people will get the new version
4948 version = Math.round( Math.random() + 1 );
5049 $j.cookie( 'vector-nav-pref-version', version, { 'expires': 30, 'path': '/' } );
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js
@@ -1,7 +1,7 @@
22
33 $j(document).ready(function(){if(!wgVectorEnabledModules.collapsiblenav){return true;}
44 var mod={'browsers':{'ltr':{'opera':[['>=',9.6]],'konqueror':[['>=',4.0]],'blackberry':false,'ipod':false,'iphone':false,'ps3':false},'rtl':{'opera':[['>=',9.6]],'konqueror':[['>=',4.0]],'blackberry':false,'ipod':false,'iphone':false,'ps3':false}}};if(!$j.wikiEditor.isSupported(mod)){return true;}
5 -var version=1;if(wgCollapsibleNavForceNewVersion==true){version=2;}else{if(wgCollapsibleNavBucketTest==true){version=$j.cookie('vector-nav-pref-version');if(version==null){console.log(version);version=Math.round(Math.random()+1);$j.cookie('vector-nav-pref-version',version,{'expires':30,'path':'/'});}}}
 5+var version=1;if(wgCollapsibleNavForceNewVersion==true){version=2;}else{if(wgCollapsibleNavBucketTest==true){version=$j.cookie('vector-nav-pref-version');if(version==null){version=Math.round(Math.random()+1);$j.cookie('vector-nav-pref-version',version,{'expires':30,'path':'/'});}}}
66 if(version==2){var limit=5;var threshold=3;$j('#p-lang ul').addClass('secondary').before('<ul class="primary"></ul>');var languages=['en','fr','de','es','pt','it','ru','ja','nl','pl','zh','sv','ar','tr','uk','fi','no','ca','ro','hu','ksh','id','he','cs','vi','ko','sr','fa','da','eo','sk','th','lt','vo','bg','sl','hr','hi','et','mk','simple','new','ms','nn','gl','el','eu','ka','tl','bn','lv','ml','bs','te','la','az','sh','war','br','is','mr','be-x-old','sq','cy','lb','ta','zh-classical','an','jv','ht','oc','bpy','ceb','ur','zh-yue','pms','scn','be','roa-rup','qu','af','sw','nds','fy','lmo','wa','ku','hy','su','yi','io','os','ga','ast','nap','vec','gu','cv','bat-smg','kn','uz','zh-min-nan','si','als','yo','li','gan','arz','sah','tt','bar','gd','tg','kk','pam','hsb','roa-tara','nah','mn','vls','gv','mi','am','ia','co','ne','fo','nds-nl','glk','mt','ang','wuu','dv','km','sco','bcl','mg','my','diq','tk','szl','ug','fiu-vro','sc','rm','nrm','ps','nv','hif','bo','se','sa','pnb','map-bms','lad','lij','crh','fur','kw','to','pa','jbo','ba','ilo','csb','wo','xal','krc','ckb','pag','ln','frp','mzn','ce','nov','kv','eml','gn','ky','pdc','lo','haw','mhr','dsb','stq','tpi','arc','hak','ie','so','bh','ext','mwl','sd','ig','myv','ay','iu','na','cu','pi','kl','ty','lbe','ab','got','sm','as','mo','ee','zea','av','ace','kg','bm','cdo','cbk-zam','kab','om','chr','pap','udm','ks','zu','rmy','cr','ch','st','ik','mdf','kaa','aa','fj','srn','tet','or','pnt','bug','ss','ts','pcd','pih','za','sg','lg','bxr','xh','ak','ha','bi','ve','tn','ff','dz','ti','ki','ny','rw','chy','tw','sn','tum','ng','rn','mh','ii','cho','hz','kr','ho','mus','kj'];var acceptLangCookie=$j.cookie('accept-language');if(acceptLangCookie!=null){if(acceptLangCookie!=''){languages=acceptLangCookie.split(',').concat(languages);}}else{$j.getJSON(wgScriptPath+'/api.php?action=query&meta=userinfo&uiprop=acceptlang&format=json',function(data){var langs=[];if(typeof data.query!='undefined'&&typeof data.query.userinfo!='undefined'&&typeof data.query.userinfo.acceptlang!='undefined'){for(var j=0;j<data.query.userinfo.acceptlang.length;j++){if(data.query.userinfo.acceptlang[j].q!=0){langs.push(data.query.userinfo.acceptlang[j]['*']);}}}
77 $j.cookie('accept-language',langs.join(','),{'path':'/','expires':30});});}
88 $primary=$j('#p-lang ul.primary');$secondary=$j('#p-lang ul.secondary');if($secondary.children().length<limit+threshold){limit+=threshold;}
Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -72,10 +72,10 @@
7373 array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 4 ),
7474 array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ),
7575 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 18 ),
76 - array( 'src' => 'js/plugins/jquery.expandableField.js', 'version' => 15 ),
 76+ array( 'src' => 'js/plugins/jquery.expandableField.js', 'version' => 16 ),
7777 array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 21 ),
7878 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 34 ),
79 - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 191 ),
 79+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 192 ),
8080 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 53 ),
8181 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 66 ),
8282 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 25 ),
@@ -86,13 +86,13 @@
8787 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 5 ),
8888
8989 // thirdparty javascript libraries we use
90 - array( 'src' => 'js/thirdparty/contentCollector.js', 'version' => 1 ),
 90+ array( 'src' => 'js/thirdparty/contentCollector.js', 'version' => 2 ),
9191 ),
9292 'combined' => array(
93 - array( 'src' => 'js/plugins.combined.js', 'version' => 419 ),
 93+ array( 'src' => 'js/plugins.combined.js', 'version' => 420 ),
9494 ),
9595 'minified' => array(
96 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 419 ),
 96+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 420 ),
9797 ),
9898 ),
9999 );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.expandableField.js
@@ -73,7 +73,7 @@
7474 // callback function for after collapse
7575 'afterCondense': function( context ) {},
7676 // callback function for after expand
77 - 'afterExpand': function( context ) {},
 77+ 'afterExpand': function( context ) {}
7878 }
7979 };
8080 }
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -532,7 +532,6 @@
533533
534534 //now place the cursor at the end of pasted content
535535 var restoreTo = cursorPos[1] + offset;
536 - //console.log("CURSOR POS: " + cursorPos[1] + " offset: " + offset + " restoreTo: " + restoreTo );
537536
538537 context.fn.setSelection( { start: restoreTo, end: restoreTo } );
539538
Index: trunk/extensions/UsabilityInitiative/js/thirdparty/contentCollector.js
@@ -196,7 +196,7 @@
197197 cc.collectContent = function(node, state) {
198198 if (!state) {
199199 state = {
200 - flags : {/* name -> nesting counter */},
 200+ flags : {/* name -> nesting counter */}
201201 };
202202 }
203203 var isBlock = isBlockElement(node);
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -5834,7 +5834,7 @@
58355835 // callback function for after collapse
58365836 'afterCondense': function( context ) {},
58375837 // callback function for after expand
5838 - 'afterExpand': function( context ) {},
 5838+ 'afterExpand': function( context ) {}
58395839 }
58405840 };
58415841 }
@@ -7340,7 +7340,6 @@
73417341
73427342 //now place the cursor at the end of pasted content
73437343 var restoreTo = cursorPos[1] + offset;
7344 - //console.log("CURSOR POS: " + cursorPos[1] + " offset: " + offset + " restoreTo: " + restoreTo );
73457344
73467345 context.fn.setSelection( { start: restoreTo, end: restoreTo } );
73477346
@@ -12048,7 +12047,7 @@
1204912048 cc.collectContent = function(node, state) {
1205012049 if (!state) {
1205112050 state = {
12052 - flags : {/* name -> nesting counter */},
 12051+ flags : {/* name -> nesting counter */}
1205312052 };
1205412053 }
1205512054 var isBlock = isBlockElement(node);
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -391,7 +391,7 @@
392392 $.fn.extend({delayedBind:function(timeout,event,data,callback){var encEvent=encodeEvent(event);return this.each(function(){var that=this;if(!($(this).data('_delayedBindBound-'+encEvent+'-'+timeout))){$(this).data('_delayedBindBound-'+encEvent+'-'+timeout,true);$(this).bind(event,function(){var timerID=$(this).data('_delayedBindTimerID-'+encEvent+'-'+timeout);if(typeof timerID!='undefined')
393393 clearTimeout(timerID);timerID=setTimeout(function(){$(that).trigger('_delayedBind-'+encEvent+'-'+timeout);},timeout);$(this).data('_delayedBindTimerID-'+encEvent+'-'+timeout,timerID);});}
394394 $(this).bind('_delayedBind-'+encEvent+'-'+timeout,data,callback);});},delayedBindCancel:function(timeout,event){var encEvent=encodeEvent(event);return this.each(function(){var timerID=$(this).data('_delayedBindTimerID-'+encEvent+'-'+timeout);if(typeof timerID!='undefined')
395 -clearTimeout(timerID);});},delayedBindUnbind:function(timeout,event,callback){var encEvent=encodeEvent(event);return this.each(function(){$(this).unbind('_delayedBind-'+encEvent+'-'+timeout,callback);});}});})(jQuery);(function($){$.expandableField={expandField:function(e,context){context.config.beforeExpand.call(context.data.$field,context);context.data.$field.animate({'width':context.data.expandedWidth},'fast',function(){context.config.afterExpand.call(this,context);});},condenseField:function(e,context){context.config.beforeCondense.call(context.data.$field,context);context.data.$field.animate({'width':context.data.condensedWidth},'fast',function(){context.config.afterCondense.call(this,context);});},configure:function(context,property,value){switch(property){default:context.config[property]=value;break;}}};$.fn.expandableField=function(){var returnValue=null;var args=arguments;$(this).each(function(){var context=$(this).data('expandableField-context');if(context==null){context={config:{'beforeCondense':function(context){},'beforeExpand':function(context){},'afterCondense':function(context){},'afterExpand':function(context){},}};}
 395+clearTimeout(timerID);});},delayedBindUnbind:function(timeout,event,callback){var encEvent=encodeEvent(event);return this.each(function(){$(this).unbind('_delayedBind-'+encEvent+'-'+timeout,callback);});}});})(jQuery);(function($){$.expandableField={expandField:function(e,context){context.config.beforeExpand.call(context.data.$field,context);context.data.$field.animate({'width':context.data.expandedWidth},'fast',function(){context.config.afterExpand.call(this,context);});},condenseField:function(e,context){context.config.beforeCondense.call(context.data.$field,context);context.data.$field.animate({'width':context.data.condensedWidth},'fast',function(){context.config.afterCondense.call(this,context);});},configure:function(context,property,value){switch(property){default:context.config[property]=value;break;}}};$.fn.expandableField=function(){var returnValue=null;var args=arguments;$(this).each(function(){var context=$(this).data('expandableField-context');if(context==null){context={config:{'beforeCondense':function(context){},'beforeExpand':function(context){},'afterCondense':function(context){},'afterExpand':function(context){}}};}
396396 if(args.length>0){if(typeof args[0]=='object'){for(var key in args[0]){$.expandableField.configure(context,key,args[0][key]);}}else if(typeof args[0]=='string'){if(args.length>1){$.expandableField.configure(context,args[0],args[1]);}else if(returnValue==null){returnValue=(args[0]in context.config?undefined:context.config[args[0]]);}}}
397397 if(typeof context.data=='undefined'){context.data={'condensedWidth':$(this).width(),'expandedWidth':$(this).width()*2,'$field':$(this)};$(this).addClass('expandableField').focus(function(e){$.expandableField.expandField(e,context);}).delayedBind(250,'blur',function(e){$.expandableField.condenseField(e,context);});}
398398 $(this).data('expandableField-context',context);});return returnValue!==null?returnValue:$(this);};})(jQuery);(function($){$.suggestions={cancel:function(context){if(context.data.timerID!=null){clearTimeout(context.data.timerID);}
@@ -833,7 +833,7 @@
834834 function _produceListMarker(state){}
835835 function _startNewLine(state){if(state){var atBeginningOfLine=lines.textOfLine(lines.length()-1).length==0;if(atBeginningOfLine&&state.listType&&state.listType!='none'){_produceListMarker(state);}}
836836 lines.startNew();}
837 -cc.notifySelection=function(sel){if(sel){selection=sel;startPoint=selection.startPoint;endPoint=selection.endPoint;}};cc.collectContent=function(node,state){if(!state){state={flags:{},};}
 837+cc.notifySelection=function(sel){if(sel){selection=sel;startPoint=selection.startPoint;endPoint=selection.endPoint;}};cc.collectContent=function(node,state){if(!state){state={flags:{}};}
838838 var isBlock=isBlockElement(node);var isEmpty=_isEmpty(node,state);if(isBlock)
839839 _ensureColumnZero(state);var startLine=lines.length()-1;_reachBlockPoint(node,0,state);if(dom.isNodeText(node)){var txt=dom.nodeValue(node);var rest='';var x=0;if(txt.length==0){if(startPoint&&node==startPoint.node){selStart=_pointHere(0,state);}
840840 if(endPoint&&node==endPoint.node){selEnd=_pointHere(0,state);}}

Status & tagging log