Change-Id: Idd78fa72dcff46341cd55ba128ef24107d240c6b
"groups": [
{
"name": "Plugins",
"groups": [
{
"name": "Plugins",
- "classes": ["jQuery.plugin.*"]
+ "classes": [
+ "jQuery.client",
+ "jQuery.plugin.*"
+ ]
"../../resources/src/jquery/jquery.autoEllipsis.js",
"../../resources/src/jquery/jquery.badge.js",
"../../resources/src/jquery/jquery.byteLimit.js",
"../../resources/src/jquery/jquery.autoEllipsis.js",
"../../resources/src/jquery/jquery.badge.js",
"../../resources/src/jquery/jquery.byteLimit.js",
+ "../../resources/src/jquery/jquery.client.js",
"../../resources/src/jquery/jquery.localize.js",
"../../resources/src/jquery/jquery.spinner.js",
"../../resources/lib/oojs",
"../../resources/src/jquery/jquery.localize.js",
"../../resources/src/jquery/jquery.spinner.js",
"../../resources/lib/oojs",
/**
* User-agent detection
/**
* User-agent detection
+ *
+ * @class jQuery.client
+ * @singleton
- /* Private Members */
-
- * @var {Object} profileCache Keyed by userAgent string,
+ * @private
+ * @property {Object} profileCache Keyed by userAgent string,
* value is the parsed $.client.profile object for that user agent.
*/
var profileCache = {};
* value is the parsed $.client.profile object for that user agent.
*/
var profileCache = {};
$.client = {
/**
* Get an object containing information about the client.
*
$.client = {
/**
* Get an object containing information about the client.
*
- * @param {Object} nav An object with atleast a 'userAgent' and 'platform' key.
- * Defaults to the global Navigator object.
+ * @param {Object} [nav] An object with a 'userAgent' and 'platform' property.
+ * Defaults to the global `navigator` object.
* @return {Object} The resulting client object will be in the following format:
* @return {Object} The resulting client object will be in the following format:
- * {
- * 'name': 'firefox',
- * 'layout': 'gecko',
- * 'layoutVersion': 20101026,
- * 'platform': 'linux'
- * 'version': '3.5.1',
- * 'versionBase': '3',
- * 'versionNumber': 3.5,
- * }
+ *
+ * {
+ * 'name': 'firefox',
+ * 'layout': 'gecko',
+ * 'layoutVersion': 20101026,
+ * 'platform': 'linux'
+ * 'version': '3.5.1',
+ * 'versionBase': '3',
+ * 'versionNumber': 3.5,
+ * }
*/
profile: function ( nav ) {
/*jshint boss: true */
*/
profile: function ( nav ) {
/*jshint boss: true */
versionNumber,
key = nav.userAgent + '|' + nav.platform,
versionNumber,
key = nav.userAgent + '|' + nav.platform,
// Name of browsers or layout engines we don't recognize
uk = 'unknown',
// Name of browsers or layout engines we don't recognize
uk = 'unknown',
// Translations for conforming operating system names
platformTranslations = [ ['sunos', 'solaris'], ['wow64', 'win'] ],
// Translations for conforming operating system names
platformTranslations = [ ['sunos', 'solaris'], ['wow64', 'win'] ],
/**
* Performs multiple replacements on a string
/**
* Performs multiple replacements on a string
*/
translate = function ( source, translations ) {
var i;
*/
translate = function ( source, translations ) {
var i;
ua = nav.userAgent,
match,
ua = nav.userAgent,
match,
// Everything will be in lowercase from now on
ua = ua.toLowerCase();
// Everything will be in lowercase from now on
ua = ua.toLowerCase();
if ( match = new RegExp( '(' + names.join( '|' ) + ')' ).exec( ua ) ) {
name = translate( match[1], nameTranslations );
if ( match = new RegExp( '(' + names.join( '|' ) + ')' ).exec( ua ) ) {
name = translate( match[1], nameTranslations );
- /* Edge Cases -- did I mention about how user agent string lie? */
+ // Edge Cases -- did I mention about how user agent string lie?
// Decode Safari's crazy 400+ version numbers
if ( name === 'safari' && version > 400 ) {
// Decode Safari's crazy 400+ version numbers
if ( name === 'safari' && version > 400 ) {
versionNumber = parseFloat( version, 10 ) || 0.0;
versionNumber = parseFloat( version, 10 ) || 0.0;
return profileCache[ key ] = {
name: name,
return profileCache[ key ] = {
name: name,
* algorithm, similar to PHP's version_compare ('1.2' < '1.11').
*
* A browser map is in the following format:
* algorithm, similar to PHP's version_compare ('1.2' < '1.11').
*
* A browser map is in the following format:
- * {
- * // Multiple rules with configurable operators
- * 'msie': [['>=', 7], ['!=', 9]],
- * // Match no versions
- * 'iphone': false,
- * // Match any version
- * 'android': null
- * }
+ *
+ * {
+ * // Multiple rules with configurable operators
+ * 'msie': [['>=', 7], ['!=', 9]],
+ * // Match no versions
+ * 'iphone': false,
+ * // Match any version
+ * 'android': null
+ * }
*
* It can optionally be split into ltr/rtl sections:
*
* It can optionally be split into ltr/rtl sections:
- * {
- * 'ltr': {
- * 'android': null,
- * 'iphone': false
- * },
- * 'rtl': {
- * 'android': false,
- * // rules are not inherited from ltr
- * 'iphone': false
- * }
- * }
+ *
+ * {
+ * 'ltr': {
+ * 'android': null,
+ * 'iphone': false
+ * },
+ * 'rtl': {
+ * 'android': false,
+ * // rules are not inherited from ltr
+ * 'iphone': false
+ * }
+ * }
*
* @param {Object} map Browser support map
* @param {Object} [profile] A client-profile object
*
* @param {Object} map Browser support map
* @param {Object} [profile] A client-profile object