mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-09-24 10:58:20 +00:00
Merge "Add 'collapsible-headings-collapsed' body class"
This commit is contained in:
commit
beded3d29d
|
@ -60,6 +60,14 @@ class PageHooks implements
|
|||
$this->userOptionsLookup = $userOptionsLookup;
|
||||
}
|
||||
|
||||
private function isMobile(): bool {
|
||||
if ( ExtensionRegistry::getInstance()->isLoaded( 'MobileFrontend' ) ) {
|
||||
$mobFrontContext = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Context' );
|
||||
return $mobFrontContext->shouldDisplayMobileView();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds DiscussionTools JS to the output.
|
||||
*
|
||||
|
@ -79,6 +87,10 @@ class PageHooks implements
|
|||
}
|
||||
}
|
||||
|
||||
if ( $this->isMobile() && HookUtils::isFeatureEnabledForOutput( $output, HookUtils::VISUALENHANCEMENTS ) ) {
|
||||
$output->addBodyClasses( 'collapsible-headings-collapsed' );
|
||||
}
|
||||
|
||||
// Load style modules if the tools can be available for the title
|
||||
// to selectively hide DT features, depending on the body classes added above.
|
||||
$availableForTitle = HookUtils::isAvailableForTitle( $output->getTitle() );
|
||||
|
@ -240,11 +252,7 @@ class PageHooks implements
|
|||
// This hook can be executed more than once per page view if the page content is composed from
|
||||
// multiple sources!
|
||||
|
||||
$isMobile = false;
|
||||
if ( ExtensionRegistry::getInstance()->isLoaded( 'MobileFrontend' ) ) {
|
||||
$mobFrontContext = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Context' );
|
||||
$isMobile = $mobFrontContext->shouldDisplayMobileView();
|
||||
}
|
||||
$isMobile = $this->isMobile();
|
||||
$lang = $output->getLanguage();
|
||||
|
||||
if ( HookUtils::isFeatureEnabledForOutput( $output, HookUtils::TOPICSUBSCRIPTION ) ) {
|
||||
|
|
Loading…
Reference in a new issue