dsh-ustc-quota 1.1.37 → 1.1.38
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/client.js +109 -10
- package/index.js +1 -1
- package/package.json +1 -1
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.38';
|
|
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`;
|
|
@@ -476,7 +476,7 @@ window.__ModuleLoader__.load({
|
|
|
476
476
|
},
|
|
477
477
|
legendRow: {
|
|
478
478
|
display: 'grid',
|
|
479
|
-
gridTemplateColumns: 'var(--ustc-key-col, 36px) repeat(3, minmax(0, 1fr))',
|
|
479
|
+
gridTemplateColumns: 'var(--ustc-key-col, 36px) repeat(3, minmax(0, 1fr)) auto',
|
|
480
480
|
columnGap: 4,
|
|
481
481
|
alignItems: 'center',
|
|
482
482
|
minWidth: 0,
|
|
@@ -505,6 +505,14 @@ window.__ModuleLoader__.load({
|
|
|
505
505
|
color: 'var(--dsw-alias-label-primary)',
|
|
506
506
|
whiteSpace: 'nowrap',
|
|
507
507
|
},
|
|
508
|
+
legendMeta: {
|
|
509
|
+
fontSize: 8,
|
|
510
|
+
lineHeight: 1.2,
|
|
511
|
+
color: 'var(--dsw-alias-label-secondary)',
|
|
512
|
+
whiteSpace: 'nowrap',
|
|
513
|
+
textAlign: 'right',
|
|
514
|
+
paddingLeft: 2,
|
|
515
|
+
},
|
|
508
516
|
legendReset: {
|
|
509
517
|
width: '100%',
|
|
510
518
|
fontSize: 8,
|
|
@@ -555,8 +563,18 @@ window.__ModuleLoader__.load({
|
|
|
555
563
|
cell: {
|
|
556
564
|
minWidth: 0,
|
|
557
565
|
display: 'flex',
|
|
558
|
-
flexDirection: '
|
|
559
|
-
|
|
566
|
+
flexDirection: 'row',
|
|
567
|
+
alignItems: 'center',
|
|
568
|
+
gap: 3,
|
|
569
|
+
},
|
|
570
|
+
inlineBar: {
|
|
571
|
+
flex: '1 1 14px',
|
|
572
|
+
minWidth: 10,
|
|
573
|
+
height: 5,
|
|
574
|
+
position: 'relative',
|
|
575
|
+
borderRadius: 999,
|
|
576
|
+
background: 'transparent',
|
|
577
|
+
overflow: 'hidden',
|
|
560
578
|
},
|
|
561
579
|
valueLine: {
|
|
562
580
|
display: 'flex',
|
|
@@ -1141,6 +1159,72 @@ window.__ModuleLoader__.load({
|
|
|
1141
1159
|
const DOCK_TRANSCRIPT_FLOOR = 360;
|
|
1142
1160
|
|
|
1143
1161
|
|
|
1162
|
+
// When the blank strip beside the transcript is too narrow, free room on the
|
|
1163
|
+
// right instead of letting the card shrink: pad the conversation column and pin
|
|
1164
|
+
// the transcript to the left edge of that padded box.
|
|
1165
|
+
const DOCK_COMFORT = 220;
|
|
1166
|
+
let pushedColumn = null;
|
|
1167
|
+
let pushedTarget = null;
|
|
1168
|
+
let pushedSaved = null;
|
|
1169
|
+
let padState = 0;
|
|
1170
|
+
|
|
1171
|
+
function transcriptOf() {
|
|
1172
|
+
const flow = document.querySelector('[data-slot="conversation.chat.flow"]');
|
|
1173
|
+
if (!flow) return null;
|
|
1174
|
+
let node = flow;
|
|
1175
|
+
for (let i = 0; i < 6 && node; i += 1) {
|
|
1176
|
+
const style = getComputedStyle(node);
|
|
1177
|
+
if (style.marginLeft === 'auto' || style.marginRight === 'auto') return node;
|
|
1178
|
+
node = node.parentElement;
|
|
1179
|
+
}
|
|
1180
|
+
return flow.firstElementChild || flow;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
function pushConversation(reserve) {
|
|
1184
|
+
const holder = document.querySelector('[data-slot="main.conversation"]');
|
|
1185
|
+
const column = holder ? (holder.firstElementChild || holder) : null;
|
|
1186
|
+
if (!column) return;
|
|
1187
|
+
const target = transcriptOf();
|
|
1188
|
+
if (!target) return;
|
|
1189
|
+
if (pushedColumn !== column) {
|
|
1190
|
+
releaseConversation();
|
|
1191
|
+
pushedColumn = column;
|
|
1192
|
+
pushedSaved = {
|
|
1193
|
+
pad: column.style.getPropertyValue('padding-right'),
|
|
1194
|
+
padPriority: column.style.getPropertyPriority('padding-right'),
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1197
|
+
if (pushedTarget !== target) {
|
|
1198
|
+
if (pushedTarget) {
|
|
1199
|
+
pushedTarget.style.removeProperty('margin-left');
|
|
1200
|
+
pushedTarget.style.removeProperty('margin-right');
|
|
1201
|
+
}
|
|
1202
|
+
pushedTarget = target;
|
|
1203
|
+
target.style.setProperty('margin-left', '0px', 'important');
|
|
1204
|
+
target.style.setProperty('margin-right', 'auto', 'important');
|
|
1205
|
+
}
|
|
1206
|
+
const wanted = reserve + 'px';
|
|
1207
|
+
if (column.style.getPropertyValue('padding-right') !== wanted) {
|
|
1208
|
+
column.style.setProperty('padding-right', wanted, 'important');
|
|
1209
|
+
}
|
|
1210
|
+
padState = reserve;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
function releaseConversation() {
|
|
1214
|
+
if (pushedTarget) {
|
|
1215
|
+
pushedTarget.style.removeProperty('margin-left');
|
|
1216
|
+
pushedTarget.style.removeProperty('margin-right');
|
|
1217
|
+
pushedTarget = null;
|
|
1218
|
+
}
|
|
1219
|
+
if (pushedColumn && pushedSaved) {
|
|
1220
|
+
if (pushedSaved.pad) pushedColumn.style.setProperty('padding-right', pushedSaved.pad, pushedSaved.padPriority);
|
|
1221
|
+
else pushedColumn.style.removeProperty('padding-right');
|
|
1222
|
+
}
|
|
1223
|
+
pushedColumn = null;
|
|
1224
|
+
pushedSaved = null;
|
|
1225
|
+
padState = 0;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1144
1228
|
function measureRightDock() {
|
|
1145
1229
|
const holder = document.querySelector('[data-slot="main.conversation"]');
|
|
1146
1230
|
const column = holder ? (holder.firstElementChild || holder) : null;
|
|
@@ -1189,10 +1273,12 @@ window.__ModuleLoader__.load({
|
|
|
1189
1273
|
}
|
|
1190
1274
|
}
|
|
1191
1275
|
|
|
1276
|
+
const floored = span < 240;
|
|
1192
1277
|
return {
|
|
1193
1278
|
top: contentTop,
|
|
1194
|
-
left: leftEdge,
|
|
1195
|
-
width:
|
|
1279
|
+
left: floored ? Math.max(0, rightEdge - 240) : leftEdge,
|
|
1280
|
+
width: floored ? 240 : span,
|
|
1281
|
+
naturalSpan: span,
|
|
1196
1282
|
columnWidth: Math.round(columnRect.width),
|
|
1197
1283
|
maxHeight: Math.max(120, Math.round(columnRect.bottom) - contentTop - DOCK_GAP),
|
|
1198
1284
|
};
|
|
@@ -1218,7 +1304,20 @@ window.__ModuleLoader__.load({
|
|
|
1218
1304
|
observer = new ResizeObserver(schedule);
|
|
1219
1305
|
observer.observe(column);
|
|
1220
1306
|
}
|
|
1221
|
-
|
|
1307
|
+
const next = measureRightDock();
|
|
1308
|
+
if (activeRef.current && next) {
|
|
1309
|
+
const natural = next.naturalSpan;
|
|
1310
|
+
let pad = padState;
|
|
1311
|
+
if (natural < DOCK_COMFORT - 8) pad = pad + (DOCK_COMFORT - natural);
|
|
1312
|
+
else if (natural > DOCK_COMFORT + 24) pad = Math.max(0, pad - (natural - DOCK_COMFORT));
|
|
1313
|
+
const limit = Math.max(0, next.columnWidth - 340);
|
|
1314
|
+
pad = Math.min(Math.round(pad), limit);
|
|
1315
|
+
if (pad > 0) pushConversation(pad);
|
|
1316
|
+
else releaseConversation();
|
|
1317
|
+
} else {
|
|
1318
|
+
releaseConversation();
|
|
1319
|
+
}
|
|
1320
|
+
setBox(next);
|
|
1222
1321
|
};
|
|
1223
1322
|
function schedule() {
|
|
1224
1323
|
if (!frame) frame = window.requestAnimationFrame(measure);
|
|
@@ -1705,7 +1804,7 @@ window.__ModuleLoader__.load({
|
|
|
1705
1804
|
percent ? h('span', { style: { ...STYLE.percent, color: percentColor } }, percent) : null
|
|
1706
1805
|
),
|
|
1707
1806
|
h('div', {
|
|
1708
|
-
style: { ...STYLE.
|
|
1807
|
+
style: { ...STYLE.inlineBar, opacity: isStale ? 0.55 : 1 },
|
|
1709
1808
|
role: 'progressbar',
|
|
1710
1809
|
'aria-label': label,
|
|
1711
1810
|
'aria-valuemin': 0,
|
|
@@ -1816,7 +1915,6 @@ window.__ModuleLoader__.load({
|
|
|
1816
1915
|
? h('span', { style: STYLE.warn, title: warnings.join('\n'), 'aria-label': t('warnings') }, '!')
|
|
1817
1916
|
: null,
|
|
1818
1917
|
error && snapshot ? h('span', { style: STYLE.warn, title: error }, '!') : null,
|
|
1819
|
-
h('span', { style: STYLE.meta }, updated ? `${t('updatedLabel')} ${updated}` : ''),
|
|
1820
1918
|
|
|
1821
1919
|
h('button', {
|
|
1822
1920
|
type: 'button',
|
|
@@ -1853,7 +1951,8 @@ window.__ModuleLoader__.load({
|
|
|
1853
1951
|
h('div', { style: tableStyle },
|
|
1854
1952
|
h('div', { style: STYLE.legendRow },
|
|
1855
1953
|
h('div', { key: 'corner' }),
|
|
1856
|
-
WINDOW_IDS.map((id) => h(React.Fragment, { key: id }, windowLegend(id)))
|
|
1954
|
+
WINDOW_IDS.map((id) => h(React.Fragment, { key: id }, windowLegend(id))),
|
|
1955
|
+
h('div', { key: 'updated', style: STYLE.legendMeta, title: updated || '' }, updated ? `${t('updatedLabel')} ${updated}` : '')
|
|
1857
1956
|
),
|
|
1858
1957
|
keys.map((key, index) => keyRow(key, index, activeProvider))
|
|
1859
1958
|
),
|
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.38';
|
|
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