MediaWiki:Common.js
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer或Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:按 Ctrl-F5。
$(function () {
// 只在条目页面生效,不影响首页/编辑页等
if (mw.config.get("wgNamespaceNumber") === 0) {
$('<a href="/index.php/首页" id="return-home-button">← 返回首页</a>')
.css({
position: 'fixed',
bottom: '80px', // 避开右下角的按钮
left: '30px', // 靠左放置更安全
background: '#ffffffdd',
padding: '6px 12px',
borderRadius: '8px',
fontWeight: 'bold',
zIndex: 9999 // 确保在最上层
})
.appendTo('body');
}
});
setInterval(() => {
fetch('/online.php')
.then(res => res.text())
.then(n => {
document.getElementById("online-count").textContent = n;
});
}, 5000);
👥 当前在线人数:64