"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "resources/lib/jquery.client/jquery.client.js" between
mediawiki-1.31.1.tar.gz and mediawiki-1.32.0.tar.gz

About: MediaWiki is a wiki engine (the collaborative editing software that runs for e.g. Wikipedia, the free encyclopedia).

jquery.client.js  (mediawiki-1.31.1):jquery.client.js  (mediawiki-1.32.0)
/*! /*!
* jQuery Client v2.0.0 * jQuery Client v2.0.1
* https://www.mediawiki.org/wiki/JQuery_Client * https://www.mediawiki.org/wiki/JQuery_Client
* *
* Copyright 2010-2015 jquery-client maintainers and other contributors. * Copyright 2010-2015 jquery-client maintainers and other contributors.
* Released under the MIT license * Released under the MIT license
* http://jquery-client.mit-license.org * http://jquery-client.mit-license.org
*/ */
/** /**
* User-agent detection * User-agent detection
* *
skipping to change at line 45 skipping to change at line 45
* 'name': 'firefox', * 'name': 'firefox',
* 'layout': 'gecko', * 'layout': 'gecko',
* 'layoutVersion': 20101026, * 'layoutVersion': 20101026,
* 'platform': 'linux' * 'platform': 'linux'
* 'version': '3.5.1', * 'version': '3.5.1',
* 'versionBase': '3', * 'versionBase': '3',
* 'versionNumber': 3.5, * 'versionNumber': 3.5,
* } * }
*/ */
profile: function ( nav ) { profile: function ( nav ) {
/*jshint boss:true */
if ( nav === undefined ) { if ( nav === undefined ) {
nav = window.navigator; nav = window.navigator;
} }
// Use the cached version if possible // Use the cached version if possible
if ( profileCache[ nav.userAgent + '|' + nav.platform ] ! == undefined ) { if ( profileCache[ nav.userAgent + '|' + nav.platform ] ! == undefined ) {
return profileCache[ nav.userAgent + '|' + nav.pl atform ]; return profileCache[ nav.userAgent + '|' + nav.pl atform ];
} }
var var
versionNumber, versionNumber,
key = nav.userAgent + '|' + nav.platform, key = nav.userAgent + '|' + nav.platform,
// Configuration // Configuration
// Name of browsers or layout engines we don't re cognize // Name of browsers or layout engines we don't re cognize
uk = 'unknown', uk = 'unknown',
// Generic version digit // Generic version digit
x = 'x', x = 'x',
// Strings found in user agent strings that need to be conformed // Strings found in user agent strings that need to be conformed
wildUserAgents = ['Opera', 'Navigator', 'Minefiel d', 'KHTML', 'Chrome', 'PLAYSTATION 3', 'Iceweasel'], wildUserAgents = [ 'Opera', 'Navigator', 'Minefie ld', 'KHTML', 'Chrome', 'PLAYSTATION 3', 'Iceweasel' ],
// Translations for conforming user agent strings // Translations for conforming user agent strings
userAgentTranslations = [ userAgentTranslations = [
// Tons of browsers lie about being somet hing they are not // Tons of browsers lie about being somet hing they are not
[/(Firefox|MSIE|KHTML,?\slike\sGecko|Konq ueror)/, ''], [ /(Firefox|MSIE|KHTML,?\slike\sGecko|Kon queror)/, '' ],
// Chrome lives in the shadow of Safari s till // Chrome lives in the shadow of Safari s till
['Chrome Safari', 'Chrome'], [ 'Chrome Safari', 'Chrome' ],
// KHTML is the layout engine not the bro wser - LIES! // KHTML is the layout engine not the bro wser - LIES!
['KHTML', 'Konqueror'], [ 'KHTML', 'Konqueror' ],
// Firefox nightly builds // Firefox nightly builds
['Minefield', 'Firefox'], [ 'Minefield', 'Firefox' ],
// This helps keep different versions con sistent // This helps keep different versions con sistent
['Navigator', 'Netscape'], [ 'Navigator', 'Netscape' ],
// This prevents version extraction issue s, otherwise translation would happen later // This prevents version extraction issue s, otherwise translation would happen later
['PLAYSTATION 3', 'PS3'] [ 'PLAYSTATION 3', 'PS3' ]
], ],
// Strings which precede a version number in a us er agent string - combined and used as // Strings which precede a version number in a us er agent string - combined and used as
// match 1 in version detection // match 1 in version detection
versionPrefixes = [ versionPrefixes = [
'camino', 'chrome', 'firefox', 'iceweasel ', 'netscape', 'netscape6', 'opera', 'version', 'konqueror', 'camino', 'chrome', 'firefox', 'iceweasel ', 'netscape', 'netscape6', 'opera', 'version', 'konqueror',
'lynx', 'msie', 'safari', 'ps3', 'android ' 'lynx', 'msie', 'safari', 'ps3', 'android '
], ],
// Used as matches 2, 3 and 4 in version extracti on - 3 is used as actual version number // Used as matches 2, 3 and 4 in version extracti on - 3 is used as actual version number
versionSuffix = '(\\/|\\;?\\s|)([a-z0-9\\.\\+]*?) (\\;|dev|rel|\\)|\\s|$)', versionSuffix = '(\\/|\\;?\\s|)([a-z0-9\\.\\+]*?) (\\;|dev|rel|\\)|\\s|$)',
// Names of known browsers // Names of known browsers
names = [ names = [
'camino', 'chrome', 'firefox', 'iceweasel ', 'netscape', 'konqueror', 'lynx', 'msie', 'opera', 'camino', 'chrome', 'firefox', 'iceweasel ', 'netscape', 'konqueror', 'lynx', 'msie', 'opera',
'safari', 'ipod', 'iphone', 'blackberry', 'ps3', 'rekonq', 'android' 'safari', 'ipod', 'iphone', 'blackberry', 'ps3', 'rekonq', 'android'
], ],
// Tanslations for conforming browser names // Tanslations for conforming browser names
nameTranslations = [], nameTranslations = [],
// Names of known layout engines // Names of known layout engines
layouts = ['gecko', 'konqueror', 'msie', 'trident ', 'edge', 'opera', 'webkit'], layouts = [ 'gecko', 'konqueror', 'msie', 'triden t', 'edge', 'opera', 'webkit' ],
// Translations for conforming layout names // Translations for conforming layout names
layoutTranslations = [ ['konqueror', 'khtml'], [' msie', 'trident'], ['opera', 'presto'] ], layoutTranslations = [ [ 'konqueror', 'khtml' ], [ 'msie', 'trident' ], [ 'opera', 'presto' ] ],
// Names of supported layout engines for version number // Names of supported layout engines for version number
layoutVersions = ['applewebkit', 'gecko', 'triden t', 'edge'], layoutVersions = [ 'applewebkit', 'gecko', 'tride nt', 'edge' ],
// Names of known operating systems // Names of known operating systems
platforms = ['win', 'wow64', 'mac', 'linux', 'sun os', 'solaris', 'iphone'], platforms = [ 'win', 'wow64', 'mac', 'linux', 'su nos', 'solaris', 'iphone' ],
// Translations for conforming operating system n ames // Translations for conforming operating system n ames
platformTranslations = [ ['sunos', 'solaris'], [' wow64', 'win'] ], platformTranslations = [ [ 'sunos', 'solaris' ], [ 'wow64', 'win' ] ],
/** /**
* Performs multiple replacements on a string * Performs multiple replacements on a string
* @ignore * @ignore
*/ */
translate = function ( source, translations ) { translate = function ( source, translations ) {
var i; var i;
for ( i = 0; i < translations.length; i++ ) { for ( i = 0; i < translations.length; i++ ) {
source = source.replace( translat ions[i][0], translations[i][1] ); source = source.replace( translat ions[ i ][ 0 ], translations[ i ][ 1 ] );
} }
return source; return source;
}, },
// Pre-processing // Pre-processing
ua = nav.userAgent, ua = nav.userAgent,
match, match,
name = uk, name = uk,
layout = uk, layout = uk,
skipping to change at line 141 skipping to change at line 139
if ( match = new RegExp( '(' + wildUserAgents.join( '|' ) + ')' ).exec( ua ) ) { if ( match = new RegExp( '(' + wildUserAgents.join( '|' ) + ')' ).exec( ua ) ) {
// Takes a userAgent string and translates given text into something we can more easily work with // Takes a userAgent string and translates given text into something we can more easily work with
ua = translate( ua, userAgentTranslations ); ua = translate( ua, userAgentTranslations );
} }
// Everything will be in lowercase from now on // Everything will be in lowercase from now on
ua = ua.toLowerCase(); ua = ua.toLowerCase();
// Extraction // Extraction
if ( match = new RegExp( '(' + names.join( '|' ) + ')' ). exec( ua ) ) { if ( match = new RegExp( '(' + names.join( '|' ) + ')' ). exec( ua ) ) {
name = translate( match[1], nameTranslations ); name = translate( match[ 1 ], nameTranslations );
} }
if ( match = new RegExp( '(' + layouts.join( '|' ) + ')' ).exec( ua ) ) { if ( match = new RegExp( '(' + layouts.join( '|' ) + ')' ).exec( ua ) ) {
layout = translate( match[1], layoutTranslations ); layout = translate( match[ 1 ], layoutTranslation s );
} }
if ( match = new RegExp( '(' + layoutVersions.join( '|' ) if ( match = new RegExp( '(' + layoutVersions.join( '|' )
+ ')\\\/(\\d+)').exec( ua ) ) { + ')\\/(\\d+)' ).exec( ua ) ) {
layoutversion = parseInt( match[2], 10 ); layoutversion = parseInt( match[ 2 ], 10 );
} }
if ( match = new RegExp( '(' + platforms.join( '|' ) + ') ' ).exec( nav.platform.toLowerCase() ) ) { if ( match = new RegExp( '(' + platforms.join( '|' ) + ') ' ).exec( nav.platform.toLowerCase() ) ) {
platform = translate( match[1], platformTranslati ons ); platform = translate( match[ 1 ], platformTransla tions );
} }
if ( match = new RegExp( '(' + versionPrefixes.join( '|' ) + ')' + versionSuffix ).exec( ua ) ) { if ( match = new RegExp( '(' + versionPrefixes.join( '|' ) + ')' + versionSuffix ).exec( ua ) ) {
version = match[3]; version = match[ 3 ];
} }
// Edge Cases -- did I mention about how user agent strin g lie? // Edge Cases -- did I mention about how user agent strin g lie?
// Decode Safari's crazy 400+ version numbers // Decode Safari's crazy 400+ version numbers
if ( name === 'safari' && version > 400 ) { if ( name === 'safari' && version > 400 ) {
version = '2.0'; version = '2.0';
} }
// Expose Opera 10's lies about being Opera 9.8 // Expose Opera 10's lies about being Opera 9.8
if ( name === 'opera' && version >= 9.8 ) { if ( name === 'opera' && version >= 9.8 ) {
match = ua.match( /\bversion\/([0-9\.]*)/ ); match = ua.match( /\bversion\/([0-9.]*)/ );
if ( match && match[1] ) { if ( match && match[ 1 ] ) {
version = match[1]; version = match[ 1 ];
} else { } else {
version = '10'; version = '10';
} }
} }
// And Opera 15's lies about being Chrome // And Opera 15's lies about being Chrome
if ( name === 'chrome' && ( match = ua.match( /\bopr\/([0 if ( name === 'chrome' && ( match = ua.match( /\bopr\/([0
-9\.]*)/ ) ) ) { -9.]*)/ ) ) ) {
if ( match[1] ) { if ( match[ 1 ] ) {
name = 'opera'; name = 'opera';
version = match[1]; version = match[ 1 ];
} }
} }
// And IE 11's lies about being not being IE // And IE 11's lies about being not being IE
if ( layout === 'trident' && layoutversion >= 7 && ( matc if ( layout === 'trident' && layoutversion >= 7 && ( matc
h = ua.match( /\brv[ :\/]([0-9\.]*)/ ) ) ) { h = ua.match( /\brv[ :/]([0-9.]*)/ ) ) ) {
if ( match[1] ) { if ( match[ 1 ] ) {
name = 'msie'; name = 'msie';
version = match[1]; version = match[ 1 ];
} }
} }
// And MS Edge's lies about being Chrome // And MS Edge's lies about being Chrome
// //
// It's different enough from classic IE Trident engine t hat they do this // It's different enough from classic IE Trident engine t hat they do this
// to avoid getting caught by MSIE-specific browser sniff ing. // to avoid getting caught by MSIE-specific browser sniff ing.
if ( name === 'chrome' && ( match = ua.match( /\bedge\/([ 0-9\.]*)/ ) ) ) { if ( name === 'chrome' && ( match = ua.match( /\bedge\/([ 0-9.]*)/ ) ) ) {
name = 'edge'; name = 'edge';
version = match[1]; version = match[ 1 ];
layout = 'edge'; layout = 'edge';
layoutversion = parseInt( match[1], 10 ); layoutversion = parseInt( match[ 1 ], 10 );
} }
// And Amazon Silk's lies about being Android on mobile o r Safari on desktop // And Amazon Silk's lies about being Android on mobile o r Safari on desktop
if ( match = ua.match( /\bsilk\/([0-9.\-_]*)/ ) ) { if ( match = ua.match( /\bsilk\/([0-9.\-_]*)/ ) ) {
if ( match[1] ) { if ( match[ 1 ] ) {
name = 'silk'; name = 'silk';
version = match[1]; version = match[ 1 ];
} }
} }
versionNumber = parseFloat( version, 10 ) || 0.0; versionNumber = parseFloat( version, 10 ) || 0.0;
// Caching // Caching
return profileCache[ key ] = { return profileCache[ key ] = {
name: name, name: name,
layout: layout, layout: layout,
layoutVersion: layoutversion, layoutVersion: layoutversion,
platform: platform, platform: platform,
version: version, version: version,
versionBase: ( version !== x ? Math.floor( versio nNumber ).toString() : x ), versionBase: ( version !== x ? Math.floor( versio nNumber ).toString() : x ),
versionNumber: versionNumber versionNumber: versionNumber
}; };
}, },
skipping to change at line 258 skipping to change at line 256
* } * }
* *
* @param {Object} map Browser support map * @param {Object} map Browser support map
* @param {Object} [profile] A client-profile object * @param {Object} [profile] A client-profile object
* @param {boolean} [exactMatchOnly=false] Only return true if th e browser is matched, otherwise * @param {boolean} [exactMatchOnly=false] Only return true if th e browser is matched, otherwise
* returns true if the browser is not found. * returns true if the browser is not found.
* *
* @return {boolean} The current browser is in the support map * @return {boolean} The current browser is in the support map
*/ */
test: function ( map, profile, exactMatchOnly ) { test: function ( map, profile, exactMatchOnly ) {
/*jshint evil:true */ /* eslint-disable no-eval */
var conditions, dir, i, op, val, j, pieceVersion, pieceVa l, compare; var conditions, dir, i, op, val, j, pieceVersion, pieceVa l, compare;
profile = $.isPlainObject( profile ) ? profile : $.client .profile(); profile = $.isPlainObject( profile ) ? profile : $.client .profile();
if ( map.ltr && map.rtl ) { if ( map.ltr && map.rtl ) {
dir = $( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'; dir = $( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr';
map = map[dir]; map = map[ dir ];
} }
// Check over each browser condition to determine if we a re running in a compatible client // Check over each browser condition to determine if we a re running in a compatible client
if ( typeof map !== 'object' || map[profile.name] === und efined ) { if ( typeof map !== 'object' || map[ profile.name ] === u ndefined ) {
// Not found, return true if exactMatchOnly not s et, false otherwise // Not found, return true if exactMatchOnly not s et, false otherwise
return !exactMatchOnly; return !exactMatchOnly;
} }
conditions = map[profile.name]; conditions = map[ profile.name ];
if ( conditions === false ) { if ( conditions === false ) {
// Match no versions // Match no versions
return false; return false;
} }
if ( conditions === null ) { if ( conditions === null ) {
// Match all versions // Match all versions
return true; return true;
} }
for ( i = 0; i < conditions.length; i++ ) { for ( i = 0; i < conditions.length; i++ ) {
op = conditions[i][0]; op = conditions[ i ][ 0 ];
val = conditions[i][1]; val = conditions[ i ][ 1 ];
if ( typeof val === 'string' ) { if ( typeof val === 'string' ) {
// Perform a component-wise comparison of versions, similar to PHP's version_compare // Perform a component-wise comparison of versions, similar to PHP's version_compare
// but simpler. '1.11' is larger than '1. 2'. // but simpler. '1.11' is larger than '1. 2'.
pieceVersion = profile.version.toString() .split( '.' ); pieceVersion = profile.version.toString() .split( '.' );
pieceVal = val.split( '.' ); pieceVal = val.split( '.' );
// Extend with zeroes to equal length // Extend with zeroes to equal length
while ( pieceVersion.length < pieceVal.le ngth ) { while ( pieceVersion.length < pieceVal.le ngth ) {
pieceVersion.push( '0' ); pieceVersion.push( '0' );
} }
while ( pieceVal.length < pieceVersion.le ngth ) { while ( pieceVal.length < pieceVersion.le ngth ) {
pieceVal.push( '0' ); pieceVal.push( '0' );
} }
// Compare components // Compare components
compare = 0; compare = 0;
for ( j = 0; j < pieceVersion.length; j++ ) { for ( j = 0; j < pieceVersion.length; j++ ) {
if ( Number( pieceVersion[j] ) < Number( pieceVal[j] ) ) { if ( Number( pieceVersion[ j ] ) < Number( pieceVal[ j ] ) ) {
compare = -1; compare = -1;
break; break;
} else if ( Number( pieceVersion[ j] ) > Number( pieceVal[j] ) ) { } else if ( Number( pieceVersion[ j ] ) > Number( pieceVal[ j ] ) ) {
compare = 1; compare = 1;
break; break;
} }
} }
// compare will be -1, 0 or 1, depending on comparison result // compare will be -1, 0 or 1, depending on comparison result
if ( !( eval( String( compare + op + '0' ) ) ) ) { if ( !( eval( String( compare + op + '0' ) ) ) ) {
return false; return false;
} }
} else if ( typeof val === 'number' ) { } else if ( typeof val === 'number' ) {
if ( !( eval( 'profile.versionNumber' + o p + val ) ) ) { if ( !( eval( 'profile.versionNumber' + o p + val ) ) ) {
 End of changes. 38 change blocks. 
48 lines changed or deleted 46 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)