Merge "Make addedwatchtext less verbose"
[lhc/web/wiklou.git] / resources / src / startup.js
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 */
6
7 var mediaWikiLoadStart = ( new Date() ).getTime();
8
9 if ( !window.performance ) {
10 window.performance = {};
11 }
12 if ( !performance.mark ) {
13 performance.mark = function () {};
14 }
15 performance.mark( 'mediaWikiStartUp' );
16
17 /**
18 * Returns false for Grade C supported browsers.
19 *
20 * This function should only be used by the Startup module, do not expand it to
21 * be generally useful beyond startup.
22 *
23 * See also:
24 * - https://www.mediawiki.org/wiki/Compatibility#Browsers
25 * - https://jquery.com/browser-support/
26 */
27
28 /*jshint unused: false */
29 function isCompatible( ua ) {
30 if ( ua === undefined ) {
31 ua = navigator.userAgent;
32 }
33
34 // Browsers with outdated or limited JavaScript engines get the no-JS experience
35 return !(
36 // Internet Explorer < 8
37 ( ua.indexOf( 'MSIE' ) !== -1 && parseFloat( ua.split( 'MSIE' )[1] ) < 8 ) ||
38 // Firefox < 3
39 ( ua.indexOf( 'Firefox/' ) !== -1 && parseFloat( ua.split( 'Firefox/' )[1] ) < 3 ) ||
40 // Opera < 12
41 ( ua.indexOf( 'Opera/' ) !== -1 && ( ua.indexOf( 'Version/' ) === -1 ?
42 // "Opera/x.y"
43 parseFloat( ua.split( 'Opera/' )[1] ) < 10 :
44 // "Opera/9.80 ... Version/x.y"
45 parseFloat( ua.split( 'Version/' )[1] ) < 12
46 ) ) ||
47 // "Mozilla/0.0 ... Opera x.y"
48 ( ua.indexOf( 'Opera ' ) !== -1 && parseFloat( ua.split( ' Opera ' )[1] ) < 10 ) ||
49 // BlackBerry < 6
50 ua.match( /BlackBerry[^\/]*\/[1-5]\./ ) ||
51 // Open WebOS < 1.5
52 ua.match( /webOS\/1\.[0-4]/ ) ||
53 // Anything PlayStation based.
54 ua.match( /PlayStation/i ) ||
55 // Any Symbian based browsers
56 ua.match( /SymbianOS|Series60/ ) ||
57 // Any NetFront based browser
58 ua.match( /NetFront/ ) ||
59 // Opera Mini, all versions
60 ua.match( /Opera Mini/ ) ||
61 // Nokia's Ovi Browser
62 ua.match( /S40OviBrowser/ ) ||
63 // MeeGo's browser
64 ua.match( /MeeGo/ ) ||
65 // Google Glass browser groks JS but UI is too limited
66 ( ua.match( /Glass/ ) && ua.match( /Android/ ) )
67 );
68 }
69
70 /**
71 * The startUp() function will be auto-generated and added below.
72 */