dsh-question-timeout-protection 0.1.4 → 0.2.0
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 +28 -15
- package/README_en-US.md +28 -15
- package/dist/client.js +408 -42
- package/dist/index.mjs +47 -33
- package/package.json +8 -8
- package/src/translation/.example_zh-CN.ini +4 -2
- package/src/translation/en-US.ini +4 -2
- package/src/translation/zh-CN.ini +4 -2
package/dist/client.js
CHANGED
|
@@ -39,6 +39,22 @@ const QUESTION_CARD_SELECTOR = "[data-question-key]";
|
|
|
39
39
|
const QUESTION_CARD_KEY_PREFIX = "question:";
|
|
40
40
|
/** 宿主提问卡片右上角操作区(类名带构建哈希,按后缀匹配) */
|
|
41
41
|
const HEADER_ACTIONS_SELECTOR = "[class*=\"_headerActions\"]";
|
|
42
|
+
/** 宿主单选题的自定义回答行(类名带构建哈希, 按后缀匹配) */
|
|
43
|
+
const CUSTOM_ROW_SELECTOR = "[class*=\"_customRow\"]";
|
|
44
|
+
/** 插件自绘「自定义回答」单选按钮的类名 */
|
|
45
|
+
const CUSTOM_RADIO_CLASS = "dqtp-custom-radio";
|
|
46
|
+
/** 插件自绘「已保留自定义内容」提示按钮的类名 */
|
|
47
|
+
const CUSTOM_HINT_CLASS = "dqtp-custom-hint";
|
|
48
|
+
/** 选中自定义回答时挂在卡片上的类名: 用它压掉宿主预设选项的选中底色 */
|
|
49
|
+
const CUSTOM_CHOICE_CLASS = "dqtp-custom-choice";
|
|
50
|
+
/** 单选题自定义回答的输入内容与选中状态在 localStorage 里的键 */
|
|
51
|
+
const CUSTOM_STATE_STORAGE_KEY = "dqtp-custom-choice.v1";
|
|
52
|
+
/** 「自定义回答」单选按钮的文案(中文/英文) */
|
|
53
|
+
const CUSTOM_RADIO_LABEL_ZH = "自定义回答";
|
|
54
|
+
const CUSTOM_RADIO_LABEL_EN = "Custom answer";
|
|
55
|
+
/** 自定义内容已保留但当前未选中时的提示(中文/英文), {text} 替换为内容 */
|
|
56
|
+
const CUSTOM_HINT_ZH = "已保留自定义内容: {text}(点这里选用)";
|
|
57
|
+
const CUSTOM_HINT_EN = "Custom answer kept: {text} (click to use it)";
|
|
42
58
|
/** 卡片输入框选择器 */
|
|
43
59
|
const CARD_INPUT_SELECTOR = "textarea, input";
|
|
44
60
|
/** 卡片内可点击的控件 */
|
|
@@ -69,6 +85,12 @@ const COUNTDOWN_PATTERNS = [
|
|
|
69
85
|
];
|
|
70
86
|
/** 判定宿主是否停在暂停态的文案特征: 暂停态下的剩余秒数不是真实到期时间 */
|
|
71
87
|
const PAUSED_TEXT_PATTERNS = [/已暂停/, /Paused/];
|
|
88
|
+
/**
|
|
89
|
+
* 宿主「已经停表」的等待文案: 用户点过「慢慢回答」或开始编辑回答后,
|
|
90
|
+
* 宿主自己的定时器已经停下, 卡片只显示这句提示, 不再渲染倒计时与暂停控件。
|
|
91
|
+
* 与 HOST_WAIT_PATTERNS 分开: 后者还含「已继续工作」这类已结算文案。
|
|
92
|
+
*/
|
|
93
|
+
const HOST_HELD_PATTERNS = ["会一直等你回答", "Waiting until you answer"];
|
|
72
94
|
/** 「问答自动无限等待」常开开关的文案(中文与英文): 中文侧带「自动」, 与英文的 Auto 对齐 */
|
|
73
95
|
const AUTO_INFINITE_LABEL_ZH = "问答自动无限等待";
|
|
74
96
|
const AUTO_INFINITE_LABEL_EN = "Auto wait indefinitely";
|
|
@@ -310,6 +332,46 @@ const CARD_STYLE = `
|
|
|
310
332
|
.dqtp-card-locked {
|
|
311
333
|
cursor: default;
|
|
312
334
|
}
|
|
335
|
+
.dqtp-custom-radio {
|
|
336
|
+
flex: 0 0 20px;
|
|
337
|
+
width: 20px;
|
|
338
|
+
height: 20px;
|
|
339
|
+
/* 与宿主 .number 标号座对齐: 行内 gap 提供水平间距, 这里只补垂直偏移 */
|
|
340
|
+
margin: 2px 0 0;
|
|
341
|
+
padding: 0;
|
|
342
|
+
border-radius: 50%;
|
|
343
|
+
border: 1px solid var(--dsw-alias-border-secondary, rgba(0, 0, 0, 0.24));
|
|
344
|
+
background: transparent;
|
|
345
|
+
cursor: pointer;
|
|
346
|
+
}
|
|
347
|
+
.dqtp-custom-radio[aria-checked="true"] {
|
|
348
|
+
border-color: var(--dsw-alias-label-primary, #111);
|
|
349
|
+
background: var(--dsw-alias-label-primary, #111);
|
|
350
|
+
box-shadow: inset 0 0 0 3px var(--dsw-alias-bg-primary, #fff);
|
|
351
|
+
}
|
|
352
|
+
/* 选中自定义回答时压掉宿主预设项的选中底色, 避免界面上出现两个"已选" */
|
|
353
|
+
.dqtp-custom-choice[data-question-key] button[role="radio"][aria-checked="true"] > span:first-child {
|
|
354
|
+
background: transparent;
|
|
355
|
+
color: var(--dsw-alias-label-secondary, #666);
|
|
356
|
+
}
|
|
357
|
+
/* 宿主把选中底色加在整行上, 只清标号底色仍会出现两个"已选" */
|
|
358
|
+
.dqtp-custom-choice[data-question-key] [class*="_optionSelected"] {
|
|
359
|
+
background: transparent;
|
|
360
|
+
border-color: var(--dsw-alias-border-secondary, rgba(0, 0, 0, 0.16));
|
|
361
|
+
}
|
|
362
|
+
.dqtp-custom-hint {
|
|
363
|
+
display: block;
|
|
364
|
+
margin: 6px 0 0;
|
|
365
|
+
padding: 0;
|
|
366
|
+
border: 0;
|
|
367
|
+
background: transparent;
|
|
368
|
+
color: var(--dsw-alias-label-secondary, #666);
|
|
369
|
+
font-size: 12px;
|
|
370
|
+
line-height: 18px;
|
|
371
|
+
text-align: left;
|
|
372
|
+
cursor: pointer;
|
|
373
|
+
word-break: break-word;
|
|
374
|
+
}
|
|
313
375
|
#dqtp-draft-panel {
|
|
314
376
|
position: fixed;
|
|
315
377
|
z-index: 2147483000;
|
|
@@ -431,14 +493,18 @@ function recommendedOptionLabels(question) {
|
|
|
431
493
|
if (question?.multiSelect === true) return marked;
|
|
432
494
|
return labels.length > 0 && stripRecommendedSuffix(labels[0]) !== labels[0] ? [labels[0]] : [];
|
|
433
495
|
}
|
|
434
|
-
function
|
|
435
|
-
const recommended =
|
|
436
|
-
|
|
496
|
+
function dropPreselected(selected, question) {
|
|
497
|
+
const recommended = recommendedOptionLabels(question);
|
|
498
|
+
if (recommended.length === 0) return [...selected];
|
|
499
|
+
if (selected.length !== recommended.length) return [...selected];
|
|
500
|
+
const expected = new Set(recommended);
|
|
501
|
+
return selected.every((label) => expected.has(label)) ? [] : [...selected];
|
|
437
502
|
}
|
|
438
503
|
function readSelected(card, question) {
|
|
439
504
|
const selected = [];
|
|
440
505
|
const originals = (question?.options ?? []).map((option) => typeof option.label === "string" ? option.label : "").filter((label) => label !== "");
|
|
441
506
|
for (const button of Array.from(card.querySelectorAll("button[aria-checked=\"true\"]"))) {
|
|
507
|
+
if (button.classList.contains("dqtp-custom-radio")) continue;
|
|
442
508
|
const display = (button.getAttribute("aria-label") ?? "").trim();
|
|
443
509
|
if (display === "") continue;
|
|
444
510
|
const label = originals.find((original) => stripRecommendedSuffix(original) === display) ?? display;
|
|
@@ -716,14 +782,19 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
716
782
|
const draftSyncFailures = /* @__PURE__ */ new Map();
|
|
717
783
|
const drafts = /* @__PURE__ */ new Map();
|
|
718
784
|
const lastDrafts = /* @__PURE__ */ new Map();
|
|
785
|
+
const typedCustom = /* @__PURE__ */ new Map();
|
|
786
|
+
const customChoice = /* @__PURE__ */ new Map();
|
|
719
787
|
const subscriptions = /* @__PURE__ */ new Map();
|
|
720
788
|
const lockedCards = /* @__PURE__ */ new WeakSet();
|
|
721
|
-
const
|
|
789
|
+
const dismissFailures = /* @__PURE__ */ new WeakMap();
|
|
790
|
+
const dismissAttemptedAt = /* @__PURE__ */ new WeakMap();
|
|
791
|
+
const dismissFailedWarned = /* @__PURE__ */ new Set();
|
|
722
792
|
const deferred = /* @__PURE__ */ new Map();
|
|
723
793
|
const projectedCounts = /* @__PURE__ */ new Map();
|
|
724
794
|
const projectedQuestions = /* @__PURE__ */ new Map();
|
|
725
795
|
const optionInteractions = /* @__PURE__ */ new Map();
|
|
726
796
|
const callActive = /* @__PURE__ */ new Set();
|
|
797
|
+
const seenLive = /* @__PURE__ */ new Set();
|
|
727
798
|
const callTouchedAt = /* @__PURE__ */ new Map();
|
|
728
799
|
const draftTooLarge = /* @__PURE__ */ new Set();
|
|
729
800
|
const badCallIdWarned = /* @__PURE__ */ new Set();
|
|
@@ -735,17 +806,211 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
735
806
|
const question = projectedQuestions.get(callId)?.[index];
|
|
736
807
|
const selected = readSelected(card, question);
|
|
737
808
|
if (optionInteractions.get(callId)?.has(index) === true) return selected;
|
|
738
|
-
return
|
|
809
|
+
return dropPreselected(selected, question);
|
|
739
810
|
};
|
|
740
811
|
const gateDraftSelections = (items, callId) => {
|
|
741
812
|
if (items === void 0) return void 0;
|
|
742
813
|
const touched = optionInteractions.get(callId);
|
|
743
814
|
return items.map((item, index) => touched?.has(index) === true ? item : {
|
|
744
|
-
selected:
|
|
815
|
+
selected: dropPreselected(item.selected, projectedQuestions.get(callId)?.[index]),
|
|
745
816
|
custom: item.custom,
|
|
746
817
|
skipped: item.skipped
|
|
747
818
|
});
|
|
748
819
|
};
|
|
820
|
+
const rememberTypedCustom = (callId, index, text) => {
|
|
821
|
+
let entries = typedCustom.get(callId);
|
|
822
|
+
if (text === "") {
|
|
823
|
+
if (entries === void 0) return;
|
|
824
|
+
entries.delete(index);
|
|
825
|
+
if (entries.size === 0) typedCustom.delete(callId);
|
|
826
|
+
saveCustomState();
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
if (entries === void 0) {
|
|
830
|
+
entries = /* @__PURE__ */ new Map();
|
|
831
|
+
typedCustom.set(callId, entries);
|
|
832
|
+
}
|
|
833
|
+
entries.set(index, text);
|
|
834
|
+
saveCustomState();
|
|
835
|
+
};
|
|
836
|
+
const typedCustomAt = (callId, index) => typedCustom.get(callId)?.get(index);
|
|
837
|
+
const setCustomChoice = (callId, index, custom) => {
|
|
838
|
+
let entries = customChoice.get(callId);
|
|
839
|
+
if (entries === void 0) {
|
|
840
|
+
entries = /* @__PURE__ */ new Map();
|
|
841
|
+
customChoice.set(callId, entries);
|
|
842
|
+
}
|
|
843
|
+
entries.set(index, custom);
|
|
844
|
+
saveCustomState();
|
|
845
|
+
};
|
|
846
|
+
const clearCustomState = (callId) => {
|
|
847
|
+
typedCustom.delete(callId);
|
|
848
|
+
customChoice.delete(callId);
|
|
849
|
+
saveCustomState();
|
|
850
|
+
};
|
|
851
|
+
const loadCustomState = () => {
|
|
852
|
+
try {
|
|
853
|
+
const raw = window.localStorage.getItem(CUSTOM_STATE_STORAGE_KEY);
|
|
854
|
+
if (raw === null) return;
|
|
855
|
+
const parsed = JSON.parse(raw);
|
|
856
|
+
if (parsed === null || typeof parsed !== "object") return;
|
|
857
|
+
for (const [callId, entry] of Object.entries(parsed)) {
|
|
858
|
+
if (entry === null || typeof entry !== "object") continue;
|
|
859
|
+
if (entry.text !== void 0 && entry.text !== null) {
|
|
860
|
+
const map = /* @__PURE__ */ new Map();
|
|
861
|
+
for (const [key, value] of Object.entries(entry.text)) {
|
|
862
|
+
const index = Number(key);
|
|
863
|
+
if (Number.isInteger(index) && index >= 0 && typeof value === "string" && value !== "") map.set(index, value);
|
|
864
|
+
}
|
|
865
|
+
if (map.size > 0) typedCustom.set(callId, map);
|
|
866
|
+
}
|
|
867
|
+
if (entry.choice !== void 0 && entry.choice !== null) {
|
|
868
|
+
const map = /* @__PURE__ */ new Map();
|
|
869
|
+
for (const [key, value] of Object.entries(entry.choice)) {
|
|
870
|
+
const index = Number(key);
|
|
871
|
+
if (Number.isInteger(index) && index >= 0 && typeof value === "boolean") map.set(index, value);
|
|
872
|
+
}
|
|
873
|
+
if (map.size > 0) customChoice.set(callId, map);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
} catch {}
|
|
877
|
+
};
|
|
878
|
+
const saveCustomState = () => {
|
|
879
|
+
try {
|
|
880
|
+
const out = {};
|
|
881
|
+
const ids = /* @__PURE__ */ new Set([...typedCustom.keys(), ...customChoice.keys()]);
|
|
882
|
+
let kept = 0;
|
|
883
|
+
for (const callId of ids) {
|
|
884
|
+
if (kept >= 64) break;
|
|
885
|
+
kept += 1;
|
|
886
|
+
const text = {};
|
|
887
|
+
for (const [index, value] of typedCustom.get(callId) ?? []) text[String(index)] = value;
|
|
888
|
+
const choice = {};
|
|
889
|
+
for (const [index, value] of customChoice.get(callId) ?? []) choice[String(index)] = value;
|
|
890
|
+
out[callId] = {
|
|
891
|
+
text,
|
|
892
|
+
choice
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
window.localStorage.setItem(CUSTOM_STATE_STORAGE_KEY, JSON.stringify(out));
|
|
896
|
+
} catch {}
|
|
897
|
+
};
|
|
898
|
+
loadCustomState();
|
|
899
|
+
const resolveCustomChoice = (callId, index, card) => {
|
|
900
|
+
const explicit = customChoice.get(callId)?.get(index);
|
|
901
|
+
if (explicit !== void 0) return explicit ? "custom" : "option";
|
|
902
|
+
if (card === void 0) return "option";
|
|
903
|
+
const question = projectedQuestions.get(callId)?.[index];
|
|
904
|
+
const selected = readSelected(card, question);
|
|
905
|
+
const custom = readCustom(card);
|
|
906
|
+
return selected.length === 0 && custom.trim() !== "" ? "custom" : "option";
|
|
907
|
+
};
|
|
908
|
+
const applyCustomChoice = (items, callId) => {
|
|
909
|
+
const choices = customChoice.get(callId);
|
|
910
|
+
const typed = typedCustom.get(callId);
|
|
911
|
+
if (choices === void 0 && typed === void 0) return items;
|
|
912
|
+
return items.map((item, index) => {
|
|
913
|
+
const question = projectedQuestions.get(callId)?.[index];
|
|
914
|
+
if (question?.multiSelect === true) return item;
|
|
915
|
+
const explicit = choices?.get(index);
|
|
916
|
+
if (explicit === void 0 && question === void 0) return item;
|
|
917
|
+
if (item.skipped) return {
|
|
918
|
+
...item,
|
|
919
|
+
custom: ""
|
|
920
|
+
};
|
|
921
|
+
const typedText = typed?.get(index);
|
|
922
|
+
if (explicit ?? (item.selected.length === 0 && (typedText ?? item.custom).trim() !== "")) return {
|
|
923
|
+
...item,
|
|
924
|
+
selected: [],
|
|
925
|
+
custom: typedText ?? item.custom
|
|
926
|
+
};
|
|
927
|
+
return {
|
|
928
|
+
...item,
|
|
929
|
+
custom: ""
|
|
930
|
+
};
|
|
931
|
+
});
|
|
932
|
+
};
|
|
933
|
+
const writeField = (field, value) => {
|
|
934
|
+
const prototype = field instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype;
|
|
935
|
+
const setter = Object.getOwnPropertyDescriptor(prototype, "value")?.set;
|
|
936
|
+
if (setter === void 0) field.value = value;
|
|
937
|
+
else setter.call(field, value);
|
|
938
|
+
field.dispatchEvent(new Event("input", { bubbles: true }));
|
|
939
|
+
};
|
|
940
|
+
const writeFieldWithChange = (field, value) => {
|
|
941
|
+
const sentinel = field.value === " " ? "" : " ";
|
|
942
|
+
writeField(field, sentinel);
|
|
943
|
+
writeField(field, value);
|
|
944
|
+
};
|
|
945
|
+
const hostHasCheckedOption = (card) => Array.from(card.querySelectorAll("button[role=\"radio\"][aria-checked=\"true\"]")).some((button) => !button.classList.contains(CUSTOM_RADIO_CLASS));
|
|
946
|
+
const customFieldOf = (card) => {
|
|
947
|
+
const row = card.querySelector(CUSTOM_ROW_SELECTOR);
|
|
948
|
+
if (!(row instanceof HTMLElement)) return void 0;
|
|
949
|
+
const field = row.querySelector(CARD_INPUT_SELECTOR);
|
|
950
|
+
return field instanceof HTMLTextAreaElement || field instanceof HTMLInputElement ? field : void 0;
|
|
951
|
+
};
|
|
952
|
+
const isReadOnlyCard = (card) => {
|
|
953
|
+
const fields = Array.from(card.querySelectorAll(CARD_INPUT_SELECTOR));
|
|
954
|
+
return fields.length > 0 && fields.every((field) => field.disabled);
|
|
955
|
+
};
|
|
956
|
+
const removeCustomChoiceUI = (card) => {
|
|
957
|
+
const row = card.querySelector(CUSTOM_ROW_SELECTOR);
|
|
958
|
+
for (const element of Array.from(card.querySelectorAll("button.dqtp-custom-radio, button.dqtp-custom-hint"))) element.remove();
|
|
959
|
+
if (row instanceof HTMLElement) {
|
|
960
|
+
for (const marker of Array.from(row.querySelectorAll("span[aria-hidden=\"true\"]"))) if (marker instanceof HTMLElement) marker.classList.remove(HIDDEN_CONTROL_CLASS);
|
|
961
|
+
}
|
|
962
|
+
card.classList.remove(CUSTOM_CHOICE_CLASS);
|
|
963
|
+
};
|
|
964
|
+
const ensureCustomChoiceUI = (card, identity) => {
|
|
965
|
+
if (!(options().cardEnhancements !== false && !card.classList.contains("dqtp-card-locked") && card.querySelector("[role=\"radiogroup\"]") !== null && card.querySelector("[class*=\"_customRow\"]") instanceof HTMLElement && !passive.has(identity.callId) && !isReadOnlyCard(card))) {
|
|
966
|
+
removeCustomChoiceUI(card);
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
const row = card.querySelector(CUSTOM_ROW_SELECTOR);
|
|
970
|
+
const field = customFieldOf(card);
|
|
971
|
+
if (!(row instanceof HTMLElement) || field === void 0) {
|
|
972
|
+
removeCustomChoiceUI(card);
|
|
973
|
+
return;
|
|
974
|
+
}
|
|
975
|
+
let radio = row.querySelector("button.dqtp-custom-radio");
|
|
976
|
+
if (!(radio instanceof HTMLButtonElement)) {
|
|
977
|
+
radio = document.createElement("button");
|
|
978
|
+
radio.type = "button";
|
|
979
|
+
radio.className = CUSTOM_RADIO_CLASS;
|
|
980
|
+
radio.setAttribute("role", "radio");
|
|
981
|
+
const anchor = field.parentElement !== null && field.parentElement !== row ? field.parentElement : field;
|
|
982
|
+
if (anchor.parentElement === row) row.insertBefore(radio, anchor);
|
|
983
|
+
else row.appendChild(radio);
|
|
984
|
+
}
|
|
985
|
+
for (const marker of Array.from(row.querySelectorAll("span[aria-hidden=\"true\"]"))) if (marker instanceof HTMLElement) marker.classList.add(HIDDEN_CONTROL_CLASS);
|
|
986
|
+
const index = readProgress(card)?.index ?? 0;
|
|
987
|
+
const mode = resolveCustomChoice(identity.callId, index, card);
|
|
988
|
+
radio.setAttribute("aria-checked", mode === "custom" ? "true" : "false");
|
|
989
|
+
const label = pick(CUSTOM_RADIO_LABEL_ZH, CUSTOM_RADIO_LABEL_EN);
|
|
990
|
+
if (radio.title !== label) radio.title = label;
|
|
991
|
+
if (radio.getAttribute("aria-label") !== label) radio.setAttribute("aria-label", label);
|
|
992
|
+
card.classList.toggle(CUSTOM_CHOICE_CLASS, mode === "custom");
|
|
993
|
+
const typed = typedCustomAt(identity.callId, index);
|
|
994
|
+
const showHint = mode === "option" && typed !== void 0 && typed.trim() !== "";
|
|
995
|
+
let hint = null;
|
|
996
|
+
const sibling = row.nextElementSibling;
|
|
997
|
+
if (sibling instanceof HTMLButtonElement && sibling.classList.contains("dqtp-custom-hint")) hint = sibling;
|
|
998
|
+
if (!showHint) {
|
|
999
|
+
if (hint !== null) hint.remove();
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
if (!(hint instanceof HTMLButtonElement)) {
|
|
1003
|
+
hint = document.createElement("button");
|
|
1004
|
+
hint.type = "button";
|
|
1005
|
+
hint.className = CUSTOM_HINT_CLASS;
|
|
1006
|
+
row.insertAdjacentElement("afterend", hint);
|
|
1007
|
+
}
|
|
1008
|
+
const customText = typed ?? "";
|
|
1009
|
+
const customShown = customText.length > 80 ? customText.slice(0, 80) + "…" : customText;
|
|
1010
|
+
const text = pick(CUSTOM_HINT_ZH, CUSTOM_HINT_EN).replace("{text}", () => customShown);
|
|
1011
|
+
if (hint.textContent !== text) hint.textContent = text;
|
|
1012
|
+
if (hint.title !== customText) hint.title = customText;
|
|
1013
|
+
};
|
|
749
1014
|
const rememberCallSession = (identity) => {
|
|
750
1015
|
callTouchedAt.set(identity.callId, Date.now());
|
|
751
1016
|
if (callSessions.get(identity.callId) === identity.sessionId) return;
|
|
@@ -771,10 +1036,11 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
771
1036
|
for (const id of draftSyncFailures.keys()) ids.add(id);
|
|
772
1037
|
for (const id of draftTooLarge.keys()) ids.add(id);
|
|
773
1038
|
for (const id of draftTooLargeAt.keys()) ids.add(id);
|
|
774
|
-
for (const id of dismissedCallIds.keys()) ids.add(id);
|
|
775
1039
|
for (const id of interrupted.keys()) ids.add(id);
|
|
776
1040
|
for (const id of badCallIdWarned.keys()) ids.add(id);
|
|
777
1041
|
for (const id of optionInteractions.keys()) ids.add(id);
|
|
1042
|
+
for (const id of typedCustom.keys()) ids.add(id);
|
|
1043
|
+
for (const id of customChoice.keys()) ids.add(id);
|
|
778
1044
|
return [...ids];
|
|
779
1045
|
};
|
|
780
1046
|
const forgetCall = (callId) => {
|
|
@@ -795,12 +1061,14 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
795
1061
|
projectedQuestions.delete(callId);
|
|
796
1062
|
optionInteractions.delete(callId);
|
|
797
1063
|
callActive.delete(callId);
|
|
1064
|
+
seenLive.delete(callId);
|
|
798
1065
|
callTouchedAt.delete(callId);
|
|
799
1066
|
draftTooLarge.delete(callId);
|
|
800
1067
|
draftTooLargeAt.delete(callId);
|
|
801
|
-
|
|
1068
|
+
dismissFailedWarned.delete(callId);
|
|
802
1069
|
interrupted.delete(callId);
|
|
803
1070
|
badCallIdWarned.delete(callId);
|
|
1071
|
+
clearCustomState(callId);
|
|
804
1072
|
};
|
|
805
1073
|
const pruneCallStates = () => {
|
|
806
1074
|
const now = Date.now();
|
|
@@ -1016,28 +1284,61 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1016
1284
|
if (SUBMIT_TEXTS.includes(text) || NEXT_QUESTION_TEXTS.includes(text) || SKIP_QUESTION_TEXTS.includes(text)) disableControl(button);
|
|
1017
1285
|
}
|
|
1018
1286
|
};
|
|
1287
|
+
const dismissCard = (card) => {
|
|
1288
|
+
for (const button of Array.from(card.querySelectorAll(CARD_BUTTON_SELECTOR))) {
|
|
1289
|
+
const label = (button.getAttribute("aria-label") ?? button.getAttribute("title") ?? "").trim();
|
|
1290
|
+
if (!CLOSE_PANEL_LABELS.includes(label)) continue;
|
|
1291
|
+
if (button instanceof HTMLButtonElement && button.disabled) return false;
|
|
1292
|
+
button.click();
|
|
1293
|
+
return true;
|
|
1294
|
+
}
|
|
1295
|
+
return false;
|
|
1296
|
+
};
|
|
1297
|
+
const handBackCard = (card) => {
|
|
1298
|
+
card.classList.remove(HIDDEN_CONTROL_CLASS);
|
|
1299
|
+
card.removeAttribute(CARD_DISMISSED_ATTRIBUTE);
|
|
1300
|
+
const identity = parseCardKey(card.getAttribute("data-question-key"));
|
|
1301
|
+
if (identity === void 0) return;
|
|
1302
|
+
passive.add(identity.callId);
|
|
1303
|
+
timedOut.delete(identity.callId);
|
|
1304
|
+
drafts.delete(identity.callId);
|
|
1305
|
+
restoreCard(card);
|
|
1306
|
+
if (dismissFailedWarned.has(identity.callId)) return;
|
|
1307
|
+
dismissFailedWarned.add(identity.callId);
|
|
1308
|
+
console.warn("[question-timeout-protection] 无法让宿主收起问答卡片, 这一轮改由宿主原版处理, 卡片保持可作答");
|
|
1309
|
+
};
|
|
1019
1310
|
const hideCard = (card) => {
|
|
1020
1311
|
const key = card.getAttribute("data-question-key") ?? "";
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
if (
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1312
|
+
if (Date.now() - (dismissAttemptedAt.get(card) ?? 0) < 500) return;
|
|
1313
|
+
let failures = dismissFailures.get(card) ?? 0;
|
|
1314
|
+
if (card.getAttribute(CARD_DISMISSED_ATTRIBUTE) === key) {
|
|
1315
|
+
card.removeAttribute(CARD_DISMISSED_ATTRIBUTE);
|
|
1316
|
+
card.classList.remove(HIDDEN_CONTROL_CLASS);
|
|
1317
|
+
failures += 1;
|
|
1318
|
+
}
|
|
1319
|
+
dismissAttemptedAt.set(card, Date.now());
|
|
1320
|
+
if (failures >= 5) {
|
|
1321
|
+
dismissFailures.set(card, failures);
|
|
1322
|
+
handBackCard(card);
|
|
1323
|
+
return;
|
|
1032
1324
|
}
|
|
1033
|
-
card
|
|
1325
|
+
if (dismissCard(card)) {
|
|
1326
|
+
dismissFailures.set(card, failures);
|
|
1327
|
+
card.setAttribute(CARD_DISMISSED_ATTRIBUTE, key);
|
|
1328
|
+
card.classList.add(HIDDEN_CONTROL_CLASS);
|
|
1329
|
+
return;
|
|
1330
|
+
}
|
|
1331
|
+
dismissFailures.set(card, failures + 1);
|
|
1034
1332
|
};
|
|
1035
1333
|
const restoreCard = (card) => {
|
|
1036
|
-
|
|
1334
|
+
const markedKey = card.getAttribute(CARD_DISMISSED_ATTRIBUTE);
|
|
1335
|
+
if (markedKey !== null && markedKey === (card.getAttribute("data-question-key") ?? "")) return;
|
|
1336
|
+
if (markedKey !== null) card.removeAttribute(CARD_DISMISSED_ATTRIBUTE);
|
|
1037
1337
|
card.classList.remove(HIDDEN_CONTROL_CLASS);
|
|
1038
1338
|
for (const element of Array.from(card.querySelectorAll("." + HIDDEN_CONTROL_CLASS))) element.classList.remove(HIDDEN_CONTROL_CLASS);
|
|
1039
1339
|
for (const element of Array.from(card.querySelectorAll("[data-dqtp-host-wait]"))) element.removeAttribute(HIDDEN_WAIT_ATTRIBUTE);
|
|
1040
1340
|
for (const element of Array.from(card.querySelectorAll("[data-dqtp-countdown], button.dqtp-infinite-wait"))) element.remove();
|
|
1341
|
+
removeCustomChoiceUI(card);
|
|
1041
1342
|
restoreDisabled(card);
|
|
1042
1343
|
card.classList.remove(CARD_LOCKED_CLASS);
|
|
1043
1344
|
lockedCards.delete(card);
|
|
@@ -1151,15 +1452,24 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1151
1452
|
hideCard(card);
|
|
1152
1453
|
}
|
|
1153
1454
|
};
|
|
1455
|
+
const hostTimerStopped = (card) => {
|
|
1456
|
+
for (const element of Array.from(card.querySelectorAll(WAIT_STATUS_SELECTOR))) {
|
|
1457
|
+
const text = (element.textContent ?? "").trim();
|
|
1458
|
+
if (text === "") continue;
|
|
1459
|
+
if (HOST_HELD_PATTERNS.some((pattern) => text.includes(pattern))) return true;
|
|
1460
|
+
}
|
|
1461
|
+
return false;
|
|
1462
|
+
};
|
|
1154
1463
|
const clickHostTakeTime = (identity) => {
|
|
1155
1464
|
const card = findCard(identity);
|
|
1156
|
-
if (card === void 0) return
|
|
1465
|
+
if (card === void 0) return "missing";
|
|
1157
1466
|
for (const element of Array.from(card.querySelectorAll(CARD_BUTTON_SELECTOR))) {
|
|
1158
1467
|
if (!TAKE_TIME_TEXTS.includes(element.textContent?.trim() ?? "")) continue;
|
|
1468
|
+
if (element instanceof HTMLButtonElement && element.disabled) continue;
|
|
1159
1469
|
element.click();
|
|
1160
|
-
return
|
|
1470
|
+
return "clicked";
|
|
1161
1471
|
}
|
|
1162
|
-
return
|
|
1472
|
+
return hostTimerStopped(card) ? "already-stopped" : "missing";
|
|
1163
1473
|
};
|
|
1164
1474
|
const pauseCountdown = (card, identity) => {
|
|
1165
1475
|
if (paused.has(identity.callId)) return;
|
|
@@ -1170,7 +1480,7 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1170
1480
|
if (disposed) return;
|
|
1171
1481
|
if (reply.ok) {
|
|
1172
1482
|
if (timedOut.has(identity.callId)) return;
|
|
1173
|
-
if (clickHostTakeTime(identity)) return;
|
|
1483
|
+
if (clickHostTakeTime(identity) !== "missing") return;
|
|
1174
1484
|
paused.delete(identity.callId);
|
|
1175
1485
|
syncUnavailable.add(identity.callId);
|
|
1176
1486
|
reportInfiniteWait(identity, void 0, false);
|
|
@@ -1422,12 +1732,13 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1422
1732
|
draftTooLargeAt.delete(identity.callId);
|
|
1423
1733
|
}
|
|
1424
1734
|
if (timedOut.has(identity.callId) || passive.has(identity.callId)) return;
|
|
1425
|
-
|
|
1735
|
+
const waitingByStatus = !card.classList.contains("dqtp-card-locked") && Array.from(card.querySelectorAll("[class*=\"_waitStatus\"]")).some((element) => (element.textContent ?? "").trim() !== "");
|
|
1736
|
+
if (!callActive.has(identity.callId) && !hostStillWaiting(card) && !waitingByStatus) return;
|
|
1426
1737
|
rememberCallSession(identity);
|
|
1427
1738
|
const progress = readProgress(card);
|
|
1428
1739
|
const projected = projectedCounts.get(identity.callId) ?? 1;
|
|
1429
1740
|
const count = Math.max(progress?.count ?? 1, projected);
|
|
1430
|
-
const items = mergeDrafts(gateDraftSelections(readHostDrafts(identity, count), identity.callId), readLiveDrafts(card, count, readLiveSelected(card, identity.callId)), lastDrafts.get(identity.callId), count, progress?.index);
|
|
1741
|
+
const items = applyCustomChoice(mergeDrafts(gateDraftSelections(readHostDrafts(identity, count), identity.callId), readLiveDrafts(card, count, readLiveSelected(card, identity.callId)), lastDrafts.get(identity.callId), count, progress?.index), identity.callId);
|
|
1431
1742
|
const last = draftReportedAt.get(identity.callId);
|
|
1432
1743
|
const now = Date.now();
|
|
1433
1744
|
if (last !== void 0 && now - last < DRAFT_REPORT_INTERVAL_MS) return;
|
|
@@ -1503,7 +1814,7 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1503
1814
|
const progress = card === void 0 ? void 0 : readProgress(card);
|
|
1504
1815
|
const count = Math.max(progress?.count ?? 1, projectedCounts.get(row.callId) ?? 1, row.questions.length);
|
|
1505
1816
|
const liveIndex = progress?.index;
|
|
1506
|
-
const items = mergeDrafts(gateDraftSelections(readHostDrafts(identity, count), identity.callId), readLiveDrafts(card, count, card === void 0 ? [] : readLiveSelected(card, row.callId)), stored, count, liveIndex);
|
|
1817
|
+
const items = applyCustomChoice(mergeDrafts(gateDraftSelections(readHostDrafts(identity, count), identity.callId), readLiveDrafts(card, count, card === void 0 ? [] : readLiveSelected(card, row.callId)), stored, count, liveIndex), row.callId);
|
|
1507
1818
|
lastDrafts.set(row.callId, items);
|
|
1508
1819
|
const current = options();
|
|
1509
1820
|
if (!(current.draftFallback && !syncUnavailable.has(row.callId) && !draftSyncFailed.has(row.callId) && items.some(hasItemContent))) {
|
|
@@ -1547,6 +1858,7 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1547
1858
|
for (const row of active) {
|
|
1548
1859
|
if (typeof row.callId !== "string") continue;
|
|
1549
1860
|
live.add(row.callId);
|
|
1861
|
+
seenLive.add(row.callId);
|
|
1550
1862
|
callActive.add(row.callId);
|
|
1551
1863
|
callTouchedAt.set(row.callId, Date.now());
|
|
1552
1864
|
if (!Array.isArray(row.questions)) continue;
|
|
@@ -1561,6 +1873,7 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1561
1873
|
for (const callId of knownCallIds()) {
|
|
1562
1874
|
if (live.has(callId)) continue;
|
|
1563
1875
|
if (callSessionOf(callId) !== sessionId) continue;
|
|
1876
|
+
if (!seenLive.has(callId)) continue;
|
|
1564
1877
|
forgetCall(callId);
|
|
1565
1878
|
}
|
|
1566
1879
|
};
|
|
@@ -1589,10 +1902,8 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1589
1902
|
};
|
|
1590
1903
|
const ensureSubscription = (sessionId) => {
|
|
1591
1904
|
if (subscriptions.has(sessionId)) return;
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
polledSessions.delete(sessionId);
|
|
1595
|
-
}
|
|
1905
|
+
const wasPolled = polledSessions.has(sessionId);
|
|
1906
|
+
if (wasPolled && subscriptions.size >= 8) return;
|
|
1596
1907
|
const face = resolveProjectionFace(ctx, sessionId);
|
|
1597
1908
|
if (face === void 0) {
|
|
1598
1909
|
if (!subscribeWarned.has(sessionId)) {
|
|
@@ -1601,6 +1912,7 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1601
1912
|
}
|
|
1602
1913
|
return;
|
|
1603
1914
|
}
|
|
1915
|
+
if (wasPolled) polledSessions.delete(sessionId);
|
|
1604
1916
|
const evaluate = () => {
|
|
1605
1917
|
if (disposed) return;
|
|
1606
1918
|
try {
|
|
@@ -1662,7 +1974,7 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1662
1974
|
const target = event.target;
|
|
1663
1975
|
if (!(target instanceof Element)) return;
|
|
1664
1976
|
const option = target.closest("button[role=\"radio\"], button[role=\"checkbox\"]");
|
|
1665
|
-
if (option instanceof HTMLElement) {
|
|
1977
|
+
if (option instanceof HTMLElement && !option.classList.contains("dqtp-custom-radio")) {
|
|
1666
1978
|
const card = option.closest(QUESTION_CARD_SELECTOR);
|
|
1667
1979
|
if (card instanceof HTMLElement) {
|
|
1668
1980
|
const identity = parseCardKey(card.getAttribute("data-question-key"));
|
|
@@ -1672,11 +1984,35 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1672
1984
|
const touched = optionInteractions.get(identity.callId) ?? /* @__PURE__ */ new Set();
|
|
1673
1985
|
touched.add(index);
|
|
1674
1986
|
optionInteractions.set(identity.callId, touched);
|
|
1987
|
+
if (card.querySelector("[role=\"group\"]") === null) {
|
|
1988
|
+
setCustomChoice(identity.callId, index, false);
|
|
1989
|
+
ensureCustomChoiceUI(card, identity);
|
|
1990
|
+
}
|
|
1675
1991
|
}
|
|
1676
1992
|
}
|
|
1677
1993
|
}
|
|
1678
1994
|
const button = target.closest(CARD_BUTTON_SELECTOR);
|
|
1679
1995
|
if (!(button instanceof HTMLElement)) return;
|
|
1996
|
+
if (button.classList.contains("dqtp-custom-radio") || button.classList.contains("dqtp-custom-hint")) {
|
|
1997
|
+
event.preventDefault();
|
|
1998
|
+
event.stopPropagation();
|
|
1999
|
+
const card = button.closest(QUESTION_CARD_SELECTOR);
|
|
2000
|
+
const identity = parseCardKey(card instanceof HTMLElement ? card.getAttribute("data-question-key") : null);
|
|
2001
|
+
if (!(card instanceof HTMLElement) || identity === void 0) return;
|
|
2002
|
+
const index = readProgress(card)?.index ?? 0;
|
|
2003
|
+
setCustomChoice(identity.callId, index, true);
|
|
2004
|
+
rememberCallSession(identity);
|
|
2005
|
+
const field = customFieldOf(card);
|
|
2006
|
+
if (field !== void 0) {
|
|
2007
|
+
const intended = typedCustomAt(identity.callId, index) ?? field.value;
|
|
2008
|
+
if (intended !== "") rememberTypedCustom(identity.callId, index, intended);
|
|
2009
|
+
writeFieldWithChange(field, intended);
|
|
2010
|
+
if (hostHasCheckedOption(card)) writeFieldWithChange(field, intended);
|
|
2011
|
+
}
|
|
2012
|
+
ensureCustomChoiceUI(card, identity);
|
|
2013
|
+
field?.focus();
|
|
2014
|
+
return;
|
|
2015
|
+
}
|
|
1680
2016
|
if (button.classList.contains("dqtp-auto-infinite")) {
|
|
1681
2017
|
event.preventDefault();
|
|
1682
2018
|
event.stopPropagation();
|
|
@@ -1712,6 +2048,7 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1712
2048
|
paused.delete(identity.callId);
|
|
1713
2049
|
deadlines.delete(identity.callId);
|
|
1714
2050
|
lastDrafts.delete(identity.callId);
|
|
2051
|
+
clearCustomState(identity.callId);
|
|
1715
2052
|
};
|
|
1716
2053
|
document.addEventListener("click", onDocumentClick, true);
|
|
1717
2054
|
const visibleSessionIds = (containers) => {
|
|
@@ -1737,15 +2074,28 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1737
2074
|
subscriptionMissing.delete(sessionId);
|
|
1738
2075
|
continue;
|
|
1739
2076
|
}
|
|
1740
|
-
const
|
|
1741
|
-
if (
|
|
1742
|
-
subscriptionMissing.set(sessionId,
|
|
2077
|
+
const missingSince = subscriptionMissing.get(sessionId);
|
|
2078
|
+
if (missingSince === void 0) {
|
|
2079
|
+
subscriptionMissing.set(sessionId, Date.now());
|
|
1743
2080
|
continue;
|
|
1744
2081
|
}
|
|
2082
|
+
if (Date.now() - missingSince < 6e5) continue;
|
|
1745
2083
|
off();
|
|
1746
2084
|
subscriptions.delete(sessionId);
|
|
1747
2085
|
subscriptionMissing.delete(sessionId);
|
|
1748
|
-
|
|
2086
|
+
polledSessions.set(sessionId, () => {
|
|
2087
|
+
try {
|
|
2088
|
+
const face = resolveProjectionFace(ctx, sessionId);
|
|
2089
|
+
if (face === void 0) return;
|
|
2090
|
+
evaluateProjection(sessionId, face.getSnapshot?.());
|
|
2091
|
+
} catch (error) {
|
|
2092
|
+
if (evaluateWarned.has(sessionId)) return;
|
|
2093
|
+
evaluateWarned.add(sessionId);
|
|
2094
|
+
console.warn("[question-timeout-protection] 评估提问投影时出错, 该会话的兜底可能受影响", error);
|
|
2095
|
+
}
|
|
2096
|
+
});
|
|
2097
|
+
subscriptionSeen.set(sessionId, Date.now());
|
|
2098
|
+
enforcePolledLimit();
|
|
1749
2099
|
subscribeWarned.delete(sessionId);
|
|
1750
2100
|
evaluateWarned.delete(sessionId);
|
|
1751
2101
|
}
|
|
@@ -1762,11 +2112,13 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1762
2112
|
}
|
|
1763
2113
|
subscriptionSeen.set(identity.sessionId, Date.now());
|
|
1764
2114
|
ensureSubscription(identity.sessionId);
|
|
2115
|
+
if (enhancementOn && !passive.has(identity.callId) && (callActive.has(identity.callId) || hostStillWaiting(element))) ensureCustomChoiceUI(element, identity);
|
|
2116
|
+
else removeCustomChoiceUI(element);
|
|
1765
2117
|
if (enhancementOn && (callActive.has(identity.callId) || hostStillWaiting(element))) {
|
|
1766
2118
|
const previous = lastDrafts.get(identity.callId);
|
|
1767
2119
|
const progress = readProgress(element);
|
|
1768
2120
|
const count = Math.max(progress?.count ?? 1, previous?.length ?? 1);
|
|
1769
|
-
lastDrafts.set(identity.callId, mergeDrafts(gateDraftSelections(readHostDrafts(identity, count), identity.callId), readLiveDrafts(element, count, readLiveSelected(element, identity.callId)), previous, count, progress?.index));
|
|
2121
|
+
lastDrafts.set(identity.callId, applyCustomChoice(mergeDrafts(gateDraftSelections(readHostDrafts(identity, count), identity.callId), readLiveDrafts(element, count, readLiveSelected(element, identity.callId)), previous, count, progress?.index), identity.callId));
|
|
1770
2122
|
}
|
|
1771
2123
|
if (enhancementOn) decorateCard(element, identity);
|
|
1772
2124
|
else restoreCardOnce(element, QUESTION_CARD_KEY_PREFIX + identity.sessionId + ":" + identity.callId);
|
|
@@ -1818,6 +2170,18 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1818
2170
|
if (!(target instanceof Element) || target.closest("[data-question-key]") === null) return;
|
|
1819
2171
|
invalidateHostDraftCache();
|
|
1820
2172
|
scheduleScan();
|
|
2173
|
+
if (!event.isTrusted) return;
|
|
2174
|
+
const card = target.closest(QUESTION_CARD_SELECTOR);
|
|
2175
|
+
if (!(card instanceof HTMLElement)) return;
|
|
2176
|
+
const identity = parseCardKey(card.getAttribute("data-question-key"));
|
|
2177
|
+
const index = readProgress(card)?.index;
|
|
2178
|
+
if (identity === void 0 || index === void 0) return;
|
|
2179
|
+
const field = customFieldOf(card);
|
|
2180
|
+
if (field === void 0 || field !== target) return;
|
|
2181
|
+
if (card.querySelector("[role=\"radiogroup\"]") === null) return;
|
|
2182
|
+
rememberTypedCustom(identity.callId, index, field.value);
|
|
2183
|
+
setCustomChoice(identity.callId, index, true);
|
|
2184
|
+
ensureCustomChoiceUI(card, identity);
|
|
1821
2185
|
};
|
|
1822
2186
|
window.addEventListener("storage", onDraftStorageChange);
|
|
1823
2187
|
document.addEventListener("input", onDraftContentChange, true);
|
|
@@ -1844,20 +2208,22 @@ function installQuestionTimeoutAdapter(ctx, source) {
|
|
|
1844
2208
|
closeDraftPanel();
|
|
1845
2209
|
for (const off of subscriptions.values()) off();
|
|
1846
2210
|
subscriptions.clear();
|
|
1847
|
-
for (const element of Array.from(document.querySelectorAll(QUESTION_CARD_SELECTOR)))
|
|
1848
|
-
|
|
2211
|
+
for (const element of Array.from(document.querySelectorAll(QUESTION_CARD_SELECTOR))) {
|
|
2212
|
+
if (!(element instanceof HTMLElement)) continue;
|
|
1849
2213
|
element.removeAttribute(CARD_DISMISSED_ATTRIBUTE);
|
|
2214
|
+
restoreCard(element);
|
|
1850
2215
|
}
|
|
1851
|
-
for (const element of Array.from(document.querySelectorAll("[data-dqtp-countdown], button.dqtp-infinite-wait, button.dqtp-question-bubble"))) element.remove();
|
|
2216
|
+
for (const element of Array.from(document.querySelectorAll("[data-dqtp-countdown], button.dqtp-infinite-wait, button.dqtp-question-bubble, button.dqtp-custom-radio, button.dqtp-custom-hint"))) element.remove();
|
|
1852
2217
|
for (const element of Array.from(document.querySelectorAll("." + HIDDEN_CONTROL_CLASS))) element.classList.remove(HIDDEN_CONTROL_CLASS);
|
|
1853
2218
|
for (const element of Array.from(document.querySelectorAll("[data-dqtp-host-wait]"))) element.removeAttribute(HIDDEN_WAIT_ATTRIBUTE);
|
|
1854
2219
|
for (const element of Array.from(document.querySelectorAll("button.dqtp-auto-infinite"))) element.remove();
|
|
2220
|
+
for (const element of Array.from(document.querySelectorAll(".dqtp-custom-choice"))) element.classList.remove(CUSTOM_CHOICE_CLASS);
|
|
1855
2221
|
releaseStyle();
|
|
1856
2222
|
enhancementUsers -= 1;
|
|
1857
2223
|
if (enhancementUsers <= 0) document.documentElement.classList.remove(CARD_ENHANCEMENTS_CLASS);
|
|
1858
2224
|
syncUnavailable.clear();
|
|
1859
2225
|
autoInfiniteAttempted.clear();
|
|
1860
|
-
|
|
2226
|
+
dismissFailedWarned.clear();
|
|
1861
2227
|
subscribeWarned.clear();
|
|
1862
2228
|
evaluateWarned.clear();
|
|
1863
2229
|
};
|