全站通知:
再生原石
刷
历
编
阅读
2026-02-26更新
最新编辑:雨苍龙
阅读:
更新日期:2026-02-26
最新编辑:雨苍龙
跳到导航
跳到搜索
加载中... 活动日历
更新时间:
<style>
.bwiki-activity-calendar {
font-family: "Microsoft YaHei", sans-serif;
max-width: 900px;
margin: 20px auto;
padding: 20px;
background: #fdfdfd;
border: 1px solid #ddd;
border-radius: 8px;
}
.calendar-header {
text-align: center;
margin-bottom: 20px;
color: #333;
}
.activity-day {
display: flex;
justify-content: space-between;
padding: 12px 15px;
margin-bottom: 8px;
background: #f5f5f5;
border-radius: 5px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.activity-day.today {
background: #fffacd; /* 今天的背景色 (浅黄) */
border-left: 4px solid #ff8c00;
}
.day-info {
flex: 1;
}
.day-title {
margin: 0;
font-size: 1.1em;
font-weight: bold;
}
.activity-time-list {
font-size: 0.9em;
color: #555;
margin: 5px 0;
}
.countdown-box {
text-align: right;
min-width: 180px;
padding-left: 15px;
}
.countdown {
font-weight: bold;
color: #c00;
}
.countdown.ready {
color: #0a0;
font-size: 1.1em;
}
</style> <script> (function() {
// ================= 配置区域 =================
// 请在这里修改你的活动时间
// 格式: 星期几: { name: "活动名称", times: ["时.分", "时.分"] }
// 注意:BWiki 使用点号分隔,如 0.30 代表 0点30分
const scheduleConfig = {
1: { name: "红龙活动", times: ["0.30", "2.25", "6.38"] },
2: { name: "血色活动", times: ["1.25", "5.30", "9.30"] },
3: { name: "恶魔活动", times: ["13.25", "6.25", "8.33"] },
4: { name: "僵尸活动", times: ["10.30", "12.25", "16.38"] },
5: { name: "黄金怪活动", times: ["11.25", "15.30", "19.30"] },
6: { name: "木头人活动", times: ["11.25", "16.25", "18.33"] },
0: { name: "混沌城堡活动", times: ["16.1", "19.5", "23.3"] }
};
// 中文星期映射
const weekMap = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];
function updateCalendar() {
const now = new Date();
const currentDay = now.getDay(); // 0-6
const currentHours = now.getHours();
const currentMinutes = now.getMinutes();
const currentSeconds = now.getSeconds();
// 更新顶部月份
document.getElementById('current-month').textContent = now.toLocaleDateString();
document.getElementById('update-time').textContent = now.toLocaleTimeString();
const container = document.getElementById('activity-list');
container.innerHTML = ;
// 遍历每一天
for (let day = 0; day < 7; day++) {
const data = scheduleConfig[day];
if (!data) continue;
// 解析时间字符串 (如 "0.30" -> [0, 30])
const parsedTimes = data.times.map(t => {
const [h, m] = t.split('.').map(Number);
return { hour: h, minute: m, label: t };
});
// 找出当天的下一场活动
let nextEvent = findNextEvent(parsedTimes, day, currentDay, currentHours, currentMinutes);
const dayEl = document.createElement('div');
dayEl.className = 'activity-day' + (day === currentDay ? ' today' : );
// 左侧:活动信息
const infoDiv = document.createElement('div');
infoDiv.className = 'day-info';
infoDiv.innerHTML = `
${weekMap[day]} - ${data.name}
时间: ${data.times.join(', ')}
`;
// 右侧:倒计时
const countDiv = document.createElement('div');
countDiv.className = 'countdown-box';
if (nextEvent.isReady) {
countDiv.innerHTML = '进行中 / 即将开始!';
} else {
// 计算差值
const diff = nextEvent.time - now;
const totalSeconds = Math.max(0, Math.floor(diff / 1000));
const hours = Math.floor(totalSeconds / 3600);
const minutes = Math.floor((totalSeconds % 3600) / 60);
const seconds = totalSeconds % 60;
countDiv.innerHTML = `
距离 ${nextEvent.label} 开始
${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}
`;
}
dayEl.appendChild(infoDiv);
dayEl.appendChild(countDiv);
container.appendChild(dayEl);
}
}
// 核心逻辑:查找下一场活动
function findNextEvent(times, targetDay, currentDay, currentH, currentM) {
const now = new Date();
// 1. 如果是今天,找今天剩余时间里最近的一场
if (targetDay === currentDay) {
for (let t of times) {
if (t.hour > currentH || (t.hour === currentH && t.minute > currentM)) {
// 找到了今天未来的场次
const eventTime = new Date(now);
eventTime.setHours(t.hour, t.minute, 0, 0);
return { time: eventTime, label: t.label, isReady: false };
}
}
// 如果今天的所有场次都过了,视为明天的活动
targetDay = (currentDay + 1) % 7;
// 注意:这里需要重新获取明天的配置,但为了简化,我们直接取明天的第一场
// 这里我们简单处理:直接取明天的第一场
const nextDayConfig = scheduleConfig[targetDay];
if (nextDayConfig && nextDayConfig.times.length > 0) {
const firstTime = nextDayConfig.times[0];
const [h, m] = firstTime.split('.').map(Number);
const tomorrow = new Date(now);
tomorrow.setDate(tomorrow.getDate() + 1);
tomorrow.setHours(h, m, 0, 0);
return { time: tomorrow, label: firstTime, isReady: false };
}
}
// 2. 如果不是今天,或者今天已结束,取目标天的第一场活动时间作为参考(用于显示距离那天还有多久)
// 注意:这里为了倒计时逻辑的连贯性,我们计算距离目标天第一场活动的时间
// 找到距离目标天最近的日期
let daysToAdd = targetDay - currentDay;
if (daysToAdd <= 0) daysToAdd += 7; // 如果目标天小于等于今天,说明是下周
const eventDate = new Date(now);
eventDate.setDate(eventDate.getDate() + daysToAdd);
// 取该天的第一场活动时间
const firstTimeStr = times[0].label;
const [h, m] = firstTimeStr.split('.').map(Number);
eventDate.setHours(h, m, 0, 0);
return { time: eventDate, label: firstTimeStr, isReady: false };
}
// 初始化与循环
updateCalendar();
setInterval(updateCalendar, 1000); // 每秒刷新
})(); </script>

沪公网安备 31011002002714 号