Merge branch 'master'

master
落雨楓 1 year ago
commit 5125723c79

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

@ -29,16 +29,22 @@ class Isekai {
} }
public static function setHeader(OutputPage $outputPage) { 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->addHeadItem('dns-prefetch-main', Html::element('link', ['rel' => 'dns-prefetch', 'href' => '//www.isekai.cn']));
$outputPage->addMeta('author', '异世界百科');
$outputPage->addHeadItem('sitemap-link', Html::element('link', [ $outputPage->addHeadItem('sitemap-link', Html::element('link', [
'rel' => 'sitemap', 'type' => 'application/xml', 'rel' => 'sitemap', 'type' => 'application/xml',
'title' => 'Sitemap', 'href' => '/sitemap/sitemap-index-wiki.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->addHeadItem('dns-prefetch-static', \Html::element('link', ['rel' => 'dns-prefetch', 'href' => '//static-www.isekai.cn']));
$outputPage->addMeta('robots', 'all'); $outputPage->addMeta('robots', 'all');
$outputPage->addMeta('revisit-after', '1 days'); $outputPage->addMeta('revisit-after', '1 days');
$outputPage->addMeta('author', '异世界百科');
$outputPage->addModuleStyles(['ext.isekai.styles']); $outputPage->addModuleStyles(['ext.isekai.styles']);
$outputPage->addModules(['ext.isekai', 'ext.isekai.function-btn']); $outputPage->addModules(['ext.isekai', 'ext.isekai.function-btn']);
@ -68,6 +74,7 @@ HTML
); );
} }
if ($isIsekaiWiki) {
// 百度统计 // 百度统计
$outputPage->addHeadItem( $outputPage->addHeadItem(
'baiduhm', 'baiduhm',
@ -83,13 +90,16 @@ var _hmt = _hmt || [];
</script> </script>
HTML HTML
); );
}
if ($outputPage->getUser() && $outputPage->getUser()->isRegistered()) { if ($outputPage->getUser() && $outputPage->getUser()->isRegistered()) {
$outputPage->addBodyClasses(['logged-in']); $outputPage->addBodyClasses(['logged-in']);
} }
if ($isIsekaiWiki) {
self::showAds($outputPage); self::showAds($outputPage);
} }
}
public static function showAds(OutputPage $outputPage) { public static function showAds(OutputPage $outputPage) {
global $wgIsekaiShowAds; global $wgIsekaiShowAds;
@ -323,6 +333,10 @@ HTML
} }
public static function onGetPreferences(User $user, array &$preferences){ public static function onGetPreferences(User $user, array &$preferences){
$config = MediaWikiServices::getInstance()->getMainConfig();
$isIsekaiWiki = $config->get('IsekaiMiscIsIsekaiWiki');
if ($isIsekaiWiki) {
$preferences['isekai-show-ads-bottom'] = [ $preferences['isekai-show-ads-bottom'] = [
'type' => 'toggle', 'type' => 'toggle',
'label-message' => 'isekai-show-ads-bottom', 'label-message' => 'isekai-show-ads-bottom',
@ -335,6 +349,7 @@ HTML
'section' => 'misc/isekai-ads', 'section' => 'misc/isekai-ads',
]; ];
} }
}
public static function onCirrusSearchAnalysisConfig(array &$config, $builder) { public static function onCirrusSearchAnalysisConfig(array &$config, $builder) {
if (isset($config['filter']['smartcn_stop'])) { // 处理中文Analysis Config if (isset($config['filter']['smartcn_stop'])) { // 处理中文Analysis Config

Loading…
Cancel
Save