X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fresourceloader%2FResourceLoaderClientHtml.php;h=6061fb518eee5ab7202e9489472ecd0977af4939;hb=efe7286cac744ccc7bce5417d20601a387f6d1ad;hp=ec408c742bbfd9c65bb806689a51eec905deb06e;hpb=b306873222f91789e334abcf2005d4b610cfce91;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/resourceloader/ResourceLoaderClientHtml.php b/includes/resourceloader/ResourceLoaderClientHtml.php index ec408c742b..6061fb518e 100644 --- a/includes/resourceloader/ResourceLoaderClientHtml.php +++ b/includes/resourceloader/ResourceLoaderClientHtml.php @@ -233,27 +233,43 @@ class ResourceLoaderClientHtml { $chunks = []; // Change "client-nojs" class to client-js. This allows easy toggling of UI components. - // This happens synchronously on every page view to avoid flashes of wrong content. + // This must happen synchronously on every page view to avoid flashes of wrong content. // See also #getDocumentAttributes() and /resources/src/startup.js. - $chunks[] = Html::inlineScript( - 'document.documentElement.className = document.documentElement.className' - . '.replace( /(^|\s)client-nojs(\s|$)/, "$1client-js$2" );', - $nonce - ); + $script = <<config ) { - $chunks[] = ResourceLoader::makeInlineScript( - ResourceLoader::makeConfigSetScript( $this->config ), - $nonce - ); + $confJson = ResourceLoader::encodeJsonForScript( $this->config ); + $script .= <<exemptStates, $data['states'] ); if ( $states ) { - $chunks[] = ResourceLoader::makeInlineScript( - ResourceLoader::makeLoaderStateScript( $states ), + $stateJson = ResourceLoader::encodeJsonForScript( $states ); + $script .= <<context->getDebug() ) { + $chunks[] = Html::inlineScript( $script, $nonce ); + } else { + $chunks[] = Html::inlineScript( + ResourceLoader::filter( 'minify-js', $script, [ 'cache' => false ] ), $nonce ); } @@ -267,17 +283,6 @@ class ResourceLoaderClientHtml { ); } - // Inline RLQ: Load general modules - if ( $data['general'] ) { - $chunks[] = ResourceLoader::makeInlineScript( - 'RLPAGEMODULES=' - . ResourceLoader::encodeJsonForScript( $data['general'] ) - . ';' - . 'mw.loader.load(RLPAGEMODULES);', - $nonce - ); - } - // External stylesheets (only=styles) if ( $data['styles'] ) { $chunks[] = $this->getLoad(