dsh-ustc-quota 1.1.46 → 1.1.49
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/README.md +1 -0
- package/client.js +38 -5
- package/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -112,6 +112,7 @@ key-c 8.7/30 29% 8.7/70 12% 11.1/100 11%
|
|
|
112
112
|
- 右侧位置会在对话区右侧**预留一条槽**:插件给对话列加右侧内边距(约列宽的 26%,封顶 34%),正文与轮次导航条整体左移,卡片占住这条槽——因此不遮挡正文、不遮挡轮次导航条、也不遮挡右侧原生按钮。上沿从「对话 / 轨迹 / 看板」选项卡下的分隔线以下 6px 开始。
|
|
113
113
|
- 窄窗口或打开侧栏时槽宽自动收窄(下限 140px),卡片始终可见;如果连正文最小宽度都不够,则允许卡片比常规更窄,而不是消失。
|
|
114
114
|
- 换边不重新加载:两处卡片共用同一份已取到的数据。底色用左侧边栏的底色(`--dsw-specific-sidebar-fill`),阴影与左侧一致。
|
|
115
|
+
- 右侧卡片宽度上限 420px(避免空状态把卡片拉得过宽),并与其它插件的右侧卡片(如 Codex Advisor)自动上下排开;测量一时失败时退回固定位置显示,不会整块消失。
|
|
115
116
|
## 更新
|
|
116
117
|
|
|
117
118
|
- 标题「USTC 词元额度」右侧显示灰色小字版本号;点击版本号可手动检查更新;
|
package/client.js
CHANGED
|
@@ -11,7 +11,7 @@ window.__ModuleLoader__.load({
|
|
|
11
11
|
const UPDATE_ENDPOINT = 'plugins/dsh-ustc-quota/update';
|
|
12
12
|
const UPDATE_APPLY_ENDPOINT = 'plugins/dsh-ustc-quota/update/apply';
|
|
13
13
|
const WINDOW_IDS = ['3h', '12h', '24h'];
|
|
14
|
-
const CLIENT_VERSION = '1.1.
|
|
14
|
+
const CLIENT_VERSION = '1.1.49';
|
|
15
15
|
const UPDATE_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
16
16
|
const CLIENT_VERSION_KEY = `${NS}:client-version`;
|
|
17
17
|
const CLIENT_RELOAD_KEY = `${NS}:client-reload`;
|
|
@@ -1189,8 +1189,8 @@ window.__ModuleLoader__.load({
|
|
|
1189
1189
|
// conversation when either side is dragged or toggled.
|
|
1190
1190
|
const DOCK_GAP = 6;
|
|
1191
1191
|
const DOCK_MIN_WIDTH = 200;
|
|
1192
|
-
const DOCK_MAX_WIDTH = 340;
|
|
1193
1192
|
const DOCK_FLOOR_WIDTH = 140;
|
|
1193
|
+
const DOCK_MAX_WIDTH = 420;
|
|
1194
1194
|
const DOCK_TRANSCRIPT_FLOOR = 360;
|
|
1195
1195
|
|
|
1196
1196
|
|
|
@@ -1232,7 +1232,22 @@ window.__ModuleLoader__.load({
|
|
|
1232
1232
|
const leftEdge = Math.round(boundaryRight) + DOCK_GAP;
|
|
1233
1233
|
const rightEdge = Math.round(rightLimit) - DOCK_GAP;
|
|
1234
1234
|
const span = rightEdge - leftEdge;
|
|
1235
|
-
if (span < 40)
|
|
1235
|
+
if (span < 40) {
|
|
1236
|
+
// Measurement can fail transiently (column re-mounts, first paint). Never
|
|
1237
|
+
// hide the card: anchor it to the column's right edge with a sane width and
|
|
1238
|
+
// let the next measurement refine it.
|
|
1239
|
+
const fallbackTop = Math.round(columnRect.top) + 40;
|
|
1240
|
+
const fallbackWidth = Math.min(300, Math.max(220, Math.round(columnRect.width * 0.24)));
|
|
1241
|
+
return {
|
|
1242
|
+
top: fallbackTop,
|
|
1243
|
+
left: Math.max(0, Math.round(columnRect.right) - fallbackWidth - 12),
|
|
1244
|
+
width: fallbackWidth,
|
|
1245
|
+
naturalSpan: fallbackWidth,
|
|
1246
|
+
columnWidth: Math.round(columnRect.width),
|
|
1247
|
+
maxHeight: Math.max(120, Math.round(columnRect.height) - 60),
|
|
1248
|
+
fallback: true,
|
|
1249
|
+
};
|
|
1250
|
+
}
|
|
1236
1251
|
|
|
1237
1252
|
// Vertical bound: below the conversation tab strip, above the column bottom.
|
|
1238
1253
|
let contentTop = Math.round(columnRect.top) + DOCK_GAP;
|
|
@@ -1246,10 +1261,25 @@ window.__ModuleLoader__.load({
|
|
|
1246
1261
|
}
|
|
1247
1262
|
|
|
1248
1263
|
const floored = span < 240;
|
|
1264
|
+
let stackTop = contentTop;
|
|
1265
|
+
try {
|
|
1266
|
+
// Other plugins place their own right docks with the same anchor; stack below
|
|
1267
|
+
// any of them that already occupy this band so the cards never overlap.
|
|
1268
|
+
for (const node of document.querySelectorAll('[data-codex-advisor-dock="right"]')) {
|
|
1269
|
+
const rect = node.getBoundingClientRect();
|
|
1270
|
+
if (rect.height <= 0 || rect.width <= 0) continue;
|
|
1271
|
+
if (rect.bottom > stackTop && rect.top < columnRect.bottom) {
|
|
1272
|
+
stackTop = Math.max(stackTop, Math.round(rect.bottom) + DOCK_GAP);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
} catch {
|
|
1276
|
+
// Stacking is best-effort; a broken neighbour must not break this card.
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1249
1279
|
return {
|
|
1250
|
-
top:
|
|
1280
|
+
top: stackTop,
|
|
1251
1281
|
left: floored ? Math.max(0, rightEdge - 240) : leftEdge,
|
|
1252
|
-
width: floored ? 240 : span,
|
|
1282
|
+
width: floored ? 240 : Math.min(span, DOCK_MAX_WIDTH),
|
|
1253
1283
|
naturalSpan: span,
|
|
1254
1284
|
columnWidth: Math.round(columnRect.width),
|
|
1255
1285
|
maxHeight: Math.max(120, Math.round(columnRect.bottom) - contentTop - DOCK_GAP),
|
|
@@ -1876,6 +1906,9 @@ window.__ModuleLoader__.load({
|
|
|
1876
1906
|
if (text.length > valueChars) valueChars = text.length;
|
|
1877
1907
|
}
|
|
1878
1908
|
}
|
|
1909
|
+
// Stale windows render an '≈ ' prefix, so the value column needs those chars too.
|
|
1910
|
+
const hasStaleWindow = keys.some((key) => (key.windows || []).some((window) => window.state === 'stale'));
|
|
1911
|
+
if (hasStaleWindow) valueChars += 2;
|
|
1879
1912
|
const tableStyle = {
|
|
1880
1913
|
...STYLE.table,
|
|
1881
1914
|
'--ustc-key-col': `${keyColumnWidth}px`,
|
package/index.js
CHANGED
|
@@ -22,7 +22,7 @@ const ROUTE_PATH = '/plugins/dsh-ustc-quota/snapshot';
|
|
|
22
22
|
const UPDATE_PATH = '/plugins/dsh-ustc-quota/update';
|
|
23
23
|
const UPDATE_APPLY_PATH = '/plugins/dsh-ustc-quota/update/apply';
|
|
24
24
|
const UPDATE_TOKEN_TTL_MS = 30 * 60 * 1000;
|
|
25
|
-
const PLUGIN_VERSION = '1.1.
|
|
25
|
+
const PLUGIN_VERSION = '1.1.49';
|
|
26
26
|
const KEY_INFO_PATH = 'key/info';
|
|
27
27
|
const USER_INFO_PATH = 'user/info';
|
|
28
28
|
const DISCOVERY_TTL_MS = 30000;
|
package/package.json
CHANGED