diff --git a/includes/SkinTimeless.php b/includes/SkinTimeless.php index 4bd1287..1f94b05 100644 --- a/includes/SkinTimeless.php +++ b/includes/SkinTimeless.php @@ -5,19 +5,33 @@ * @ingroup Skins */ class SkinTimeless extends SkinTemplate { - /** @var string */ - public $stylename = 'Timeless'; - - /** @var string */ - public $template = 'TimelessTemplate'; - /** - * @param OutputPage $out + * Provide support for < 1.36. Can be deleted when no longer supported. + * @inheritDoc */ - public function initPage( OutputPage $out ) { - parent::initPage( $out ); + public function __construct( + array $options = [] + ) { + global $wgVersion; + $out = $this->getOutput(); + // This code block can be removed when 1.35 is no longer supported. + if ( version_compare( $wgVersion, '1.36', '<' ) ) { + // Add external links - this is replaced by `content-links` feature in 1.36 + $out->addModuleStyles( [ + 'mediawiki.skinning.content.externallinks' + ] ); + // Make responsive - this is replaced by `responsive` option in 1.36 + $out->addMeta( 'viewport', + 'width=device-width, initial-scale=1.0, ' . + 'user-scalable=yes, minimum-scale=0.25, maximum-scale=5.0' + ); + // Associate template - this is replaced by `template` option in 1.36 + $this->template = 'TimelessTemplate'; + } // Basic IE support without flexbox $out->addStyle( $this->stylename . '/resources/IE9fixes.css', 'screen', 'IE' ); + + parent::__construct( $options ); } } diff --git a/includes/TimelessVariablesModule.php b/includes/TimelessVariablesModule.php index 9a172fc..a6ce3be 100644 --- a/includes/TimelessVariablesModule.php +++ b/includes/TimelessVariablesModule.php @@ -3,6 +3,23 @@ * ResourceLoader module to set some LESS variables for the skin */ class TimelessVariablesModule extends ResourceLoaderSkinModule { + /** + * Add compatibility to < 1.36 + * @inheritDoc + */ + public function __construct( + array $options = [], + $localBasePath = null, + $remoteBasePath = null + ) { + global $wgVersion; + if ( version_compare( $wgVersion, '1.36', '<' ) ) { + $options['features'] = [ "logo", "legacy" ]; + } + + parent::__construct( $options, $localBasePath, $remoteBasePath ); + } + /** * Add our LESS variables * diff --git a/skin.json b/skin.json index b8c9d5a..69c1502 100644 --- a/skin.json +++ b/skin.json @@ -8,7 +8,7 @@ "license-name": "GPL-2.0-or-later", "type": "skin", "requires": { - "MediaWiki": ">= 1.36" + "MediaWiki": ">= 1.35" }, "ValidSkinNames": { "timeless": { @@ -17,6 +17,7 @@ "args": [ { "name": "timeless", + "template": "TimelessTemplate", "responsive": true, "styles": [ "skins.timeless"