MediaWiki:Common.js:修订间差异
MediaWiki界面页面
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
// | // 等待页面完全加载后再执行 | ||
$(function() { | |||
// 如果已经添加过,则不再重复添加 | // 如果已经添加过,则不再重复添加 | ||
if (document.getElementById('global-footer-links')) { | if (document.getElementById('global-footer-links')) { | ||
| 第11行: | 第11行: | ||
'</div>'; | '</div>'; | ||
// | // 查找页脚元素(PC和手机端通用的选择器) | ||
var | var $footer = $('#footer, #mw-footer, footer, .footer'); | ||
if ( | if ($footer.length) { | ||
// | // 在页脚之前插入 | ||
$footer.before(footerHtml); | |||
} else { | } else { | ||
// | // 如果找不到页脚,才尝试追加到内容区末尾 | ||
$('#mw-content-text, .mw-body-content, #content').append(footerHtml); | |||
} | } | ||
}); | }); | ||
2026年3月22日 (日) 05:22的版本
// 等待页面完全加载后再执行
$(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>';
// 查找页脚元素(PC和手机端通用的选择器)
var $footer = $('#footer, #mw-footer, footer, .footer');
if ($footer.length) {
// 在页脚之前插入
$footer.before(footerHtml);
} else {
// 如果找不到页脚,才尝试追加到内容区末尾
$('#mw-content-text, .mw-body-content, #content').append(footerHtml);
}
});