Commit f603c0e1 authored by Tobias Haider's avatar Tobias Haider
Browse files

Merge branch 'master' into development

parents 2bc2d69d 742a57c3
......@@ -65,6 +65,52 @@ class TweekiHooks {
return true;
}
/**
* Adding modules
*/
public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) {
$config = \MediaWiki\MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'tweeki' );
$styles = [];
// load styles
if( $config->get( 'TweekiSkinCustomStyleModule' ) ) {
$styles[] = 'skins.tweeki.bootstrap4.mediawiki.styles';
$styles[] = $this->tweekiConfig->get( 'TweekiSkinCustomStyleModule' );
} elseif( !$config->get( 'TweekiSkinUseBootstrap4' ) ) {
$styles[] = 'skins.tweeki.styles';
if( $config->get( 'TweekiSkinUseBootstrapTheme' ) ) {
$styles[] = 'skins.tweeki.bootstraptheme.styles';
}
} else {
$styles[] = 'skins.tweeki.bootstrap4.mediawiki.styles';
if( !$config->get( 'TweekiSkinUseCustomFiles' ) ) {
$styles[] = 'skins.tweeki.bootstrap4.styles';
} else {
$styles[] = 'skins.tweeki.bootstrap4.custom.styles';
}
}
// load last minute changes (outside webpack)
if( $config->get( 'TweekiSkinUseBootstrap4' ) ) {
$styles[] = 'skins.tweeki.bootstrap4.corrections.styles';
}
if( $config->get( 'TweekiSkinUseExternallinkStyles' ) ) {
$styles[] = 'skins.tweeki.externallinks.styles';
}
if( $config->get( 'TweekiSkinUseAwesome' ) ) {
$styles[] = 'skins.tweeki.awesome.styles';
}
// if( $config->get( 'CookieWarningEnabled' ) ) {
// $styles[] = 'skins.tweeki.cookiewarning.styles';
// }
foreach( $GLOBALS['wgTweekiSkinCustomCSS'] as $customstyle ) {
$styles[] = $customstyle;
}
Hooks::run( 'SkinTweekiStyleModules', array( $skin, &$styles ) );
$out->addModuleStyles( $styles );
}
/**
* Manipulate headlines – we need .mw-headline to be empty because it has a padding
* that we need for correct positioning for anchors and this would render links above headlines inaccessible
......
......@@ -74,53 +74,6 @@ class SkinTweeki extends SkinTemplate {
Hooks::run( 'SkinTweekiAdditionalBodyClasses', array( $this, &$GLOBALS['wgTweekiSkinAdditionalBodyClasses'] ) );
static::$bodyClasses = array_merge( static::$bodyClasses, $GLOBALS['wgTweekiSkinAdditionalBodyClasses'] );
}
/**
* Loads skin and user CSS files.
* @param OutputPage $out
*/
function setupSkinUserCss( OutputPage $out ) {
parent::setupSkinUserCss( $out );
$styles = [];
// load styles
if( $this->tweekiConfig->get( 'TweekiSkinCustomStyleModule' ) ) {
$styles[] = 'skins.tweeki.bootstrap4.mediawiki.styles';
$styles[] = $this->tweekiConfig->get( 'TweekiSkinCustomStyleModule' );
} elseif( !$this->tweekiConfig->get( 'TweekiSkinUseBootstrap4' ) ) {
$styles[] = 'skins.tweeki.styles';
if( $this->tweekiConfig->get( 'TweekiSkinUseBootstrapTheme' ) ) {
$styles[] = 'skins.tweeki.bootstraptheme.styles';
}
} else {
$styles[] = 'skins.tweeki.bootstrap4.mediawiki.styles';
if( !$this->tweekiConfig->get( 'TweekiSkinUseCustomFiles' ) ) {
$styles[] = 'skins.tweeki.bootstrap4.styles';
} else {
$styles[] = 'skins.tweeki.bootstrap4.custom.styles';
}
}
// load last minute changes (outside webpack)
if( $this->tweekiConfig->get( 'TweekiSkinUseBootstrap4' ) ) {
$styles[] = 'skins.tweeki.bootstrap4.corrections.styles';
}
if( $this->tweekiConfig->get( 'TweekiSkinUseExternallinkStyles' ) ) {
$styles[] = 'skins.tweeki.externallinks.styles';
}
if( $this->tweekiConfig->get( 'TweekiSkinUseAwesome' ) ) {
$styles[] = 'skins.tweeki.awesome.styles';
}
// if( $this->tweekiConfig->get( 'CookieWarningEnabled' ) ) {
// $styles[] = 'skins.tweeki.cookiewarning.styles';
// }
foreach( $GLOBALS['wgTweekiSkinCustomCSS'] as $customstyle ) {
$styles[] = $customstyle;
}
Hooks::run( 'SkinTweekiStyleModules', array( $this, &$styles ) );
$out->addModuleStyles( $styles );
}
/**
* Override to pass our Config instance to it
......
......@@ -39,7 +39,8 @@
"MagicWordMagicWords": "TweekiHooks::onMagicWordMagicWords",
"MagicWordwgVariableIDs": "TweekiHooks::onMagicWordwgVariableIDs",
"InternalParseBeforeLinks": "TweekiHooks::onInternalParseBeforeLinks",
"OutputPageBeforeHTML": "TweekiHooks::onOutputPageBeforeHTML"
"OutputPageBeforeHTML": "TweekiHooks::onOutputPageBeforeHTML",
"BeforePageDisplay": "TweekiHooks::onBeforePageDisplay"
},
"ResourceModules": {
"skins.tweeki.messages": {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment