mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Always load init CSS when tools are available for a title
Also, make init CSS available on mobile. Bug: T274311 Change-Id: I8f63fdb249cdd8ccdc6d1c4944d2622ac7d668cc
This commit is contained in:
parent
9403fb961c
commit
6224c11ff1
|
@ -26,7 +26,11 @@
|
|||
},
|
||||
"ResourceModules": {
|
||||
"ext.discussionTools.init.styles": {
|
||||
"styles": "dt.init.less"
|
||||
"styles": "dt.init.less",
|
||||
"targets": [
|
||||
"desktop",
|
||||
"mobile"
|
||||
]
|
||||
},
|
||||
"ext.discussionTools.init": {
|
||||
"packageFiles": [
|
||||
|
|
|
@ -32,11 +32,15 @@ class PageHooks implements
|
|||
*/
|
||||
public function onBeforePageDisplay( $output, $skin ) : void {
|
||||
$user = $output->getUser();
|
||||
// Load modules if any DT feature is enabled for this user
|
||||
if ( HookUtils::isFeatureEnabledForOutput( $output ) ) {
|
||||
// Load style modules if the tools can be available for the title
|
||||
// as this means the DOM may have been modified in the parser cache.
|
||||
if ( HookUtils::isAvailableForTitle( $output->getTitle() ) ) {
|
||||
$output->addModuleStyles( [
|
||||
'ext.discussionTools.init.styles'
|
||||
] );
|
||||
}
|
||||
// Load modules if any DT feature is enabled for this user
|
||||
if ( HookUtils::isFeatureEnabledForOutput( $output ) ) {
|
||||
$output->addModules( [
|
||||
'ext.discussionTools.init'
|
||||
] );
|
||||
|
|
Loading…
Reference in a new issue