Merge branch 'master'

master
落雨楓 1 year ago
commit 5125723c79

@ -217,6 +217,9 @@
},
"IsekaiMainCategoriesIndexUrl": {
"value": "/index.php?title=Project:MainCategories.json&action=raw"
},
"IsekaiMiscIsIsekaiWiki": {
"value": true
}
},
"manifest_version": 2

@ -29,16 +29,22 @@ class Isekai {
}
public static function setHeader(OutputPage $outputPage) {
$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,6 +74,7 @@ HTML
);
}
if ($isIsekaiWiki) {
// 百度统计
$outputPage->addHeadItem(
'baiduhm',
@ -83,13 +90,16 @@ var _hmt = _hmt || [];
</script>
HTML
);
}
if ($outputPage->getUser() && $outputPage->getUser()->isRegistered()) {
$outputPage->addBodyClasses(['logged-in']);
}
if ($isIsekaiWiki) {
self::showAds($outputPage);
}
}
public static function showAds(OutputPage $outputPage) {
global $wgIsekaiShowAds;
@ -323,6 +333,10 @@ HTML
}
public static function onGetPreferences(User $user, array &$preferences){
$config = MediaWikiServices::getInstance()->getMainConfig();
$isIsekaiWiki = $config->get('IsekaiMiscIsIsekaiWiki');
if ($isIsekaiWiki) {
$preferences['isekai-show-ads-bottom'] = [
'type' => 'toggle',
'label-message' => 'isekai-show-ads-bottom',
@ -335,6 +349,7 @@ HTML
'section' => 'misc/isekai-ads',
];
}
}
public static function onCirrusSearchAnalysisConfig(array &$config, $builder) {
if (isset($config['filter']['smartcn_stop'])) { // 处理中文Analysis Config

Loading…
Cancel
Save