Admin留言 | 贡献
无编辑摘要
Admin留言 | 贡献
无编辑摘要
 
第3行: 第3行:


// 维护开始时间戳(2025-04-05 03:00:00 UTC)
// 维护开始时间戳(2025-04-05 03:00:00 UTC)
// MediaWiki:Common.js (安全增强版)
// 维护开始时间(示例:2020-09-01 00:00:00 UTC)
 
'use strict'; 
 
const startTimestamp = 1743793200;
const startTimestamp = 1743793200;


function updateMaintenanceTimer() {
function updateMaintenanceTimer() {
    const safeElement = document.getElementById("maintenance-timer");
     const now = Math.floor(Date.now() / 1000); // 当前时间戳(秒)
    if (!safeElement) return;
 
     const now = Math.floor(Date.now() / 1000);
     const duration = now - startTimestamp;
     const duration = now - startTimestamp;


     // 使用模板字符串防止注入
     // 计算天、小时、分钟
     safeElement.textContent = `距离本赛季已维护${
     const days = Math.floor(duration / 86400);
        Math.floor(duration / 86400)}天${
    const hours = Math.floor((duration % 86400) / 3600);
        Math.floor((duration % 86400) / 3600)}时${
    const minutes = Math.floor((duration % 3600) / 60);
        Math.floor((duration % 3600) / 60)}分${
    const seconds = duration % 60;
        duration % 60}秒`;
}


     // 更新页面显示
     // 更新页面显示