blob: 03dd361216368ebf18625d3c5d84eded96fac886 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
<?php
/**
* Tyrian -- the new look of gentoo.org
* MediaWiki implementation based on MonoBook nouveau.
*
* Copyright (C) 2014-2016 Alex Legler <a3li@gentoo.org>
* Copyright (C) 2016-2021 Gentoo wiki project <wiki@gentoo.org>
*/
/**
* Inherit main code from SkinTemplate, set the CSS and template filter.
* @ingroup Skins
*/
class SkinTyrian extends SkinTemplate {
public $skinname = 'tyrian';
public $stylename = 'Tyrian';
public $template = 'TyrianTemplate';
private $output;
const CDN_URL = 'https://assets.gentoo.org/tyrian/';
public function setupTyrianSkinUserCss(OutputPage $out) {
$this->output = $out;
$out->addStyle(SkinTyrian::CDN_URL . 'bootstrap.min.css');
$out->addStyle(SkinTyrian::CDN_URL . 'tyrian.min.css');
$out->addModuleStyles([
'mediawiki.skinning.interface',
'mediawiki.skinning.content.externallinks',
'skins.tyrian.styles',
'skins.tyrian.icons'
]);
}
public static function injectMetaTags($out) {
$out->addMeta('viewport', 'width=device-width, initial-scale=1.0');
$out->addMeta('theme-color', '#54487a');
return true;
}
public function initPage( OutputPage $out ) {
parent::initPage( $out );
$this->setupTyrianSkinUserCss( $out );
$cdnURL = self::CDN_URL . 'bootstrap.min.js';
$script = <<<EOS
function defer(method) {
if (window.jQuery) {
method();
} else {
setTimeout(function() { defer(method) }, 50);
}
}
defer(function() { mw.loader.load( '$cdnURL'); });
EOS;
$out->addInlineScript($script);
}
}
|