Avoid reflow (FOUC) due to ULS link on Special:Preferences

Rather than building the link in JS, which is delayed until the JS
code loads, we build it in PHP and hide it from no-JS users with CSS.

Change-Id: If0c3a4dc137d8bf6cf24957dd063bd0a39791d2e
This commit is contained in:
Bartosz Dziewoński
2018-09-07 22:31:20 +02:00
committed by jenkins-bot
parent 427c36a9e1
commit f0ad6be4ab
4 changed files with 17 additions and 6 deletions

View File

@@ -139,6 +139,10 @@ class UniversalLanguageSelectorHooks {
} else {
$out->addModuleStyles( 'ext.uls.interlanguage' );
}
if ( $out->getTitle()->isSpecial( 'Preferences' ) ) {
$out->addModuleStyles( 'ext.uls.preferencespage' );
}
}
/**
@@ -381,9 +385,10 @@ class UniversalLanguageSelectorHooks {
'type' => 'info',
'raw' => true,
'section' => 'personal/i18n',
'default' => "<a id='uls-preferences-link' href='#'></a>",
// The above link will have text set from javascript. Just to avoid
// showing the link when javascript is disabled.
// We use this class to hide this from no-JS users
'cssclass' => 'uls-preferences-link-wrapper',
'default' => "<a id='uls-preferences-link' href='#'>" .
wfMessage( 'ext-uls-language-settings-preferences-link' )->escaped() . "</a>",
];
if ( $wgULSCompactLanguageLinksBetaFeature === false ) {