gacha-calendar-core 0.10.5 → 0.10.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core.mjs +10 -3
- package/package.json +1 -1
package/core.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// 用途:缓存里记录"这份数据是哪版插件产出的"。更新插件后首次启动,据此**强制**刷新一次
|
|
5
5
|
// (不看自动刷新开关)——因为有些改动(悬停格式、来源地址、样式、解析器)不刷新就看不到效果。
|
|
6
6
|
// 写入时机见 engine-api.js 的 refresh();判定见 60-helpers.js 的 autoRefreshPlan()。
|
|
7
|
-
const PLUGIN_VERSION = "0.10.
|
|
7
|
+
const PLUGIN_VERSION = "0.10.6";
|
|
8
8
|
//#endregion
|
|
9
9
|
|
|
10
10
|
//#region config
|
|
@@ -1271,6 +1271,13 @@ export function createEngine(env) {
|
|
|
1271
1271
|
})[0] || null;
|
|
1272
1272
|
}
|
|
1273
1273
|
|
|
1274
|
+
// 永久/常驻活动的计数行。抽成函数是为了**措辞只有一处**,并让守卫能直接断言文案
|
|
1275
|
+
// (曾经的写法是 `常驻/永久活动 N 项(无结束时间,不参与倒计时)`,用户要求改为
|
|
1276
|
+
// `以及常驻活动 N 项`)。
|
|
1277
|
+
function permanentLine(count) {
|
|
1278
|
+
return count > 0 ? `以及常驻活动 ${count} 项` : "";
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1274
1281
|
// 活动列悬停(鸣潮式多行):按传入顺序(调用方已 sortEventItems)每条一行;
|
|
1275
1282
|
// 各行窗口完全相同 → 时间只在末尾写一遍;缺起止的行原样显示该行原文;跨年窗口两端带年份(②)。
|
|
1276
1283
|
// 兜底:只有 0/1 条时返回 "",由 UI 退回原有"活动名 + 时间"单条展示 ——
|
|
@@ -1283,7 +1290,7 @@ export function createEngine(env) {
|
|
|
1283
1290
|
// 只有 1 条当期活动时,本函数仍返回 ""(由 UI 单条展示);但若还有永久活动,
|
|
1284
1291
|
// 就必须把那一行计数带上,否则永久活动又变成看不见。
|
|
1285
1292
|
if (list.length < 2) {
|
|
1286
|
-
return permanentCount
|
|
1293
|
+
return permanentLine(permanentCount);
|
|
1287
1294
|
}
|
|
1288
1295
|
const allTimed = list.every((x) => x.startTs != null && x.endTs != null);
|
|
1289
1296
|
const same = allTimed && new Set(list.map((x) => `${x.startTs}~${x.endTs}`)).size === 1;
|
|
@@ -1296,7 +1303,7 @@ export function createEngine(env) {
|
|
|
1296
1303
|
return raw ? `${x.name} ${raw}` : x.name;
|
|
1297
1304
|
});
|
|
1298
1305
|
if (same) lines.push(fmtWindow(list[0].startTs, list[0].endTs));
|
|
1299
|
-
if (permanentCount > 0) lines.push(
|
|
1306
|
+
if (permanentCount > 0) lines.push(permanentLine(permanentCount));
|
|
1300
1307
|
return lines.join("\n");
|
|
1301
1308
|
}
|
|
1302
1309
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gacha-calendar-core",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.6",
|
|
4
4
|
"description": "二游活动/卡池排期抓取核心:11 款游戏的来源注册表 + 解析器 + 刷新编排 + 缓存降级。零依赖、零宿主环境依赖,任何 JS 运行时(浏览器扩展 background / Tauri / JavaScriptCore / ArkTS 嵌入式引擎)都能跑。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./core.mjs",
|