Index: trunk/extensions/UsabilityInitiative/css/vector.collapsibleNav.css |
— | — | @@ -50,6 +50,7 @@ |
51 | 51 | #panel.collapsible-nav div.persistent h5 { |
52 | 52 | background: none !important; |
53 | 53 | padding-left: 0.7em; |
| 54 | + cursor: default; |
54 | 55 | } |
55 | 56 | #panel.collapsible-nav div.portal div.body ul li { |
56 | 57 | padding: 0.25em 0; |
Index: trunk/extensions/UsabilityInitiative/css/combined.css |
— | — | @@ -117,6 +117,7 @@ |
118 | 118 | #panel.collapsible-nav div.persistent h5 { |
119 | 119 | background: none !important; |
120 | 120 | padding-left: 0.7em; |
| 121 | + cursor: default; |
121 | 122 | } |
122 | 123 | #panel.collapsible-nav div.portal div.body ul li { |
123 | 124 | padding: 0.25em 0; |
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css |
— | — | @@ -115,6 +115,7 @@ |
116 | 116 | #panel.collapsible-nav div.persistent h5{ |
117 | 117 | background:none !important; |
118 | 118 | padding-left:0.7em; |
| 119 | +cursor:default; |
119 | 120 | } |
120 | 121 | #panel.collapsible-nav div.portal div.body ul li{ |
121 | 122 | padding:0.25em 0; |
Index: trunk/extensions/UsabilityInitiative/Vector/Modules/CollapsibleNav/CollapsibleNav.js |
— | — | @@ -29,20 +29,108 @@ |
30 | 30 | if ( !$j.wikiEditor.isSupported( mod ) ) { |
31 | 31 | return true; |
32 | 32 | } |
33 | | - // Create a new portal for overflow languages |
34 | | - $j( '#p-lang' ) |
35 | | - .after( '<div id="p-lang-more" class="portal"><h5></h5><div class="body"><ul></ul></div></div>' ) |
36 | | - .addClass( 'persistent' ); |
37 | | - $j( '#panel > div.portal:first' ) |
38 | | - .addClass( 'first persistent' ); |
39 | | - $j( '#p-lang-more h5' ).text( mw.usability.getMsg( 'vector-collapsiblenav-more' ) ); |
| 33 | + // Allow new version override |
| 34 | + if ( wgCollapsibleNavForceNewVersion == true ) { |
| 35 | + var version = 2; |
| 36 | + } else { |
| 37 | + // Make bucket testing optional |
| 38 | + if ( wgCollapsibleNavBucketTest == true ) { |
| 39 | + // This is be determined randomly, and then stored in a cookie |
| 40 | + var version = $j.cookie( 'vector-nav-pref-version' ); |
| 41 | + // If the cookie didn't exist, or the value is out of range, generate a new one and save it |
| 42 | + if ( version == null ) { |
| 43 | + console.log( version ); |
| 44 | + // 50% of the people will get the new version |
| 45 | + version = Math.round( Math.random() + 1 ); |
| 46 | + $j.cookie( 'vector-nav-pref-version', version, { 'expires': 30, 'path': '/' } ); |
| 47 | + } |
| 48 | + } else { |
| 49 | + // Fallback to old version |
| 50 | + var version = 1; |
| 51 | + } |
| 52 | + } |
| 53 | + // Language portal splitting feature (if it's turned on) |
| 54 | + if ( version == 2 ) { |
| 55 | + // How many links to show in the primary languages portal |
| 56 | + var limit = 5; |
| 57 | + // How many links there must be in the secondary portal to justify having a secondary portal |
| 58 | + var threshold = 3; |
| 59 | + // Make the interwiki language links list a secondary list, and create a new list before it as primary list |
| 60 | + $j( '#p-lang ul' ).addClass( 'secondary' ).before( '<ul class="primary"></ul>' ); |
| 61 | + // This is a list of languages in order of Wikipedia project size. This is the lowest fallback for choosing |
| 62 | + // which links to show in the primary list. Ideally the browser's accept-language headers should steer this |
| 63 | + // list, and we should fallback on a site configured (MediaWiki:Common.js) list of prefered languages. |
| 64 | + var languages = [ |
| 65 | + 'en', 'fr', 'de', 'es', 'pt', 'it', 'ru', 'ja', 'nl', 'pl', 'zh', 'sv', 'ar', 'tr', 'uk', 'fi', 'no', 'ca', |
| 66 | + 'ro', 'hu', 'ksh', 'id', 'he', 'cs', 'vi', 'ko', 'sr', 'fa', 'da', 'eo', 'sk', 'th', 'lt', 'vo', 'bg', |
| 67 | + 'sl', 'hr', 'hi', 'et', 'mk', 'simple', 'new', 'ms', 'nn', 'gl', 'el', 'eu', 'ka', 'tl', 'bn', 'lv', 'ml', |
| 68 | + 'bs', 'te', 'la', 'az', 'sh', 'war', 'br', 'is', 'mr', 'be-x-old', 'sq', 'cy', 'lb', 'ta', 'zh-classical', |
| 69 | + 'an', 'jv', 'ht', 'oc', 'bpy', 'ceb', 'ur', 'zh-yue', 'pms', 'scn', 'be', 'roa-rup', 'qu', 'af', 'sw', |
| 70 | + 'nds', 'fy', 'lmo', 'wa', 'ku', 'hy', 'su', 'yi', 'io', 'os', 'ga', 'ast', 'nap', 'vec', 'gu', 'cv', |
| 71 | + 'bat-smg', 'kn', 'uz', 'zh-min-nan', 'si', 'als', 'yo', 'li', 'gan', 'arz', 'sah', 'tt', 'bar', 'gd', 'tg', |
| 72 | + 'kk', 'pam', 'hsb', 'roa-tara', 'nah', 'mn', 'vls', 'gv', 'mi', 'am', 'ia', 'co', 'ne', 'fo', 'nds-nl', |
| 73 | + 'glk', 'mt', 'ang', 'wuu', 'dv', 'km', 'sco', 'bcl', 'mg', 'my', 'diq', 'tk', 'szl', 'ug', 'fiu-vro', 'sc', |
| 74 | + 'rm', 'nrm', 'ps', 'nv', 'hif', 'bo', 'se', 'sa', 'pnb', 'map-bms', 'lad', 'lij', 'crh', 'fur', 'kw', 'to', |
| 75 | + 'pa', 'jbo', 'ba', 'ilo', 'csb', 'wo', 'xal', 'krc', 'ckb', 'pag', 'ln', 'frp', 'mzn', 'ce', 'nov', 'kv', |
| 76 | + 'eml', 'gn', 'ky', 'pdc', 'lo', 'haw', 'mhr', 'dsb', 'stq', 'tpi', 'arc', 'hak', 'ie', 'so', 'bh', 'ext', |
| 77 | + 'mwl', 'sd', 'ig', 'myv', 'ay', 'iu', 'na', 'cu', 'pi', 'kl', 'ty', 'lbe', 'ab', 'got', 'sm', 'as', 'mo', |
| 78 | + 'ee', 'zea', 'av', 'ace', 'kg', 'bm', 'cdo', 'cbk-zam', 'kab', 'om', 'chr', 'pap', 'udm', 'ks', 'zu', 'rmy', |
| 79 | + 'cr', 'ch', 'st', 'ik', 'mdf', 'kaa', 'aa', 'fj', 'srn', 'tet', 'or', 'pnt', 'bug', 'ss', 'ts', 'pcd', |
| 80 | + 'pih', 'za', 'sg', 'lg', 'bxr', 'xh', 'ak', 'ha', 'bi', 've', 'tn', 'ff', 'dz', 'ti', 'ki', 'ny', 'rw', |
| 81 | + 'chy', 'tw', 'sn', 'tum', 'ng', 'rn', 'mh', 'ii', 'cho', 'hz', 'kr', 'ho', 'mus', 'kj' |
| 82 | + ]; |
| 83 | + // Shortcuts to the two lists |
| 84 | + $primary = $j( '#p-lang ul.primary' ); |
| 85 | + $secondary = $j( '#p-lang ul.secondary' ); |
| 86 | + // Adjust the limit based on the threshold |
| 87 | + if ( $secondary.children().length < limit + threshold ) { |
| 88 | + limit += threshold; |
| 89 | + } |
| 90 | + // Move up to 5 of the links into the primary list, based on the priorities set forth in the languages list |
| 91 | + var count = 0; |
| 92 | + for ( var i = 0; i < languages.length; i++ ) { |
| 93 | + $link = $secondary.find( '.interwiki-' + languages[i] ); |
| 94 | + if ( $link.length ) { |
| 95 | + if ( count++ < limit ) { |
| 96 | + $link.remove().appendTo( $primary ); |
| 97 | + } else { |
| 98 | + break; |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + // If there's still links in the secondary list and we havn't filled the primary list to it's limit yet, move links |
| 103 | + // into the primary list in order of appearance |
| 104 | + if ( count < limit ) { |
| 105 | + $secondary.children().each( function() { |
| 106 | + if ( count++ < limit ) { |
| 107 | + $j(this).remove().appendTo( $primary ); |
| 108 | + } else { |
| 109 | + return false; |
| 110 | + } |
| 111 | + } ); |
| 112 | + } |
| 113 | + // Hide the more portal if it's now empty, otherwise make the list into it's very own portal |
| 114 | + if ( $secondary.children().length == 0 ) { |
| 115 | + $secondary.remove(); |
| 116 | + } else { |
| 117 | + $j( '#p-lang' ).after( '<div id="p-lang-more" class="portal"><h5></h5><div class="body"></div></div>' ); |
| 118 | + $j( '#p-lang-more h5' ).text( mw.usability.getMsg( 'vector-collapsiblenav-more' ) ); |
| 119 | + $secondary.remove().appendTo( $j( '#p-lang-more div.body' ) ); |
| 120 | + } |
| 121 | + // Always show the primary interwiki language portal |
| 122 | + $j( '#p-lang' ).addClass( 'persistent' ); |
| 123 | + } |
| 124 | + // Always show the first portal |
| 125 | + $j( '#panel > div.portal:first' ).addClass( 'first persistent' ); |
40 | 126 | // Apply a class to the entire panel to activate styles |
41 | 127 | $j( '#panel' ).addClass( 'collapsible-nav' ); |
42 | 128 | // Use cookie data to restore preferences of what to show and hide |
43 | 129 | $j( '#panel > div.portal:not(.persistent)' ) |
44 | 130 | .each( function( i ) { |
45 | | - var state = $j.cookie( 'vector-nav-' + $j(this).attr( 'id' ) ); |
46 | | - if ( state == 'true' || ( state == null && i < 1 ) ) { |
| 131 | + var id = $j(this).attr( 'id' ); |
| 132 | + var state = $j.cookie( 'vector-nav-' + id ); |
| 133 | + // In the case that we are not showing the new version, let's show the languages by default |
| 134 | + if ( state == 'true' || ( state == null && i < 1 ) || version == 1 && id == 'p-lang' ) { |
47 | 135 | $j(this) |
48 | 136 | .addClass( 'expanded' ) |
49 | 137 | .find( 'div.body' ) |
— | — | @@ -52,13 +140,16 @@ |
53 | 141 | } |
54 | 142 | // Re-save cookie |
55 | 143 | if ( state != null ) { |
56 | | - $j.cookie( 'vector-nav-' + $j(this).attr( 'id' ), state, { expires: 30, path: '/' } ); |
| 144 | + $j.cookie( 'vector-nav-' + $j(this).attr( 'id' ), state, { 'expires': 30, 'path': '/' } ); |
57 | 145 | } |
58 | 146 | } ); |
59 | | - |
60 | 147 | // Use the same function for all navigation headings - don't repeat yourself |
61 | 148 | function toggle( $element ) { |
62 | | - $j.cookie( 'vector-nav-' + $element.parent().attr( 'id' ), $element.parent().is( '.collapsed' ), { expires: 30, path: '/' } ); |
| 149 | + $j.cookie( |
| 150 | + 'vector-nav-' + $element.parent().attr( 'id' ), |
| 151 | + $element.parent().is( '.collapsed' ), |
| 152 | + { 'expires': 30, 'path': '/' } |
| 153 | + ); |
63 | 154 | $element |
64 | 155 | .parent() |
65 | 156 | .toggleClass( 'expanded' ) |
— | — | @@ -96,47 +187,4 @@ |
97 | 188 | $j(this).blur(); |
98 | 189 | return false; |
99 | 190 | } ); |
100 | | - // Split the language lists, showing the first 5 in the original portal and all others in the overflow portal |
101 | | - var limit = 5; |
102 | | - var count = 0; |
103 | | - $more = $j( '#p-lang-more ul' ); |
104 | | - $j( '#p-lang li' ).each( function() { |
105 | | - if ( count++ >= limit ) { |
106 | | - $j(this).remove().appendTo( $more ); |
107 | | - } |
108 | | - } ); |
109 | | - /* |
110 | | - * It may be clever to use something like this to steer which languages get shown by default... |
111 | | - var wikipediaProjectSizes = { |
112 | | - 'en': 1, 'fr': 2, 'de': 3, 'es': 4, 'pt': 5, 'it': 6, 'ru': 7, 'ja': 8, 'nl': 9, 'pl': 10, 'zh': 11, 'sv': 12, |
113 | | - 'ar': 13, 'tr': 14, 'uk': 15, 'fi': 16, 'no': 17, 'ca': 18, 'ro': 19, 'hu': 20, 'ksh': 21, 'id': 22, 'he': 23, |
114 | | - 'cs': 24, 'vi': 25, 'ko': 26, 'sr': 27, 'fa': 28, 'da': 29, 'eo': 30, 'sk': 31, 'th': 32, 'lt': 33, 'vo': 34, |
115 | | - 'bg': 35, 'sl': 36, 'hr': 37, 'hi': 38, 'et': 39, 'mk': 40, 'simple': 41, 'new': 42, 'ms': 43, 'nn': 44, |
116 | | - 'gl': 45, 'el': 46, 'eu': 47, 'ka': 48, 'tl': 49, 'bn': 50, 'lv': 51, 'ml': 52, 'bs': 53, 'te': 54, 'la': 55, |
117 | | - 'az': 56, 'sh': 57, 'war': 58, 'br': 59, 'is': 60, 'mr': 61, 'be-x-old': 62, 'sq': 63, 'cy': 64, 'lb': 65, |
118 | | - 'ta': 66, 'zh-classical': 67, 'an': 68, 'jv': 69, 'ht': 70, 'oc': 71, 'bpy': 72, 'ceb': 73, 'ur': 74, |
119 | | - 'zh-yue': 75, 'pms': 76, 'scn': 77, 'be': 78, 'roa-rup': 79, 'qu': 80, 'af': 81, 'sw': 82, 'nds': 83, 'fy': 84, |
120 | | - 'lmo': 85, 'wa': 86, 'ku': 87, 'hy': 88, 'su': 89, 'yi': 90, 'io': 91, 'os': 92, 'ga': 93, 'ast': 94, 'nap': 95, |
121 | | - 'vec': 96, 'gu': 97, 'cv': 98, 'bat-smg': 99, 'kn': 100, 'uz': 101, 'zh-min-nan': 102, 'si': 103, 'als': 104, |
122 | | - 'yo': 105, 'li': 106, 'gan': 107, 'arz': 108, 'sah': 109, 'tt': 110, 'bar': 111, 'gd': 112, 'tg': 113, |
123 | | - 'kk': 114, 'pam': 115, 'hsb': 116, 'roa-tara': 117, 'nah': 118, 'mn': 119, 'vls': 120, 'gv': 121, 'mi': 122, |
124 | | - 'am': 123, 'ia': 124, 'co': 125, 'ne': 126, 'fo': 127, 'nds-nl': 128, 'glk': 129, 'mt': 130, 'ang': 131, |
125 | | - 'wuu': 132, 'dv': 133, 'km': 134, 'sco': 135, 'bcl': 136, 'mg': 137, 'my': 138, 'diq': 139, 'tk': 140, |
126 | | - 'szl': 141, 'ug': 142, 'fiu-vro': 143, 'sc': 144, 'rm': 145, 'nrm': 146, 'ps': 147, 'nv': 148, 'hif': 149, |
127 | | - 'bo': 150, 'se': 151, 'sa': 152, 'pnb': 153, 'map-bms': 154, 'lad': 155, 'lij': 156, 'crh': 157, 'fur': 158, |
128 | | - 'kw': 159, 'to': 160, 'pa': 161, 'jbo': 162, 'ba': 163, 'ilo': 164, 'csb': 165, 'wo': 166, 'xal': 167, |
129 | | - 'krc': 168, 'ckb': 169, 'pag': 170, 'ln': 171, 'frp': 172, 'mzn': 173, 'ce': 174, 'nov': 175, 'kv': 176, |
130 | | - 'eml': 177, 'gn': 178, 'ky': 179, 'pdc': 180, 'lo': 181, 'haw': 182, 'mhr': 183, 'dsb': 184, 'stq': 185, |
131 | | - 'tpi': 186, 'arc': 187, 'hak': 188, 'ie': 189, 'so': 190, 'bh': 191, 'ext': 192, 'mwl': 193, 'sd': 194, |
132 | | - 'ig': 195, 'myv': 196, 'ay': 197, 'iu': 198, 'na': 199, 'cu': 200, 'pi': 201, 'kl': 202, 'ty': 203, 'lbe': 204, |
133 | | - 'ab': 205, 'got': 206, 'sm': 207, 'as': 208, 'mo': 209, 'ee': 210, 'zea': 211, 'av': 212, 'ace': 213, 'kg': 214, |
134 | | - 'bm': 215, 'cdo': 216, 'cbk-zam': 217, 'kab': 218, 'om': 219, 'chr': 220, 'pap': 221, 'udm': 222, 'ks': 223, |
135 | | - 'zu': 224, 'rmy': 225, 'cr': 226, 'ch': 227, 'st': 228, 'ik': 229, 'mdf': 230, 'kaa': 231, 'aa': 232, 'fj': 233, |
136 | | - 'srn': 234, 'tet': 235, 'or': 236, 'pnt': 237, 'bug': 238, 'ss': 239, 'ts': 240, 'pcd': 241, 'pih': 242, |
137 | | - 'za': 243, 'sg': 244, 'lg': 245, 'bxr': 246, 'xh': 247, 'ak': 248, 'ha': 249, 'bi': 250, 've': 251, 'tn': 252, |
138 | | - 'ff': 253, 'dz': 254, 'ti': 255, 'ki': 256, 'ny': 257, 'rw': 258, 'chy': 259, 'tw': 260, 'sn': 261, 'tum': 262, |
139 | | - 'ng': 263, 'rn': 264, 'mh': 265, 'ii': 266, 'cho': 267, 'hz': 268, 'kr': 269, 'ho': 270, 'mus': 271, 'kj': 272 |
140 | | - }; |
141 | | - */ |
142 | | - */ |
143 | 191 | } ); |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.php |
— | — | @@ -30,6 +30,11 @@ |
31 | 31 | |
32 | 32 | /* Setup */ |
33 | 33 | |
| 34 | +// Enable bucket testing for new version of collapsible nav |
| 35 | +$wgCollapsibleNavBucketTest = false; |
| 36 | +// Force the new version |
| 37 | +$wgCollapsibleNavForceNewVersion = false; |
| 38 | + |
34 | 39 | // Credits |
35 | 40 | $wgExtensionCredits['other'][] = array( |
36 | 41 | 'path' => __FILE__, |
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' => 16 ), |
| 16 | + array( 'src' => 'Modules/CollapsibleNav/CollapsibleNav.js', 'version' => 17 ), |
17 | 17 | array( 'src' => 'Modules/CollapsibleTabs/CollapsibleTabs.js', 'version' => 8 ), |
18 | 18 | array( 'src' => 'Modules/ExpandableSearch/ExpandableSearch.js', 'version' => 2 ), |
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' => 38 ), |
| 24 | + array( 'src' => 'Vector.combined.js', 'version' => 39 ), |
25 | 25 | ), |
26 | 26 | 'minified' => array( |
27 | | - array( 'src' => 'Vector.combined.min.js', 'version' => 38 ), |
| 27 | + array( 'src' => 'Vector.combined.min.js', 'version' => 39 ), |
28 | 28 | ), |
29 | 29 | ); |
30 | 30 | static $modules = array( |
— | — | @@ -42,6 +42,10 @@ |
43 | 43 | 'messages' => array( |
44 | 44 | 'vector-collapsiblenav-more', |
45 | 45 | ), |
| 46 | + 'variables' => array( |
| 47 | + 'wgCollapsibleNavBucketTest', |
| 48 | + 'wgCollapsibleNavForceNewVersion', |
| 49 | + ), |
46 | 50 | ), |
47 | 51 | 'collapsibletabs' => array( |
48 | 52 | ), |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js |
— | — | @@ -29,18 +29,108 @@ |
30 | 30 | if ( !$j.wikiEditor.isSupported( mod ) ) { |
31 | 31 | return true; |
32 | 32 | } |
33 | | - |
| 33 | + // Allow new version override |
| 34 | + if ( wgCollapsibleNavForceNewVersion == true ) { |
| 35 | + var version = 2; |
| 36 | + } else { |
| 37 | + // Make bucket testing optional |
| 38 | + if ( wgCollapsibleNavBucketTest == true ) { |
| 39 | + // This is be determined randomly, and then stored in a cookie |
| 40 | + var version = $j.cookie( 'vector-nav-pref-version' ); |
| 41 | + // If the cookie didn't exist, or the value is out of range, generate a new one and save it |
| 42 | + if ( version == null ) { |
| 43 | + console.log( version ); |
| 44 | + // 50% of the people will get the new version |
| 45 | + version = Math.round( Math.random() + 1 ); |
| 46 | + $j.cookie( 'vector-nav-pref-version', version, { 'expires': 30, 'path': '/' } ); |
| 47 | + } |
| 48 | + } else { |
| 49 | + // Fallback to old version |
| 50 | + var version = 1; |
| 51 | + } |
| 52 | + } |
| 53 | + // Language portal splitting feature (if it's turned on) |
| 54 | + if ( version == 2 ) { |
| 55 | + // How many links to show in the primary languages portal |
| 56 | + var limit = 5; |
| 57 | + // How many links there must be in the secondary portal to justify having a secondary portal |
| 58 | + var threshold = 3; |
| 59 | + // Make the interwiki language links list a secondary list, and create a new list before it as primary list |
| 60 | + $j( '#p-lang ul' ).addClass( 'secondary' ).before( '<ul class="primary"></ul>' ); |
| 61 | + // This is a list of languages in order of Wikipedia project size. This is the lowest fallback for choosing |
| 62 | + // which links to show in the primary list. Ideally the browser's accept-language headers should steer this |
| 63 | + // list, and we should fallback on a site configured (MediaWiki:Common.js) list of prefered languages. |
| 64 | + var languages = [ |
| 65 | + 'en', 'fr', 'de', 'es', 'pt', 'it', 'ru', 'ja', 'nl', 'pl', 'zh', 'sv', 'ar', 'tr', 'uk', 'fi', 'no', 'ca', |
| 66 | + 'ro', 'hu', 'ksh', 'id', 'he', 'cs', 'vi', 'ko', 'sr', 'fa', 'da', 'eo', 'sk', 'th', 'lt', 'vo', 'bg', |
| 67 | + 'sl', 'hr', 'hi', 'et', 'mk', 'simple', 'new', 'ms', 'nn', 'gl', 'el', 'eu', 'ka', 'tl', 'bn', 'lv', 'ml', |
| 68 | + 'bs', 'te', 'la', 'az', 'sh', 'war', 'br', 'is', 'mr', 'be-x-old', 'sq', 'cy', 'lb', 'ta', 'zh-classical', |
| 69 | + 'an', 'jv', 'ht', 'oc', 'bpy', 'ceb', 'ur', 'zh-yue', 'pms', 'scn', 'be', 'roa-rup', 'qu', 'af', 'sw', |
| 70 | + 'nds', 'fy', 'lmo', 'wa', 'ku', 'hy', 'su', 'yi', 'io', 'os', 'ga', 'ast', 'nap', 'vec', 'gu', 'cv', |
| 71 | + 'bat-smg', 'kn', 'uz', 'zh-min-nan', 'si', 'als', 'yo', 'li', 'gan', 'arz', 'sah', 'tt', 'bar', 'gd', 'tg', |
| 72 | + 'kk', 'pam', 'hsb', 'roa-tara', 'nah', 'mn', 'vls', 'gv', 'mi', 'am', 'ia', 'co', 'ne', 'fo', 'nds-nl', |
| 73 | + 'glk', 'mt', 'ang', 'wuu', 'dv', 'km', 'sco', 'bcl', 'mg', 'my', 'diq', 'tk', 'szl', 'ug', 'fiu-vro', 'sc', |
| 74 | + 'rm', 'nrm', 'ps', 'nv', 'hif', 'bo', 'se', 'sa', 'pnb', 'map-bms', 'lad', 'lij', 'crh', 'fur', 'kw', 'to', |
| 75 | + 'pa', 'jbo', 'ba', 'ilo', 'csb', 'wo', 'xal', 'krc', 'ckb', 'pag', 'ln', 'frp', 'mzn', 'ce', 'nov', 'kv', |
| 76 | + 'eml', 'gn', 'ky', 'pdc', 'lo', 'haw', 'mhr', 'dsb', 'stq', 'tpi', 'arc', 'hak', 'ie', 'so', 'bh', 'ext', |
| 77 | + 'mwl', 'sd', 'ig', 'myv', 'ay', 'iu', 'na', 'cu', 'pi', 'kl', 'ty', 'lbe', 'ab', 'got', 'sm', 'as', 'mo', |
| 78 | + 'ee', 'zea', 'av', 'ace', 'kg', 'bm', 'cdo', 'cbk-zam', 'kab', 'om', 'chr', 'pap', 'udm', 'ks', 'zu', 'rmy', |
| 79 | + 'cr', 'ch', 'st', 'ik', 'mdf', 'kaa', 'aa', 'fj', 'srn', 'tet', 'or', 'pnt', 'bug', 'ss', 'ts', 'pcd', |
| 80 | + 'pih', 'za', 'sg', 'lg', 'bxr', 'xh', 'ak', 'ha', 'bi', 've', 'tn', 'ff', 'dz', 'ti', 'ki', 'ny', 'rw', |
| 81 | + 'chy', 'tw', 'sn', 'tum', 'ng', 'rn', 'mh', 'ii', 'cho', 'hz', 'kr', 'ho', 'mus', 'kj' |
| 82 | + ]; |
| 83 | + // Shortcuts to the two lists |
| 84 | + $primary = $j( '#p-lang ul.primary' ); |
| 85 | + $secondary = $j( '#p-lang ul.secondary' ); |
| 86 | + // Adjust the limit based on the threshold |
| 87 | + if ( $secondary.children().length < limit + threshold ) { |
| 88 | + limit += threshold; |
| 89 | + } |
| 90 | + // Move up to 5 of the links into the primary list, based on the priorities set forth in the languages list |
| 91 | + var count = 0; |
| 92 | + for ( var i = 0; i < languages.length; i++ ) { |
| 93 | + $link = $secondary.find( '.interwiki-' + languages[i] ); |
| 94 | + if ( $link.length ) { |
| 95 | + if ( count++ < limit ) { |
| 96 | + $link.remove().appendTo( $primary ); |
| 97 | + } else { |
| 98 | + break; |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + // If there's still links in the secondary list and we havn't filled the primary list to it's limit yet, move links |
| 103 | + // into the primary list in order of appearance |
| 104 | + if ( count < limit ) { |
| 105 | + $secondary.children().each( function() { |
| 106 | + if ( count++ < limit ) { |
| 107 | + $j(this).remove().appendTo( $primary ); |
| 108 | + } else { |
| 109 | + return false; |
| 110 | + } |
| 111 | + } ); |
| 112 | + } |
| 113 | + // Hide the more portal if it's now empty, otherwise make the list into it's very own portal |
| 114 | + if ( $secondary.children().length == 0 ) { |
| 115 | + $secondary.remove(); |
| 116 | + } else { |
| 117 | + $j( '#p-lang' ).after( '<div id="p-lang-more" class="portal"><h5></h5><div class="body"></div></div>' ); |
| 118 | + $j( '#p-lang-more h5' ).text( mw.usability.getMsg( 'vector-collapsiblenav-more' ) ); |
| 119 | + $secondary.remove().appendTo( $j( '#p-lang-more div.body' ) ); |
| 120 | + } |
| 121 | + // Always show the primary interwiki language portal |
| 122 | + $j( '#p-lang' ).addClass( 'persistent' ); |
| 123 | + } |
| 124 | + // Always show the first portal |
| 125 | + $j( '#panel > div.portal:first' ).addClass( 'first persistent' ); |
| 126 | + // Apply a class to the entire panel to activate styles |
34 | 127 | $j( '#panel' ).addClass( 'collapsible-nav' ); |
35 | | - // Always show the first portal |
36 | | - $j( '#panel > div.portal:first' ) |
37 | | - .addClass( 'expanded' ) |
38 | | - .find( 'div.body' ) |
39 | | - .show(); |
40 | | - // Remember which portals to hide and show |
41 | | - $j( '#panel > div.portal:not(:first)' ) |
| 128 | + // Use cookie data to restore preferences of what to show and hide |
| 129 | + $j( '#panel > div.portal:not(.persistent)' ) |
42 | 130 | .each( function( i ) { |
43 | | - var state = $j.cookie( 'vector-nav-' + $j(this).attr( 'id' ) ); |
44 | | - if ( state == 'true' || ( state == null && i < 1 ) ) { |
| 131 | + var id = $j(this).attr( 'id' ); |
| 132 | + var state = $j.cookie( 'vector-nav-' + id ); |
| 133 | + // In the case that we are not showing the new version, let's show the languages by default |
| 134 | + if ( state == 'true' || ( state == null && i < 1 ) || version == 1 && id == 'p-lang' ) { |
45 | 135 | $j(this) |
46 | 136 | .addClass( 'expanded' ) |
47 | 137 | .find( 'div.body' ) |
— | — | @@ -50,12 +140,16 @@ |
51 | 141 | } |
52 | 142 | // Re-save cookie |
53 | 143 | if ( state != null ) { |
54 | | - $j.cookie( 'vector-nav-' + $j(this).attr( 'id' ), state, { expires: 30, path: '/' } ); |
| 144 | + $j.cookie( 'vector-nav-' + $j(this).attr( 'id' ), state, { 'expires': 30, 'path': '/' } ); |
55 | 145 | } |
56 | 146 | } ); |
57 | 147 | // Use the same function for all navigation headings - don't repeat yourself |
58 | 148 | function toggle( $element ) { |
59 | | - $j.cookie( 'vector-nav-' + $element.parent().attr( 'id' ), $element.parent().is( '.collapsed' ), { expires: 30, path: '/' } ); |
| 149 | + $j.cookie( |
| 150 | + 'vector-nav-' + $element.parent().attr( 'id' ), |
| 151 | + $element.parent().is( '.collapsed' ), |
| 152 | + { 'expires': 30, 'path': '/' } |
| 153 | + ); |
60 | 154 | $element |
61 | 155 | .parent() |
62 | 156 | .toggleClass( 'expanded' ) |
— | — | @@ -63,7 +157,7 @@ |
64 | 158 | .find( 'div.body' ) |
65 | 159 | .slideToggle( 'fast' ); |
66 | 160 | } |
67 | | - var $headings = $j( '#panel > div.portal > h5' ); |
| 161 | + var $headings = $j( '#panel > div.portal:not(.persistent) > h5' ); |
68 | 162 | /** Copy-pasted from jquery.wikiEditor.dialogs - :( */ |
69 | 163 | // Find the highest tabindex in use |
70 | 164 | var maxTI = 0; |
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js |
— | — | @@ -1,9 +1,15 @@ |
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 | | -$j('#panel').addClass('collapsible-nav');$j('#panel > div.portal:first').addClass('expanded').find('div.body').show();$j('#panel > div.portal:not(:first)').each(function(i){var state=$j.cookie('vector-nav-'+$j(this).attr('id'));if(state=='true'||(state==null&&i<1)){$j(this).addClass('expanded').find('div.body').show();}else{$j(this).addClass('collapsed');} |
6 | | -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');} |
7 | | -var $headings=$j('#panel > div.portal > h5');var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI) |
| 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;}} |
| 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'];$primary=$j('#p-lang ul.primary');$secondary=$j('#p-lang ul.secondary');if($secondary.children().length<limit+threshold){limit+=threshold;} |
| 7 | +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;}}} |
| 8 | +if(count<limit){$secondary.children().each(function(){if(count++<limit){$j(this).remove().appendTo($primary);}else{return false;}});} |
| 9 | +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'));} |
| 10 | +$j('#p-lang').addClass('persistent');} |
| 11 | +$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');} |
| 12 | +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');} |
| 13 | +var $headings=$j('#panel > div.portal:not(.persistent) > h5');var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI) |
8 | 14 | maxTI=ti;});var tabIndex=maxTI+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;} |
9 | 15 | 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') |
10 | 16 | $j("#p-cactions").addClass("filledPortlet").removeClass("emptyPortlet").find('h5').css('width','1px').animate({'width':'26px'},390);}).bind("beforeTabExpand",function(){if($j('#p-cactions li').length==1) |
Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | 'base_sets' => array( |
21 | 21 | 'raw' => array( |
22 | 22 | array( 'src' => 'css/suggestions.css', 'version' => 14 ), |
23 | | - array( 'src' => 'css/vector.collapsibleNav.css', 'version' => 10 ), |
| 23 | + array( 'src' => 'css/vector.collapsibleNav.css', 'version' => 11 ), |
24 | 24 | array( 'src' => 'css/vector.expandableSearch.css', 'version' => 2 ), |
25 | 25 | array( 'src' => 'css/vector.footerCleanup.css', 'version' => 2 ), |
26 | 26 | array( 'src' => 'css/wikiEditor.css', 'version' => 14 ), |
— | — | @@ -30,11 +30,11 @@ |
31 | 31 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
32 | 32 | ), |
33 | 33 | 'combined' => array( |
34 | | - array( 'src' => 'css/combined.css', 'version' => 98 ), |
| 34 | + array( 'src' => 'css/combined.css', 'version' => 99 ), |
35 | 35 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
36 | 36 | ), |
37 | 37 | 'minified' => array( |
38 | | - array( 'src' => 'css/combined.min.css', 'version' => 98 ), |
| 38 | + array( 'src' => 'css/combined.min.css', 'version' => 99 ), |
39 | 39 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
40 | 40 | ), |
41 | 41 | ) |