增加定制功能屏蔽开关

master
落雨楓 1 year ago
parent 1643f1bfc1
commit 04470231bf

@ -184,6 +184,9 @@
},
"IsekaiActivateEditorRequiredWords": {
"value": 300
},
"IsekaiMiscIsIsekaiWiki": {
"value": true
}
},
"manifest_version": 2

@ -29,16 +29,22 @@ class Isekai {
}
public static function setHeader(OutputPage $outputPage) {
$outputPage->addHeadItem('dns-prefetch-main', Html::element('link', ['rel' => 'dns-prefetch', 'href' => '//www.isekai.cn']));
$outputPage->addHeadItem('sitemap-link', Html::element('link', [
'rel' => 'sitemap', 'type' => 'application/xml',
'title' => 'Sitemap', 'href' => '/sitemap/sitemap-index-wiki.xml',
]));
$config = MediaWikiServices::getInstance()->getMainConfig();
$isIsekaiWiki = $config->get('IsekaiMiscIsIsekaiWiki');
if ($isIsekaiWiki) {
$outputPage->addHeadItem('dns-prefetch-main', Html::element('link', ['rel' => 'dns-prefetch', 'href' => '//www.isekai.cn']));
$outputPage->addMeta('author', '异世界百科');
$outputPage->addHeadItem('sitemap-link', Html::element('link', [
'rel' => 'sitemap', 'type' => 'application/xml',
'title' => 'Sitemap', 'href' => '/sitemap/sitemap-index-wiki.xml',
]));
}
// $outputPage->addHeadItem('dns-prefetch-static', \Html::element('link', ['rel' => 'dns-prefetch', 'href' => '//static-www.isekai.cn']));
$outputPage->addMeta('robots', 'all');
$outputPage->addMeta('revisit-after', '1 days');
$outputPage->addMeta('author', '异世界百科');
$outputPage->addModuleStyles(['ext.isekai.styles']);
$outputPage->addModules(['ext.isekai', 'ext.isekai.function-btn']);
@ -68,10 +74,11 @@ HTML
);
}
// 百度统计
$outputPage->addHeadItem(
'baiduhm',
<<<HTML
if ($isIsekaiWiki) {
// 百度统计
$outputPage->addHeadItem(
'baiduhm',
<<<HTML
<script type="text/javascript">
var _hmt = _hmt || [];
(function() {
@ -82,13 +89,16 @@ var _hmt = _hmt || [];
})();
</script>
HTML
);
);
}
if ($outputPage->getUser() && $outputPage->getUser()->isRegistered()) {
$outputPage->addBodyClasses(['logged-in']);
}
self::showAds($outputPage);
if ($isIsekaiWiki) {
self::showAds($outputPage);
}
}
public static function showAds(OutputPage $outputPage) {
@ -322,17 +332,22 @@ HTML
}
public static function onGetPreferences(User $user, array &$preferences){
$preferences['isekai-show-ads-bottom'] = [
'type' => 'toggle',
'label-message' => 'isekai-show-ads-bottom',
'section' => 'misc/isekai-ads',
];
$preferences['isekai-show-ads-sidebar'] = [
'type' => 'toggle',
'label-message' => 'isekai-show-ads-sidebar',
'section' => 'misc/isekai-ads',
];
$config = MediaWikiServices::getInstance()->getMainConfig();
$isIsekaiWiki = $config->get('IsekaiMiscIsIsekaiWiki');
if ($isIsekaiWiki) {
$preferences['isekai-show-ads-bottom'] = [
'type' => 'toggle',
'label-message' => 'isekai-show-ads-bottom',
'section' => 'misc/isekai-ads',
];
$preferences['isekai-show-ads-sidebar'] = [
'type' => 'toggle',
'label-message' => 'isekai-show-ads-sidebar',
'section' => 'misc/isekai-ads',
];
}
}
public static function onCirrusSearchAnalysisConfig(array &$config, $builder) {

Loading…
Cancel
Save