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

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
// 引入jQuery计时器插件[6](@ref)
mw.loader.load('//cdn.jsdelivr.net/npm/jquery-countdown@2.2.0/dist/jquery.countdown.min.js');

// 维护开始时间戳(2025-04-05 03:00:00 UTC)

// 维护开始时间(示例:2020-09-01 00:00:00 UTC)
const startTimestamp = 1743814800;

function updateMaintenanceTimer() {
    const now = Math.floor(Date.now() / 1000); // 当前时间戳(秒)
    const duration = now - startTimestamp;

    // 计算天、小时、分钟
    const days = Math.floor(duration / 86400);
    const hours = Math.floor((duration % 86400) / 3600);
    const minutes = Math.floor((duration % 3600) / 60);
    const seconds = duration % 60;

    // 更新页面显示
    const timerElement = document.getElementById("maintenance-timer");
    if (timerElement) {
        timerElement.textContent =`距离本WIKI开始维护已过去${days}${hours}${minutes}${seconds}秒`;
    }
}

// 首次加载更新
updateMaintenanceTimer();
// 每秒刷新
setInterval(updateMaintenanceTimer, 1000);