mediawiki.filewarning: Use 'visibility: hidden' instead of 'display: none'
[lhc/web/wiklou.git] / resources / src / startup.js
index 56bb3d3..1332459 100644 (file)
@@ -6,6 +6,14 @@
 
 var mediaWikiLoadStart = ( new Date() ).getTime();
 
+if ( !window.performance ) {
+       window.performance = {};
+}
+if ( !performance.mark ) {
+       performance.mark = function () {};
+}
+performance.mark( 'mediaWikiStartUp' );
+
 /**
  * Returns false for Grade C supported browsers.
  *
@@ -17,7 +25,8 @@ var mediaWikiLoadStart = ( new Date() ).getTime();
  * - https://jquery.com/browser-support/
  */
 
-/*jshint unused: false */
+/*jshint unused: false, evil: true */
+/*globals mw, RLQ: true, $VARS, $CODE */
 function isCompatible( ua ) {
        if ( ua === undefined ) {
                ua = navigator.userAgent;
@@ -25,8 +34,8 @@ function isCompatible( ua ) {
 
        // Browsers with outdated or limited JavaScript engines get the no-JS experience
        return !(
-               // Internet Explorer < 7
-               ( ua.indexOf( 'MSIE' ) !== -1 && parseFloat( ua.split( 'MSIE' )[1] ) < 7 ) ||
+               // Internet Explorer < 8
+               ( ua.indexOf( 'MSIE' ) !== -1 && parseFloat( ua.split( 'MSIE' )[1] ) < 8 ) ||
                // Firefox < 3
                ( ua.indexOf( 'Firefox/' ) !== -1 && parseFloat( ua.split( 'Firefox/' )[1] ) < 3 ) ||
                // Opera < 12
@@ -52,11 +61,35 @@ function isCompatible( ua ) {
                ua.match( /Opera Mini/ ) ||
                // Nokia's Ovi Browser
                ua.match( /S40OviBrowser/ ) ||
+               // MeeGo's browser
+               ua.match( /MeeGo/ ) ||
                // Google Glass browser groks JS but UI is too limited
                ( ua.match( /Glass/ ) && ua.match( /Android/ ) )
        );
 }
 
 /**
- * The startUp() function will be auto-generated and added below.
+ * The $CODE and $VARS placeholders are substituted in ResourceLoaderStartUpModule.php.
  */
+function startUp() {
+       mw.config = new mw.Map( $VARS.wgLegacyJavaScriptGlobals );
+
+       $CODE.registrations();
+
+       window.RLQ = window.RLQ || [];
+       while ( RLQ.length ) {
+               RLQ.shift()();
+       }
+       RLQ = {
+               push: function ( fn ) {
+                       fn();
+               }
+       };
+
+       mw.config.set( $VARS.configuration );
+}
+
+// Conditional script injection
+if ( isCompatible() ) {
+       document.write( $VARS.baseModulesScript );
+}