r67744 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67743‎ | r67744 | r67745 >
Date:18:54, 9 June 2010
Author:tparscal
Status:ok
Tags:
Comment:
Solves code style issue in r67559 and removes debugger statement added in r67742 (oops).
Modified paths:
  • /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)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/Vector/Modules/CollapsibleNav/CollapsibleNav.js
@@ -40,11 +40,11 @@
4141 // Fallback to old version
4242 var version = 1;
4343 // Allow new version override
44 - if ( wgCollapsibleNavForceNewVersion == true ) {
 44+ if ( wgCollapsibleNavForceNewVersion ) {
4545 version = 2;
4646 } else {
4747 // Make bucket testing optional
48 - if ( wgCollapsibleNavBucketTest == true ) {
 48+ if ( wgCollapsibleNavBucketTest ) {
4949 // This is be determined randomly, and then stored in a cookie
5050 version = $j.cookie( 'vector-nav-pref-version' );
5151 // If the cookie didn't exist, or the value is out of range, generate a new one and save it
@@ -153,7 +153,7 @@
154154 }
155155
156156 /* General Portal Modification */
157 - debugger;
 157+
158158 // Always show the first portal
159159 $j( '#mw-panel > div.portal:first' ).addClass( 'first persistent' );
160160 // Apply a class to the entire panel to activate styles
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' => 24 ),
 16+ array( 'src' => 'Modules/CollapsibleNav/CollapsibleNav.js', 'version' => 25 ),
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 ),
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js
@@ -40,11 +40,11 @@
4141 // Fallback to old version
4242 var version = 1;
4343 // Allow new version override
44 - if ( wgCollapsibleNavForceNewVersion == true ) {
 44+ if ( wgCollapsibleNavForceNewVersion ) {
4545 version = 2;
4646 } else {
4747 // Make bucket testing optional
48 - if ( wgCollapsibleNavBucketTest == true ) {
 48+ if ( wgCollapsibleNavBucketTest ) {
4949 // This is be determined randomly, and then stored in a cookie
5050 version = $j.cookie( 'vector-nav-pref-version' );
5151 // If the cookie didn't exist, or the value is out of range, generate a new one and save it
@@ -153,7 +153,7 @@
154154 }
155155
156156 /* General Portal Modification */
157 - debugger;
 157+
158158 // Always show the first portal
159159 $j( '#mw-panel > div.portal:first' ).addClass( 'first persistent' );
160160 // Apply a class to the entire panel to activate styles
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 map={'ltr':{'msie':[['>=',7]],'opera':[['>=',9.6]],'konqueror':[['>=',4.0]],'blackberry':false,'ipod':false,'iphone':false,'ps3':false},'rtl':{'msie':[['>=',7]],'opera':[['>=',9.6]],'konqueror':[['>=',4.0]],'blackberry':false,'ipod':false,'iphone':false,'ps3':false}};if(!mw.usability.testBrowser(map)){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){version=Math.round(Math.random()+1);$j.cookie('vector-nav-pref-version',version,{'expires':30,'path':'/'});}}}
 5+var version=1;if(wgCollapsibleNavForceNewVersion){version=2;}else{if(wgCollapsibleNavBucketTest){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 var $primary=$j('#p-lang ul.primary');var $secondary=$j('#p-lang ul.secondary');if($secondary.children().length<limit+threshold){limit+=threshold;}
@@ -9,7 +9,7 @@
1010 if(count<limit){$secondary.children().each(function(){if(count++<limit){$j(this).appendTo($primary);}else{return false;}});}
1111 if($secondary.children().length==0){$secondary.remove();}else{$j('#p-lang').after('<div id="p-lang-more" class="portal"><h5></h5><div class="body"></div></div>');$j('#p-lang-more h5').text(mw.usability.getMsg('vector-collapsiblenav-more'));$secondary.appendTo($j('#p-lang-more div.body'));}
1212 $j('#p-lang').addClass('persistent');}
13 -debugger;$j('#mw-panel > div.portal:first').addClass('first persistent');$j('#mw-panel').addClass('collapsible-nav');$j('#mw-panel > div.portal:not(.persistent)').each(function(i){var id=$j(this).attr('id');var state=$j.cookie('vector-nav-'+id);if(state=='true'||(state==null&&i<1)||version==1&&id=='p-lang'){$j(this).addClass('expanded').find('div.body').show();}else{$j(this).addClass('collapsed');}
 13+$j('#mw-panel > div.portal:first').addClass('first persistent');$j('#mw-panel').addClass('collapsible-nav');$j('#mw-panel > div.portal:not(.persistent)').each(function(i){var id=$j(this).attr('id');var state=$j.cookie('vector-nav-'+id);if(state=='true'||(state==null&&i<1)||version==1&&id=='p-lang'){$j(this).addClass('expanded').find('div.body').show();}else{$j(this).addClass('collapsed');}
1414 if(state!=null){$j.cookie('vector-nav-'+$j(this).attr('id'),state,{'expires':30,'path':'/'});}});function toggle($element){$j.cookie('vector-nav-'+$element.parent().attr('id'),$element.parent().is('.collapsed'),{'expires':30,'path':'/'});$element.parent().toggleClass('expanded').toggleClass('collapsed').find('div.body').slideToggle('fast');}
1515 var $headings=$j('#mw-panel > div.portal:not(.persistent) > h5');var tabIndex=mw.usability.getMaxTabIndex()+1;$j('#searchInput').attr('tabindex',tabIndex++);$headings.each(function(){$j(this).attr('tabindex',tabIndex++);});$headings.keydown(function(event){if(event.which==13||event.which==32){toggle($j(this));}}).mousedown(function(){toggle($j(this));$j(this).blur();return false;});});$j(document).ready(function(){if(!wgVectorEnabledModules.collapsibletabs){return true;}
1616 var rtl=$j('body').is('.rtl');$j.collapsibleTabs.moveToCollapsed=function(ele){var $moving=$j(ele);$j.collapsibleTabs.getSettings($j($j.collapsibleTabs.getSettings($moving).expandedContainer)).shifting=true;var data=$j.collapsibleTabs.getSettings($moving);var target=data.collapsedContainer;$moving.css("position","relative").css((rtl?'left':'right'),0).animate({width:'1px'},"normal",function(){$j(this).hide();$j('<span class="placeholder" style="display:none;"></span>').insertAfter(this);$j(this).remove().prependTo(target).data('collapsibleTabsSettings',data);$j(this).attr('style','display:list-item;');$j.collapsibleTabs.getSettings($j($j.collapsibleTabs.getSettings($j(ele)).expandedContainer)).shifting=false;$j.collapsibleTabs.handleResize();});};$j.collapsibleTabs.moveToExpanded=function(ele){var $moving=$j(ele);$j.collapsibleTabs.getSettings($j($j.collapsibleTabs.getSettings($moving).expandedContainer)).shifting=true;var data=$j.collapsibleTabs.getSettings($moving);var $target=$j(data.expandedContainer).find('span.placeholder:first');var expandedWidth=data.expandedWidth;$moving.css("position","relative").css((rtl?'right':'left'),0).css('width','1px');$target.replaceWith($moving.remove().css('width','1px').data('collapsibleTabsSettings',data).animate({width:expandedWidth+"px"},"normal",function(){$j(this).attr('style','display:block;');$j.collapsibleTabs.getSettings($j($j.collapsibleTabs.getSettings($moving).expandedContainer)).shifting=false;$j.collapsibleTabs.handleResize();}));};$j('#p-views ul').bind("beforeTabCollapse",function(){if($j('#p-cactions').css('display')=='none')

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r67559Added bucket testing for collapsible nav (50% of people get the old version),...tparscal19:40, 7 June 2010
r67742Moved functionality for testing browser compatability and finding the highest...tparscal18:47, 9 June 2010

Status & tagging log