MediaWiki:Common.js

来自赛尔号精灵图鉴
225940114留言 | 贡献2025年5月11日 (日) 11:28的版本
跳转到导航 跳转到搜索

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-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) {
    const btn = $('<a href="/index.php/首页" id="return-home-button">🏠 返回首页</a>').css({
      position: 'fixed',
      bottom: '20px',
      right: '20px',
      padding: '10px 14px',
      background: '#ffffffdd',
      color: '#333',
      fontSize: '14px',
      fontWeight: 'bold',
      border: '1px solid #ccc',
      borderRadius: '8px',
      textDecoration: 'none',
      boxShadow: '0 2px 6px rgba(0,0,0,0.2)',
      zIndex: 9999
    });
    $('body').append(btn);
  }
});

// 在线人数计数器
setInterval(() => {
  fetch('/online.php')
    .then(res => res.text())
    .then(n => {
      document.getElementById("online-count").textContent = n;
    });
}, 5000);
👥 当前在线人数:64