From: Krinkle Date: Fri, 29 Oct 2010 15:30:54 +0000 (+0000) Subject: white-space cleanup throughout $.client and mw.util and mw.util.test (r75593) X-Git-Tag: 1.31.0-rc.0~34226 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=4074b58c3ce451f897d9e2f7f063ff2944a06d46;p=lhc%2Fweb%2Fwiklou.git white-space cleanup throughout $.client and mw.util and mw.util.test (r75593) --- diff --git a/resources/jquery/jquery.client.js b/resources/jquery/jquery.client.js index 1395771323..628679ec00 100644 --- a/resources/jquery/jquery.client.js +++ b/resources/jquery/jquery.client.js @@ -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 ) { diff --git a/resources/mediawiki.util/mediawiki.util.js b/resources/mediawiki.util/mediawiki.util.js index 621a5e9913..6ccd3fba6c 100644 --- a/resources/mediawiki.util/mediawiki.util.js +++ b/resources/mediawiki.util/mediawiki.util.js @@ -14,33 +14,32 @@ // 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'); - } + } });