Merge "Move pager inside searchresults div"
[lhc/web/wiklou.git] / resources / src / startup.js
index ac42854..3b79bd3 100644 (file)
@@ -26,7 +26,7 @@ performance.mark( 'mediaWikiStartUp' );
  */
 
 /*jshint unused: false, evil: true */
-/*globals mw, $VARS, $CODE */
+/*globals mw, RLQ: true, $VARS, $CODE */
 function isCompatible( ua ) {
        if ( ua === undefined ) {
                ua = navigator.userAgent;
@@ -77,9 +77,30 @@ function startUp() {
        $CODE.registrations();
 
        mw.config.set( $VARS.configuration );
+
+       // Must be after mw.config.set because these callbacks may use mw.loader which
+       // needs to have values 'skin', 'debug' etc. from mw.config.
+       window.RLQ = window.RLQ || [];
+       while ( RLQ.length ) {
+               RLQ.shift()();
+       }
+       window.RLQ = {
+               push: function ( fn ) {
+                       fn();
+               }
+       };
 }
 
 // Conditional script injection
 if ( isCompatible() ) {
-       document.write( $VARS.baseModulesScript );
+       ( function () {
+               var script = document.createElement( 'script' );
+               script.src = $VARS.baseModulesUri;
+               document.getElementsByTagName( 'head' )[0].appendChild( script );
+       }() );
+} else {
+       // Undo class swapping in case of an unsupported browser.
+       // See OutputPage::getHeadScripts().
+       document.documentElement.className = document.documentElement.className
+               .replace( /(^|\s)client-js(\s|$)/, '$1client-nojs$2' );
 }