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

  • 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)
// MediaWiki:Common.js (安全增强版)
'use strict';  // 启用严格模式

const startTimestamp = 1743793200;

function updateMaintenanceTimer() {
    const safeElement = document.getElementById("maintenance-timer");
    if (!safeElement) return;

    const now = Math.floor(Date.now() / 1000);
    const duration = now - startTimestamp;

    // 使用模板字符串防止注入
    safeElement.textContent = `距离本赛季已维护${
        Math.floor(duration / 86400)}${
        Math.floor((duration % 86400) / 3600)}${
        Math.floor((duration % 3600) / 60)}${
        duration % 60}秒`;
}

// 启用模块化加载
if (window.addEventListener) {
    window.addEventListener('load', updateMaintenanceTimer);
} else {
    window.attachEvent('onload', updateMaintenanceTimer);
}