移除FontAwesome,增加全屏按钮
parent
6f689ab895
commit
5bb602d909
@ -1,364 +1,363 @@
|
||||
<?php
|
||||
|
||||
namespace Isekai;
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Config;
|
||||
use OutputPage;
|
||||
use Html;
|
||||
use Title;
|
||||
use MediaWiki\Linker\LinkRenderer;
|
||||
use MediaWiki\Linker\LinkTarget;
|
||||
use User;
|
||||
use EditPage;
|
||||
|
||||
class Isekai {
|
||||
public static function onLoad(OutputPage $output) {
|
||||
$title = $output->getTitle();
|
||||
|
||||
self::setHeader($output);
|
||||
|
||||
if ($title->inNamespace(NS_USER)) {
|
||||
self::onUserPage($output);
|
||||
}
|
||||
|
||||
if ($title->inNamespace(NS_MAIN)) {
|
||||
self::handleSubpageTitle($output);
|
||||
}
|
||||
}
|
||||
|
||||
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',
|
||||
]));
|
||||
// $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->addModuleStyles('ext.fontawesome');
|
||||
$outputPage->addModules('ext.isekai');
|
||||
//$outputPage->addModules('ext.treeview');
|
||||
|
||||
// 加载动画,三秒内未加载完成则强制显示
|
||||
if ($outputPage->getSkin()->getSkinName() === 'timeless') {
|
||||
$outputPage->addHeadItem(
|
||||
'loading-animate-script',
|
||||
<<<HTML
|
||||
<script type="text/javascript">
|
||||
var c = document.documentElement.classList;
|
||||
c.add('content-loading');
|
||||
setTimeout(function() {
|
||||
c.remove('content-loading');
|
||||
c.add('content-loaded');
|
||||
}, 3000);
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var b = getComputedStyle(document.body, null).backgroundColor;
|
||||
var a = document.createElement('div');
|
||||
a.classList.add('page-loading-spinner');
|
||||
a.innerHTML = '<div class="spinner-box"><div class="circle-border"><div class="circle-core" style="background-color: ' + b + '"></div></div></div>';
|
||||
document.body.appendChild(a);
|
||||
});
|
||||
</script>
|
||||
HTML
|
||||
);
|
||||
}
|
||||
|
||||
// 百度统计
|
||||
$outputPage->addHeadItem(
|
||||
'baiduhm',
|
||||
<<<HTML
|
||||
<script type="text/javascript">
|
||||
var _hmt = _hmt || [];
|
||||
(function() {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "https://hm.baidu.com/hm.js?2f650f34db6f2bbffa0af4d4e91a09a9";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
HTML
|
||||
);
|
||||
|
||||
if ($outputPage->getUser() && $outputPage->getUser()->isRegistered()) {
|
||||
$outputPage->addBodyClasses(['logged-in']);
|
||||
}
|
||||
|
||||
self::showAds($outputPage);
|
||||
}
|
||||
|
||||
public static function showAds(OutputPage $outputPage) {
|
||||
global $wgIsekaiShowAds;
|
||||
$service = MediaWikiServices::getInstance();
|
||||
$isView = $outputPage->getContext()->getRequest()->getText( 'action', 'view' ) == 'view';
|
||||
$showAdsSidebar = $service->getUserOptionsLookup()->getOption($outputPage->getUser(), 'isekai-show-ads-sidebar');
|
||||
$showAdsBottom = $service->getUserOptionsLookup()->getOption($outputPage->getUser(), 'isekai-show-ads-bottom');
|
||||
|
||||
// 检测Adblock
|
||||
$outputPage->addHeadItem('adblock-detect', '<script src="/peel1.js"></script>');
|
||||
|
||||
if($wgIsekaiShowAds
|
||||
&& ($showAdsSidebar || $showAdsBottom)
|
||||
&& $outputPage->getTitle()->getNamespace() !== NS_SPECIAL
|
||||
&& $isView){
|
||||
|
||||
// 谷歌广告
|
||||
$outputPage->addHeadItem(
|
||||
'googlead',
|
||||
<<<HTML
|
||||
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8607817613161226" crossorigin="anonymous"></script>
|
||||
HTML
|
||||
);
|
||||
|
||||
if ($showAdsSidebar && $outputPage->getSkin()->getSkinName() === 'timeless') {
|
||||
$outputPage->addHTML(
|
||||
<<<HTML
|
||||
<script type="text/javascript">
|
||||
window.addEventListener('load', function () {
|
||||
if (window.innerWidth >= 1100) {
|
||||
var adElem = document.createElement('div');
|
||||
adElem.className = 'googlead-container googlead-container-sidebar';
|
||||
adElem.innerHTML = '<ins class="adsbygoogle" style="display:block;" data-ad-client="ca-pub-8607817613161226" data-ad-slot="8245595332" data-ad-format="rectangle" data-full-width-responsive="true"></ins>';
|
||||
var relatedNav = document.querySelector('#mw-related-navigation');
|
||||
if (relatedNav) {
|
||||
relatedNav.appendChild(adElem);
|
||||
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
HTML
|
||||
);
|
||||
}
|
||||
|
||||
if ($showAdsBottom) {
|
||||
$outputPage->addHTML(
|
||||
<<<HTML
|
||||
<div class="googlead-container googlead-container-bottom">
|
||||
<ins class="adsbygoogle"
|
||||
style="display:block"
|
||||
data-ad-client="ca-pub-8607817613161226"
|
||||
data-ad-slot="3245545943"
|
||||
data-ad-format="horizontal"
|
||||
data-full-width-responsive="true"></ins>
|
||||
</div>
|
||||
HTML
|
||||
);
|
||||
|
||||
$outputPage->addHTML(
|
||||
<<<HTML
|
||||
<script>
|
||||
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||
</script>
|
||||
HTML
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function onUserPage(OutputPage $outputPage) {
|
||||
// 用户页
|
||||
$title = $outputPage->getTitle();
|
||||
if ($title->inNamespace(NS_USER)) {
|
||||
$userName = $title->getText();
|
||||
$user = MediaWikiServices::getInstance()->getUserFactory()->newFromName($userName);
|
||||
if ($user && $user->isRegistered()) {
|
||||
$showName = $user->getRealName();
|
||||
if (!$showName) {
|
||||
$showName = $userName;
|
||||
}
|
||||
$outputPage->setPageTitle($showName);
|
||||
$outputPage->setSubtitle('@' . $title->getText());
|
||||
$outputPage->setHTMLTitle(wfMessage('group-user')->text() . ' - ' . $outputPage->getHTMLTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function handleSubpageTitle(OutputPage $outputPage) {
|
||||
if (!$outputPage->isArticle()) return;
|
||||
|
||||
$title = $outputPage->getTitle();
|
||||
if ($title) {
|
||||
if ($title->isSubpage()) {
|
||||
//更改显示的标题
|
||||
$titleText = $title->getPrefixedText();
|
||||
|
||||
$currentDisplayTitle = $outputPage->getDisplayTitle();
|
||||
$htmlTitle = $outputPage->getHTMLTitle();
|
||||
if (strpos($htmlTitle, $currentDisplayTitle) === 0) {
|
||||
// 将HTML标题替换为完整标题
|
||||
$htmlTitleText = $currentDisplayTitle . ' (' . dirname($titleText) . ')';
|
||||
$outputPage->setHTMLTitle($htmlTitleText . substr($htmlTitle, strlen($currentDisplayTitle)));
|
||||
$outputPage->addMeta('title', $htmlTitleText);
|
||||
}
|
||||
|
||||
//面包屑
|
||||
$titlePathList = explode('/', $titleText);
|
||||
$titlePathLen = count($titlePathList);
|
||||
$breadcrumbsHtml = [
|
||||
Html::openElement('ol', ['class' => 'breadcrumb']),
|
||||
];
|
||||
$linkRender = MediaWikiServices::getInstance()->getLinkRenderer();
|
||||
foreach ($titlePathList as $key => $titleName) {
|
||||
if ($key === $titlePathLen - 1) {
|
||||
$breadcrumbsHtml[] = Html::element('li', ['class' => 'active'], $titleName);
|
||||
} else {
|
||||
$titleSubPath = implode('/', array_slice($titlePathList, 0, $key + 1));
|
||||
$currentTitle = Title::newFromText($titleSubPath);
|
||||
if ($currentTitle) {
|
||||
$link = $linkRender->makeLink(Title::newFromText($titleSubPath), $titleName);
|
||||
} else {
|
||||
$link = $titleSubPath;
|
||||
}
|
||||
|
||||
if ($key === 0) {
|
||||
$breadcrumbsHtml[] = Html::openElement('li', ['class' => 'root']) . $link . Html::closeElement('li');
|
||||
} else {
|
||||
$breadcrumbsHtml[] = Html::openElement('li') . $link . Html::closeElement('li');
|
||||
}
|
||||
|
||||
$breadcrumbsHtml[] = Html::openElement('span', ['class' => 'breadcrumb-divider']) . '/' . Html::closeElement('span');
|
||||
}
|
||||
}
|
||||
$breadcrumbsHtml[] = Html::closeElement('ol');
|
||||
$html = implode($breadcrumbsHtml);
|
||||
|
||||
// 阻止出现subtitle空行
|
||||
$subtitle = $outputPage->getSubtitle();
|
||||
$outputPage->setSubtitle($subtitle . $html);
|
||||
} else {
|
||||
$currentDisplayTitle = $outputPage->getDisplayTitle();
|
||||
if ($currentDisplayTitle) {
|
||||
$currentDisplayTitle = strip_tags($currentDisplayTitle);
|
||||
$outputPage->addMeta('title', $currentDisplayTitle);
|
||||
|
||||
if ($currentDisplayTitle !== $title->getPrefixedText()) {
|
||||
// 输出原标题
|
||||
$breadcrumbsHtml = [
|
||||
Html::openElement('ol', ['class' => 'breadcrumb']),
|
||||
Html::element('li', ['class' => 'root active'], $title->getPrefixedText()),
|
||||
Html::closeElement('ol'),
|
||||
];
|
||||
$html = implode($breadcrumbsHtml);
|
||||
|
||||
$subtitle = $outputPage->getSubtitle();
|
||||
$outputPage->setSubtitle($subtitle . $html);
|
||||
}
|
||||
} else {
|
||||
$outputPage->addMeta('title', $title->getPrefixedText());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function onParserBeforeInternalParse(\Parser $parser, &$text, $strip_state) {
|
||||
$title = $parser->getPage();
|
||||
|
||||
if ($title !== null && $title instanceof \Title && $title->isSubpage()) {
|
||||
//更改显示的标题
|
||||
$titleText = $title->getPrefixedText();
|
||||
if ($titleText) {
|
||||
$parser->getOutput()->setTitleText(basename($titleText));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function onHtmlPageLinkRendererBegin(
|
||||
LinkRenderer $linkRenderer, LinkTarget $target,
|
||||
&$text, &$extraAttribs, &$query, &$ret
|
||||
) {
|
||||
if ($target->inNamespace(NS_USER)) {
|
||||
$userName = $target->getText();
|
||||
$user = MediaWikiServices::getInstance()->getUserFactory()->newFromName($userName);
|
||||
if ($user && $user->isRegistered()) {
|
||||
$showName = $user->getRealName();
|
||||
if ($showName) {
|
||||
$text = $showName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function onAttemptSave(EditPage $editPage) {
|
||||
$services = MediaWikiServices::getInstance();
|
||||
$title = $editPage->getTitle();
|
||||
if (
|
||||
!$title || !$title->inNamespace(NS_MAIN) ||
|
||||
!$title->isSubpage() || $title->exists()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
$path = explode('/', $title->getBaseText());
|
||||
$categoryList = [];
|
||||
$pathLen = count($path);
|
||||
for ($i = 0; $i < $pathLen; $i ++) {
|
||||
if ($i === 0) {
|
||||
$categoryList[] = $path[0];
|
||||
} else {
|
||||
$categoryList[] = implode('/', array_slice($path, 0, $i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
$categorySyntaxList = [];
|
||||
$categoryNsText = $services->getContentLanguage()->
|
||||
getNsText($services->getNamespaceInfo()->getSubject(NS_CATEGORY));
|
||||
foreach ($categoryList as $categoryName) {
|
||||
$categorySyntaxList[] = "[[{$categoryNsText}:{$categoryName}]]";
|
||||
}
|
||||
if (substr($editPage->textbox1, -1, 1) !== "\n") {
|
||||
$editPage->textbox1 .= "\n" . implode("", $categorySyntaxList);
|
||||
} else {
|
||||
$editPage->textbox1 .= implode("", $categorySyntaxList);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function onResourceLoaderGetConfigVars(array &$vars, string $skin, Config $config){
|
||||
$vars['wgIsekaiShowAds'] = $config->get('IsekaiShowAds');
|
||||
}
|
||||
|
||||
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',
|
||||
];
|
||||
}
|
||||
|
||||
public static function onCirrusSearchAnalysisConfig(array &$config, $builder) {
|
||||
if (isset($config['filter']['smartcn_stop'])) { // 处理中文Analysis Config
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static function onMugenAppGetAvatar(&$avatarUrl, $size, $user) {
|
||||
if (!$user) {
|
||||
$avatarUrl = "https://account.isekai.cn/realms/isekai/avatar/default";
|
||||
return;
|
||||
}
|
||||
|
||||
$userName = $user->getName();
|
||||
|
||||
$avatarBase = 'https://account.isekai.cn/realms/isekai/avatar/by-username/' . $userName;
|
||||
|
||||
if ($size <= 64) {
|
||||
$avatarUrl = "$avatarBase?size=md";
|
||||
} else if ($size <= 128) {
|
||||
$avatarUrl = "$avatarBase?size=lg";
|
||||
} else if ($size <= 256) {
|
||||
$avatarUrl = "$avatarBase?size=xl";
|
||||
} else {
|
||||
$avatarUrl = "$avatarBase?size=xxl";
|
||||
}
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
namespace Isekai;
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Config;
|
||||
use OutputPage;
|
||||
use Html;
|
||||
use Title;
|
||||
use MediaWiki\Linker\LinkRenderer;
|
||||
use MediaWiki\Linker\LinkTarget;
|
||||
use User;
|
||||
use EditPage;
|
||||
|
||||
class Isekai {
|
||||
public static function onLoad(OutputPage $output) {
|
||||
$title = $output->getTitle();
|
||||
|
||||
self::setHeader($output);
|
||||
|
||||
if ($title->inNamespace(NS_USER)) {
|
||||
self::onUserPage($output);
|
||||
}
|
||||
|
||||
if ($title->inNamespace(NS_MAIN)) {
|
||||
self::handleSubpageTitle($output);
|
||||
}
|
||||
}
|
||||
|
||||
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',
|
||||
]));
|
||||
// $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']);
|
||||
//$outputPage->addModules(['ext.treeview']);
|
||||
|
||||
// 加载动画,三秒内未加载完成则强制显示
|
||||
if ($outputPage->getSkin()->getSkinName() === 'timeless') {
|
||||
$outputPage->addHeadItem(
|
||||
'loading-animate-script',
|
||||
<<<HTML
|
||||
<script type="text/javascript">
|
||||
var c = document.documentElement.classList;
|
||||
c.add('content-loading');
|
||||
setTimeout(function() {
|
||||
c.remove('content-loading');
|
||||
c.add('content-loaded');
|
||||
}, 3000);
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
var b = getComputedStyle(document.body, null).backgroundColor;
|
||||
var a = document.createElement('div');
|
||||
a.classList.add('page-loading-spinner');
|
||||
a.innerHTML = '<div class="spinner-box"><div class="circle-border"><div class="circle-core" style="background-color: ' + b + '"></div></div></div>';
|
||||
document.body.appendChild(a);
|
||||
});
|
||||
</script>
|
||||
HTML
|
||||
);
|
||||
}
|
||||
|
||||
// 百度统计
|
||||
$outputPage->addHeadItem(
|
||||
'baiduhm',
|
||||
<<<HTML
|
||||
<script type="text/javascript">
|
||||
var _hmt = _hmt || [];
|
||||
(function() {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "https://hm.baidu.com/hm.js?2f650f34db6f2bbffa0af4d4e91a09a9";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
HTML
|
||||
);
|
||||
|
||||
if ($outputPage->getUser() && $outputPage->getUser()->isRegistered()) {
|
||||
$outputPage->addBodyClasses(['logged-in']);
|
||||
}
|
||||
|
||||
self::showAds($outputPage);
|
||||
}
|
||||
|
||||
public static function showAds(OutputPage $outputPage) {
|
||||
global $wgIsekaiShowAds;
|
||||
$service = MediaWikiServices::getInstance();
|
||||
$isView = $outputPage->getContext()->getRequest()->getText( 'action', 'view' ) == 'view';
|
||||
$showAdsSidebar = $service->getUserOptionsLookup()->getOption($outputPage->getUser(), 'isekai-show-ads-sidebar');
|
||||
$showAdsBottom = $service->getUserOptionsLookup()->getOption($outputPage->getUser(), 'isekai-show-ads-bottom');
|
||||
|
||||
// 检测Adblock
|
||||
$outputPage->addHeadItem('adblock-detect', '<script src="/peel1.js"></script>');
|
||||
|
||||
if($wgIsekaiShowAds
|
||||
&& ($showAdsSidebar || $showAdsBottom)
|
||||
&& $outputPage->getTitle()->getNamespace() !== NS_SPECIAL
|
||||
&& $isView){
|
||||
|
||||
// 谷歌广告
|
||||
$outputPage->addHeadItem(
|
||||
'googlead',
|
||||
<<<HTML
|
||||
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8607817613161226" crossorigin="anonymous"></script>
|
||||
HTML
|
||||
);
|
||||
|
||||
if ($showAdsSidebar && $outputPage->getSkin()->getSkinName() === 'timeless') {
|
||||
$outputPage->addHTML(
|
||||
<<<HTML
|
||||
<script type="text/javascript">
|
||||
window.addEventListener('load', function () {
|
||||
if (window.innerWidth >= 1100) {
|
||||
var adElem = document.createElement('div');
|
||||
adElem.className = 'googlead-container googlead-container-sidebar';
|
||||
adElem.innerHTML = '<ins class="adsbygoogle" style="display:block;" data-ad-client="ca-pub-8607817613161226" data-ad-slot="8245595332" data-ad-format="rectangle" data-full-width-responsive="true"></ins>';
|
||||
var relatedNav = document.querySelector('#mw-related-navigation');
|
||||
if (relatedNav) {
|
||||
relatedNav.appendChild(adElem);
|
||||
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
HTML
|
||||
);
|
||||
}
|
||||
|
||||
if ($showAdsBottom) {
|
||||
$outputPage->addHTML(
|
||||
<<<HTML
|
||||
<div class="googlead-container googlead-container-bottom">
|
||||
<ins class="adsbygoogle"
|
||||
style="display:block"
|
||||
data-ad-client="ca-pub-8607817613161226"
|
||||
data-ad-slot="3245545943"
|
||||
data-ad-format="horizontal"
|
||||
data-full-width-responsive="true"></ins>
|
||||
</div>
|
||||
HTML
|
||||
);
|
||||
|
||||
$outputPage->addHTML(
|
||||
<<<HTML
|
||||
<script>
|
||||
(adsbygoogle = window.adsbygoogle || []).push({});
|
||||
</script>
|
||||
HTML
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function onUserPage(OutputPage $outputPage) {
|
||||
// 用户页
|
||||
$title = $outputPage->getTitle();
|
||||
if ($title->inNamespace(NS_USER)) {
|
||||
$userName = $title->getText();
|
||||
$user = MediaWikiServices::getInstance()->getUserFactory()->newFromName($userName);
|
||||
if ($user && $user->isRegistered()) {
|
||||
$showName = $user->getRealName();
|
||||
if (!$showName) {
|
||||
$showName = $userName;
|
||||
}
|
||||
$outputPage->setPageTitle($showName);
|
||||
$outputPage->setSubtitle('@' . $title->getText());
|
||||
$outputPage->setHTMLTitle(wfMessage('group-user')->text() . ' - ' . $outputPage->getHTMLTitle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function handleSubpageTitle(OutputPage $outputPage) {
|
||||
if (!$outputPage->isArticle()) return;
|
||||
|
||||
$title = $outputPage->getTitle();
|
||||
if ($title) {
|
||||
if ($title->isSubpage()) {
|
||||
//更改显示的标题
|
||||
$titleText = $title->getPrefixedText();
|
||||
|
||||
$currentDisplayTitle = $outputPage->getDisplayTitle();
|
||||
$htmlTitle = $outputPage->getHTMLTitle();
|
||||
if (strpos($htmlTitle, $currentDisplayTitle) === 0) {
|
||||
// 将HTML标题替换为完整标题
|
||||
$htmlTitleText = $currentDisplayTitle . ' (' . dirname($titleText) . ')';
|
||||
$outputPage->setHTMLTitle($htmlTitleText . substr($htmlTitle, strlen($currentDisplayTitle)));
|
||||
$outputPage->addMeta('title', $htmlTitleText);
|
||||
}
|
||||
|
||||
//面包屑
|
||||
$titlePathList = explode('/', $titleText);
|
||||
$titlePathLen = count($titlePathList);
|
||||
$breadcrumbsHtml = [
|
||||
Html::openElement('ol', ['class' => 'breadcrumb']),
|
||||
];
|
||||
$linkRender = MediaWikiServices::getInstance()->getLinkRenderer();
|
||||
foreach ($titlePathList as $key => $titleName) {
|
||||
if ($key === $titlePathLen - 1) {
|
||||
$breadcrumbsHtml[] = Html::element('li', ['class' => 'active'], $titleName);
|
||||
} else {
|
||||
$titleSubPath = implode('/', array_slice($titlePathList, 0, $key + 1));
|
||||
$currentTitle = Title::newFromText($titleSubPath);
|
||||
if ($currentTitle) {
|
||||
$link = $linkRender->makeLink(Title::newFromText($titleSubPath), $titleName);
|
||||
} else {
|
||||
$link = $titleSubPath;
|
||||
}
|
||||
|
||||
if ($key === 0) {
|
||||
$breadcrumbsHtml[] = Html::openElement('li', ['class' => 'root']) . $link . Html::closeElement('li');
|
||||
} else {
|
||||
$breadcrumbsHtml[] = Html::openElement('li') . $link . Html::closeElement('li');
|
||||
}
|
||||
|
||||
$breadcrumbsHtml[] = Html::openElement('span', ['class' => 'breadcrumb-divider']) . '/' . Html::closeElement('span');
|
||||
}
|
||||
}
|
||||
$breadcrumbsHtml[] = Html::closeElement('ol');
|
||||
$html = implode($breadcrumbsHtml);
|
||||
|
||||
// 阻止出现subtitle空行
|
||||
$subtitle = $outputPage->getSubtitle();
|
||||
$outputPage->setSubtitle($subtitle . $html);
|
||||
} else {
|
||||
$currentDisplayTitle = $outputPage->getDisplayTitle();
|
||||
if ($currentDisplayTitle) {
|
||||
$currentDisplayTitle = strip_tags($currentDisplayTitle);
|
||||
$outputPage->addMeta('title', $currentDisplayTitle);
|
||||
|
||||
if ($currentDisplayTitle !== $title->getPrefixedText()) {
|
||||
// 输出原标题
|
||||
$breadcrumbsHtml = [
|
||||
Html::openElement('ol', ['class' => 'breadcrumb']),
|
||||
Html::element('li', ['class' => 'root active'], $title->getPrefixedText()),
|
||||
Html::closeElement('ol'),
|
||||
];
|
||||
$html = implode($breadcrumbsHtml);
|
||||
|
||||
$subtitle = $outputPage->getSubtitle();
|
||||
$outputPage->setSubtitle($subtitle . $html);
|
||||
}
|
||||
} else {
|
||||
$outputPage->addMeta('title', $title->getPrefixedText());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function onParserBeforeInternalParse(\Parser $parser, &$text, $strip_state) {
|
||||
$title = $parser->getPage();
|
||||
|
||||
if ($title !== null && $title instanceof \Title && $title->isSubpage()) {
|
||||
//更改显示的标题
|
||||
$titleText = $title->getPrefixedText();
|
||||
if ($titleText) {
|
||||
$parser->getOutput()->setTitleText(basename($titleText));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function onHtmlPageLinkRendererBegin(
|
||||
LinkRenderer $linkRenderer, LinkTarget $target,
|
||||
&$text, &$extraAttribs, &$query, &$ret
|
||||
) {
|
||||
if ($target->inNamespace(NS_USER)) {
|
||||
$userName = $target->getText();
|
||||
$user = MediaWikiServices::getInstance()->getUserFactory()->newFromName($userName);
|
||||
if ($user && $user->isRegistered()) {
|
||||
$showName = $user->getRealName();
|
||||
if ($showName) {
|
||||
$text = $showName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function onAttemptSave(EditPage $editPage) {
|
||||
$services = MediaWikiServices::getInstance();
|
||||
$title = $editPage->getTitle();
|
||||
if (
|
||||
!$title || !$title->inNamespace(NS_MAIN) ||
|
||||
!$title->isSubpage() || $title->exists()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
$path = explode('/', $title->getBaseText());
|
||||
$categoryList = [];
|
||||
$pathLen = count($path);
|
||||
for ($i = 0; $i < $pathLen; $i ++) {
|
||||
if ($i === 0) {
|
||||
$categoryList[] = $path[0];
|
||||
} else {
|
||||
$categoryList[] = implode('/', array_slice($path, 0, $i + 1));
|
||||
}
|
||||
}
|
||||
|
||||
$categorySyntaxList = [];
|
||||
$categoryNsText = $services->getContentLanguage()->
|
||||
getNsText($services->getNamespaceInfo()->getSubject(NS_CATEGORY));
|
||||
foreach ($categoryList as $categoryName) {
|
||||
$categorySyntaxList[] = "[[{$categoryNsText}:{$categoryName}]]";
|
||||
}
|
||||
if (substr($editPage->textbox1, -1, 1) !== "\n") {
|
||||
$editPage->textbox1 .= "\n" . implode("", $categorySyntaxList);
|
||||
} else {
|
||||
$editPage->textbox1 .= implode("", $categorySyntaxList);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function onResourceLoaderGetConfigVars(array &$vars, string $skin, Config $config){
|
||||
$vars['wgIsekaiShowAds'] = $config->get('IsekaiShowAds');
|
||||
}
|
||||
|
||||
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',
|
||||
];
|
||||
}
|
||||
|
||||
public static function onCirrusSearchAnalysisConfig(array &$config, $builder) {
|
||||
if (isset($config['filter']['smartcn_stop'])) { // 处理中文Analysis Config
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static function onMugenAppGetAvatar(&$avatarUrl, $size, $user) {
|
||||
if (!$user) {
|
||||
$avatarUrl = "https://account.isekai.cn/realms/isekai/avatar/default";
|
||||
return;
|
||||
}
|
||||
|
||||
$userName = $user->getName();
|
||||
|
||||
$avatarBase = 'https://account.isekai.cn/realms/isekai/avatar/by-username/' . $userName;
|
||||
|
||||
if ($size <= 64) {
|
||||
$avatarUrl = "$avatarBase?size=md";
|
||||
} else if ($size <= 128) {
|
||||
$avatarUrl = "$avatarBase?size=lg";
|
||||
} else if ($size <= 256) {
|
||||
$avatarUrl = "$avatarBase?size=xl";
|
||||
} else {
|
||||
$avatarUrl = "$avatarBase?size=xxl";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,143 +1,148 @@
|
||||
{
|
||||
"name": "Isekai wiki misc",
|
||||
"namemsg": "isekaiwiki-misc-name",
|
||||
"author": "Hyperzlib",
|
||||
"version": "1.0.1",
|
||||
"url": "https://www.isekai.cn",
|
||||
"descriptionmsg": "isekaiwiki-misc-desc",
|
||||
"license-name": "MIT",
|
||||
"type": "other",
|
||||
"requires": {
|
||||
|
||||
},
|
||||
"MessagesDirs": {
|
||||
"IsekaiMisc": [
|
||||
"i18n"
|
||||
]
|
||||
},
|
||||
"AutoloadClasses": {
|
||||
"Isekai\\InfoBox": "InfoBox.class.php",
|
||||
"Isekai\\IsekaiChart": "IsekaiChart.class.php",
|
||||
"Isekai\\Isekai": "Isekai.class.php"
|
||||
},
|
||||
"ExtensionMessagesFiles": {
|
||||
"IsekaiMagic": "Isekai.i18n.php"
|
||||
},
|
||||
"Hooks": {
|
||||
"ParserFirstCallInit": [
|
||||
"Isekai\\InfoBox::onParserSetup",
|
||||
"Isekai\\IsekaiChart::onParserSetup"
|
||||
],
|
||||
"BeforePageDisplay": [
|
||||
"Isekai\\Isekai::onLoad"
|
||||
],
|
||||
"ParserBeforeInternalParse": [
|
||||
"Isekai\\Isekai::onParserBeforeInternalParse"
|
||||
],
|
||||
"HtmlPageLinkRendererBegin": [
|
||||
"Isekai\\Isekai::onHtmlPageLinkRendererBegin"
|
||||
],
|
||||
"ResourceLoaderGetConfigVars": [
|
||||
"Isekai\\Isekai::onResourceLoaderGetConfigVars"
|
||||
],
|
||||
"GetPreferences": [
|
||||
"Isekai\\Isekai::onGetPreferences"
|
||||
],
|
||||
"EditPage::attemptSave": [
|
||||
"Isekai\\Isekai::onAttemptSave"
|
||||
],
|
||||
"CirrusSearchAnalysisConfig": [
|
||||
"Isekai\\Isekai::onCirrusSearchAnalysisConfig"
|
||||
],
|
||||
"MugenAppGetAvatar": [
|
||||
"Isekai\\Isekai::onMugenAppGetAvatar"
|
||||
]
|
||||
},
|
||||
"ResourceModules": {
|
||||
"ext.isekai": {
|
||||
"scripts": ["ext.isekai.js"],
|
||||
"dependencies": [
|
||||
"oojs-ui-core",
|
||||
"oojs-ui-windows",
|
||||
"mediawiki.user"
|
||||
],
|
||||
"targets": [
|
||||
"desktop",
|
||||
"mobile"
|
||||
],
|
||||
"messages": [
|
||||
"isekai-collapse-show",
|
||||
"isekai-collapse-hide",
|
||||
"isekai-editor-prompt-content",
|
||||
"isekai-editor-prompt-btn-cancel",
|
||||
"isekai-editor-prompt-btn-use-mobile",
|
||||
"isekai-editor-prompt-btn-use-desktop",
|
||||
"isekai-login-prompt-content",
|
||||
"isekai-login-prompt-btn-login",
|
||||
"isekai-login-prompt-btn-createaccount",
|
||||
"isekai-login-prompt-btn-cancel",
|
||||
"isekai-ads-prompt-title",
|
||||
"isekai-ads-prompt-content",
|
||||
"isekai-ads-prompt-btn-cancel",
|
||||
"nav-login-createaccount",
|
||||
"visualeditor-savedialog-label-set-categories"
|
||||
]
|
||||
},
|
||||
"ext.isekai.styles": {
|
||||
"styles": ["ext.isekai.less"],
|
||||
"targets": [
|
||||
"desktop",
|
||||
"mobile"
|
||||
]
|
||||
},
|
||||
"ext.fontawesome": {
|
||||
"styles": [
|
||||
"lib/fontawesome/_fontawesome.css",
|
||||
"fontawesome.less"
|
||||
],
|
||||
"targets": [
|
||||
"desktop",
|
||||
"mobile"
|
||||
]
|
||||
},
|
||||
"lib.isekai.echarts": {
|
||||
"scripts": ["lib/echarts.custom.min.js"]
|
||||
},
|
||||
"ext.isekai.chart": {
|
||||
"scripts": ["ext.isekai.chart.js"],
|
||||
"styles": ["ext.isekai.chart.less"]
|
||||
},
|
||||
"ext.treeview": {
|
||||
"scripts": ["ext.treeview.js"],
|
||||
"styles": ["ext.treeview.css"],
|
||||
"targets": [
|
||||
"desktop",
|
||||
"mobile"
|
||||
]
|
||||
},
|
||||
"ext.isekai.ve": {
|
||||
"scripts": ["ext.isekai.ve.js"],
|
||||
"targets": [
|
||||
"desktop",
|
||||
"mobile"
|
||||
]
|
||||
}
|
||||
},
|
||||
"VisualEditorPluginModules": [
|
||||
"ext.isekai.ve"
|
||||
],
|
||||
"ResourceFileModulePaths": {
|
||||
"localBasePath": "modules",
|
||||
"remoteExtPath": "IsekaiMisc/modules"
|
||||
},
|
||||
"DefaultUserOptions": {
|
||||
"isekai-show-ads-bottom": true,
|
||||
"isekai-show-ads-sidebar": true
|
||||
},
|
||||
"config": {
|
||||
"IsekaiShowAds": {
|
||||
"value": false
|
||||
}
|
||||
},
|
||||
"manifest_version": 2
|
||||
{
|
||||
"name": "Isekai wiki misc",
|
||||
"namemsg": "isekaiwiki-misc-name",
|
||||
"author": "Hyperzlib",
|
||||
"version": "1.0.1",
|
||||
"url": "https://www.isekai.cn",
|
||||
"descriptionmsg": "isekaiwiki-misc-desc",
|
||||
"license-name": "MIT",
|
||||
"type": "other",
|
||||
"requires": {
|
||||
|
||||
},
|
||||
"MessagesDirs": {
|
||||
"IsekaiMisc": [
|
||||
"i18n"
|
||||
]
|
||||
},
|
||||
"AutoloadClasses": {
|
||||
"Isekai\\InfoBox": "InfoBox.class.php",
|
||||
"Isekai\\IsekaiChart": "IsekaiChart.class.php",
|
||||
"Isekai\\Isekai": "Isekai.class.php"
|
||||
},
|
||||
"ExtensionMessagesFiles": {
|
||||
"IsekaiMagic": "Isekai.i18n.php"
|
||||
},
|
||||
"Hooks": {
|
||||
"ParserFirstCallInit": [
|
||||
"Isekai\\InfoBox::onParserSetup",
|
||||
"Isekai\\IsekaiChart::onParserSetup"
|
||||
],
|
||||
"BeforePageDisplay": [
|
||||
"Isekai\\Isekai::onLoad"
|
||||
],
|
||||
"ParserBeforeInternalParse": [
|
||||
"Isekai\\Isekai::onParserBeforeInternalParse"
|
||||
],
|
||||
"HtmlPageLinkRendererBegin": [
|
||||
"Isekai\\Isekai::onHtmlPageLinkRendererBegin"
|
||||
],
|
||||
"ResourceLoaderGetConfigVars": [
|
||||
"Isekai\\Isekai::onResourceLoaderGetConfigVars"
|
||||
],
|
||||
"GetPreferences": [
|
||||
"Isekai\\Isekai::onGetPreferences"
|
||||
],
|
||||
"EditPage::attemptSave": [
|
||||
"Isekai\\Isekai::onAttemptSave"
|
||||
],
|
||||
"CirrusSearchAnalysisConfig": [
|
||||
"Isekai\\Isekai::onCirrusSearchAnalysisConfig"
|
||||
],
|
||||
"MugenAppGetAvatar": [
|
||||
"Isekai\\Isekai::onMugenAppGetAvatar"
|
||||
]
|
||||
},
|
||||
"ResourceModules": {
|
||||
"ext.isekai": {
|
||||
"scripts": ["ext.isekai.js"],
|
||||
"dependencies": [
|
||||
"oojs-ui-core",
|
||||
"oojs-ui-windows",
|
||||
"mediawiki.user"
|
||||
],
|
||||
"targets": [
|
||||
"desktop",
|
||||
"mobile"
|
||||
],
|
||||
"messages": [
|
||||
"isekai-collapse-show",
|
||||
"isekai-collapse-hide",
|
||||
"isekai-editor-prompt-content",
|
||||
"isekai-editor-prompt-btn-cancel",
|
||||
"isekai-editor-prompt-btn-use-mobile",
|
||||
"isekai-editor-prompt-btn-use-desktop",
|
||||
"isekai-login-prompt-content",
|
||||
"isekai-login-prompt-btn-login",
|
||||
"isekai-login-prompt-btn-createaccount",
|
||||
"isekai-login-prompt-btn-cancel",
|
||||
"isekai-ads-prompt-title",
|
||||
"isekai-ads-prompt-content",
|
||||
"isekai-ads-prompt-btn-cancel",
|
||||
"nav-login-createaccount",
|
||||
"visualeditor-savedialog-label-set-categories"
|
||||
]
|
||||
},
|
||||
"ext.isekai.styles": {
|
||||
"styles": ["ext.isekai.less"],
|
||||
"targets": [
|
||||
"desktop",
|
||||
"mobile"
|
||||
]
|
||||
},
|
||||
"lib.isekai.echarts": {
|
||||
"scripts": ["lib/echarts.custom.min.js"]
|
||||
},
|
||||
"ext.isekai.chart": {
|
||||
"scripts": ["ext.isekai.chart.js"],
|
||||
"styles": ["ext.isekai.chart.less"]
|
||||
},
|
||||
"ext.treeview": {
|
||||
"scripts": ["ext.treeview.js"],
|
||||
"styles": ["ext.treeview.css"],
|
||||
"targets": [
|
||||
"desktop",
|
||||
"mobile"
|
||||
]
|
||||
},
|
||||
"ext.isekai.ve": {
|
||||
"scripts": ["ext.isekai.ve.js"],
|
||||
"targets": [
|
||||
"desktop",
|
||||
"mobile"
|
||||
]
|
||||
},
|
||||
"ext.isekai.function-btn": {
|
||||
"scripts": ["ext.isekai.function-btn.js"],
|
||||
"dependencies": [
|
||||
"ext.isekai.baseWidgets",
|
||||
"oojs-ui.styles.icons-media"
|
||||
],
|
||||
"targets": [
|
||||
"desktop",
|
||||
"mobile"
|
||||
],
|
||||
"messages": [
|
||||
"isekai-function-btn-fullscreen",
|
||||
"isekai-function-btn-exit-fullscreen"
|
||||
]
|
||||
}
|
||||
},
|
||||
"VisualEditorPluginModules": [
|
||||
"ext.isekai.ve"
|
||||
],
|
||||
"ResourceFileModulePaths": {
|
||||
"localBasePath": "modules",
|
||||
"remoteExtPath": "IsekaiMisc/modules"
|
||||
},
|
||||
"DefaultUserOptions": {
|
||||
"isekai-show-ads-bottom": true,
|
||||
"isekai-show-ads-sidebar": true
|
||||
},
|
||||
"config": {
|
||||
"IsekaiShowAds": {
|
||||
"value": false
|
||||
}
|
||||
},
|
||||
"manifest_version": 2
|
||||
}
|
@ -1,36 +1,39 @@
|
||||
{
|
||||
"isekaiwiki-misc-name": "IsekaiWiki Misc",
|
||||
"isekaiwiki-misc-desc": "Isekai wiki performance plugin",
|
||||
|
||||
"isekai-collapse-show": "Show",
|
||||
"isekai-collapse-hide": "Hide",
|
||||
|
||||
"isekai-login-prompt-content": "Share your imagine world, contribute your fictional settings, and help more people! now, let's join the Fantasy World wiki.",
|
||||
"isekai-login-prompt-btn-login": "Login",
|
||||
"isekai-login-prompt-btn-createaccount": "Create Account",
|
||||
"isekai-login-prompt-btn-cancel": "Cancel",
|
||||
|
||||
"isekai-background-param-error": "Background image parameter error: ",
|
||||
|
||||
"isekai-editor-prompt-content": "Please select the editor, use the Standard Editor will get a better writing experience.",
|
||||
"isekai-editor-prompt-btn-cancel": "Cancel",
|
||||
"isekai-editor-prompt-btn-use-mobile": "Mobile Editor",
|
||||
"isekai-editor-prompt-btn-use-desktop": "Standard Editor",
|
||||
|
||||
"isekai-userpage": "User",
|
||||
|
||||
"isekai-chart-undefined-type": "Undefined chart type",
|
||||
"isekai-chart-unknow-type": "Unknow chart type: {0}",
|
||||
"isekai-chart-transform-error": "Data conversion errors: {0}",
|
||||
"isekai-chart-default-row-name": "Data {0}",
|
||||
|
||||
"prefs-isekai-ads": "Support Fanta World Wiki",
|
||||
"isekai-show-ads-bottom": "Display ads at the bottom of the content page",
|
||||
"isekai-show-ads-sidebar": "Display ads in the sidebar of the PC version",
|
||||
|
||||
"isekai-ads-prompt-title": "Please allow ads on Fanta World Wiki",
|
||||
"isekai-ads-prompt-content": "<p>Looks like you're using an ad blocker.</p><p>Fanta World Wiki rely on advertising to help fund our site.</p><p>If you want to support Fanta World Wiki, you can turn off Adblock, Adblock Pro, and other plugins on this site.</p>",
|
||||
"isekai-ads-prompt-btn-cancel": "No longer display",
|
||||
|
||||
"visualeditor-savedialog-label-set-categories": "Select categories"
|
||||
{
|
||||
"isekaiwiki-misc-name": "IsekaiWiki Misc",
|
||||
"isekaiwiki-misc-desc": "Isekai wiki performance plugin",
|
||||
|
||||
"isekai-collapse-show": "Show",
|
||||
"isekai-collapse-hide": "Hide",
|
||||
|
||||
"isekai-login-prompt-content": "Share your imagine world, contribute your fictional settings, and help more people! now, let's join the Fantasy World wiki.",
|
||||
"isekai-login-prompt-btn-login": "Login",
|
||||
"isekai-login-prompt-btn-createaccount": "Create Account",
|
||||
"isekai-login-prompt-btn-cancel": "Cancel",
|
||||
|
||||
"isekai-background-param-error": "Background image parameter error: ",
|
||||
|
||||
"isekai-editor-prompt-content": "Please select the editor, use the Standard Editor will get a better writing experience.",
|
||||
"isekai-editor-prompt-btn-cancel": "Cancel",
|
||||
"isekai-editor-prompt-btn-use-mobile": "Mobile Editor",
|
||||
"isekai-editor-prompt-btn-use-desktop": "Standard Editor",
|
||||
|
||||
"isekai-userpage": "User",
|
||||
|
||||
"isekai-chart-undefined-type": "Undefined chart type",
|
||||
"isekai-chart-unknow-type": "Unknow chart type: {0}",
|
||||
"isekai-chart-transform-error": "Data conversion errors: {0}",
|
||||
"isekai-chart-default-row-name": "Data {0}",
|
||||
|
||||
"prefs-isekai-ads": "Support Fanta World Wiki",
|
||||
"isekai-show-ads-bottom": "Display ads at the bottom of the content page",
|
||||
"isekai-show-ads-sidebar": "Display ads in the sidebar of the PC version",
|
||||
|
||||
"isekai-ads-prompt-title": "Please allow ads on Fanta World Wiki",
|
||||
"isekai-ads-prompt-content": "<p>Looks like you're using an ad blocker.</p><p>Fanta World Wiki rely on advertising to help fund our site.</p><p>If you want to support Fanta World Wiki, you can turn off Adblock, Adblock Pro, and other plugins on this site.</p>",
|
||||
"isekai-ads-prompt-btn-cancel": "No longer display",
|
||||
|
||||
"visualeditor-savedialog-label-set-categories": "Select categories",
|
||||
|
||||
"isekai-function-btn-fullscreen": "Full screen",
|
||||
"isekai-function-btn-exit-fullscreen": "Exit full screen"
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
var fullScreenBtn;
|
||||
var exitFullScreenBtn;
|
||||
|
||||
function onFullScreenChange() {
|
||||
if (document.fullscreenElement || document.webkitFullscreenElement ||
|
||||
document.mozFullScreenElement || document.msFullscreenElement) {
|
||||
|
||||
$(fullScreenBtn).hide();
|
||||
$(exitFullScreenBtn).show();
|
||||
} else {
|
||||
$(fullScreenBtn).show();
|
||||
$(exitFullScreenBtn).hide();
|
||||
}
|
||||
}
|
||||
|
||||
$(function () {
|
||||
if (mw.config.get('wgIsArticle')) {
|
||||
var fullScreenIcon = new OO.ui.IconWidget({ icon: 'fullScreen' });
|
||||
var exitFullScreenIcon = new OO.ui.IconWidget({ icon: 'exitFullScreen' });
|
||||
|
||||
fullScreenBtn = isekai.bottomNav.addButton({
|
||||
id: 'fullscreen',
|
||||
label: mw.msg('isekai-function-btn-fullscreen'),
|
||||
icon: fullScreenIcon.$element[0],
|
||||
priority: 60,
|
||||
onClick: function() {
|
||||
if (document.documentElement.requestFullscreen) {
|
||||
document.documentElement.requestFullscreen();
|
||||
} else if (document.documentElement.webkitRequestFullscreen) {
|
||||
document.documentElement.webkitRequestFullscreen();
|
||||
} else if (document.documentElement.mozRequestFullScreen) {
|
||||
document.documentElement.mozRequestFullScreen();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
exitFullScreenBtn = isekai.bottomNav.addButton({
|
||||
id: 'exit-fullscreen',
|
||||
label: mw.msg('isekai-function-btn-exit-fullscreen'),
|
||||
icon: exitFullScreenIcon.$element[0],
|
||||
priority: 60,
|
||||
onClick: function() {
|
||||
if (document.exitFullscreen) {
|
||||
document.exitFullscreen();
|
||||
} else if (document.webkitExitFullscreen) {
|
||||
document.webkitExitFullscreen();
|
||||
} else if (document.mozCancelFullScreen) {
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$(exitFullScreenBtn).hide();
|
||||
|
||||
document.addEventListener('fullscreenchange', onFullScreenChange);
|
||||
}
|
||||
});
|
@ -1,287 +1,287 @@
|
||||
// 页面加载动画
|
||||
body.skin-timeless {
|
||||
#mw-content-container,
|
||||
#mw-footer-container {
|
||||
transition: opacity 150ms linear;
|
||||
}
|
||||
|
||||
#mw-overscroll-bottom-cover {
|
||||
transition: opacity 0ms linear 150ms;
|
||||
}
|
||||
}
|
||||
|
||||
.page-loading-spinner {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 30vh;
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
body.skin-timeless {
|
||||
.spinner-box {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: transparent;
|
||||
|
||||
.circle-border {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
padding: 3px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 50%;
|
||||
background: #3f51b5;
|
||||
background: linear-gradient(0deg,rgba(63, 81, 181, 0.1) 33%,#3f51b5 100%);
|
||||
animation: spin .8s linear 0s infinite;
|
||||
}
|
||||
|
||||
.circle-core {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #f3f3f3;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 850px) {
|
||||
.circle-core {
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0);
|
||||
}
|
||||
99% {
|
||||
transform: rotate(356.4deg);
|
||||
}
|
||||
}
|
||||
|
||||
html.content-loading body.skin-timeless {
|
||||
#mw-content-container,
|
||||
#mw-footer-container {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
#mw-overscroll-bottom-cover {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.page-loading-spinner {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
html.content-unloading body.skin-timeless {
|
||||
#mw-content-container,
|
||||
#mw-footer-container {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
#mw-overscroll-bottom-cover {
|
||||
transition: none;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
html.content-loaded body.skin-timeless {
|
||||
|
||||
}
|
||||
|
||||
// 折叠区域
|
||||
.mw-collapse-content {
|
||||
display: none;
|
||||
margin: 1em 0 0;
|
||||
}
|
||||
.mw-collapse-toggle {
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.wikitable-container .wikitable {
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 850px){
|
||||
.wikitable-container {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
float: none;
|
||||
margin-left: 0px;
|
||||
margin-right: 0px;
|
||||
|
||||
.wikitable {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.black-space {
|
||||
background-color: #252525;
|
||||
color: #252525;
|
||||
transition: color .15s;
|
||||
|
||||
&:hover {
|
||||
color: #fff;
|
||||
transition: color .15s;
|
||||
}
|
||||
}
|
||||
|
||||
.ve-init-target-visual .black-space {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body.auto-color-scheme .black-space {
|
||||
background-color: #fff;
|
||||
color: #fff;
|
||||
|
||||
&:hover {
|
||||
color: #222;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#toc > ul {
|
||||
overflow-y: auto;
|
||||
max-height: 50vh;
|
||||
scrollbar-width: thin;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
border-radius: 0;
|
||||
background: #cdcdcd;
|
||||
|
||||
&:hover {
|
||||
background: #a6a6a6;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: #606060;
|
||||
}
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
border-radius: 0;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 851px){
|
||||
#mw-footer .footer-places li {
|
||||
white-space: pre;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 850px){
|
||||
#mw-footer #copyright {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
// 面包屑
|
||||
.breadcrumb {
|
||||
padding: 8px 15px;
|
||||
margin-bottom: 10px;
|
||||
list-style: none;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 4px;
|
||||
margin-block-start: 0;
|
||||
margin-left: 0;
|
||||
font-size: 14px;
|
||||
|
||||
> li {
|
||||
display: inline-block;
|
||||
|
||||
&.active {
|
||||
color: #777;
|
||||
}
|
||||
}
|
||||
|
||||
.breadcrumb-divider {
|
||||
padding: 0 5px;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
> li.root:before {
|
||||
padding: 0 5px 0 0;
|
||||
color: #ccc;
|
||||
content: "/";
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
#toc,
|
||||
#contentSub .breadcrumb,
|
||||
#flowthread {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.subpages {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
#content {
|
||||
.user-heading {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
|
||||
.user-avatar {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
}
|
||||
|
||||
#firstHeading {
|
||||
flex-grow: 1;
|
||||
margin: 0 0.5em 0.25em 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.oo-ui-messageDialog-actions-horizontal .oo-ui-actionWidget {
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
|
||||
.googlead-container-bottom {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 8px;
|
||||
width: 100%;
|
||||
min-height: 90px;
|
||||
}
|
||||
|
||||
.skin-minerva .googlead-container-bottom {
|
||||
margin-top: 30px;
|
||||
margin-left: 16px;
|
||||
margin-bottom: 16px;
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1099px) {
|
||||
.googlead-container-sidebar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
// 对登录用户隐藏标题
|
||||
@media (max-width: 576px) {
|
||||
.logged-in #p-logo-text {
|
||||
display: none;
|
||||
}
|
||||
// 页面加载动画
|
||||
body.skin-timeless {
|
||||
#mw-content-container,
|
||||
#mw-footer-container {
|
||||
transition: opacity 150ms linear;
|
||||
}
|
||||
|
||||
#mw-overscroll-bottom-cover {
|
||||
transition: opacity 0ms linear 150ms;
|
||||
}
|
||||
}
|
||||
|
||||
.page-loading-spinner {
|
||||
display: none;
|
||||
position: fixed;
|
||||
top: 30vh;
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
body.skin-timeless {
|
||||
.spinner-box {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: transparent;
|
||||
|
||||
.circle-border {
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
padding: 3px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 50%;
|
||||
background: #3f51b5;
|
||||
background: linear-gradient(0deg,rgba(63, 81, 181, 0.1) 33%,#3f51b5 100%);
|
||||
animation: spin .8s linear 0s infinite;
|
||||
}
|
||||
|
||||
.circle-core {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #f3f3f3;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 850px) {
|
||||
.circle-core {
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
0% {
|
||||
transform: rotate(0);
|
||||
}
|
||||
99% {
|
||||
transform: rotate(356.4deg);
|
||||
}
|
||||
}
|
||||
|
||||
html.content-loading body.skin-timeless {
|
||||
#mw-content-container,
|
||||
#mw-footer-container {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
#mw-overscroll-bottom-cover {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.page-loading-spinner {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
html.content-unloading body.skin-timeless {
|
||||
#mw-content-container,
|
||||
#mw-footer-container {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
#mw-overscroll-bottom-cover {
|
||||
transition: none;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
html.content-loaded body.skin-timeless {
|
||||
|
||||
}
|
||||
|
||||
// 折叠区域
|
||||
.mw-collapse-content {
|
||||
display: none;
|
||||
margin: 1em 0 0;
|
||||
}
|
||||
.mw-collapse-toggle {
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.wikitable-container .wikitable {
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 850px){
|
||||
.wikitable-container {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
float: none;
|
||||
margin-left: 0px;
|
||||
margin-right: 0px;
|
||||
|
||||
.wikitable {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.black-space {
|
||||
background-color: #252525;
|
||||
color: #252525;
|
||||
transition: color .15s;
|
||||
|
||||
&:hover {
|
||||
color: #fff;
|
||||
transition: color .15s;
|
||||
}
|
||||
}
|
||||
|
||||
.ve-init-target-visual .black-space {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body.auto-color-scheme .black-space {
|
||||
background-color: #fff;
|
||||
color: #fff;
|
||||
|
||||
&:hover {
|
||||
color: #222;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#toc > ul {
|
||||
overflow-y: auto;
|
||||
max-height: 50vh;
|
||||
scrollbar-width: thin;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-thumb {
|
||||
border-radius: 0;
|
||||
background: #cdcdcd;
|
||||
|
||||
&:hover {
|
||||
background: #a6a6a6;
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: #606060;
|
||||
}
|
||||
}
|
||||
|
||||
&::-webkit-scrollbar-track {
|
||||
border-radius: 0;
|
||||
background: #f0f0f0;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 851px){
|
||||
#mw-footer .footer-places li {
|
||||
white-space: pre;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 850px){
|
||||
#mw-footer #copyright {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
// 面包屑
|
||||
.breadcrumb {
|
||||
padding: 8px 15px;
|
||||
margin-bottom: 10px;
|
||||
list-style: none;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 4px;
|
||||
margin-block-start: 0;
|
||||
margin-left: 0;
|
||||
font-size: 14px;
|
||||
|
||||
> li {
|
||||
display: inline-block;
|
||||
|
||||
&.active {
|
||||
color: #777;
|
||||
}
|
||||
}
|
||||
|
||||
.breadcrumb-divider {
|
||||
padding: 0 5px;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
> li.root:before {
|
||||
padding: 0 5px 0 0;
|
||||
color: #ccc;
|
||||
content: "/";
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
#toc,
|
||||
#contentSub .breadcrumb,
|
||||
#flowthread {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.subpages {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
#content {
|
||||
.user-heading {
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
|
||||
.user-avatar {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
}
|
||||
|
||||
#firstHeading {
|
||||
flex-grow: 1;
|
||||
margin: 0 0.5em 0.25em 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.oo-ui-messageDialog-actions-horizontal .oo-ui-actionWidget {
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
|
||||
.googlead-container-bottom {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 8px;
|
||||
width: 100%;
|
||||
min-height: 90px;
|
||||
}
|
||||
|
||||
.skin-minerva .googlead-container-bottom {
|
||||
margin-top: 30px;
|
||||
margin-left: 16px;
|
||||
margin-bottom: 16px;
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1099px) {
|
||||
.googlead-container-sidebar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
// 对登录用户隐藏标题
|
||||
@media (max-width: 576px) {
|
||||
.logged-in #p-logo-text {
|
||||
display: none;
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
:root,
|
||||
:host {
|
||||
--fa-style-family-classic: 'Font Awesome 6 Free';
|
||||
--fa-font-solid: normal 900 1em/1 'Font Awesome 6 Free';
|
||||
--fa-font-regular: normal 400 1em/1 'Font Awesome 6 Free';
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Font Awesome 6 Free';
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
font-display: block;
|
||||
src: url("fonts/fa-solid-900.woff2") format("woff2"), url("fonts/fa-solid-900.ttf") format("truetype");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Font Awesome 6 Free';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
font-display: block;
|
||||
src: url("fonts/fa-regular-400.woff2") format("woff2"), url("fonts/fa-regular-400.ttf") format("truetype");
|
||||
}
|
||||
|
||||
|
||||
.fas,
|
||||
.fa-solid {
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
.far,
|
||||
.fa-regular {
|
||||
font-weight: 400;
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Isekai\Specials;
|
||||
|
||||
class SpecialGetPageModules {
|
||||
|
||||
<?php
|
||||
|
||||
namespace Isekai\Specials;
|
||||
|
||||
class SpecialGetPageModules {
|
||||
|
||||
}
|
Loading…
Reference in New Issue