zois-core 1.0.3 → 1.0.4
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 +16 -16
- package/dist/index.d.ts +1 -0
- package/dist/messaging.d.ts +8 -0
- package/dist/messaging.js +44 -2
- package/dist/modsApi.js +20 -1
- package/dist/styles.css +22 -4
- package/dist/ui.d.ts +5 -1
- package/dist/ui.js +26 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
⠀⠀⠀⠀⠀⡟⠈⠛⢦⣄⠀⠀⠀⠀⠀⣀⡴⠚⠩⠘⡇⠀⠀
|
|
3
|
+
⠀⠀⠀⠀⠀⣧⠀⡀⠄⠈⠛⠛⠛⠛⢛⠁⠌⠀⠀⠀⡇⠀⠀
|
|
4
|
+
⠀⠀⠀⠀⠀⣿⠞⠁⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣧
|
|
5
|
+
⠀⠀⠀⠀⣼⠃⢠⠤⢤⠀⠀⠀⠀⢀⡤⢤⡀⠀⠀⠀⠘⣧
|
|
6
|
+
⠀⢀⣤⣤⣧⡄⠀⠀⠀⠀⣤⡀⠀⠀⠀⠀⠁⣤⣤⣤⣤⣼⣦⡄
|
|
7
|
+
⠀⢀⣠⡤⣷⠶⠀⠀⠀⠦⠜⠤⠄⠀⠀⠀⠰⠦⣤⣄⣀⣸⠃
|
|
8
|
+
⠀⠀⠀⠀⠘⢧⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣽⣋⠁
|
|
9
|
+
⠀⠀⠀⠀⠀⠀⠈⠙⢳⡶⠶⠶⠶⠶⠶⠶⠖⠛⠛⠍⠀⠉⠛
|
|
10
|
+
⠀⠀⠀⠀⠀⠀⠀⢠⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣦⡀
|
|
11
|
+
⠀⠀⠀⠀⠀⠀⠀⣾⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢷⡀
|
|
12
|
+
⠀⠀⠀⠀⠀⠀⠀⣏⠀⠀⠀⠀⢠⠆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇
|
|
13
|
+
⠀⠀⠀⠀⠀⠀⠀⢻⡀⠀⠀⠀⣿⠀⠀⠀⠀⢠⡾⠋⠁⠀⠀⠀⠀⠀⠀⢸⡇
|
|
14
|
+
⠀⠀⠀⠀⠀⠀⠀⠈⢷⡀⠀⠀⣿⠀⠀⠀⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⠃
|
|
15
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠈⢧⣀⣠⣼⣧⣀⣀⣰⣟⡀⠀⠀⠀⠀⠀⢀⣀⣼⢿⡀
|
|
16
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣟⠁⠀⠉⠉⠉⠉⠙⠛⠛⠛⠻⠿⠛⠛⠉⠁⣼⠁
|
|
17
|
+
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢦⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⡴⠞⠁
|
|
18
18
|
|
|
19
19
|
## The core for the my mods, which contains a shared code reused in all my mods
|
package/dist/index.d.ts
CHANGED
package/dist/messaging.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
interface RequestResponse<T> {
|
|
2
|
+
data?: T;
|
|
3
|
+
isError: boolean;
|
|
4
|
+
}
|
|
1
5
|
export declare function chatSendLocal(message: string | Node): void;
|
|
2
6
|
export declare function chatSendActionMessage(msg: string, target?: undefined | number, dictionary?: ChatMessageDictionaryEntry[]): void;
|
|
3
7
|
export declare function chatSendModMessage<T>(msg: string, _data?: T, targetNumber?: any): void;
|
|
4
8
|
export declare function chatSendBeep(data: any, targetId: number): void;
|
|
9
|
+
export declare function sendRequest<T>(message: string, data: any, target: number): Promise<RequestResponse<T>>;
|
|
5
10
|
export declare function handleRequestResponse(requestId: number, data: any): void;
|
|
11
|
+
export declare function handleRequest(requestId: number, message: string, _data: any, sender: Character): void;
|
|
12
|
+
export declare function addRequestListener(message: string, listener: (data: any, sender: Character) => any): void;
|
|
13
|
+
export {};
|
package/dist/messaging.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { MOD_DATA } from "./index";
|
|
1
|
+
import { getRandomNumber, MOD_DATA } from "./index";
|
|
2
2
|
const pendingRequests = /* @__PURE__ */ new Map();
|
|
3
|
+
const requestListeners = /* @__PURE__ */ new Map();
|
|
3
4
|
function chatSendLocal(message) {
|
|
4
5
|
if (!ServerPlayerIsInChatRoom()) return;
|
|
5
6
|
const div = document.createElement("div");
|
|
@@ -57,6 +58,29 @@ function chatSendBeep(data, targetId) {
|
|
|
57
58
|
};
|
|
58
59
|
ServerSend("AccountBeep", beep);
|
|
59
60
|
}
|
|
61
|
+
function sendRequest(message, data, target) {
|
|
62
|
+
return new Promise((resolve, reject) => {
|
|
63
|
+
const requestId = parseInt(`${Date.now()}${getRandomNumber(1e3, 1e4)}`);
|
|
64
|
+
pendingRequests.set(requestId, {
|
|
65
|
+
message,
|
|
66
|
+
data,
|
|
67
|
+
target,
|
|
68
|
+
resolve,
|
|
69
|
+
reject
|
|
70
|
+
});
|
|
71
|
+
chatSendModMessage("request", {
|
|
72
|
+
requestId,
|
|
73
|
+
message,
|
|
74
|
+
data
|
|
75
|
+
}, target);
|
|
76
|
+
setTimeout(() => {
|
|
77
|
+
pendingRequests.delete(requestId);
|
|
78
|
+
resolve({
|
|
79
|
+
isError: true
|
|
80
|
+
});
|
|
81
|
+
}, 6e3);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
60
84
|
function handleRequestResponse(requestId, data) {
|
|
61
85
|
const request = pendingRequests.get(requestId);
|
|
62
86
|
if (!request) return;
|
|
@@ -64,10 +88,28 @@ function handleRequestResponse(requestId, data) {
|
|
|
64
88
|
data
|
|
65
89
|
});
|
|
66
90
|
}
|
|
91
|
+
function handleRequest(requestId, message, _data, sender) {
|
|
92
|
+
const listener = requestListeners.get(message);
|
|
93
|
+
if (!listener) return;
|
|
94
|
+
const data = listener(_data, sender);
|
|
95
|
+
if (data !== void 0) {
|
|
96
|
+
chatSendModMessage("requestResponse", {
|
|
97
|
+
requestId,
|
|
98
|
+
message,
|
|
99
|
+
data
|
|
100
|
+
}, sender.MemberNumber);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function addRequestListener(message, listener) {
|
|
104
|
+
requestListeners.set(message, listener);
|
|
105
|
+
}
|
|
67
106
|
export {
|
|
107
|
+
addRequestListener,
|
|
68
108
|
chatSendActionMessage,
|
|
69
109
|
chatSendBeep,
|
|
70
110
|
chatSendLocal,
|
|
71
111
|
chatSendModMessage,
|
|
72
|
-
|
|
112
|
+
handleRequest,
|
|
113
|
+
handleRequestResponse,
|
|
114
|
+
sendRequest
|
|
73
115
|
};
|
package/dist/modsApi.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import bcModSdk from "bondage-club-mod-sdk";
|
|
2
|
-
import { MOD_DATA } from "./index";
|
|
2
|
+
import { getPlayer, MOD_DATA } from "./index";
|
|
3
3
|
import { getCurrentSubscreen } from "./ui";
|
|
4
|
+
import { handleRequest, handleRequestResponse } from "./messaging";
|
|
4
5
|
var HookPriority = /* @__PURE__ */ ((HookPriority2) => {
|
|
5
6
|
HookPriority2[HookPriority2["OBSERVE"] = 0] = "OBSERVE";
|
|
6
7
|
HookPriority2[HookPriority2["ADD_BEHAVIOR"] = 1] = "ADD_BEHAVIOR";
|
|
@@ -21,6 +22,24 @@ function registerMod() {
|
|
|
21
22
|
if (CommonKey.IsPressed(args[0], "Escape") && getCurrentSubscreen()) getCurrentSubscreen().exit();
|
|
22
23
|
return next(args);
|
|
23
24
|
});
|
|
25
|
+
hookFunction("ChatRoomMessage", 1 /* ADD_BEHAVIOR */, (args, next) => {
|
|
26
|
+
const message = args[0];
|
|
27
|
+
const sender = getPlayer(message.Sender);
|
|
28
|
+
if (!sender) return next(args);
|
|
29
|
+
if (message.Content === MOD_DATA.key && !sender.IsPlayer()) {
|
|
30
|
+
const msg = message.Dictionary.msg;
|
|
31
|
+
const data = message.Dictionary.data;
|
|
32
|
+
console.log("message.Dictionary.data", data);
|
|
33
|
+
if (msg === "request") {
|
|
34
|
+
if (typeof data.requestId !== "number" || typeof data.message !== "string") return;
|
|
35
|
+
handleRequest(data.requestId, data.message, data.data, sender);
|
|
36
|
+
}
|
|
37
|
+
if (msg === "requestResponse") {
|
|
38
|
+
if (typeof data.requestId !== "number") return;
|
|
39
|
+
handleRequestResponse(data.requestId, data.data);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
});
|
|
24
43
|
}
|
|
25
44
|
function hookFunction(functionName, priority, hook) {
|
|
26
45
|
if (!modSdk) throw new Error("zois-core is not registered");
|
package/dist/styles.css
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
@import "https://fonts.googleapis.com/css2?family=Emilys+Candy&display=swap";
|
|
2
1
|
* {
|
|
3
2
|
margin: 0;
|
|
4
3
|
padding: 0;
|
|
@@ -7,7 +6,6 @@
|
|
|
7
6
|
.zcButton {
|
|
8
7
|
cursor: pointer;
|
|
9
8
|
background: var(--tmd-element, white);
|
|
10
|
-
font-family: "Emilys Candy";
|
|
11
9
|
color: var(--tmd-text, black);
|
|
12
10
|
border: 2px solid var(--tmd-accent, black);
|
|
13
11
|
border-radius: 4px;
|
|
@@ -17,6 +15,28 @@
|
|
|
17
15
|
border-color: var(--tmd-accent-hover, #7dd3fc);
|
|
18
16
|
color: var(--tmd-accent-hover, #015a8c);
|
|
19
17
|
}
|
|
18
|
+
.zcButton .tooltip {
|
|
19
|
+
position: absolute;
|
|
20
|
+
color: black;
|
|
21
|
+
text-align: center;
|
|
22
|
+
padding: 4px;
|
|
23
|
+
border-radius: 4px;
|
|
24
|
+
background: #FFFF88;
|
|
25
|
+
border: 2px solid #e7e787;
|
|
26
|
+
width: max-content;
|
|
27
|
+
min-height: 100%;
|
|
28
|
+
visibility: hidden;
|
|
29
|
+
z-index: 10;
|
|
30
|
+
}
|
|
31
|
+
.zcButton .tooltip[position=left] {
|
|
32
|
+
right: calc(100% + 1vw);
|
|
33
|
+
}
|
|
34
|
+
.zcButton .tooltip[position=right] {
|
|
35
|
+
left: calc(100% + 1vw);
|
|
36
|
+
}
|
|
37
|
+
.zcButton:hover .tooltip {
|
|
38
|
+
visibility: visible;
|
|
39
|
+
}
|
|
20
40
|
.zcButton[data-zc-style=green] {
|
|
21
41
|
background: rgb(124, 255, 124);
|
|
22
42
|
border-color: rgb(82, 204, 82);
|
|
@@ -36,7 +56,6 @@
|
|
|
36
56
|
}
|
|
37
57
|
.zcInput {
|
|
38
58
|
background: var(--tmd-element, white);
|
|
39
|
-
font-family: Emilys Candy;
|
|
40
59
|
color: var(--tmd-text, black);
|
|
41
60
|
padding: 2vw;
|
|
42
61
|
border: 2px solid var(--tmd-accent, black);
|
|
@@ -51,7 +70,6 @@
|
|
|
51
70
|
justify-content: center;
|
|
52
71
|
align-items: center;
|
|
53
72
|
background: var(--tmd-element, white);
|
|
54
|
-
font-family: Emilys Candy;
|
|
55
73
|
color: var(--tmd-text, black);
|
|
56
74
|
border: 2px solid var(--tmd-accent, black);
|
|
57
75
|
border-radius: 4px;
|
package/dist/ui.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ interface CreateButtonArgs {
|
|
|
13
13
|
icon?: string;
|
|
14
14
|
iconAbsolutePosition?: boolean;
|
|
15
15
|
iconWidth?: string;
|
|
16
|
+
tooltip?: {
|
|
17
|
+
text: string;
|
|
18
|
+
position: "left" | "right";
|
|
19
|
+
};
|
|
16
20
|
onClick?: () => void;
|
|
17
21
|
isDisabled?: () => boolean;
|
|
18
22
|
}
|
|
@@ -113,7 +117,7 @@ export declare abstract class BaseSubscreen {
|
|
|
113
117
|
update?(): void;
|
|
114
118
|
setPreviousSubscreen(): void;
|
|
115
119
|
setSubscreen(subscreen: BaseSubscreen | null): void;
|
|
116
|
-
createButton({ text, x, y, width, height, fontSize, anchor, padding, style, place, icon, iconAbsolutePosition, iconWidth, onClick, isDisabled }: CreateButtonArgs): HTMLButtonElement;
|
|
120
|
+
createButton({ text, x, y, width, height, fontSize, anchor, padding, style, place, icon, iconAbsolutePosition, iconWidth, tooltip, onClick, isDisabled }: CreateButtonArgs): HTMLButtonElement;
|
|
117
121
|
createText({ text, color, x, y, width, height, withBackground, fontSize, anchor, padding, place }: CreateTextArgs): HTMLParagraphElement;
|
|
118
122
|
createInput({ value, placeholder, x, y, width, height, textArea, fontSize, anchor, padding, place, onChange, onInput, isDisabled }: CreateInputArgs): HTMLInputElement | HTMLTextAreaElement;
|
|
119
123
|
createCheckbox({ text, x, y, isChecked, width, anchor, place, isDisabled, onChange }: CreateCheckboxArgs): HTMLInputElement;
|
package/dist/ui.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MOD_DATA } from "./index";
|
|
1
2
|
function getRelativeHeight(height) {
|
|
2
3
|
return height * (MainCanvas.canvas.clientHeight / 1e3);
|
|
3
4
|
}
|
|
@@ -38,6 +39,9 @@ function setFontSize(element, targetFontSize) {
|
|
|
38
39
|
fontSize: fontSize + "px"
|
|
39
40
|
});
|
|
40
41
|
}
|
|
42
|
+
function setFontFamily(element, fontFamily) {
|
|
43
|
+
element.style.fontFamily = fontFamily ?? "sans-serif";
|
|
44
|
+
}
|
|
41
45
|
function setPadding(element, targetPadding) {
|
|
42
46
|
const canvasWidth = MainCanvas.canvas.clientWidth;
|
|
43
47
|
const canvasHeight = MainCanvas.canvas.clientHeight;
|
|
@@ -128,6 +132,7 @@ class BaseSubscreen {
|
|
|
128
132
|
icon,
|
|
129
133
|
iconAbsolutePosition = true,
|
|
130
134
|
iconWidth,
|
|
135
|
+
tooltip,
|
|
131
136
|
onClick,
|
|
132
137
|
isDisabled
|
|
133
138
|
}) {
|
|
@@ -138,6 +143,7 @@ class BaseSubscreen {
|
|
|
138
143
|
btn.style.alignItems = "center";
|
|
139
144
|
btn.style.justifyContent = "center";
|
|
140
145
|
btn.style.columnGap = "1.25vw";
|
|
146
|
+
setFontFamily(btn, MOD_DATA.fontFamily);
|
|
141
147
|
if (icon) {
|
|
142
148
|
const img = document.createElement("img");
|
|
143
149
|
img.src = icon;
|
|
@@ -159,6 +165,13 @@ class BaseSubscreen {
|
|
|
159
165
|
}
|
|
160
166
|
btn.append(span);
|
|
161
167
|
}
|
|
168
|
+
if (tooltip) {
|
|
169
|
+
const tooltipEl = document.createElement("span");
|
|
170
|
+
tooltipEl.classList.add("tooltip");
|
|
171
|
+
tooltipEl.setAttribute("position", tooltip.position);
|
|
172
|
+
tooltipEl.textContent = tooltip.text;
|
|
173
|
+
btn.append(tooltipEl);
|
|
174
|
+
}
|
|
162
175
|
const setProperties = () => {
|
|
163
176
|
if (typeof x === "number" && typeof y === "number") setPosition(btn, x, y, anchor);
|
|
164
177
|
setSize(btn, width, height);
|
|
@@ -172,7 +185,7 @@ class BaseSubscreen {
|
|
|
172
185
|
if (typeof isDisabled === "function" && !isDisabled() && typeof onClick === "function") {
|
|
173
186
|
onClick();
|
|
174
187
|
}
|
|
175
|
-
if (isDisabled
|
|
188
|
+
if (typeof isDisabled === "function" && isDisabled()) btn.classList.add("zcDisabled");
|
|
176
189
|
});
|
|
177
190
|
window.addEventListener("resize", setProperties);
|
|
178
191
|
if (place) document.body.append(btn);
|
|
@@ -197,7 +210,7 @@ class BaseSubscreen {
|
|
|
197
210
|
p.innerHTML = text;
|
|
198
211
|
p.style.color = color ?? "var(--tmd-text, black)";
|
|
199
212
|
if (withBackground) p.style.background = "var(--tmd-element,rgb(239, 239, 239))";
|
|
200
|
-
p
|
|
213
|
+
setFontFamily(p);
|
|
201
214
|
const setProperties = () => {
|
|
202
215
|
if (typeof x === "number" && typeof y === "number") setPosition(p, x, y, anchor);
|
|
203
216
|
setSize(p, width, height);
|
|
@@ -232,6 +245,7 @@ class BaseSubscreen {
|
|
|
232
245
|
input.classList.add("zcInput");
|
|
233
246
|
if (placeholder) input.placeholder = placeholder;
|
|
234
247
|
if (value) input.value = value;
|
|
248
|
+
setFontFamily(input, MOD_DATA.fontFamily);
|
|
235
249
|
const setProperties = () => {
|
|
236
250
|
if (typeof x === "number" && typeof y === "number") setPosition(input, x, y, anchor);
|
|
237
251
|
setSize(input, width, height);
|
|
@@ -245,13 +259,13 @@ class BaseSubscreen {
|
|
|
245
259
|
if (typeof isDisabled === "function" && !isDisabled() && typeof onChange === "function") {
|
|
246
260
|
onChange();
|
|
247
261
|
}
|
|
248
|
-
if (isDisabled
|
|
262
|
+
if (typeof isDisabled === "function" && isDisabled()) input.classList.add("zcDisabled");
|
|
249
263
|
});
|
|
250
264
|
input.addEventListener("input", () => {
|
|
251
265
|
if (typeof isDisabled === "function" && !isDisabled() && typeof onInput === "function") {
|
|
252
266
|
onInput();
|
|
253
267
|
}
|
|
254
|
-
if (isDisabled
|
|
268
|
+
if (typeof isDisabled === "function" && isDisabled()) input.classList.add("zcDisabled");
|
|
255
269
|
});
|
|
256
270
|
window.addEventListener("resize", setProperties);
|
|
257
271
|
if (place) document.body.append(input);
|
|
@@ -277,7 +291,7 @@ class BaseSubscreen {
|
|
|
277
291
|
const p = document.createElement("p");
|
|
278
292
|
p.textContent = text;
|
|
279
293
|
p.style.color = "var(--tmd-text, black)";
|
|
280
|
-
p
|
|
294
|
+
setFontFamily(p);
|
|
281
295
|
const setProperties = () => {
|
|
282
296
|
if (typeof x === "number" && typeof y === "number") setPosition(checkbox, x, y, anchor);
|
|
283
297
|
setPosition(p, x + 100, y, anchor);
|
|
@@ -291,7 +305,7 @@ class BaseSubscreen {
|
|
|
291
305
|
if (typeof isDisabled === "function" && !isDisabled() && typeof onChange === "function") {
|
|
292
306
|
onChange();
|
|
293
307
|
}
|
|
294
|
-
if (isDisabled
|
|
308
|
+
if (typeof isDisabled === "function" && isDisabled()) checkbox.classList.add("zcDisabled");
|
|
295
309
|
});
|
|
296
310
|
window.addEventListener("resize", setProperties);
|
|
297
311
|
if (place) document.body.append(checkbox, p);
|
|
@@ -339,8 +353,9 @@ class BaseSubscreen {
|
|
|
339
353
|
const div = document.createElement("div");
|
|
340
354
|
div.style.cssText = `
|
|
341
355
|
display: flex; flex-direction: column; gap: 1vw; border: 2px solid var(--tmd-accent, black);
|
|
342
|
-
|
|
356
|
+
border-radius: 4px; padding: 0.75vw;
|
|
343
357
|
`;
|
|
358
|
+
setFontFamily(div, MOD_DATA.fontFamily);
|
|
344
359
|
const buttonsElement = document.createElement("div");
|
|
345
360
|
buttonsElement.style.cssText = "display: flex; justify-content: center; column-gap: 1vw; width: 100%;";
|
|
346
361
|
const titleElement = document.createElement("b");
|
|
@@ -361,7 +376,7 @@ class BaseSubscreen {
|
|
|
361
376
|
b.addEventListener("click", onClick);
|
|
362
377
|
};
|
|
363
378
|
const addItem = (text) => {
|
|
364
|
-
if (isDisabled
|
|
379
|
+
if (typeof isDisabled === "function" && isDisabled()) return div.classList.add("zcDisabled");
|
|
365
380
|
const item = document.createElement("div");
|
|
366
381
|
item.style.cssText = "cursor: pointer; background: var(--tmd-element-hover, rgb(206, 206, 206)); color: var(--tmd-text, black); height: fit-content; padding: 0.8vw; border-radius: 0.8vw; font-size: clamp(8px, 2vw, 20px);";
|
|
367
382
|
item.textContent = text;
|
|
@@ -379,14 +394,14 @@ class BaseSubscreen {
|
|
|
379
394
|
setSize(div, width, height);
|
|
380
395
|
};
|
|
381
396
|
addButton("Icons/Cancel.png", () => {
|
|
382
|
-
if (isDisabled
|
|
397
|
+
if (typeof isDisabled === "function" && isDisabled()) return div.classList.add("zcDisabled");
|
|
383
398
|
itemsElement.innerHTML = "";
|
|
384
399
|
items.splice(0, items.length);
|
|
385
400
|
itemsElement.append(input);
|
|
386
401
|
value.forEach((v) => addItem(String(v)));
|
|
387
402
|
});
|
|
388
403
|
addButton("Icons/Trash.png", () => {
|
|
389
|
-
if (isDisabled
|
|
404
|
+
if (typeof isDisabled === "function" && isDisabled()) div.classList.add("zcDisabled");
|
|
390
405
|
for (const c of [...itemsElement.children]) {
|
|
391
406
|
if (c.getAttribute("style").includes("border: 2px solid red;")) {
|
|
392
407
|
items.splice(items.indexOf(c.textContent), 1);
|
|
@@ -452,6 +467,7 @@ class BaseSubscreen {
|
|
|
452
467
|
}) {
|
|
453
468
|
const div = document.createElement("div");
|
|
454
469
|
div.classList.add("zcBackNextButton");
|
|
470
|
+
setFontFamily(div, MOD_DATA.fontFamily);
|
|
455
471
|
const backBtn = document.createElement("button");
|
|
456
472
|
backBtn.style.cssText = "position: absolute; left: 1vw; font-size: 3.5vw; aspect-ratio: 1/1; height: 140%;";
|
|
457
473
|
backBtn.classList.add("zcButton");
|