MediaWiki:Common.js:修订间差异

来自赛尔号精灵图鉴
跳转到导航 跳转到搜索
无编辑摘要
无编辑摘要
第1行: 第1行:
/* 这里的任何JavaScript将为所有用户在每次页面加载时加载。 */
$(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({
        position: 'fixed',
        bottom: '80px',    // 避开右下角的按钮
        left: '30px',      // 靠左放置更安全
        background: '#ffffffdd',
        padding: '6px 12px',
        borderRadius: '8px',
        fontWeight: 'bold',
        zIndex: 9999        // 确保在最上层
      })
       .appendTo('body');
       .appendTo('body');
   }
   }
});
});
setInterval(() => {
setInterval(() => {
   fetch('/online.php')
   fetch('/online.php')

2025年5月11日 (日) 11:12的版本

$(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);
👥 当前在线人数:68