white-space cleanup throughout $.client and mw.util and mw.util.test (r75593)
authorKrinkle <krinkle@users.mediawiki.org>
Fri, 29 Oct 2010 15:30:54 +0000 (15:30 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Fri, 29 Oct 2010 15:30:54 +0000 (15:30 +0000)
resources/jquery/jquery.client.js
resources/mediawiki.util/mediawiki.util.js

index 1395771..628679e 100644 (file)
@@ -1,17 +1,17 @@
 /*
- * User-agent detection 
+ * User-agent detection
  */
 jQuery.client = new ( function() {
-       
+
        /* Private Members */
-       
+
        var profile;
-       
+
        /* Public Functions */
-       
+
        /**
         * Returns an object containing information about the browser
-        * 
+        *
         * The resulting client object will be in the following format:
         *  {
         *              'name': 'firefox',
@@ -26,9 +26,9 @@ jQuery.client = new ( function() {
        this.profile = function() {
                // Use the cached version if possible
                if ( typeof profile === 'undefined' ) {
-                       
+
                        /* Configuration */
-                       
+
                        // Name of browsers or layout engines we don't recognize
                        var uk = 'unknown';
                        // Generic version digit
@@ -75,9 +75,9 @@ jQuery.client = new ( function() {
                        var platforms = ['win', 'mac', 'linux', 'sunos', 'solaris', 'iphone'];
                        // Translations for conforming operating system names
                        var platformTranslations = [['sunos', 'solaris']];
-                       
+
                        /* Methods */
-                       
+
                        // Performs multiple replacements on a string
                        function translate( source, translations ) {
                                for ( var i = 0; i < translations.length; i++ ) {
@@ -85,9 +85,9 @@ jQuery.client = new ( function() {
                                }
                                return source;
                        };
-                       
+
                        /* Pre-processing  */
-                       
+
                        var userAgent = navigator.userAgent, match, name = uk, layout = uk, layoutversion = uk, platform = uk, version = x;
                        if ( match = new RegExp( '(' + wildUserAgents.join( '|' ) + ')' ).exec( userAgent ) ) {
                                // Takes a userAgent string and translates given text into something we can more easily work with
@@ -95,9 +95,9 @@ jQuery.client = new ( function() {
                        }
                        // Everything will be in lowercase from now on
                        userAgent = userAgent.toLowerCase();
-                       
+
                        /* Extraction */
-                       
+
                        if ( match = new RegExp( '(' + names.join( '|' ) + ')' ).exec( userAgent ) ) {
                                name = translate( match[1], nameTranslations );
                        }
@@ -113,9 +113,9 @@ jQuery.client = new ( function() {
                        if ( match = new RegExp( '(' + versionPrefixes.join( '|' ) + ')' + versionSuffix ).exec( userAgent ) ) {
                                version = match[3];
                        }
-                       
+
                        /* Edge Cases -- did I mention about how user agent string lie? */
-                       
+
                        // Decode Safari's crazy 400+ version numbers
                        if ( name.match( /safari/ ) && version > 400 ) {
                                version = '2.0';
@@ -124,9 +124,9 @@ jQuery.client = new ( function() {
                        if ( name === 'opera' && version >= 9.8) {
                                version = userAgent.match( /version\/([0-9\.]*)/i )[1] || 10;
                        }
-                       
+
                        /* Caching */
-                       
+
                        profile = {
                                'name': name,
                                'layout': layout,
@@ -139,12 +139,12 @@ jQuery.client = new ( function() {
                }
                return profile;
        };
-       
+
        /**
         * Checks the current browser against a support map object to determine if the browser has been black-listed or
         * not. If the browser was not configured specifically it is assumed to work. It is assumed that the body
         * element is classified as either "ltr" or "rtl". If neither is set, "ltr" is assumed.
-        * 
+        *
         * A browser map is in the following format:
         *      {
         *              'ltr': {
@@ -160,9 +160,9 @@ jQuery.client = new ( function() {
         *                      'iphone': false
         *              }
         *      }
-        * 
+        *
         * @param map Object of browser support map
-        * 
+        *
         * @return Boolean true if browser known or assumed to be supported, false if blacklisted
         */
        this.test = function( map ) {
index 621a5e9..6ccd3fb 100644 (file)
 
                                // Any initialisation after the DOM is ready
                                $(function () {
-                                       
+
                                        // Populate clientProfile var
                                        mw.util.clientProfile = $.client.profile();
-                                       var webkit = navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
 
                                        // Set tooltipAccessKeyPrefix
-                                       
+
                                        // Opera on any platform
                                        if ( mw.util.isBrowser('opera') ) {
                                                this.tooltipAccessKeyPrefix = 'shift-esc-';
-                                       
+
                                        // Chrome on any platform
                                        } else if ( mw.util.isBrowser('chrome') ) {
                                                // Chrome on Mac or Chrome on other platform ?
                                                this.tooltipAccessKeyPrefix = mw.util.isPlatform('mac') ? 'ctrl-option-' : 'alt-';
-                                       
+
                                        // Non-Windows Safari with webkit_version > 526
                                        } else if ( !mw.util.isPlatform('win') && mw.util.isBrowser('safari') && webkit_version > 526 ) {
                                                this.tooltipAccessKeyPrefix = 'ctrl-alt-';
-                                       
+
                                        // Safari/Konqueror on any platform, or any browser on Mac (but not Safari on Windows)
                                        } else if ( !( mw.util.isPlatform('win') && mw.util.isBrowser('safari') )
                                                                        && ( mw.util.isBrowser('safari')
                                                                          || mw.util.isPlatform('mac')
                                                                          || mw.util.isBrowser('konqueror') ) ) {
                                                this.tooltipAccessKeyPrefix = 'ctrl-';
-                                       
+
                                        // Firefox 2.x
                                        } else if ( mw.util.isBrowser('firefox') && mw.util.isBrowserVersion('2') ) {
                                                this.tooltipAccessKeyPrefix = 'alt-shift-';
@@ -56,7 +55,7 @@
                                                mw.util.$content = $('#article');
                                        } else {
                                                mw.util.$content = $('#content');
-                                       } 
+                                       }
                                });