Index: trunk/phase3/resources/mediawiki/mediawiki.util.js |
— | — | @@ -12,87 +12,87 @@ |
13 | 13 | */ |
14 | 14 | 'init' : function() { |
15 | 15 | |
16 | | - /* Set up $.messageBox */ |
17 | | - $.messageBoxNew( { |
18 | | - 'id': 'mw-js-message', |
19 | | - 'parent': '#content' |
20 | | - } ); |
| 16 | + /* Set up $.messageBox */ |
| 17 | + $.messageBoxNew( { |
| 18 | + 'id': 'mw-js-message', |
| 19 | + 'parent': '#content' |
| 20 | + } ); |
21 | 21 | |
22 | | - // Shortcut to client profile return |
23 | | - var profile = $.client.profile(); |
| 22 | + // Shortcut to client profile return |
| 23 | + var profile = $.client.profile(); |
24 | 24 | |
25 | | - /* Set tooltipAccessKeyPrefix */ |
| 25 | + /* Set tooltipAccessKeyPrefix */ |
26 | 26 | |
27 | | - // Opera on any platform |
28 | | - if ( profile.name == 'opera' ) { |
29 | | - util.tooltipAccessKeyPrefix = 'shift-esc-'; |
| 27 | + // Opera on any platform |
| 28 | + if ( profile.name == 'opera' ) { |
| 29 | + util.tooltipAccessKeyPrefix = 'shift-esc-'; |
30 | 30 | |
31 | | - // Chrome on any platform |
32 | | - } else if ( profile.name == 'chrome' ) { |
33 | | - // Chrome on Mac or Chrome on other platform ? |
34 | | - util.tooltipAccessKeyPrefix = ( profile.platform == 'mac' |
35 | | - ? 'ctrl-option-' : 'alt-' ); |
| 31 | + // Chrome on any platform |
| 32 | + } else if ( profile.name == 'chrome' ) { |
| 33 | + // Chrome on Mac or Chrome on other platform ? |
| 34 | + util.tooltipAccessKeyPrefix = ( profile.platform == 'mac' |
| 35 | + ? 'ctrl-option-' : 'alt-' ); |
36 | 36 | |
37 | | - // Non-Windows Safari with webkit_version > 526 |
38 | | - } else if ( profile.platform !== 'win' |
39 | | - && profile.name == 'safari' |
40 | | - && profile.layoutVersion > 526 ) { |
41 | | - util.tooltipAccessKeyPrefix = 'ctrl-alt-'; |
| 37 | + // Non-Windows Safari with webkit_version > 526 |
| 38 | + } else if ( profile.platform !== 'win' |
| 39 | + && profile.name == 'safari' |
| 40 | + && profile.layoutVersion > 526 ) { |
| 41 | + util.tooltipAccessKeyPrefix = 'ctrl-alt-'; |
42 | 42 | |
43 | | - // Safari/Konqueror on any platform, or any browser on Mac |
44 | | - // (but not Safari on Windows) |
45 | | - } else if ( !( profile.platform == 'win' && profile.name == 'safari' ) |
46 | | - && ( profile.name == 'safari' |
47 | | - || profile.platform == 'mac' |
48 | | - || profile.name == 'konqueror' ) ) { |
49 | | - util.tooltipAccessKeyPrefix = 'ctrl-'; |
| 43 | + // Safari/Konqueror on any platform, or any browser on Mac |
| 44 | + // (but not Safari on Windows) |
| 45 | + } else if ( !( profile.platform == 'win' && profile.name == 'safari' ) |
| 46 | + && ( profile.name == 'safari' |
| 47 | + || profile.platform == 'mac' |
| 48 | + || profile.name == 'konqueror' ) ) { |
| 49 | + util.tooltipAccessKeyPrefix = 'ctrl-'; |
50 | 50 | |
51 | | - // Firefox 2.x and later |
52 | | - } else if ( profile.name == 'firefox' && profile.versionBase > '1' ) { |
53 | | - util.tooltipAccessKeyPrefix = 'alt-shift-'; |
54 | | - } |
| 51 | + // Firefox 2.x and later |
| 52 | + } else if ( profile.name == 'firefox' && profile.versionBase > '1' ) { |
| 53 | + util.tooltipAccessKeyPrefix = 'alt-shift-'; |
| 54 | + } |
55 | 55 | |
56 | | - /* Fill $content var */ |
57 | | - if ( $( '#bodyContent' ).length ) { |
58 | | - // Vector, Monobook, Chick etc. |
59 | | - util.$content = $( '#bodyContent' ); |
| 56 | + /* Fill $content var */ |
| 57 | + if ( $( '#bodyContent' ).length ) { |
| 58 | + // Vector, Monobook, Chick etc. |
| 59 | + util.$content = $( '#bodyContent' ); |
60 | 60 | |
61 | | - } else if ( $( '#mw_contentholder' ).length ) { |
62 | | - // Modern |
63 | | - util.$content = $( '#mw_contentholder' ); |
| 61 | + } else if ( $( '#mw_contentholder' ).length ) { |
| 62 | + // Modern |
| 63 | + util.$content = $( '#mw_contentholder' ); |
64 | 64 | |
65 | | - } else if ( $( '#article' ).length ) { |
66 | | - // Standard, CologneBlue |
67 | | - util.$content = $( '#article' ); |
| 65 | + } else if ( $( '#article' ).length ) { |
| 66 | + // Standard, CologneBlue |
| 67 | + util.$content = $( '#article' ); |
68 | 68 | |
69 | | - } else { |
70 | | - // #content is present on almost all if not all skins. Most skins (the above cases) |
71 | | - // have #content too, but as an outer wrapper instead of the article text container. |
72 | | - // The skins that don't have an outer wrapper do have #content for everything |
73 | | - // so it's a good fallback |
74 | | - util.$content = $( '#content' ); |
75 | | - } |
| 69 | + } else { |
| 70 | + // #content is present on almost all if not all skins. Most skins (the above cases) |
| 71 | + // have #content too, but as an outer wrapper instead of the article text container. |
| 72 | + // The skins that don't have an outer wrapper do have #content for everything |
| 73 | + // so it's a good fallback |
| 74 | + util.$content = $( '#content' ); |
| 75 | + } |
76 | 76 | |
77 | | - /* Table of Contents toggle */ |
78 | | - var $tocContainer = $( '#toc' ), |
79 | | - $tocTitle = $( '#toctitle' ), |
80 | | - $tocToggleLink = $( '#togglelink' ); |
81 | | - // Only add it if there is a TOC and there is no toggle added already |
82 | | - if ( $tocContainer.length && $tocTitle.length && !$tocToggleLink.length ) { |
83 | | - var hideTocCookie = $.cookie( 'mw_hidetoc' ); |
84 | | - $tocToggleLink = $( '<a href="#" class="internal" id="togglelink"></a>' ) |
85 | | - .text( mw.msg( 'hidetoc' ) ) |
86 | | - .click( function(e){ |
87 | | - e.preventDefault(); |
88 | | - util.toggleToc( $(this) ); |
89 | | - } ); |
90 | | - $tocTitle.append( $tocToggleLink.wrap( '<span class="toctoggle"></span>' ).parent().prepend( ' [' ).append( '] ' ) ); |
| 77 | + /* Table of Contents toggle */ |
| 78 | + var $tocContainer = $( '#toc' ), |
| 79 | + $tocTitle = $( '#toctitle' ), |
| 80 | + $tocToggleLink = $( '#togglelink' ); |
| 81 | + // Only add it if there is a TOC and there is no toggle added already |
| 82 | + if ( $tocContainer.length && $tocTitle.length && !$tocToggleLink.length ) { |
| 83 | + var hideTocCookie = $.cookie( 'mw_hidetoc' ); |
| 84 | + $tocToggleLink = $( '<a href="#" class="internal" id="togglelink"></a>' ) |
| 85 | + .text( mw.msg( 'hidetoc' ) ) |
| 86 | + .click( function(e){ |
| 87 | + e.preventDefault(); |
| 88 | + util.toggleToc( $(this) ); |
| 89 | + } ); |
| 90 | + $tocTitle.append( $tocToggleLink.wrap( '<span class="toctoggle"></span>' ).parent().prepend( ' [' ).append( '] ' ) ); |
91 | 91 | |
92 | | - if ( hideTocCookie == '1' ) { |
93 | | - // Cookie says user want toc hidden |
94 | | - $tocToggleLink.click(); |
95 | | - } |
96 | | - } |
| 92 | + if ( hideTocCookie == '1' ) { |
| 93 | + // Cookie says user want toc hidden |
| 94 | + $tocToggleLink.click(); |
| 95 | + } |
| 96 | + } |
97 | 97 | }, |
98 | 98 | |
99 | 99 | /* Main body */ |