mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-09-24 18:58:29 +00:00
Merge "Message box styles for Minerva come from core"
This commit is contained in:
commit
5fd4a83482
|
@ -336,6 +336,51 @@ class MinervaHooks {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Minerva skin loads message box styles differently from core, to
|
||||
* reduce the amount of styles on the critical path.
|
||||
* This adds message box styles to pages that need it, to avoid loading them
|
||||
* on pages where they are not.
|
||||
*
|
||||
* @param OutputPage $out
|
||||
* @param Skin $skin
|
||||
*/
|
||||
public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) {
|
||||
if ( $skin->getSkinName() === 'minerva' ) {
|
||||
self::addMessageBoxStylesToPage( $out );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Minerva skin loads message box styles differently from core, to
|
||||
* reduce the amount of styles on the critical path.
|
||||
* This adds message box styles to pages that need it, to avoid loading them
|
||||
* on pages where they are not.
|
||||
* The pages where they are needed are:
|
||||
* - special pages
|
||||
* - edit workflow (action=edit and action=submit)
|
||||
* - when viewing old revisions
|
||||
*
|
||||
* @param OutputPage $out
|
||||
*/
|
||||
private static function addMessageBoxStylesToPage( OutputPage $out ) {
|
||||
$request = $out->getRequest();
|
||||
// Warning box styles are needed when reviewing old revisions
|
||||
// and inside the fallback editor styles to action=edit page.
|
||||
$requestAction = $request->getVal( 'action' );
|
||||
$viewAction = $requestAction === null || $requestAction === 'view';
|
||||
|
||||
if (
|
||||
$out->getTitle()->isSpecialPage() ||
|
||||
$request->getText( 'oldid' ) ||
|
||||
!$viewAction
|
||||
) {
|
||||
$out->addModuleStyles( [
|
||||
'skins.minerva.messageBox.styles'
|
||||
] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies the `<body>` element's attributes.
|
||||
*
|
||||
|
|
|
@ -251,10 +251,6 @@ input.search {
|
|||
.topic-title-list li,
|
||||
.site-link-list li,
|
||||
.drawer,
|
||||
.messagebox,
|
||||
.errorbox,
|
||||
.successbox,
|
||||
.warningbox,
|
||||
.list-header,
|
||||
.mw-revision {
|
||||
padding-left: @contentPadding;
|
||||
|
|
|
@ -121,6 +121,9 @@
|
|||
"minerva": "GlobalVarConfig::newInstance"
|
||||
},
|
||||
"Hooks": {
|
||||
"BeforePageDisplay": [
|
||||
"MinervaHooks::onBeforePageDisplay"
|
||||
],
|
||||
"ResourceLoaderRegisterModules": [
|
||||
"MinervaHooks::onResourceLoaderRegisterModules"
|
||||
],
|
||||
|
@ -579,6 +582,10 @@
|
|||
"resources/skins.minerva.scripts/watchstar.js"
|
||||
]
|
||||
},
|
||||
"skins.minerva.messageBox.styles": {
|
||||
"class": "ResourceLoaderSkinModule",
|
||||
"features": [ "interface-message-box" ]
|
||||
},
|
||||
"skins.minerva.options": {
|
||||
"targets": [
|
||||
"mobile",
|
||||
|
@ -599,6 +606,7 @@
|
|||
"localBasePath": "",
|
||||
"remoteSkinPath": "MinervaNeue",
|
||||
"dependencies": [
|
||||
"skins.minerva.messageBox.styles",
|
||||
"mobile.startup",
|
||||
"mediawiki.user",
|
||||
"mediawiki.experiments"
|
||||
|
|
|
@ -11,14 +11,6 @@
|
|||
display: none;
|
||||
}
|
||||
|
||||
// `.messagebox` not needed here, as it's not used currently.
|
||||
.errorbox,
|
||||
.successbox,
|
||||
.warningbox {
|
||||
padding: 0.5em 1em;
|
||||
margin: 1em 0;
|
||||
}
|
||||
|
||||
.mw-ui-container {
|
||||
.mw-ui-vform {
|
||||
margin: auto;
|
||||
|
|
Loading…
Reference in a new issue