* 增加#喵喵日历 功能,【!!请注意!!】此功能需要安装 moment,不建议使用#喵喵更新 自动更新,否则可能重启错误

* 请在Yunzai安装目录下运行`npm install moment`后再进行升级!
  * 功能尚未完全完成,深渊信息及部分样式仍然在调整中
  * 调整部分文案与样式
This commit is contained in:
yoimiya-kokomi 2022-05-07 05:47:54 +08:00
parent 6cadaceea2
commit 1c7795f97b
2 changed files with 10 additions and 7 deletions

View File

@ -155,12 +155,12 @@ export async function calendar(e, { render }) {
let totalRange = endTime - startTime;
let list = [];
let getList = (ds, showBanner = false) => {
let type = showBanner ? "activity" : "normal",
let getList = (ds, isAct = false) => {
let type = isAct ? "activity" : "normal",
id = ds.ann_id,
title = ds.title,
banner = showBanner ? ds.banner : '',
extra = { sort: showBanner ? 5 : 10 };
banner = isAct ? ds.banner : '',
extra = { sort: isAct ? 5 : 10 };
if (ignoreIds.includes(id) || ignoreReg.test(title)) {
return;
@ -199,9 +199,12 @@ export async function calendar(e, { render }) {
let label = "";
if (now > sDate && eDate > now) {
label = eDate.format("MM-DD HH:mm") + " (" + moment.duration(eDate - now).humanize() + ")结束"
label = eDate.format("MM-DD HH:mm") + " (" + moment.duration(eDate - now).humanize() + "后结束)"
if (width > (isAct ? 38 : 55)) {
label = sDate.format("MM-DD HH:mm") + " ~ " + label;
}
} else if (sDate > now) {
label = sDate.format("MM-DD HH:mm") + " (" + moment.duration(sDate - now).humanize() + ")开始"
label = sDate.format("MM-DD HH:mm") + " (" + moment.duration(sDate - now).humanize() + "后开始)"
}
list.push({

View File

@ -206,7 +206,7 @@ body {
width: 23px;
height: 23px;
top: 7px;
top: 6px;
margin-left: -3px;
margin-right: 5px;
}