X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fstartup.js;h=e53e5f3d2938f16ba9029e4c0bd5f28fb509fa25;hb=55d8e0d8b70e4aebdfe0b9d21f2c4e9b64323efe;hp=1a10f8379e4c2590d101bde425e3e0efbaa3f3aa;hpb=35f61c7c4b38388dc498f898193f1dda0461e0b3;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/startup.js b/resources/src/startup.js index 1a10f8379e..e53e5f3d29 100644 --- a/resources/src/startup.js +++ b/resources/src/startup.js @@ -4,7 +4,7 @@ * even the most ancient of browsers, so be very careful when editing. */ /*jshint unused: false, evil: true */ -/*globals mw, RLQ: true, $VARS, $CODE, performance */ +/*globals mw, RLQ: true, NORLQ: true, $VARS, $CODE, performance */ var mediaWikiLoadStart = ( new Date() ).getTime(), @@ -31,8 +31,8 @@ function isCompatible( ua ) { // Browsers with outdated or limited JavaScript engines get the no-JS experience return !( - // Internet Explorer < 8 - ( ua.indexOf( 'MSIE' ) !== -1 && parseFloat( ua.split( 'MSIE' )[ 1 ] ) < 8 ) || + // Internet Explorer < 9 + ( ua.indexOf( 'MSIE' ) !== -1 && parseFloat( ua.split( 'MSIE' )[ 1 ] ) < 9 ) || // Firefox < 3 ( ua.indexOf( 'Firefox/' ) !== -1 && parseFloat( ua.split( 'Firefox/' )[ 1 ] ) < 3 ) || // Opera < 12 @@ -67,11 +67,29 @@ function isCompatible( ua ) { // Conditional script injection ( function () { + var NORLQ, script; if ( !isCompatible() ) { // 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' ); + + NORLQ = window.NORLQ || []; + while ( NORLQ.length ) { + NORLQ.shift()(); + } + window.NORLQ = { + push: function ( fn ) { + fn(); + } + }; + + // Clear and disable the other queue + window.RLQ = { + // No-op + push: function () {} + }; + return; } @@ -87,7 +105,7 @@ function isCompatible( ua ) { // 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 || []; + var RLQ = window.RLQ || []; while ( RLQ.length ) { RLQ.shift()(); } @@ -96,9 +114,15 @@ function isCompatible( ua ) { fn(); } }; + + // Clear and disable the other queue + window.NORLQ = { + // No-op + push: function () {} + }; } - var script = document.createElement( 'script' ); + script = document.createElement( 'script' ); script.src = $VARS.baseModulesUri; script.onload = script.onreadystatechange = function () { if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) {