Add TimelessFileModule and $wgTimelessBackdropImage configuration
option to set configurable background image for the skin as a whole Defaults to the cat, but can ideally be set to anything appropriate to the wiki in question. Recommendation is a 20-50% opacity black/ white background image, where the alpha values of the b/w parts are likewise around 10-50/255. Bug: T193330 Change-Id: Ica3e2ce2568557ef157d06d1b7127b030f3c38f0isekai
parent
64ed4a2639
commit
c576c68a1f
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* ResourceLoader module to set the skin-backdrop background image (by default,
|
||||
* the angry cat)
|
||||
*/
|
||||
|
||||
class TimelessFileModule extends ResourceLoaderFileModule {
|
||||
/**
|
||||
* Make the style from the config var!
|
||||
* TODO: Just set a less variable here instead of hardcoding the full definition (T223112)
|
||||
*
|
||||
* @param ResourceLoaderContext $context
|
||||
* @return array
|
||||
*/
|
||||
public function getStyles( ResourceLoaderContext $context ) {
|
||||
$config = $this->getConfig();
|
||||
$background = $config->get( 'TimelessBackdropImage' );
|
||||
if ( $background === 'cat.svg' ) {
|
||||
// expand default
|
||||
$background = $config->get( 'StylePath' ) . '/Timeless/resources/images/cat.svg';
|
||||
}
|
||||
|
||||
$background = OutputPage::transformResourcePath( $config, $background );
|
||||
$styles = parent::getStyles( $context );
|
||||
|
||||
$styles['all'][] = '#mw-content-container { background-image: ' .
|
||||
CSSMin::buildUrlValue( $background ) .
|
||||
'; }';
|
||||
|
||||
return $styles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the config var with the caching stuff so it properly updates the cache
|
||||
*
|
||||
* @param ResourceLoaderContext $context
|
||||
* @return array
|
||||
*/
|
||||
public function getDefinitionSummary( ResourceLoaderContext $context ) {
|
||||
$summary = parent::getDefinitionSummary( $context );
|
||||
$summary[] = [
|
||||
'TimelessBackdropImage' => $this->getConfig()->get( 'TimelessBackdropImage' )
|
||||
];
|
||||
return $summary;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue