r96151 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96150‎ | r96151 | r96152 >
Date:21:19, 2 September 2011
Author:krinkle
Status:ok
Tags:
Comment:
Whitespace indention fix for r96150 (seperate to make review easier)
Modified paths:
  • /trunk/phase3/resources/mediawiki/mediawiki.util.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki/mediawiki.util.js
@@ -12,87 +12,87 @@
1313 */
1414 'init' : function() {
1515
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+ } );
2121
22 - // Shortcut to client profile return
23 - var profile = $.client.profile();
 22+ // Shortcut to client profile return
 23+ var profile = $.client.profile();
2424
25 - /* Set tooltipAccessKeyPrefix */
 25+ /* Set tooltipAccessKeyPrefix */
2626
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-';
3030
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-' );
3636
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-';
4242
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-';
5050
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+ }
5555
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' );
6060
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' );
6464
65 - } else if ( $( '#article' ).length ) {
66 - // Standard, CologneBlue
67 - util.$content = $( '#article' );
 65+ } else if ( $( '#article' ).length ) {
 66+ // Standard, CologneBlue
 67+ util.$content = $( '#article' );
6868
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+ }
7676
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( '&nbsp;[' ).append( ']&nbsp;' ) );
 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( '&nbsp;[' ).append( ']&nbsp;' ) );
9191
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+ }
9797 },
9898
9999 /* Main body */

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96150Separate execution from definition (mediawiki.util.init)...krinkle21:17, 2 September 2011

Status & tagging log