MediaWiki:Common.js
MediaWiki界面页面
更多操作
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5。
// 确保只执行一次
if (window.globalFooterAdded) return;
window.globalFooterAdded = true;
// 延迟执行,确保 DOM 完全加载
setTimeout(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>';
// 查找所有可能的插入位置
var possibleTargets = [
document.querySelector('#footer'),
document.querySelector('#mw-footer'),
document.querySelector('footer'),
document.querySelector('.footer'),
document.querySelector('#mw-content-text')?.parentNode,
document.querySelector('.mw-body-content')?.parentNode
];
// 找到第一个存在的元素
var target = null;
for (var i = 0; i < possibleTargets.length; i++) {
if (possibleTargets[i]) {
target = possibleTargets[i];
break;
}
}
// 如果找到目标,在它之前插入
if (target) {
target.insertAdjacentHTML('beforebegin', footerHtml);
}
}, 500);