MediaWiki:Common.js:修订间差异
MediaWiki界面页面
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
// 等待页面内容加载完成 | |||
mw.hook('wikipage.content').add(function() { | mw.hook('wikipage.content').add(function() { | ||
// 如果已经添加过,则不再重复添加 | |||
if (document.getElementById('global-footer-links')) { | if (document.getElementById('global-footer-links')) { | ||
return; | return; | ||
| 第9行: | 第10行: | ||
'<div><a href="https://www.pvzhe.com/new">前往官网以了解更多游戏信息</a></div>' + | '<div><a href="https://www.pvzhe.com/new">前往官网以了解更多游戏信息</a></div>' + | ||
'</div>'; | '</div>'; | ||
// 判断是否为移动端(Minerva 皮肤或窄屏) | |||
var isMobile = (mw.config.get('skin') === 'minerva') || window.innerWidth < 768; | |||
if (isMobile) { | |||
if ($ | // 移动端:只尝试移动端容器 | ||
var $mobileTarget = $('.mw-body, .content, main'); | |||
if ($mobileTarget.length) { | |||
$mobileTarget.append(footerHtml); | |||
} | |||
} else { | |||
// PC 端:只尝试 PC 端容器 | |||
var $pcTarget = $('#mw-content-text, .mw-body-content, #content, .mw-parser-output'); | |||
if ($pcTarget.length) { | |||
$pcTarget.append(footerHtml); | |||
} | |||
} | } | ||
}); | }); | ||
2026年3月22日 (日) 05:21的版本
// 等待页面内容加载完成
mw.hook('wikipage.content').add(function() {
// 如果已经添加过,则不再重复添加
if (document.getElementById('global-footer-links')) {
return;
}
var footerHtml = '<div id="global-footer-links" style="width:100%; margin-top:20px; padding:15px 0; display:flex; justify-content:space-between; flex-wrap:wrap; gap:10px; border-top:1px solid #ccc;">' +
'<div><a href="https://new.pvzhe.wiki/index.php?title=特殊:创建账户&returnto=首页">加入我们</a></div>' +
'<div><a href="https://www.pvzhe.com/new">前往官网以了解更多游戏信息</a></div>' +
'</div>';
// 判断是否为移动端(Minerva 皮肤或窄屏)
var isMobile = (mw.config.get('skin') === 'minerva') || window.innerWidth < 768;
if (isMobile) {
// 移动端:只尝试移动端容器
var $mobileTarget = $('.mw-body, .content, main');
if ($mobileTarget.length) {
$mobileTarget.append(footerHtml);
}
} else {
// PC 端:只尝试 PC 端容器
var $pcTarget = $('#mw-content-text, .mw-body-content, #content, .mw-parser-output');
if ($pcTarget.length) {
$pcTarget.append(footerHtml);
}
}
});