MediaWiki:Common.js:修订间差异
跳转到导航
跳转到搜索
无编辑摘要 |
无编辑摘要 |
||
第1行: | 第1行: | ||
/* 所有页面通用 JS */ | |||
$(function () { | $(function () { | ||
// | // 只在条目页面生效 | ||
if (mw.config.get("wgNamespaceNumber") === 0) { | if (mw.config.get("wgNamespaceNumber") === 0) { | ||
$('<a href="/index.php/首页" id="return-home-button">← 返回首页</a>') | $('<a href="/index.php/首页" id="return-home-button">← 返回首页</a>') | ||
.css({ | .css({ | ||
position: 'fixed', | position: 'fixed', | ||
bottom: ' | bottom: '100px', | ||
left: '30px', | left: '30px', | ||
background: '#ffffffdd', | background: '#ffffffdd', | ||
padding: '6px 12px', | padding: '6px 12px', | ||
borderRadius: '8px', | borderRadius: '8px', | ||
fontWeight: 'bold', | fontWeight: 'bold', | ||
zIndex: 9999 | zIndex: 9999 | ||
}) | }) | ||
.appendTo('body'); | .appendTo('body'); | ||
} | } | ||
}); | }); | ||
// 在线人数计数器 | |||
setInterval(() => { | setInterval(() => { | ||
fetch('/online.php') | fetch('/online.php') |
2025年5月11日 (日) 11:14的版本
/* 所有页面通用 JS */
$(function () {
// 只在条目页面生效
if (mw.config.get("wgNamespaceNumber") === 0) {
$('<a href="/index.php/首页" id="return-home-button">← 返回首页</a>')
.css({
position: 'fixed',
bottom: '100px',
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);
👥 当前在线人数:67