Merge "Bypass TransformTooBigImageAreaError for ForeignApiFile"
[mediawiki.git] / resources / src / startup.js
blob80cc7d935a6ed2a9f0c801645e12333673bb8d85
1 /**
2  * This script provides a function which is run to evaluate whether or not to
3  * continue loading jQuery and the MediaWiki modules. This code should work on
4  * even the most ancient of browsers, so be very careful when editing.
5  */
7 var mediaWikiLoadStart = ( new Date() ).getTime();
9 /**
10  * Returns false for Grade C supported browsers.
11  *
12  * This function should only be used by the Startup module, do not expand it to
13  * be generally useful beyond startup.
14  *
15  * See also:
16  * - https://www.mediawiki.org/wiki/Compatibility#Browsers
17  * - https://jquery.com/browser-support/
18  */
20 /*jshint unused: false */
21 function isCompatible( ua ) {
22         if ( ua === undefined ) {
23                 ua = navigator.userAgent;
24         }
26         // Browsers with outdated or limited JavaScript engines get the no-JS experience
27         return !(
28                 // Internet Explorer < 8
29                 ( ua.indexOf( 'MSIE' ) !== -1 && parseFloat( ua.split( 'MSIE' )[1] ) < 8 ) ||
30                 // Firefox < 3
31                 ( ua.indexOf( 'Firefox/' ) !== -1 && parseFloat( ua.split( 'Firefox/' )[1] ) < 3 ) ||
32                 // Opera < 12
33                 ( ua.indexOf( 'Opera/' ) !== -1 && ( ua.indexOf( 'Version/' ) === -1 ?
34                         // "Opera/x.y"
35                         parseFloat( ua.split( 'Opera/' )[1] ) < 10 :
36                         // "Opera/9.80 ... Version/x.y"
37                         parseFloat( ua.split( 'Version/' )[1] ) < 12
38                 ) ) ||
39                 // "Mozilla/0.0 ... Opera x.y"
40                 ( ua.indexOf( 'Opera ' ) !== -1 && parseFloat( ua.split( ' Opera ' )[1] ) < 10 ) ||
41                 // BlackBerry < 6
42                 ua.match( /BlackBerry[^\/]*\/[1-5]\./ ) ||
43                 // Open WebOS < 1.5
44                 ua.match( /webOS\/1\.[0-4]/ ) ||
45                 // Anything PlayStation based.
46                 ua.match( /PlayStation/i ) ||
47                 // Any Symbian based browsers
48                 ua.match( /SymbianOS|Series60/ ) ||
49                 // Any NetFront based browser
50                 ua.match( /NetFront/ ) ||
51                 // Opera Mini, all versions
52                 ua.match( /Opera Mini/ ) ||
53                 // Nokia's Ovi Browser
54                 ua.match( /S40OviBrowser/ ) ||
55                 // MeeGo's browser
56                 ua.match( /MeeGo/ ) ||
57                 // Google Glass browser groks JS but UI is too limited
58                 ( ua.match( /Glass/ ) && ua.match( /Android/ ) )
59         );
62 /**
63  * The startUp() function will be auto-generated and added below.
64  */