summaryrefslogtreecommitdiff
path: root/resources/jquery/jquery.client.js
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-01-18 16:46:04 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-01-18 16:46:04 +0100
commit63601400e476c6cf43d985f3e7b9864681695ed4 (patch)
treef7846203a952e38aaf66989d0a4702779f549962 /resources/jquery/jquery.client.js
parent8ff01378c9e0207f9169b81966a51def645b6a51 (diff)
Update to MediaWiki 1.20.2
this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024
Diffstat (limited to 'resources/jquery/jquery.client.js')
-rw-r--r--resources/jquery/jquery.client.js63
1 files changed, 36 insertions, 27 deletions
diff --git a/resources/jquery/jquery.client.js b/resources/jquery/jquery.client.js
index ae74a324..24f8959e 100644
--- a/resources/jquery/jquery.client.js
+++ b/resources/jquery/jquery.client.js
@@ -1,7 +1,7 @@
/**
* User-agent detection
*/
-( function( $ ) {
+( function ( $ ) {
/* Private Members */
@@ -18,7 +18,7 @@
/**
* Get an object containing information about the client.
*
- * @param nav {Object} An object with atleast a 'userAgent' and 'platform' key.=
+ * @param nav {Object} An object with atleast a 'userAgent' and 'platform' key.
* Defaults to the global Navigator object.
* @return {Object} The resulting client object will be in the following format:
* {
@@ -31,7 +31,9 @@
* 'versionNumber': 3.5,
* }
*/
- profile: function( nav ) {
+ profile: function ( nav ) {
+ /*jshint boss: true */
+
if ( nav === undefined ) {
nav = window.navigator;
}
@@ -64,15 +66,15 @@
// Strings which precede a version number in a user agent string - combined and used as match 1 in
// version detectection
var versionPrefixes = [
- 'camino', 'chrome', 'firefox', 'netscape', 'netscape6', 'opera', 'version', 'konqueror', 'lynx',
- 'msie', 'safari', 'ps3'
+ 'camino', 'chrome', 'firefox', 'netscape', 'netscape6', 'opera', 'version', 'konqueror',
+ 'lynx', 'msie', 'safari', 'ps3'
];
// Used as matches 2, 3 and 4 in version extraction - 3 is used as actual version number
var versionSuffix = '(\\/|\\;?\\s|)([a-z0-9\\.\\+]*?)(\\;|dev|rel|\\)|\\s|$)';
// Names of known browsers
var names = [
- 'camino', 'chrome', 'firefox', 'netscape', 'konqueror', 'lynx', 'msie', 'opera', 'safari', 'ipod',
- 'iphone', 'blackberry', 'ps3'
+ 'camino', 'chrome', 'firefox', 'netscape', 'konqueror', 'lynx', 'msie', 'opera',
+ 'safari', 'ipod', 'iphone', 'blackberry', 'ps3', 'rekonq'
];
// Tanslations for conforming browser names
var nameTranslations = [];
@@ -89,9 +91,12 @@
/* Methods */
- // Performs multiple replacements on a string
- var translate = function( source, translations ) {
- for ( var i = 0; i < translations.length; i++ ) {
+ /**
+ * Performs multiple replacements on a string
+ */
+ var translate = function ( source, translations ) {
+ var i;
+ for ( i = 0; i < translations.length; i++ ) {
source = source.replace( translations[i][0], translations[i][1] );
}
return source;
@@ -147,13 +152,13 @@
/* Caching */
profileCache[nav.userAgent] = {
- 'name': name,
- 'layout': layout,
- 'layoutVersion': layoutversion,
- 'platform': platform,
- 'version': version,
- 'versionBase': ( version !== x ? Math.floor( versionNumber ).toString() : x ),
- 'versionNumber': versionNumber
+ name: name,
+ layout: layout,
+ layoutVersion: layoutversion,
+ platform: platform,
+ version: version,
+ versionBase: ( version !== x ? Math.floor( versionNumber ).toString() : x ),
+ versionNumber: versionNumber
};
}
return profileCache[nav.userAgent];
@@ -185,26 +190,30 @@
*
* @return Boolean true if browser known or assumed to be supported, false if blacklisted
*/
- test: function( map, profile ) {
+ test: function ( map, profile ) {
+ /*jshint evil:true */
+
+ var conditions, dir, i, op, val;
profile = $.isPlainObject( profile ) ? profile : $.client.profile();
- var dir = $( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr';
+ dir = $( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr';
// Check over each browser condition to determine if we are running in a compatible client
- if ( typeof map[dir] !== 'object' || typeof map[dir][profile.name] === 'undefined' ) {
+ if ( typeof map[dir] !== 'object' || map[dir][profile.name] === undefined ) {
// Unknown, so we assume it's working
return true;
}
- var conditions = map[dir][profile.name];
- for ( var i = 0; i < conditions.length; i++ ) {
- var op = conditions[i][0];
- var val = conditions[i][1];
+ conditions = map[dir][profile.name];
+ for ( i = 0; i < conditions.length; i++ ) {
+ op = conditions[i][0];
+ val = conditions[i][1];
if ( val === false ) {
return false;
- } else if ( typeof val == 'string' ) {
+ }
+ if ( typeof val === 'string' ) {
if ( !( eval( 'profile.version' + op + '"' + val + '"' ) ) ) {
return false;
}
- } else if ( typeof val == 'number' ) {
+ } else if ( typeof val === 'number' ) {
if ( !( eval( 'profile.versionNumber' + op + val ) ) ) {
return false;
}
@@ -213,4 +222,4 @@
return true;
}
};
-} )( jQuery );
+}( jQuery ) );