Index: trunk/extensions/UsabilityInitiative/Vector/Modules/CollapsibleNav/CollapsibleNav.js |
— | — | @@ -29,14 +29,16 @@ |
30 | 30 | if ( !$j.wikiEditor.isSupported( mod ) ) { |
31 | 31 | return true; |
32 | 32 | } |
| 33 | + // Fallback to old version |
| 34 | + var version = 1; |
33 | 35 | // Allow new version override |
34 | 36 | if ( wgCollapsibleNavForceNewVersion == true ) { |
35 | | - var version = 2; |
| 37 | + version = 2; |
36 | 38 | } else { |
37 | 39 | // Make bucket testing optional |
38 | 40 | if ( wgCollapsibleNavBucketTest == true ) { |
39 | 41 | // This is be determined randomly, and then stored in a cookie |
40 | | - var version = $j.cookie( 'vector-nav-pref-version' ); |
| 42 | + version = $j.cookie( 'vector-nav-pref-version' ); |
41 | 43 | // If the cookie didn't exist, or the value is out of range, generate a new one and save it |
42 | 44 | if ( version == null ) { |
43 | 45 | console.log( version ); |
— | — | @@ -44,9 +46,6 @@ |
45 | 47 | version = Math.round( Math.random() + 1 ); |
46 | 48 | $j.cookie( 'vector-nav-pref-version', version, { 'expires': 30, 'path': '/' } ); |
47 | 49 | } |
48 | | - } else { |
49 | | - // Fallback to old version |
50 | | - var version = 1; |
51 | 50 | } |
52 | 51 | } |
53 | 52 | // Language portal splitting feature (if it's turned on) |
— | — | @@ -101,7 +100,6 @@ |
102 | 101 | $j.cookie( 'accept-language', langs.join( ',' ), { 'path': '/', 'expires': 30 } ); |
103 | 102 | } ); |
104 | 103 | } |
105 | | - |
106 | 104 | // Shortcuts to the two lists |
107 | 105 | $primary = $j( '#p-lang ul.primary' ); |
108 | 106 | $secondary = $j( '#p-lang ul.secondary' ); |
— | — | @@ -115,7 +113,7 @@ |
116 | 114 | $link = $secondary.find( '.interwiki-' + languages[i] ); |
117 | 115 | if ( $link.length ) { |
118 | 116 | if ( count++ < limit ) { |
119 | | - $link.remove().appendTo( $primary ); |
| 117 | + $link.appendTo( $primary ); |
120 | 118 | } else { |
121 | 119 | break; |
122 | 120 | } |
— | — | @@ -126,7 +124,7 @@ |
127 | 125 | if ( count < limit ) { |
128 | 126 | $secondary.children().each( function() { |
129 | 127 | if ( count++ < limit ) { |
130 | | - $j(this).remove().appendTo( $primary ); |
| 128 | + $j(this).appendTo( $primary ); |
131 | 129 | } else { |
132 | 130 | return false; |
133 | 131 | } |
— | — | @@ -138,7 +136,7 @@ |
139 | 137 | } else { |
140 | 138 | $j( '#p-lang' ).after( '<div id="p-lang-more" class="portal"><h5></h5><div class="body"></div></div>' ); |
141 | 139 | $j( '#p-lang-more h5' ).text( mw.usability.getMsg( 'vector-collapsiblenav-more' ) ); |
142 | | - $secondary.remove().appendTo( $j( '#p-lang-more div.body' ) ); |
| 140 | + $secondary.appendTo( $j( '#p-lang-more div.body' ) ); |
143 | 141 | } |
144 | 142 | // Always show the primary interwiki language portal |
145 | 143 | $j( '#p-lang' ).addClass( 'persistent' ); |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | |
14 | 14 | static $scripts = array( |
15 | 15 | 'raw' => array( |
16 | | - array( 'src' => 'Modules/CollapsibleNav/CollapsibleNav.js', 'version' => 18 ), |
| 16 | + array( 'src' => 'Modules/CollapsibleNav/CollapsibleNav.js', 'version' => 19 ), |
17 | 17 | array( 'src' => 'Modules/CollapsibleTabs/CollapsibleTabs.js', 'version' => 8 ), |
18 | 18 | array( 'src' => 'Modules/ExpandableSearch/ExpandableSearch.js', 'version' => 3 ), |
19 | 19 | array( 'src' => 'Modules/EditWarning/EditWarning.js', 'version' => 8 ), |
— | — | @@ -20,10 +20,10 @@ |
21 | 21 | array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 15 ), |
22 | 22 | ), |
23 | 23 | 'combined' => array( |
24 | | - array( 'src' => 'Vector.combined.js', 'version' => 41 ), |
| 24 | + array( 'src' => 'Vector.combined.js', 'version' => 42 ), |
25 | 25 | ), |
26 | 26 | 'minified' => array( |
27 | | - array( 'src' => 'Vector.combined.min.js', 'version' => 41 ), |
| 27 | + array( 'src' => 'Vector.combined.min.js', 'version' => 42 ), |
28 | 28 | ), |
29 | 29 | ); |
30 | 30 | static $modules = array( |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js |
— | — | @@ -29,14 +29,16 @@ |
30 | 30 | if ( !$j.wikiEditor.isSupported( mod ) ) { |
31 | 31 | return true; |
32 | 32 | } |
| 33 | + // Fallback to old version |
| 34 | + var version = 1; |
33 | 35 | // Allow new version override |
34 | 36 | if ( wgCollapsibleNavForceNewVersion == true ) { |
35 | | - var version = 2; |
| 37 | + version = 2; |
36 | 38 | } else { |
37 | 39 | // Make bucket testing optional |
38 | 40 | if ( wgCollapsibleNavBucketTest == true ) { |
39 | 41 | // This is be determined randomly, and then stored in a cookie |
40 | | - var version = $j.cookie( 'vector-nav-pref-version' ); |
| 42 | + version = $j.cookie( 'vector-nav-pref-version' ); |
41 | 43 | // If the cookie didn't exist, or the value is out of range, generate a new one and save it |
42 | 44 | if ( version == null ) { |
43 | 45 | console.log( version ); |
— | — | @@ -44,9 +46,6 @@ |
45 | 47 | version = Math.round( Math.random() + 1 ); |
46 | 48 | $j.cookie( 'vector-nav-pref-version', version, { 'expires': 30, 'path': '/' } ); |
47 | 49 | } |
48 | | - } else { |
49 | | - // Fallback to old version |
50 | | - var version = 1; |
51 | 50 | } |
52 | 51 | } |
53 | 52 | // Language portal splitting feature (if it's turned on) |
— | — | @@ -101,7 +100,6 @@ |
102 | 101 | $j.cookie( 'accept-language', langs.join( ',' ), { 'path': '/', 'expires': 30 } ); |
103 | 102 | } ); |
104 | 103 | } |
105 | | - |
106 | 104 | // Shortcuts to the two lists |
107 | 105 | $primary = $j( '#p-lang ul.primary' ); |
108 | 106 | $secondary = $j( '#p-lang ul.secondary' ); |
— | — | @@ -115,7 +113,7 @@ |
116 | 114 | $link = $secondary.find( '.interwiki-' + languages[i] ); |
117 | 115 | if ( $link.length ) { |
118 | 116 | if ( count++ < limit ) { |
119 | | - $link.remove().appendTo( $primary ); |
| 117 | + $link.appendTo( $primary ); |
120 | 118 | } else { |
121 | 119 | break; |
122 | 120 | } |
— | — | @@ -126,7 +124,7 @@ |
127 | 125 | if ( count < limit ) { |
128 | 126 | $secondary.children().each( function() { |
129 | 127 | if ( count++ < limit ) { |
130 | | - $j(this).remove().appendTo( $primary ); |
| 128 | + $j(this).appendTo( $primary ); |
131 | 129 | } else { |
132 | 130 | return false; |
133 | 131 | } |
— | — | @@ -138,7 +136,7 @@ |
139 | 137 | } else { |
140 | 138 | $j( '#p-lang' ).after( '<div id="p-lang-more" class="portal"><h5></h5><div class="body"></div></div>' ); |
141 | 139 | $j( '#p-lang-more h5' ).text( mw.usability.getMsg( 'vector-collapsiblenav-more' ) ); |
142 | | - $secondary.remove().appendTo( $j( '#p-lang-more div.body' ) ); |
| 140 | + $secondary.appendTo( $j( '#p-lang-more div.body' ) ); |
143 | 141 | } |
144 | 142 | // Always show the primary interwiki language portal |
145 | 143 | $j( '#p-lang' ).addClass( 'persistent' ); |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js |
— | — | @@ -1,13 +1,13 @@ |
2 | 2 | |
3 | 3 | $j(document).ready(function(){if(!wgVectorEnabledModules.collapsiblenav){return true;} |
4 | 4 | var mod={'browsers':{'ltr':{'opera':[['>=',9.6]],'konqueror':[['>=',4.0]],'blackberry':false,'ipod':false,'iphone':false},'rtl':{'opera':[['>=',9.6]],'konqueror':[['>=',4.0]],'blackberry':false,'ipod':false,'iphone':false}}};if(!$j.wikiEditor.isSupported(mod)){return true;} |
5 | | -if(wgCollapsibleNavForceNewVersion==true){var version=2;}else{if(wgCollapsibleNavBucketTest==true){var 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':'/'});}}else{var version=1;}} |
| 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':'/'});}}} |
6 | 6 | 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]['*']);}}} |
7 | 7 | $j.cookie('accept-language',langs.join(','),{'path':'/','expires':30});});} |
8 | 8 | $primary=$j('#p-lang ul.primary');$secondary=$j('#p-lang ul.secondary');if($secondary.children().length<limit+threshold){limit+=threshold;} |
9 | | -var count=0;for(var i=0;i<languages.length;i++){$link=$secondary.find('.interwiki-'+languages[i]);if($link.length){if(count++<limit){$link.remove().appendTo($primary);}else{break;}}} |
10 | | -if(count<limit){$secondary.children().each(function(){if(count++<limit){$j(this).remove().appendTo($primary);}else{return false;}});} |
11 | | -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.remove().appendTo($j('#p-lang-more div.body'));} |
| 9 | +var count=0;for(var i=0;i<languages.length;i++){$link=$secondary.find('.interwiki-'+languages[i]);if($link.length){if(count++<limit){$link.appendTo($primary);}else{break;}}} |
| 10 | +if(count<limit){$secondary.children().each(function(){if(count++<limit){$j(this).appendTo($primary);}else{return false;}});} |
| 11 | +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'));} |
12 | 12 | $j('#p-lang').addClass('persistent');} |
13 | 13 | $j('#panel > div.portal:first').addClass('first persistent');$j('#panel').addClass('collapsible-nav');$j('#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');} |
14 | 14 | 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');} |