From c1f9b1f7b1b77776192048005dcc66dcf3df2bfb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 27 Dec 2014 15:41:37 +0100 Subject: Update to MediaWiki 1.24.1 --- skins/Vector/SkinVector.php | 96 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 skins/Vector/SkinVector.php (limited to 'skins/Vector/SkinVector.php') diff --git a/skins/Vector/SkinVector.php b/skins/Vector/SkinVector.php new file mode 100644 index 00000000..8f7056d7 --- /dev/null +++ b/skins/Vector/SkinVector.php @@ -0,0 +1,96 @@ +vectorConfig = $config; + } + + protected static $bodyClasses = array( 'vector-animateLayout' ); + + /** + * Initializes output page and sets up skin-specific parameters + * @param OutputPage $out Object to initialize + */ + public function initPage( OutputPage $out ) { + parent::initPage( $out ); + + // Append CSS which includes IE only behavior fixes for hover support - + // this is better than including this in a CSS file since it doesn't + // wait for the CSS file to load before fetching the HTC file. + $min = $this->getRequest()->getFuzzyBool( 'debug' ) ? '' : '.min'; + $out->addHeadItem( 'csshover', + '" + ); + + $out->addModules( array( 'skins.vector.js' ) ); + } + + /** + * Loads skin and user CSS files. + * @param OutputPage $out + */ + function setupSkinUserCss( OutputPage $out ) { + parent::setupSkinUserCss( $out ); + + $styles = array( 'mediawiki.skinning.interface', 'skins.vector.styles' ); + wfRunHooks( 'SkinVectorStyleModules', array( $this, &$styles ) ); + $out->addModuleStyles( $styles ); + } + + /** + * Override to pass our Config instance to it + */ + public function setupTemplate( $classname, $repository = false, $cache_dir = false ) { + return new $classname( $this->vectorConfig ); + } + + /** + * Adds classes to the body element. + * + * @param OutputPage $out + * @param array &$bodyAttrs Array of attributes that will be set on the body element + */ + function addToBodyAttributes( $out, &$bodyAttrs ) { + if ( isset( $bodyAttrs['class'] ) && strlen( $bodyAttrs['class'] ) > 0 ) { + $bodyAttrs['class'] .= ' ' . implode( ' ', static::$bodyClasses ); + } else { + $bodyAttrs['class'] = implode( ' ', static::$bodyClasses ); + } + } +} -- cgit v1.2.2