适配1.39

master
落雨楓 2 years ago
parent e45688a629
commit ee3915fa73

@ -5,8 +5,8 @@ use Wikimedia\Parsoid\Ext\ExtensionTagHandler;
use Wikimedia\Parsoid\Ext\ParsoidExtensionAPI;
class BlockQuoteTagHandler extends ExtensionTagHandler {
public function sourceToDom(ParsoidExtensionAPI $extApi, string $src, array $extArgs): \DOMDocument {
$content = $extApi->extTagToDOM(
public function sourceToDom(ParsoidExtensionAPI $extApi, string $src, array $extArgs) {
return $extApi->extTagToDOM(
$extArgs,
'',
$src,
@ -17,15 +17,12 @@ class BlockQuoteTagHandler extends ExtensionTagHandler {
],
],
);
return $content;
}
public function getInnerWikitext(ParsoidExtensionAPI $extApi, \DOMElement $dom) {
$wikiText = '';
foreach($dom->childNodes as $child){
if($child instanceof \DOMText){
/** @type \DOMText $child */
$wikiText .= $child->nodeValue;
} else {
$wikiText .= $extApi->domToWikitext([], $child);

@ -90,14 +90,14 @@ HTML
$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){
// 检测Adblock
$outputPage->addHeadItem('adblock-detect', '<script src="/peel1.js"></script>');
// 谷歌广告
$outputPage->addHeadItem(
'googlead',
@ -155,7 +155,7 @@ HTML
$title = $outputPage->getTitle();
if ($title->inNamespace(NS_USER)) {
$userName = $title->getText();
$user = User::newFromName($userName);
$user = MediaWikiServices::getInstance()->getUserFactory()->newFromName($userName);
if ($user && $user->isRegistered()) {
$showName = $user->getRealName();
if (!$showName) {
@ -204,7 +204,7 @@ HTML
) {
if ($target->inNamespace(NS_USER)) {
$userName = $target->getText();
$user = User::newFromName($userName);
$user = MediaWikiServices::getInstance()->getUserFactory()->newFromName($userName);
if ($user && $user->isRegistered()) {
$showName = $user->getRealName();
if ($showName) {

@ -6,6 +6,8 @@ use Html;
class IsekaiChart {
/**
* @param \Parser &$parser
* @return bool
* @throws \MWException
*/
public static function onParserSetup(&$parser) {
$parser->setHook('isekaichart', self::class . '::create');
@ -23,7 +25,6 @@ class IsekaiChart {
switch ($args['type']) {
case 'radar':
return self::createRadar($input, $args, $parser, $frame);
break;
}
return '<span class="error">' . wfMessage("isekai-chart-unknow-type", $args['type'])->parse() . '</span>';
}
@ -58,12 +59,13 @@ class IsekaiChart {
/**
* @param string $input
* @param string[] $args
* @param array $inputArgs
* @param \Parser $parser
* @param \PPFrame $frame
* @return string
*/
public static function createRadar(&$input, &$inputArgs, &$parser, &$frame) {
$parser->getOutput()->addModules("ext.isekai.chart"); // 添加样式和脚本
public static function createRadar($input, &$inputArgs, $parser, $frame) {
$parser->getOutput()->addModules(["ext.isekai.chart"]); // 添加样式和脚本
$allowedArgs = ['width', 'height', 'shape'];
$args = self::parseArgs($inputArgs, [

@ -105,8 +105,18 @@
"desktop",
"mobile"
]
},
"ext.isekai.ve": {
"scripts": ["ext.isekai.ve.js"],
"targets": [
"desktop",
"mobile"
]
}
},
"VisualEditorPluginModules": [
"ext.isekai.ve"
],
"ResourceFileModulePaths": {
"localBasePath": "modules",
"remoteExtPath": "IsekaiMisc/modules"

@ -230,6 +230,7 @@ $(function(){
if (mw.config.get('wgIsekaiShowAds')) {
setTimeout(function() {
if ($('#ad-dec-7kVsyacCEKVGBLOiLVQ').length === 0) {
console.log('广告似乎被屏蔽了', $('#ad-dec-7kVsyacCEKVGBLOiLVQ'));
if (shouldShowAdsPrompt()) {
//显示广告引导框
var cancelBtn = new OO.ui.ActionWidget({
@ -326,5 +327,8 @@ $(function(){
window.addEventListener('beforeunload', function() {
$('html').addClass('content-unloading');
setTimeout(function() {
$('html').removeClass('content-unloading');
}, 5000);
});
});

@ -168,36 +168,6 @@ html.content-loaded body.skin-timeless {
}
}
@media screen and (min-width: 851px){
#user-tools {
#personal {
margin-left: 0;
padding-left: 0.5em;
h2 {
padding: 7px 0 20px 25px;
background-position: 0 6px;
/*margin-top: -3px;*/
span {
margin-top: 1px;
overflow: visible;
}
}
}
#personal-extra {
margin-top: 0.8em;
}
}
}
@media screen and (min-width: 1100px){
#mw-header #user-tools {
width: 10em;
}
}
@media screen and (min-width: 851px){
#mw-footer .footer-places li {
white-space: pre;

@ -0,0 +1,34 @@
if (mw.config.get('skin') === "timeless") {
var veReadyTimer = null;
var veReady = false;
var isFloating = false;
function updateToolbar() {
if (!veReady) return;
if (window.innerWidth >= 851 && !isFloating) {
if (!isFloating) {
var headerContainer = document.getElementById("mw-header-container");
var headerHack = document.getElementById("mw-header-hack");
var offset = headerContainer.offsetHeight + headerHack.offsetHeight;
ve.init.target.toolbarScrollOffset = offset;
isFloating = true;
}
} else if (isFloating) {
ve.init.target.toolbarScrollOffset = 0;
isFloating = false;
}
}
function waitForVE() {
if (ve && ve.init && ve.init.target) {
veReady = true;
updateToolbar();
if (veReadyTimer) {
clearInterval(veReadyTimer);
}
}
}
veReadyTimer = setInterval(waitForVE, 500);
window.addEventListener('resize', updateToolbar, { passive: true });
}
Loading…
Cancel
Save