Skip to content

Commit

Permalink
feat(core): ✨ only load the inline script if EnablePreferences is true
Browse files Browse the repository at this point in the history
  • Loading branch information
alistair3149 committed Apr 25, 2024
1 parent e5af171 commit 52f4bab
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions includes/Hooks/SkinHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ public function onBeforePageDisplay( $out, $skin ): void {
return;
}

$script = file_get_contents( MW_INSTALL_PATH . '/skins/Citizen/resources/skins.citizen.scripts/inline.js' );
$script = Html::inlineScript( $script );
// TODO: Consider turning on cache after this is more stable
$script = RL\ResourceLoader::filter( 'minify-js', $script, [ 'cache' => false ] );
$out->addHeadItem( 'skin.citizen.inline', $script );
if ( $this->getConfigValue( 'CitizenEnablePreferences', $out ) === true ) {
$script = file_get_contents( MW_INSTALL_PATH . '/skins/Citizen/resources/skins.citizen.scripts/inline.js' );
$script = Html::inlineScript( $script );
// TODO: Consider turning on cache after this is more stable
$script = RL\ResourceLoader::filter( 'minify-js', $script, [ 'cache' => false ] );
$out->addHeadItem( 'skin.citizen.inline', $script );
}
}

/**
Expand Down

0 comments on commit 52f4bab

Please sign in to comment.