bc-deeplib 1.0.6 → 1.1.1
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/CREDITS.md +13 -0
- package/LICENSE +21 -21
- package/README.md +2 -2
- package/dist/3rd_party_types/bcmodsdk.d.ts +184 -0
- package/dist/3rd_party_types/declarations.d.ts +4 -0
- package/dist/deeplib.d.ts +538 -0
- package/dist/deeplib.js +2391 -1714
- package/dist/deeplib.js.map +7 -1
- package/dist/index.js +2556 -0
- package/dist/index.js.map +7 -0
- package/dist/public/dl_images/arrow_left.svg +1 -0
- package/dist/public/dl_images/arrow_right.svg +1 -0
- package/dist/public/dl_images/bug.svg +1 -0
- package/dist/public/dl_images/clipboard_export.svg +19 -0
- package/dist/public/dl_images/clipboard_import.svg +19 -0
- package/dist/public/dl_images/cog.svg +1 -0
- package/dist/public/dl_images/exit.svg +1 -0
- package/dist/public/dl_images/file_export.svg +12 -0
- package/dist/public/dl_images/file_import.svg +12 -0
- package/dist/public/dl_images/git.svg +10 -0
- package/dist/public/dl_images/notebook.svg +1 -0
- package/dist/public/dl_images/round_arrow_left.svg +1 -0
- package/dist/public/dl_images/round_arrow_right.svg +1 -0
- package/dist/public/dl_images/round_transfer.svg +7 -0
- package/dist/public/dl_images/transfer.svg +1 -0
- package/dist/public/dl_images/trash_bin.svg +1 -0
- package/dist/public/dl_translations/en.lang +17 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/vendored_types/bcmodsdk.d.ts +184 -0
- package/dist/vendored_types/declarations.d.ts +5 -0
- package/lib/build.d.ts +32 -0
- package/lib/build.js +236 -0
- package/package.json +42 -25
- package/.types/declarations.d.ts +0 -15
- package/.types/elements.d.ts +0 -38
- package/.types/type-override.d.ts +0 -3
- package/dist/public/styles/DeepLib.css +0 -206
- package/dist/public/styles/Gratitude.css +0 -23
- package/public/styles/DeepLib.css +0 -206
- package/public/styles/Gratitude.css +0 -23
package/dist/deeplib.js
CHANGED
|
@@ -1,44 +1,515 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
|
|
28
|
+
// node_modules/.pnpm/bondage-club-mod-sdk@1.2.0/node_modules/bondage-club-mod-sdk/dist/bcmodsdk.js
|
|
29
|
+
var require_bcmodsdk = __commonJS({
|
|
30
|
+
"node_modules/.pnpm/bondage-club-mod-sdk@1.2.0/node_modules/bondage-club-mod-sdk/dist/bcmodsdk.js"(exports) {
|
|
31
|
+
var bcModSdk = function() {
|
|
32
|
+
"use strict";
|
|
33
|
+
const o = "1.2.0";
|
|
34
|
+
function e(o2) {
|
|
35
|
+
alert("Mod ERROR:\n" + o2);
|
|
36
|
+
const e2 = new Error(o2);
|
|
37
|
+
throw console.error(e2), e2;
|
|
38
|
+
}
|
|
39
|
+
__name(e, "e");
|
|
40
|
+
const t = new TextEncoder();
|
|
41
|
+
function n(o2) {
|
|
42
|
+
return !!o2 && "object" == typeof o2 && !Array.isArray(o2);
|
|
43
|
+
}
|
|
44
|
+
__name(n, "n");
|
|
45
|
+
function r(o2) {
|
|
46
|
+
const e2 = /* @__PURE__ */ new Set();
|
|
47
|
+
return o2.filter((o3) => !e2.has(o3) && e2.add(o3));
|
|
48
|
+
}
|
|
49
|
+
__name(r, "r");
|
|
50
|
+
const i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
|
|
51
|
+
function c(o2) {
|
|
52
|
+
a.has(o2) || (a.add(o2), console.warn(o2));
|
|
53
|
+
}
|
|
54
|
+
__name(c, "c");
|
|
55
|
+
function s(o2) {
|
|
56
|
+
const e2 = [], t2 = /* @__PURE__ */ new Map(), n2 = /* @__PURE__ */ new Set();
|
|
57
|
+
for (const r3 of f.values()) {
|
|
58
|
+
const i3 = r3.patching.get(o2.name);
|
|
59
|
+
if (i3) {
|
|
60
|
+
e2.push(...i3.hooks);
|
|
61
|
+
for (const [e3, a2] of i3.patches.entries()) t2.has(e3) && t2.get(e3) !== a2 && c(`ModSDK: Mod '${r3.name}' is patching function ${o2.name} with same pattern that is already applied by different mod, but with different pattern:
|
|
62
|
+
Pattern:
|
|
63
|
+
${e3}
|
|
64
|
+
Patch1:
|
|
65
|
+
${t2.get(e3) || ""}
|
|
66
|
+
Patch2:
|
|
67
|
+
${a2}`), t2.set(e3, a2), n2.add(r3.name);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
e2.sort((o3, e3) => e3.priority - o3.priority);
|
|
71
|
+
const r2 = function(o3, e3) {
|
|
72
|
+
if (0 === e3.size) return o3;
|
|
73
|
+
let t3 = o3.toString().replaceAll("\r\n", "\n");
|
|
74
|
+
for (const [n3, r3] of e3.entries()) t3.includes(n3) || c(`ModSDK: Patching ${o3.name}: Patch ${n3} not applied`), t3 = t3.replaceAll(n3, r3);
|
|
75
|
+
return (0, eval)(`(${t3})`);
|
|
76
|
+
}(o2.original, t2);
|
|
77
|
+
let i2 = /* @__PURE__ */ __name(function(e3) {
|
|
78
|
+
var t3, i3;
|
|
79
|
+
const a2 = null === (i3 = (t3 = m.errorReporterHooks).hookChainExit) || void 0 === i3 ? void 0 : i3.call(t3, o2.name, n2), c2 = r2.apply(this, e3);
|
|
80
|
+
return null == a2 || a2(), c2;
|
|
81
|
+
}, "i");
|
|
82
|
+
for (let t3 = e2.length - 1; t3 >= 0; t3--) {
|
|
83
|
+
const n3 = e2[t3], r3 = i2;
|
|
84
|
+
i2 = /* @__PURE__ */ __name(function(e3) {
|
|
85
|
+
var t4, i3;
|
|
86
|
+
const a2 = null === (i3 = (t4 = m.errorReporterHooks).hookEnter) || void 0 === i3 ? void 0 : i3.call(t4, o2.name, n3.mod), c2 = n3.hook.apply(this, [e3, (o3) => {
|
|
87
|
+
if (1 !== arguments.length || !Array.isArray(e3)) throw new Error(`Mod ${n3.mod} failed to call next hook: Expected args to be array, got ${typeof o3}`);
|
|
88
|
+
return r3.call(this, o3);
|
|
89
|
+
}]);
|
|
90
|
+
return null == a2 || a2(), c2;
|
|
91
|
+
}, "i");
|
|
92
|
+
}
|
|
93
|
+
return { hooks: e2, patches: t2, patchesSources: n2, enter: i2, final: r2 };
|
|
94
|
+
}
|
|
95
|
+
__name(s, "s");
|
|
96
|
+
function l(o2, e2 = false) {
|
|
97
|
+
let r2 = i.get(o2);
|
|
98
|
+
if (r2) e2 && (r2.precomputed = s(r2));
|
|
99
|
+
else {
|
|
100
|
+
let e3 = window;
|
|
101
|
+
const a2 = o2.split(".");
|
|
102
|
+
for (let t2 = 0; t2 < a2.length - 1; t2++) if (e3 = e3[a2[t2]], !n(e3)) throw new Error(`ModSDK: Function ${o2} to be patched not found; ${a2.slice(0, t2 + 1).join(".")} is not object`);
|
|
103
|
+
const c2 = e3[a2[a2.length - 1]];
|
|
104
|
+
if ("function" != typeof c2) throw new Error(`ModSDK: Function ${o2} to be patched not found`);
|
|
105
|
+
const l2 = function(o3) {
|
|
106
|
+
let e4 = -1;
|
|
107
|
+
for (const n2 of t.encode(o3)) {
|
|
108
|
+
let o4 = 255 & (e4 ^ n2);
|
|
109
|
+
for (let e5 = 0; e5 < 8; e5++) o4 = 1 & o4 ? -306674912 ^ o4 >>> 1 : o4 >>> 1;
|
|
110
|
+
e4 = e4 >>> 8 ^ o4;
|
|
111
|
+
}
|
|
112
|
+
return ((-1 ^ e4) >>> 0).toString(16).padStart(8, "0").toUpperCase();
|
|
113
|
+
}(c2.toString().replaceAll("\r\n", "\n")), d2 = { name: o2, original: c2, originalHash: l2 };
|
|
114
|
+
r2 = Object.assign(Object.assign({}, d2), { precomputed: s(d2), router: /* @__PURE__ */ __name(() => {
|
|
115
|
+
}, "router"), context: e3, contextProperty: a2[a2.length - 1] }), r2.router = /* @__PURE__ */ function(o3) {
|
|
116
|
+
return function(...e4) {
|
|
117
|
+
return o3.precomputed.enter.apply(this, [e4]);
|
|
118
|
+
};
|
|
119
|
+
}(r2), i.set(o2, r2), e3[r2.contextProperty] = r2.router;
|
|
120
|
+
}
|
|
121
|
+
return r2;
|
|
122
|
+
}
|
|
123
|
+
__name(l, "l");
|
|
124
|
+
function d() {
|
|
125
|
+
for (const o2 of i.values()) o2.precomputed = s(o2);
|
|
126
|
+
}
|
|
127
|
+
__name(d, "d");
|
|
128
|
+
function p() {
|
|
129
|
+
const o2 = /* @__PURE__ */ new Map();
|
|
130
|
+
for (const [e2, t2] of i) o2.set(e2, { name: e2, original: t2.original, originalHash: t2.originalHash, sdkEntrypoint: t2.router, currentEntrypoint: t2.context[t2.contextProperty], hookedByMods: r(t2.precomputed.hooks.map((o3) => o3.mod)), patchedByMods: Array.from(t2.precomputed.patchesSources) });
|
|
131
|
+
return o2;
|
|
132
|
+
}
|
|
133
|
+
__name(p, "p");
|
|
134
|
+
const f = /* @__PURE__ */ new Map();
|
|
135
|
+
function u(o2) {
|
|
136
|
+
f.get(o2.name) !== o2 && e(`Failed to unload mod '${o2.name}': Not registered`), f.delete(o2.name), o2.loaded = false, d();
|
|
137
|
+
}
|
|
138
|
+
__name(u, "u");
|
|
139
|
+
function g(o2, t2) {
|
|
140
|
+
o2 && "object" == typeof o2 || e("Failed to register mod: Expected info object, got " + typeof o2), "string" == typeof o2.name && o2.name || e("Failed to register mod: Expected name to be non-empty string, got " + typeof o2.name);
|
|
141
|
+
let r2 = `'${o2.name}'`;
|
|
142
|
+
"string" == typeof o2.fullName && o2.fullName || e(`Failed to register mod ${r2}: Expected fullName to be non-empty string, got ${typeof o2.fullName}`), r2 = `'${o2.fullName} (${o2.name})'`, "string" != typeof o2.version && e(`Failed to register mod ${r2}: Expected version to be string, got ${typeof o2.version}`), o2.repository || (o2.repository = void 0), void 0 !== o2.repository && "string" != typeof o2.repository && e(`Failed to register mod ${r2}: Expected repository to be undefined or string, got ${typeof o2.version}`), null == t2 && (t2 = {}), t2 && "object" == typeof t2 || e(`Failed to register mod ${r2}: Expected options to be undefined or object, got ${typeof t2}`);
|
|
143
|
+
const i2 = true === t2.allowReplace, a2 = f.get(o2.name);
|
|
144
|
+
a2 && (a2.allowReplace && i2 || e(`Refusing to load mod ${r2}: it is already loaded and doesn't allow being replaced.
|
|
145
|
+
Was the mod loaded multiple times?`), u(a2));
|
|
146
|
+
const c2 = /* @__PURE__ */ __name((o3) => {
|
|
147
|
+
let e2 = g2.patching.get(o3.name);
|
|
148
|
+
return e2 || (e2 = { hooks: [], patches: /* @__PURE__ */ new Map() }, g2.patching.set(o3.name, e2)), e2;
|
|
149
|
+
}, "c"), s2 = /* @__PURE__ */ __name((o3, t3) => (...n2) => {
|
|
150
|
+
var i3, a3;
|
|
151
|
+
const c3 = null === (a3 = (i3 = m.errorReporterHooks).apiEndpointEnter) || void 0 === a3 ? void 0 : a3.call(i3, o3, g2.name);
|
|
152
|
+
g2.loaded || e(`Mod ${r2} attempted to call SDK function after being unloaded`);
|
|
153
|
+
const s3 = t3(...n2);
|
|
154
|
+
return null == c3 || c3(), s3;
|
|
155
|
+
}, "s"), p2 = { unload: s2("unload", () => u(g2)), hookFunction: s2("hookFunction", (o3, t3, n2) => {
|
|
156
|
+
"string" == typeof o3 && o3 || e(`Mod ${r2} failed to patch a function: Expected function name string, got ${typeof o3}`);
|
|
157
|
+
const i3 = l(o3), a3 = c2(i3);
|
|
158
|
+
"number" != typeof t3 && e(`Mod ${r2} failed to hook function '${o3}': Expected priority number, got ${typeof t3}`), "function" != typeof n2 && e(`Mod ${r2} failed to hook function '${o3}': Expected hook function, got ${typeof n2}`);
|
|
159
|
+
const s3 = { mod: g2.name, priority: t3, hook: n2 };
|
|
160
|
+
return a3.hooks.push(s3), d(), () => {
|
|
161
|
+
const o4 = a3.hooks.indexOf(s3);
|
|
162
|
+
o4 >= 0 && (a3.hooks.splice(o4, 1), d());
|
|
163
|
+
};
|
|
164
|
+
}), patchFunction: s2("patchFunction", (o3, t3) => {
|
|
165
|
+
"string" == typeof o3 && o3 || e(`Mod ${r2} failed to patch a function: Expected function name string, got ${typeof o3}`);
|
|
166
|
+
const i3 = l(o3), a3 = c2(i3);
|
|
167
|
+
n(t3) || e(`Mod ${r2} failed to patch function '${o3}': Expected patches object, got ${typeof t3}`);
|
|
168
|
+
for (const [n2, i4] of Object.entries(t3)) "string" == typeof i4 ? a3.patches.set(n2, i4) : null === i4 ? a3.patches.delete(n2) : e(`Mod ${r2} failed to patch function '${o3}': Invalid format of patch '${n2}'`);
|
|
169
|
+
d();
|
|
170
|
+
}), removePatches: s2("removePatches", (o3) => {
|
|
171
|
+
"string" == typeof o3 && o3 || e(`Mod ${r2} failed to patch a function: Expected function name string, got ${typeof o3}`);
|
|
172
|
+
const t3 = l(o3);
|
|
173
|
+
c2(t3).patches.clear(), d();
|
|
174
|
+
}), callOriginal: s2("callOriginal", (o3, t3, n2) => {
|
|
175
|
+
"string" == typeof o3 && o3 || e(`Mod ${r2} failed to call a function: Expected function name string, got ${typeof o3}`);
|
|
176
|
+
const i3 = l(o3);
|
|
177
|
+
return Array.isArray(t3) || e(`Mod ${r2} failed to call a function: Expected args array, got ${typeof t3}`), i3.original.apply(null != n2 ? n2 : globalThis, t3);
|
|
178
|
+
}), getOriginalHash: s2("getOriginalHash", (o3) => {
|
|
179
|
+
"string" == typeof o3 && o3 || e(`Mod ${r2} failed to get hash: Expected function name string, got ${typeof o3}`);
|
|
180
|
+
return l(o3).originalHash;
|
|
181
|
+
}) }, g2 = { name: o2.name, fullName: o2.fullName, version: o2.version, repository: o2.repository, allowReplace: i2, api: p2, loaded: true, patching: /* @__PURE__ */ new Map() };
|
|
182
|
+
return f.set(o2.name, g2), Object.freeze(p2);
|
|
183
|
+
}
|
|
184
|
+
__name(g, "g");
|
|
185
|
+
function h() {
|
|
186
|
+
const o2 = [];
|
|
187
|
+
for (const e2 of f.values()) o2.push({ name: e2.name, fullName: e2.fullName, version: e2.version, repository: e2.repository });
|
|
188
|
+
return o2;
|
|
189
|
+
}
|
|
190
|
+
__name(h, "h");
|
|
191
|
+
let m;
|
|
192
|
+
const y = void 0 === window.bcModSdk ? window.bcModSdk = function() {
|
|
193
|
+
const e2 = { version: o, apiVersion: 1, registerMod: g, getModsInfo: h, getPatchingInfo: p, errorReporterHooks: Object.seal({ apiEndpointEnter: null, hookEnter: null, hookChainExit: null }) };
|
|
194
|
+
return m = e2, Object.freeze(e2);
|
|
195
|
+
}() : (n(window.bcModSdk) || e("Failed to init Mod SDK: Name already in use"), 1 !== window.bcModSdk.apiVersion && e(`Failed to init Mod SDK: Different version already loaded ('1.2.0' vs '${window.bcModSdk.version}')`), window.bcModSdk.version !== o && alert(`Mod SDK warning: Loading different but compatible versions ('1.2.0' vs '${window.bcModSdk.version}')
|
|
196
|
+
One of mods you are using is using an old version of SDK. It will work for now but please inform author to update`), window.bcModSdk);
|
|
197
|
+
return "undefined" != typeof exports && (Object.defineProperty(exports, "__esModule", { value: true }), exports.default = y), y;
|
|
198
|
+
}();
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// src/base/base_module.ts
|
|
203
|
+
var BaseModule = class {
|
|
204
|
+
static {
|
|
205
|
+
__name(this, "BaseModule");
|
|
206
|
+
}
|
|
207
|
+
get settingsScreen() {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
get settingsStorage() {
|
|
211
|
+
return this.constructor.name;
|
|
212
|
+
}
|
|
213
|
+
get settings() {
|
|
214
|
+
const modName = ModSdkManager.ModInfo.name;
|
|
215
|
+
if (!this.settingsStorage) return {};
|
|
216
|
+
if (!modStorage.playerStorage) {
|
|
217
|
+
Player[modName] = {};
|
|
218
|
+
this.registerDefaultSettings();
|
|
219
|
+
} else if (!modStorage.playerStorage[this.settingsStorage]) this.registerDefaultSettings();
|
|
220
|
+
return modStorage.playerStorage[this.settingsStorage];
|
|
221
|
+
}
|
|
222
|
+
set settings(value) {
|
|
223
|
+
const modName = ModSdkManager.ModInfo.name;
|
|
224
|
+
const storage = new ModStorage(modName);
|
|
225
|
+
if (!this.settingsStorage) return;
|
|
226
|
+
if (!storage.playerStorage) {
|
|
227
|
+
Player[modName] = {};
|
|
228
|
+
this.registerDefaultSettings();
|
|
229
|
+
} else if (!storage.playerStorage[this.settingsStorage]) this.registerDefaultSettings();
|
|
230
|
+
storage.playerStorage[this.settingsStorage] = value;
|
|
231
|
+
}
|
|
232
|
+
init() {
|
|
233
|
+
this.registerDefaultSettings();
|
|
234
|
+
}
|
|
235
|
+
registerDefaultSettings() {
|
|
236
|
+
const storage = this.settingsStorage;
|
|
237
|
+
const defaults = this.defaultSettings;
|
|
238
|
+
if (!storage || !defaults) return;
|
|
239
|
+
Player[ModSdkManager.ModInfo.name][storage] = Object.assign(defaults, Player[ModSdkManager.ModInfo.name][storage] ?? {});
|
|
240
|
+
}
|
|
241
|
+
get defaultSettings() {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
load() {
|
|
245
|
+
}
|
|
246
|
+
run() {
|
|
247
|
+
}
|
|
248
|
+
unload() {
|
|
249
|
+
}
|
|
250
|
+
};
|
|
3
251
|
|
|
4
|
-
|
|
5
|
-
|
|
252
|
+
// src/base/base_subscreen.ts
|
|
253
|
+
function getCurrentSubscreen() {
|
|
254
|
+
return GUI.instance && GUI.instance.currentSubscreen;
|
|
255
|
+
}
|
|
256
|
+
__name(getCurrentSubscreen, "getCurrentSubscreen");
|
|
257
|
+
function setSubscreen(subscreen) {
|
|
258
|
+
if (!GUI.instance) {
|
|
259
|
+
throw new Error("Attempt to set subscreen before init");
|
|
260
|
+
}
|
|
261
|
+
GUI.instance.currentSubscreen = subscreen;
|
|
262
|
+
return GUI.instance.currentSubscreen;
|
|
263
|
+
}
|
|
264
|
+
__name(setSubscreen, "setSubscreen");
|
|
265
|
+
var BaseSubscreen = class _BaseSubscreen {
|
|
266
|
+
static {
|
|
267
|
+
__name(this, "BaseSubscreen");
|
|
268
|
+
}
|
|
269
|
+
static currentElements = [];
|
|
270
|
+
static currentPage = 1;
|
|
271
|
+
options;
|
|
272
|
+
module;
|
|
273
|
+
constructor(subscreenOptions, module) {
|
|
274
|
+
if (module) this.module = module;
|
|
275
|
+
this.options = subscreenOptions || {};
|
|
276
|
+
}
|
|
277
|
+
get name() {
|
|
278
|
+
return "UNKNOWN";
|
|
279
|
+
}
|
|
280
|
+
get icon() {
|
|
281
|
+
return "";
|
|
282
|
+
}
|
|
283
|
+
get subscreenName() {
|
|
284
|
+
return this.constructor.name;
|
|
285
|
+
}
|
|
286
|
+
setSubscreen(screen) {
|
|
287
|
+
return setSubscreen(screen);
|
|
288
|
+
}
|
|
289
|
+
get settings() {
|
|
290
|
+
return this.module.settings;
|
|
291
|
+
}
|
|
292
|
+
set settings(value) {
|
|
293
|
+
this.module.settings = value;
|
|
294
|
+
}
|
|
295
|
+
get pageStructure() {
|
|
296
|
+
return [[]];
|
|
297
|
+
}
|
|
298
|
+
get currentPage() {
|
|
299
|
+
return this.pageStructure[Math.min(_BaseSubscreen.currentPage - 1, this.pageStructure.length - 1)];
|
|
300
|
+
}
|
|
301
|
+
changePage(page, setLabel) {
|
|
302
|
+
const totalPages = this.pageStructure.length;
|
|
303
|
+
if (page > totalPages) page = 1;
|
|
304
|
+
if (page < 1) page = totalPages;
|
|
305
|
+
_BaseSubscreen.currentPage = page;
|
|
306
|
+
this.managePageElementsVisibility();
|
|
307
|
+
setLabel(`${_BaseSubscreen.currentPage} of ${this.pageStructure.length}`);
|
|
308
|
+
}
|
|
309
|
+
managePageElementsVisibility() {
|
|
310
|
+
this.pageStructure.forEach((item, ix) => {
|
|
311
|
+
if (ix != _BaseSubscreen.currentPage - 1) {
|
|
312
|
+
item.forEach((setting) => {
|
|
313
|
+
domUtil.hide(`${setting.id}-container`);
|
|
314
|
+
});
|
|
315
|
+
} else {
|
|
316
|
+
item.forEach((setting) => {
|
|
317
|
+
domUtil.unhide(`${setting.id}-container`);
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
load() {
|
|
323
|
+
for (const module of modules()) {
|
|
324
|
+
if (!module.settingsScreen) continue;
|
|
325
|
+
if (!module.settings || !Object.keys(module.settings).length) module.registerDefaultSettings();
|
|
326
|
+
}
|
|
327
|
+
_BaseSubscreen.currentPage = 1;
|
|
328
|
+
layoutElement.createSubscreenDiv();
|
|
329
|
+
const settingsElement = layoutElement.createSettingsDiv();
|
|
330
|
+
layoutElement.appendToSubscreenDiv(settingsElement);
|
|
331
|
+
const menu = ElementMenu.Create("deeplib-nav-menu", []);
|
|
332
|
+
layoutElement.appendToSubscreenDiv(menu);
|
|
333
|
+
if (this.pageStructure.length > 1) {
|
|
334
|
+
const backNext = advancedElement.createBackNext({
|
|
335
|
+
id: "deeplib-page-back-next",
|
|
336
|
+
next: /* @__PURE__ */ __name(({ setLabel }) => this.changePage(_BaseSubscreen.currentPage + 1, setLabel), "next"),
|
|
337
|
+
initialNextTooltip: getText("settings.button.next_button_hint"),
|
|
338
|
+
back: /* @__PURE__ */ __name(({ setLabel }) => this.changePage(_BaseSubscreen.currentPage - 1, setLabel), "back"),
|
|
339
|
+
initialPrevTooltip: getText("settings.button.prev_button_hint"),
|
|
340
|
+
initialLabel: `${_BaseSubscreen.currentPage} of ${this.pageStructure.length}`
|
|
341
|
+
});
|
|
342
|
+
ElementMenu.PrependItem(menu, backNext);
|
|
343
|
+
}
|
|
344
|
+
const subscreenTitle = advancedElement.createLabel({
|
|
345
|
+
id: "deeplib-subscreen-title",
|
|
346
|
+
label: getText(`${this.name}.title`).replace("$ModVersion", ModSdkManager.ModInfo.version)
|
|
347
|
+
});
|
|
348
|
+
layoutElement.appendToSubscreenDiv(subscreenTitle);
|
|
349
|
+
if (this.name !== "mainmenu") {
|
|
350
|
+
const exitButton = advancedElement.createButton({
|
|
351
|
+
id: "deeplib-exit",
|
|
352
|
+
size: [90, 90],
|
|
353
|
+
image: `${PUBLIC_URL}/dl_images/exit.svg`,
|
|
354
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
355
|
+
this.exit();
|
|
356
|
+
}, "onClick"),
|
|
357
|
+
tooltip: getText("settings.button.back_button_hint")
|
|
358
|
+
});
|
|
359
|
+
ElementMenu.AppendButton(menu, exitButton);
|
|
360
|
+
}
|
|
361
|
+
const tooltip = advancedElement.createTooltip();
|
|
362
|
+
layoutElement.appendToSubscreenDiv(tooltip);
|
|
363
|
+
this.pageStructure.forEach(
|
|
364
|
+
(s) => s.forEach((item) => {
|
|
365
|
+
let element;
|
|
366
|
+
switch (item.type) {
|
|
367
|
+
case "text":
|
|
368
|
+
case "number":
|
|
369
|
+
case "color":
|
|
370
|
+
element = advancedElement.createInput(item);
|
|
371
|
+
break;
|
|
372
|
+
case "checkbox":
|
|
373
|
+
element = advancedElement.createCheckbox(item);
|
|
374
|
+
break;
|
|
375
|
+
case "button":
|
|
376
|
+
element = advancedElement.createButton(item);
|
|
377
|
+
break;
|
|
378
|
+
case "label":
|
|
379
|
+
element = advancedElement.createLabel(item);
|
|
380
|
+
break;
|
|
381
|
+
case "custom":
|
|
382
|
+
element = advancedElement.createCustom(item);
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
layoutElement.appendToSettingsDiv(element);
|
|
386
|
+
})
|
|
387
|
+
);
|
|
388
|
+
this.managePageElementsVisibility();
|
|
389
|
+
CharacterAppearanceForceUpCharacter = Player.MemberNumber ?? -1;
|
|
390
|
+
}
|
|
391
|
+
run() {
|
|
392
|
+
if (this.options.drawCharacter) DrawCharacter(Player, 50, 50, 0.9, false);
|
|
393
|
+
}
|
|
394
|
+
click() {
|
|
395
|
+
}
|
|
396
|
+
exit() {
|
|
397
|
+
CharacterAppearanceForceUpCharacter = -1;
|
|
398
|
+
CharacterLoadCanvas(Player);
|
|
399
|
+
setSubscreen("mainmenu");
|
|
400
|
+
modStorage.save();
|
|
401
|
+
}
|
|
402
|
+
resize(onLoad = false) {
|
|
403
|
+
const offset = this.options.drawCharacter ? 0 : 380;
|
|
404
|
+
const subscreen = layoutElement.getSubscreenDiv();
|
|
405
|
+
const settingsDiv = layoutElement.getSettingsDiv();
|
|
406
|
+
ElementSetPosition(subscreen || "", 0, 0);
|
|
407
|
+
ElementSetSize(subscreen || "", 2e3, 1e3);
|
|
408
|
+
ElementSetFontSize(subscreen || "", "auto");
|
|
409
|
+
if (this.name === "mainmenu") {
|
|
410
|
+
ElementSetPosition(settingsDiv || "", 530 - offset, 170);
|
|
411
|
+
ElementSetSize(settingsDiv || "", 600 + offset, 660);
|
|
412
|
+
} else {
|
|
413
|
+
ElementSetPosition(settingsDiv || "", 530 - offset, 170);
|
|
414
|
+
ElementSetSize(settingsDiv || "", 1e3 + offset, 660);
|
|
415
|
+
}
|
|
416
|
+
ElementSetPosition("deeplib-subscreen-title", 530 - offset, 75);
|
|
417
|
+
ElementSetSize("deeplib-subscreen-title", 800, 60);
|
|
418
|
+
ElementSetPosition("deeplib-nav-menu", 1905, 75, "top-right");
|
|
419
|
+
ElementSetSize("deeplib-nav-menu", null, 90);
|
|
420
|
+
ElementSetPosition(advancedElement.getTooltip() || "", 250, 850);
|
|
421
|
+
ElementSetSize(advancedElement.getTooltip() || "", 1500, 70);
|
|
422
|
+
_BaseSubscreen.currentElements.forEach((item) => {
|
|
423
|
+
const options = item[1];
|
|
424
|
+
domUtil.autoSetPosition(options.id, options.position);
|
|
425
|
+
domUtil.autoSetSize(options.id, options.size);
|
|
426
|
+
});
|
|
427
|
+
if (settingsDiv) {
|
|
428
|
+
if (domUtil.hasOverflow(settingsDiv)?.vertical) {
|
|
429
|
+
settingsDiv.classList.add("deeplib-overflow-box");
|
|
430
|
+
} else {
|
|
431
|
+
settingsDiv.classList.remove("deeplib-overflow-box");
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
unload() {
|
|
436
|
+
_BaseSubscreen.currentElements = [];
|
|
437
|
+
layoutElement.removeSubscreenDiv();
|
|
438
|
+
}
|
|
439
|
+
};
|
|
6
440
|
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
441
|
+
// src/styles/index.scss
|
|
442
|
+
var styles_default = `.deeplib-subscreen,
|
|
443
|
+
.deeplib-modal {
|
|
444
|
+
--deeplib-background-color: var(--tmd-main, white);
|
|
445
|
+
--deeplib-element-color: var(--tmd-element, white);
|
|
446
|
+
--deeplib-element-hover-color: var(--tmd-element-hover, cyan);
|
|
447
|
+
--deeplib-blocked-color: var(--tmd-blocked, red);
|
|
448
|
+
--deeplib-text-color: var(--tmd-text, black);
|
|
449
|
+
--deeplib-icon-color: var(--tmd-accent, white);
|
|
450
|
+
--deeplib-icon-hover-color: var(--tmd-accent-hover, cyan);
|
|
451
|
+
--deeplib-border-color: var(--tmd-accent, black);
|
|
452
|
+
--deeplib-border-width: min(0.2vh, 0.1vw);
|
|
453
|
+
--deeplib-border-width: min(0.2dvh, 0.1dvw);
|
|
454
|
+
--deeplib-border-radius: min(1vh, 0.5vw);
|
|
455
|
+
--deeplib-border-radius: min(1dvh, 0.5dvw);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.deeplib-button {
|
|
459
|
+
color: var(--deeplib-text-color);
|
|
460
|
+
width: 100%;
|
|
461
|
+
height: 100%;
|
|
462
|
+
}
|
|
11
463
|
|
|
464
|
+
.deeplib-button.button-styling,
|
|
465
|
+
.deeplib-button.button-styling::before {
|
|
466
|
+
border-radius: min(1dvh, 0.5dvw);
|
|
467
|
+
}
|
|
12
468
|
|
|
13
|
-
|
|
469
|
+
.deeplib-button img {
|
|
470
|
+
position: absolute;
|
|
471
|
+
top: 0%;
|
|
472
|
+
left: 0%;
|
|
473
|
+
width: 100%;
|
|
474
|
+
height: 100%;
|
|
475
|
+
background-position: left;
|
|
476
|
+
background-color: var(--deeplib-icon-color);
|
|
477
|
+
background-blend-mode: multiply;
|
|
478
|
+
background-size: contain;
|
|
479
|
+
mask-position: left;
|
|
480
|
+
mask-size: contain;
|
|
481
|
+
background-repeat: no-repeat;
|
|
482
|
+
mask-repeat: no-repeat;
|
|
483
|
+
color: transparent;
|
|
484
|
+
background-image: var(--image);
|
|
485
|
+
mask-image: var(--image);
|
|
486
|
+
pointer-events: none;
|
|
487
|
+
}
|
|
14
488
|
|
|
15
|
-
|
|
16
|
-
|
|
489
|
+
.deeplib-button:hover img {
|
|
490
|
+
background-color: var(--deeplib-icon-hover-color);
|
|
491
|
+
}
|
|
17
492
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/* harmony import */ var _node_modules_pnpm_css_loader_7_1_2_webpack_5_97_1_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(163);
|
|
24
|
-
/* harmony import */ var _node_modules_pnpm_css_loader_7_1_2_webpack_5_97_1_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_pnpm_css_loader_7_1_2_webpack_5_97_1_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
25
|
-
// Imports
|
|
493
|
+
.deeplib-button .button-label {
|
|
494
|
+
background-color: transparent !important;
|
|
495
|
+
color: var(--deeplib-text-color);
|
|
496
|
+
font-size: min(3.6dvh, 1.8dvw);
|
|
497
|
+
}
|
|
26
498
|
|
|
499
|
+
.deeplib-button .button-tooltip {
|
|
500
|
+
border-radius: min(1dvh, 0.5dvw);
|
|
501
|
+
}
|
|
27
502
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
--deeplib-element-color: var(--element, white);
|
|
33
|
-
--deeplib-element-hover-color: var(--accentHover, cyan);
|
|
34
|
-
--deeplib-text-color: var(--text, black);
|
|
35
|
-
--deeplib-icon-color: var(--accent, white);
|
|
36
|
-
--deeplib-border-color: var(--accent, black);
|
|
503
|
+
#deeplib-page-label {
|
|
504
|
+
display: flex;
|
|
505
|
+
align-items: center;
|
|
506
|
+
justify-content: center;
|
|
37
507
|
}
|
|
38
508
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
509
|
+
#deeplib-subscreen-title {
|
|
510
|
+
text-align: left;
|
|
511
|
+
color: var(--deeplib-text-color);
|
|
512
|
+
}
|
|
42
513
|
|
|
43
514
|
.deeplib-text {
|
|
44
515
|
color: var(--deeplib-text-color);
|
|
@@ -47,74 +518,72 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.deeplib-subscreen {
|
|
|
47
518
|
.deeplib-subscreen {
|
|
48
519
|
padding: 0;
|
|
49
520
|
margin: 0;
|
|
521
|
+
pointer-events: none;
|
|
50
522
|
}
|
|
51
523
|
|
|
52
524
|
.deeplib-subscreen * {
|
|
53
525
|
box-sizing: border-box;
|
|
526
|
+
pointer-events: all;
|
|
54
527
|
}
|
|
55
528
|
|
|
56
529
|
.deeplib-settings {
|
|
57
|
-
display:
|
|
58
|
-
|
|
59
|
-
padding: min(
|
|
530
|
+
display: grid;
|
|
531
|
+
grid-auto-rows: min-content;
|
|
532
|
+
padding: min(1dvh, 0.5dvw);
|
|
60
533
|
gap: 0.3em;
|
|
61
|
-
overflow-y:
|
|
534
|
+
overflow-y: scroll;
|
|
62
535
|
}
|
|
63
536
|
|
|
64
537
|
.deeplib-misc {
|
|
65
538
|
display: flex;
|
|
66
539
|
align-items: center;
|
|
67
|
-
justify-content: space-between;
|
|
68
540
|
flex-direction: column-reverse;
|
|
541
|
+
gap: min(1vh, 0.5vw);
|
|
69
542
|
}
|
|
70
543
|
|
|
71
|
-
.deeplib-
|
|
72
|
-
|
|
544
|
+
.deeplib-tooltip {
|
|
545
|
+
background-color: var(--deeplib-element-color);
|
|
73
546
|
color: var(--deeplib-text-color);
|
|
547
|
+
display: flex;
|
|
548
|
+
align-items: center;
|
|
549
|
+
justify-content: center;
|
|
550
|
+
border-radius: min(1dvh, 0.5dvw);
|
|
551
|
+
padding: min(1vh, 0.5vw);
|
|
552
|
+
font-size: 0.8em;
|
|
553
|
+
border: min(0.2vh, 0.1vw) solid var(--deeplib-border-color);
|
|
74
554
|
}
|
|
75
555
|
|
|
76
|
-
.deeplib-
|
|
77
|
-
|
|
78
|
-
top: 0%;
|
|
79
|
-
left: 0%;
|
|
80
|
-
width: 100%;
|
|
81
|
-
height: 100%;
|
|
82
|
-
background-position: left;
|
|
83
|
-
background-color: var(--deeplib-icon-color);
|
|
84
|
-
background-blend-mode: multiply;
|
|
85
|
-
background-size: contain;
|
|
86
|
-
mask-position: left;
|
|
87
|
-
mask-size: contain;
|
|
88
|
-
background-repeat: no-repeat;
|
|
89
|
-
mask-repeat: no-repeat;
|
|
90
|
-
color: transparent;
|
|
91
|
-
|
|
92
|
-
background-image: var(--image);
|
|
93
|
-
mask-image: var(--image);
|
|
556
|
+
.deeplib-overflow-box {
|
|
557
|
+
border: var(--deeplib-border-color) solid var(--deeplib-border-width);
|
|
94
558
|
}
|
|
95
559
|
|
|
96
|
-
.deeplib-
|
|
97
|
-
|
|
98
|
-
|
|
560
|
+
.deeplib-prev-next {
|
|
561
|
+
display: flex;
|
|
562
|
+
align-items: center;
|
|
563
|
+
justify-content: space-between;
|
|
564
|
+
flex-direction: row;
|
|
565
|
+
gap: min(2dvh, 1dvw);
|
|
566
|
+
background-color: var(--deeplib-element-color);
|
|
99
567
|
color: var(--deeplib-text-color);
|
|
100
|
-
|
|
568
|
+
border-radius: min(1dvh, 0.5dvw);
|
|
569
|
+
border: min(0.2vh, 0.1vw) solid var(--deeplib-border-color);
|
|
101
570
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
color: var(--deeplib-text-color);
|
|
571
|
+
.deeplib-prev-next .deeplib-prev-next-button {
|
|
572
|
+
height: 100%;
|
|
573
|
+
aspect-ratio: 1;
|
|
106
574
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
575
|
+
.deeplib-prev-next .deeplib-prev-next-button:hover {
|
|
576
|
+
background-color: var(--deeplib-element-hover-color);
|
|
577
|
+
border-radius: var(--deeplib-border-radius);
|
|
110
578
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
background-color: #BDA203;
|
|
579
|
+
.deeplib-prev-next .deeplib-prev-next-label {
|
|
580
|
+
white-space: nowrap;
|
|
114
581
|
}
|
|
115
582
|
|
|
116
|
-
#deeplib-
|
|
117
|
-
|
|
583
|
+
#deeplib-nav-menu {
|
|
584
|
+
display: flex;
|
|
585
|
+
flex-direction: row;
|
|
586
|
+
gap: min(2dvh, 1dvw);
|
|
118
587
|
}
|
|
119
588
|
|
|
120
589
|
.deeplib-checkbox-container {
|
|
@@ -124,67 +593,49 @@ ___CSS_LOADER_EXPORT___.push([module.id, `.deeplib-subscreen {
|
|
|
124
593
|
gap: 0.3em;
|
|
125
594
|
}
|
|
126
595
|
|
|
127
|
-
.deeplib-input {
|
|
128
|
-
|
|
596
|
+
.deeplib-checkbox-container input.deeplib-input {
|
|
597
|
+
width: min(5vh, 2.5vw);
|
|
598
|
+
height: min(5vh, 2.5vw);
|
|
599
|
+
border-radius: min(1dvh, 0.5dvw);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
.deeplib-checkbox-container input.deeplib-input[type=checkbox]:checked::before {
|
|
603
|
+
width: 80%;
|
|
604
|
+
height: 80%;
|
|
129
605
|
}
|
|
130
606
|
|
|
131
607
|
.deeplib-input-container {
|
|
132
|
-
|
|
608
|
+
display: flex;
|
|
609
|
+
flex-direction: row;
|
|
610
|
+
align-items: center;
|
|
611
|
+
gap: 0.3em;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
.deeplib-input-container:has(label.deeplib-text) {
|
|
133
615
|
margin-top: min(1vh, 0.5vw);
|
|
134
616
|
}
|
|
135
617
|
|
|
136
618
|
.deeplib-input-container input.deeplib-input {
|
|
137
|
-
font-size:
|
|
138
|
-
width: 100%;
|
|
619
|
+
font-size: 0.6em;
|
|
139
620
|
padding: 5px 0;
|
|
140
621
|
background-color: transparent;
|
|
141
622
|
outline: none;
|
|
142
623
|
padding-left: min(1vh, 0.5vw);
|
|
143
624
|
padding-right: min(1vh, 0.5vw);
|
|
625
|
+
min-height: min(5dvh, 2.5dvw);
|
|
626
|
+
border-radius: min(1dvh, 0.5dvw);
|
|
144
627
|
}
|
|
145
628
|
|
|
146
|
-
.deeplib-input-container
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
pointer-events: none;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.deeplib-input-container input.deeplib-input:focus~label,
|
|
155
|
-
.deeplib-input-container input.deeplib-input:not(:placeholder-shown)~label {
|
|
156
|
-
font-size: 0.7em;
|
|
157
|
-
transform: translate(20%, -70%);
|
|
158
|
-
background-color: var(--deeplib-background-color);
|
|
159
|
-
padding: 0px min(1vh, 0.5vw);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.deeplib-input-container .deeplib-underline {
|
|
163
|
-
position: absolute;
|
|
164
|
-
bottom: 0;
|
|
165
|
-
left: 0;
|
|
166
|
-
height: 2px;
|
|
167
|
-
width: 100%;
|
|
168
|
-
background-color: var(--deeplib-element-hover-color);
|
|
169
|
-
transform: scaleX(0);
|
|
170
|
-
transition: all 0.3s ease;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.deeplib-input-container input.deeplib-input:focus~.deeplib-underline,
|
|
174
|
-
.deeplib-input-container input.deeplib-input:not(:placeholder-shown)~.deeplib-underline {
|
|
175
|
-
transform: scaleX(0.98);
|
|
629
|
+
.deeplib-input-container input.deeplib-input[type=color] {
|
|
630
|
+
padding: 0px;
|
|
631
|
+
width: min(5vh, 2.5vw);
|
|
632
|
+
height: min(5vh, 2.5vw);
|
|
633
|
+
border-radius: 0px;
|
|
176
634
|
}
|
|
177
635
|
|
|
178
|
-
.deeplib-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
display: flex;
|
|
182
|
-
align-items: center;
|
|
183
|
-
justify-content: center;
|
|
184
|
-
border-radius: min(1.0dvh, 0.5dvw);
|
|
185
|
-
padding: min(1vh, 0.5vw);
|
|
186
|
-
font-size: 0.8em;
|
|
187
|
-
border: min(0.2vh, 0.1vw) solid var(--deeplib-border-color);
|
|
636
|
+
.deeplib-input-container input.deeplib-input[type=color]:disabled {
|
|
637
|
+
border: var(--deeplib-blocked-color) solid var(--deeplib-border-width);
|
|
638
|
+
cursor: not-allowed;
|
|
188
639
|
}
|
|
189
640
|
|
|
190
641
|
input::-webkit-outer-spin-button,
|
|
@@ -198,17 +649,13 @@ input[type=number] {
|
|
|
198
649
|
-moz-appearance: textfield;
|
|
199
650
|
}
|
|
200
651
|
|
|
201
|
-
/*************/
|
|
202
|
-
/* MESSAGES */
|
|
203
|
-
/*************/
|
|
204
|
-
|
|
205
652
|
.deeplib-highlight-text {
|
|
206
653
|
font-weight: bold;
|
|
207
654
|
color: rgb(203, 185, 23);
|
|
208
655
|
}
|
|
209
656
|
|
|
210
|
-
#TextAreaChatLog[data-colortheme=
|
|
211
|
-
#TextAreaChatLog[data-colortheme=
|
|
657
|
+
#TextAreaChatLog[data-colortheme=dark] div.ChatMessage.deeplib-message,
|
|
658
|
+
#TextAreaChatLog[data-colortheme=dark2] div.ChatMessage.deeplib-message {
|
|
212
659
|
background-color: var(--deeplib-element-color);
|
|
213
660
|
border: min(0.2dvh, 0.1dvw) solid var(--deeplib-border-color);
|
|
214
661
|
color: var(--deeplib-text-color);
|
|
@@ -223,8 +670,8 @@ input[type=number] {
|
|
|
223
670
|
white-space: normal;
|
|
224
671
|
}
|
|
225
672
|
|
|
226
|
-
#TextAreaChatLog[data-colortheme=
|
|
227
|
-
#TextAreaChatLog[data-colortheme=
|
|
673
|
+
#TextAreaChatLog[data-colortheme=dark] div.ChatMessage.deeplib-message a,
|
|
674
|
+
#TextAreaChatLog[data-colortheme=dark2] div.ChatMessage.deeplib-message a {
|
|
228
675
|
color: var(--deeplib-text-color);
|
|
229
676
|
}
|
|
230
677
|
|
|
@@ -233,1673 +680,1903 @@ input[type=number] {
|
|
|
233
680
|
font-weight: bold;
|
|
234
681
|
color: #111;
|
|
235
682
|
}
|
|
236
|
-
`, "",{"version":3,"sources":["webpack://./public/styles/DeepLib.css"],"names":[],"mappings":"AAAA;EACE,8CAA8C;EAC9C,8CAA8C;EAC9C,uDAAuD;EACvD,wCAAwC;EACxC,0CAA0C;EAC1C,4CAA4C;AAC9C;;AAEA,aAAa;AACb,aAAa;AACb,aAAa;;AAEb;EACE,gCAAgC;AAClC;;AAEA;EACE,UAAU;EACV,SAAS;AACX;;AAEA;EACE,sBAAsB;AACxB;;AAEA;EACE,aAAa;EACb,sBAAsB;EACtB,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;EAChB,2DAA2D;AAC7D;;AAEA;;EAEE,wBAAwB;EACxB,SAAS;AACX;;AAEA;EACE,qBAAqB;EACrB,0BAA0B;AAC5B;;AAEA,cAAc;AACd,aAAa;AACb,cAAc;;AAEd;EACE,iBAAiB;EACjB,wBAAwB;AAC1B;;AAEA;;EAEE,8CAA8C;EAC9C,6DAA6D;EAC7D,gCAAgC;AAClC;;AAEA;EACE,sBAAsB;EACtB,yCAAyC;EACzC,WAAW;EACX,iCAAiC;EACjC,cAAc;EACd,mBAAmB;AACrB;;AAEA;;EAEE,gCAAgC;AAClC;;AAEA;EACE,eAAe;EACf,iBAAiB;EACjB,WAAW;AACb","sourcesContent":[".deeplib-subscreen {\n --deeplib-background-color: var(--main, white);\n --deeplib-element-color: var(--element, white);\n --deeplib-element-hover-color: var(--accentHover, cyan);\n --deeplib-text-color: var(--text, black);\n --deeplib-icon-color: var(--accent, white);\n --deeplib-border-color: var(--accent, black);\n}\n\n/************/\n/* ELEMENTS */\n/************/\n\n.deeplib-text {\n color: var(--deeplib-text-color);\n}\n\n.deeplib-subscreen {\n padding: 0;\n margin: 0;\n}\n\n.deeplib-subscreen * {\n box-sizing: border-box;\n}\n\n.deeplib-settings {\n display: flex;\n flex-direction: column;\n padding: min(1.0dvh, 0.5dvw);\n gap: 0.3em;\n overflow-y: auto;\n}\n\n.deeplib-misc {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-direction: column-reverse;\n}\n\n.deeplib-button.button-styling {\n border-radius: min(1.0dvh, 0.5dvw);\n color: var(--deeplib-text-color);\n}\n\n.deeplib-button.button-styling img {\n position: absolute;\n top: 0%;\n left: 0%;\n width: 100%;\n height: 100%;\n background-position: left;\n background-color: var(--deeplib-icon-color);\n background-blend-mode: multiply;\n background-size: contain;\n mask-position: left;\n mask-size: contain;\n background-repeat: no-repeat;\n mask-repeat: no-repeat;\n color: transparent;\n\n background-image: var(--image);\n mask-image: var(--image);\n}\n\n.deeplib-button.button-styling .button-label {\n width: 100%;\n background-color: transparent;\n color: var(--deeplib-text-color);\n font-size: min(3.6dvh, 1.8dvw);\n}\n\n#deeplib-subscreen-title {\n text-align: center;\n color: var(--deeplib-text-color);\n}\n\n#deeplib-reset-button {\n background-color: indianred;\n}\n\n#deeplib-wiki-button {\n background-color: #BDA203;\n}\n\n#deeplib-support-button {\n background-color: #5e4969;\n}\n\n.deeplib-checkbox-container {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 0.3em;\n}\n\n.deeplib-input {\n border-radius: min(1.0dvh, 0.5dvw);\n}\n\n.deeplib-input-container {\n position: relative;\n margin-top: min(1vh, 0.5vw);\n}\n\n.deeplib-input-container input.deeplib-input {\n font-size: 20px;\n width: 100%;\n padding: 5px 0;\n background-color: transparent;\n outline: none;\n padding-left: min(1vh, 0.5vw);\n padding-right: min(1vh, 0.5vw);\n}\n\n.deeplib-input-container label.deeplib-text {\n position: absolute;\n top: min(0.6vh, 0.3vw);\n left: min(0.6vh, 0.3vw);\n transition: all 0.3s ease;\n pointer-events: none;\n}\n\n.deeplib-input-container input.deeplib-input:focus~label,\n.deeplib-input-container input.deeplib-input:not(:placeholder-shown)~label {\n font-size: 0.7em;\n transform: translate(20%, -70%);\n background-color: var(--deeplib-background-color);\n padding: 0px min(1vh, 0.5vw);\n}\n\n.deeplib-input-container .deeplib-underline {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 2px;\n width: 100%;\n background-color: var(--deeplib-element-hover-color);\n transform: scaleX(0);\n transition: all 0.3s ease;\n}\n\n.deeplib-input-container input.deeplib-input:focus~.deeplib-underline,\n.deeplib-input-container input.deeplib-input:not(:placeholder-shown)~.deeplib-underline {\n transform: scaleX(0.98);\n}\n\n.deeplib-tooltip {\n background-color: var(--deeplib-element-color);\n color: var(--deeplib-text-color);\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: min(1.0dvh, 0.5dvw);\n padding: min(1vh, 0.5vw);\n font-size: 0.8em;\n border: min(0.2vh, 0.1vw) solid var(--deeplib-border-color);\n}\n\ninput::-webkit-outer-spin-button,\ninput::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n}\n\ninput[type=number] {\n appearance: textfield;\n -moz-appearance: textfield;\n}\n\n/*************/\n/* MESSAGES */\n/*************/\n\n.deeplib-highlight-text {\n font-weight: bold;\n color: rgb(203, 185, 23);\n}\n\n#TextAreaChatLog[data-colortheme='dark'] div.ChatMessage.deeplib-message,\n#TextAreaChatLog[data-colortheme='dark2'] div.ChatMessage.deeplib-message {\n background-color: var(--deeplib-element-color);\n border: min(0.2dvh, 0.1dvw) solid var(--deeplib-border-color);\n color: var(--deeplib-text-color);\n}\n\n#TextAreaChatLog div.ChatMessage.deeplib-message {\n background-color: #eee;\n border: min(0.2dvh, 0.1dvw) solid #440171;\n color: #111;\n padding-left: min(0.6dvh, 0.3dvw);\n display: block;\n white-space: normal;\n}\n\n#TextAreaChatLog[data-colortheme='dark'] div.ChatMessage.deeplib-message a,\n#TextAreaChatLog[data-colortheme='dark2'] div.ChatMessage.deeplib-message a {\n color: var(--deeplib-text-color);\n}\n\n#TextAreaChatLog div.ChatMessage.deeplib-message a {\n cursor: pointer;\n font-weight: bold;\n color: #111;\n}\n"],"sourceRoot":""}]);
|
|
237
|
-
// Exports
|
|
238
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
/***/ }),
|
|
242
|
-
|
|
243
|
-
/***/ 163:
|
|
244
|
-
/***/ ((module) => {
|
|
245
683
|
|
|
684
|
+
.deeplib-modal {
|
|
685
|
+
position: fixed;
|
|
686
|
+
top: 10%;
|
|
687
|
+
left: 50%;
|
|
688
|
+
transform: translateX(-50%);
|
|
689
|
+
z-index: 1001;
|
|
690
|
+
display: flex;
|
|
691
|
+
flex-direction: column;
|
|
692
|
+
justify-content: center;
|
|
693
|
+
align-items: center;
|
|
694
|
+
gap: 0.5em;
|
|
695
|
+
width: max(50dvw, 25dvh);
|
|
696
|
+
font-size: min(4dvh, 2dvw);
|
|
697
|
+
padding: min(2dvh, 1dvw);
|
|
698
|
+
background-color: var(--deeplib-element-color);
|
|
699
|
+
border-radius: min(1.2dvh, 0.6dvw);
|
|
700
|
+
border: min(0.2dvh, 0.1dvw) solid var(--deeplib-border-color);
|
|
701
|
+
color: var(--deeplib-text-color);
|
|
702
|
+
}
|
|
703
|
+
.deeplib-modal .deeplib-modal-input {
|
|
704
|
+
width: 100%;
|
|
705
|
+
font-size: min(2.6dvh, 1.8dvw);
|
|
706
|
+
border-radius: min(1dvh, 0.5dvw);
|
|
707
|
+
padding: min(1dvh, 0.5dvw);
|
|
708
|
+
}
|
|
709
|
+
.deeplib-modal input.deeplib-modal-input {
|
|
710
|
+
max-width: max(50dvh, 25dvw);
|
|
711
|
+
}
|
|
712
|
+
.deeplib-modal .deeplib-modal-button-container {
|
|
713
|
+
display: flex;
|
|
714
|
+
flex-direction: row;
|
|
715
|
+
justify-content: flex-end;
|
|
716
|
+
gap: 0.5em;
|
|
717
|
+
width: 100%;
|
|
718
|
+
}
|
|
719
|
+
.deeplib-modal .deeplib-modal-button-container .deeplib-button {
|
|
720
|
+
font-size: 0.8em;
|
|
721
|
+
display: flex;
|
|
722
|
+
width: auto;
|
|
723
|
+
padding: min(0.4vh, 0.2vw) min(2vh, 1vw);
|
|
724
|
+
}
|
|
725
|
+
.deeplib-modal .deeplib-modal-button-container .deeplib-button .button-label {
|
|
726
|
+
display: contents;
|
|
727
|
+
}
|
|
246
728
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
list.toString = function toString() {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
if (
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
if (item[4]) {
|
|
277
|
-
content += "}";
|
|
278
|
-
}
|
|
279
|
-
return content;
|
|
280
|
-
}).join("");
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
// import a list of modules into the list
|
|
284
|
-
list.i = function i(modules, media, dedupe, supports, layer) {
|
|
285
|
-
if (typeof modules === "string") {
|
|
286
|
-
modules = [[null, modules, undefined]];
|
|
287
|
-
}
|
|
288
|
-
var alreadyImportedModules = {};
|
|
289
|
-
if (dedupe) {
|
|
290
|
-
for (var k = 0; k < this.length; k++) {
|
|
291
|
-
var id = this[k][0];
|
|
292
|
-
if (id != null) {
|
|
293
|
-
alreadyImportedModules[id] = true;
|
|
294
|
-
}
|
|
729
|
+
.deeplib-modal-blocker {
|
|
730
|
+
z-index: 1000;
|
|
731
|
+
position: fixed;
|
|
732
|
+
top: 0;
|
|
733
|
+
left: 0;
|
|
734
|
+
width: 100dvw;
|
|
735
|
+
height: 100dvh;
|
|
736
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
737
|
+
}
|
|
738
|
+
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VSb290IjoiL21lZGlhL0Rlby9OVk1FL1N0dWZmL0NvZGUvQkMvQkMtRGVlcExpYi9zcmMvc3R5bGVzIiwic291cmNlcyI6WyJ2YXJzLnNjc3MiLCJidXR0b25zLnNjc3MiLCJlbGVtZW50cy5zY3NzIiwiaW5wdXRzLnNjc3MiLCJtZXNzYWdlcy5zY3NzIiwibW9kYWwuc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQUFBO0VBRUU7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBO0VBQ0E7RUFDQTtFQUNBOzs7QUNiRjtFQUNFO0VBQ0E7RUFDQTs7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nZ3KSBtaW4oMnZoLCAxdncpO1xuXG4gICAgICAuYnV0dG9uLWxhYmVsIHtcbiAgICAgICAgZGlzcGxheTogY29udGVudHM7XG4gICAgICB9XG4gICAgfVxuICB9XG59XG5cbi5kZWVwbGliLW1vZGFsLWJsb2NrZXIge1xuICB6LWluZGV4OiAxMDAwO1xuICBwb3NpdGlvbjogZml4ZWQ7XG4gIHRvcDogMDtcbiAgbGVmdDogMDtcbiAgd2lkdGg6IDEwMGR2dztcbiAgaGVpZ2h0OiAxMDBkdmg7XG4gIGJhY2tncm91bmQtY29sb3I6IHJnYmEoMCwgMCwgMCwgMC41KTtcbn1cbiJdfQ== */`;
|
|
739
|
+
|
|
740
|
+
// src/base/initialization.ts
|
|
741
|
+
var modStorage;
|
|
742
|
+
function initMod(options) {
|
|
743
|
+
const sdk = new ModSdkManager(options.modInfo.info, options.modInfo.options);
|
|
744
|
+
const MOD_NAME = ModSdkManager.ModInfo.name;
|
|
745
|
+
modStorage = new ModStorage(ModSdkManager.ModInfo.name);
|
|
746
|
+
Style.injectInline("deeplib-style", styles_default);
|
|
747
|
+
deepLibLogger.debug(`Init wait for ${MOD_NAME}`);
|
|
748
|
+
if (CurrentScreen == null || CurrentScreen === "Login") {
|
|
749
|
+
options.beforeLogin?.();
|
|
750
|
+
const removeHook = sdk.hookFunction("LoginResponse", 0, (args, next) => {
|
|
751
|
+
deepLibLogger.debug(`Init for ${MOD_NAME}! LoginResponse caught: `, args);
|
|
752
|
+
next(args);
|
|
753
|
+
const response = args[0];
|
|
754
|
+
if (response === "InvalidNamePassword") return next(args);
|
|
755
|
+
if (response && typeof response.Name === "string" && typeof response.AccountName === "string") {
|
|
756
|
+
init(options);
|
|
757
|
+
removeHook();
|
|
295
758
|
}
|
|
759
|
+
});
|
|
760
|
+
} else {
|
|
761
|
+
deepLibLogger.debug(`Already logged in, initing ${MOD_NAME}`);
|
|
762
|
+
init(options);
|
|
763
|
+
}
|
|
764
|
+
return { sdk };
|
|
765
|
+
}
|
|
766
|
+
__name(initMod, "initMod");
|
|
767
|
+
async function init(options) {
|
|
768
|
+
const MOD_NAME = ModSdkManager.ModInfo.name;
|
|
769
|
+
const MOD_VERSION = ModSdkManager.ModInfo.version;
|
|
770
|
+
if (window[MOD_NAME + "Loaded"]) return;
|
|
771
|
+
modStorage.load();
|
|
772
|
+
if (options.pathToTranslationsFolder) {
|
|
773
|
+
await Localization.init({
|
|
774
|
+
pathToTranslationsFolder: options.pathToTranslationsFolder
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
if (options.modules && !initModules(options.modules)) {
|
|
778
|
+
unloadMod();
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
if (options.migrators) {
|
|
782
|
+
for (const m of options.migrators) {
|
|
783
|
+
VersionModule.registerMigrator(m);
|
|
296
784
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
|
|
307
|
-
item[5] = layer;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
if (media) {
|
|
311
|
-
if (!item[2]) {
|
|
312
|
-
item[2] = media;
|
|
313
|
-
} else {
|
|
314
|
-
item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
|
|
315
|
-
item[2] = media;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
if (supports) {
|
|
319
|
-
if (!item[4]) {
|
|
320
|
-
item[4] = "".concat(supports);
|
|
321
|
-
} else {
|
|
322
|
-
item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
|
|
323
|
-
item[4] = supports;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
list.push(item);
|
|
785
|
+
}
|
|
786
|
+
await options.initFunction?.();
|
|
787
|
+
if (options.mainMenuOptions)
|
|
788
|
+
MainMenu.setOptions(options.mainMenuOptions);
|
|
789
|
+
VersionModule.checkVersionUpdate();
|
|
790
|
+
for (const m of modules()) {
|
|
791
|
+
if (m.defaultSettings && hasGetter(m, "defaultSettings") && m.settings && hasSetter(m, "settings")) {
|
|
792
|
+
if (Object.entries(m.defaultSettings).length === 0) continue;
|
|
793
|
+
m.settings = deepMergeMatchingProperties(m.defaultSettings, m.settings);
|
|
327
794
|
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
|
|
795
|
+
}
|
|
796
|
+
window[MOD_NAME + "Loaded"] = true;
|
|
797
|
+
deepLibLogger.log(`Loaded ${MOD_NAME}! Version: ${MOD_VERSION}`);
|
|
798
|
+
}
|
|
799
|
+
__name(init, "init");
|
|
800
|
+
function initModules(modulesToRegister) {
|
|
801
|
+
const MOD_NAME = ModSdkManager.ModInfo.name;
|
|
802
|
+
for (const module of modulesToRegister) {
|
|
803
|
+
registerModule(module);
|
|
804
|
+
}
|
|
805
|
+
for (const module of modules()) {
|
|
806
|
+
module.init();
|
|
807
|
+
}
|
|
808
|
+
for (const module of modules()) {
|
|
809
|
+
module.load();
|
|
810
|
+
}
|
|
811
|
+
for (const module of modules()) {
|
|
812
|
+
module.run();
|
|
813
|
+
}
|
|
814
|
+
deepLibLogger.debug(`Modules Loaded for ${MOD_NAME}.`);
|
|
815
|
+
return true;
|
|
816
|
+
}
|
|
817
|
+
__name(initModules, "initModules");
|
|
818
|
+
function unloadMod() {
|
|
819
|
+
const MOD_NAME = ModSdkManager.ModInfo.name;
|
|
820
|
+
unloadModules();
|
|
821
|
+
delete window[MOD_NAME + "Loaded"];
|
|
822
|
+
deepLibLogger.debug(`Unloaded ${MOD_NAME}.`);
|
|
823
|
+
return true;
|
|
824
|
+
}
|
|
825
|
+
__name(unloadMod, "unloadMod");
|
|
826
|
+
function unloadModules() {
|
|
827
|
+
for (const module of modules()) {
|
|
828
|
+
module.unload();
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
__name(unloadModules, "unloadModules");
|
|
333
832
|
|
|
334
|
-
|
|
335
|
-
|
|
833
|
+
// src/base/modules.ts
|
|
834
|
+
var modulesMap = /* @__PURE__ */ new Map();
|
|
835
|
+
function modules() {
|
|
836
|
+
return [...modulesMap.values()];
|
|
837
|
+
}
|
|
838
|
+
__name(modules, "modules");
|
|
839
|
+
function registerModule(module) {
|
|
840
|
+
modulesMap.set(module.constructor.name, module);
|
|
841
|
+
return module;
|
|
842
|
+
}
|
|
843
|
+
__name(registerModule, "registerModule");
|
|
844
|
+
function getModule(moduleType) {
|
|
845
|
+
return modulesMap.get(moduleType);
|
|
846
|
+
}
|
|
847
|
+
__name(getModule, "getModule");
|
|
336
848
|
|
|
849
|
+
// src/migrators/base_migrator.ts
|
|
850
|
+
var BaseMigrator2 = class {
|
|
851
|
+
static {
|
|
852
|
+
__name(this, "BaseMigrator");
|
|
853
|
+
}
|
|
854
|
+
};
|
|
337
855
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
return
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
/******/ };
|
|
374
|
-
/******/
|
|
375
|
-
/******/ // Execute the module function
|
|
376
|
-
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
377
|
-
/******/
|
|
378
|
-
/******/ // Return the exports of the module
|
|
379
|
-
/******/ return module.exports;
|
|
380
|
-
/******/ }
|
|
381
|
-
/******/
|
|
382
|
-
/************************************************************************/
|
|
383
|
-
/******/ /* webpack/runtime/compat get default export */
|
|
384
|
-
/******/ (() => {
|
|
385
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
386
|
-
/******/ __webpack_require__.n = (module) => {
|
|
387
|
-
/******/ var getter = module && module.__esModule ?
|
|
388
|
-
/******/ () => (module['default']) :
|
|
389
|
-
/******/ () => (module);
|
|
390
|
-
/******/ __webpack_require__.d(getter, { a: getter });
|
|
391
|
-
/******/ return getter;
|
|
392
|
-
/******/ };
|
|
393
|
-
/******/ })();
|
|
394
|
-
/******/
|
|
395
|
-
/******/ /* webpack/runtime/define property getters */
|
|
396
|
-
/******/ (() => {
|
|
397
|
-
/******/ // define getter functions for harmony exports
|
|
398
|
-
/******/ __webpack_require__.d = (exports, definition) => {
|
|
399
|
-
/******/ for(var key in definition) {
|
|
400
|
-
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
401
|
-
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
402
|
-
/******/ }
|
|
403
|
-
/******/ }
|
|
404
|
-
/******/ };
|
|
405
|
-
/******/ })();
|
|
406
|
-
/******/
|
|
407
|
-
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
408
|
-
/******/ (() => {
|
|
409
|
-
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
410
|
-
/******/ })();
|
|
411
|
-
/******/
|
|
412
|
-
/************************************************************************/
|
|
413
|
-
var __webpack_exports__ = {};
|
|
414
|
-
|
|
415
|
-
;// ./src/Base/BaseModule.ts
|
|
416
|
-
|
|
417
|
-
class BaseModule {
|
|
418
|
-
get settingsScreen() {
|
|
419
|
-
return null;
|
|
420
|
-
}
|
|
421
|
-
get settingsStorage() {
|
|
422
|
-
return this.constructor.name;
|
|
423
|
-
}
|
|
424
|
-
get settings() {
|
|
425
|
-
const modName = bcSdkMod.ModInfo.name;
|
|
426
|
-
if (!this.settingsStorage)
|
|
427
|
-
return {};
|
|
428
|
-
if (!PlayerStorage()) {
|
|
429
|
-
Player[modName] = {};
|
|
430
|
-
this.registerDefaultSettings();
|
|
431
|
-
}
|
|
432
|
-
else if (!PlayerStorage()[this.settingsStorage])
|
|
433
|
-
this.registerDefaultSettings();
|
|
434
|
-
return PlayerStorage()[this.settingsStorage];
|
|
435
|
-
}
|
|
436
|
-
init() {
|
|
437
|
-
this.registerDefaultSettings();
|
|
438
|
-
}
|
|
439
|
-
registerDefaultSettings() {
|
|
440
|
-
const storage = this.settingsStorage;
|
|
441
|
-
const defaults = this.defaultSettings;
|
|
442
|
-
if (!storage || !defaults)
|
|
443
|
-
return;
|
|
444
|
-
Player[bcSdkMod.ModInfo.name][storage] = Object.assign(defaults, Player[bcSdkMod.ModInfo.name][storage] ?? {});
|
|
445
|
-
}
|
|
446
|
-
get defaultSettings() {
|
|
447
|
-
return null;
|
|
448
|
-
}
|
|
449
|
-
load() { }
|
|
450
|
-
run() { }
|
|
451
|
-
unload() { }
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
;// ./src/Base/BaseSubscreen.ts
|
|
455
|
-
|
|
456
|
-
class BaseSubscreen {
|
|
457
|
-
static currentElements = [];
|
|
458
|
-
static currentPage = 1;
|
|
459
|
-
module;
|
|
460
|
-
constructor(module) {
|
|
461
|
-
if (module)
|
|
462
|
-
this.module = module;
|
|
463
|
-
}
|
|
464
|
-
get name() {
|
|
465
|
-
return 'UNKNOWN';
|
|
466
|
-
}
|
|
467
|
-
get icon() {
|
|
468
|
-
return '';
|
|
469
|
-
}
|
|
470
|
-
get subscreenName() {
|
|
471
|
-
return this.constructor.name;
|
|
472
|
-
}
|
|
473
|
-
setSubscreen(screen) {
|
|
474
|
-
return setSubscreen(screen);
|
|
475
|
-
}
|
|
476
|
-
get settings() {
|
|
477
|
-
return this.module.settings;
|
|
478
|
-
}
|
|
479
|
-
get pageStructure() {
|
|
480
|
-
return [[]];
|
|
481
|
-
}
|
|
482
|
-
get currentPage() {
|
|
483
|
-
return this.pageStructure[Math.min(PreferencePageCurrent - 1, this.pageStructure.length - 1)];
|
|
484
|
-
}
|
|
485
|
-
hideElements() {
|
|
486
|
-
this.pageStructure.forEach((item, ix) => {
|
|
487
|
-
if (ix != PreferencePageCurrent - 1) {
|
|
488
|
-
item.forEach((setting) => {
|
|
489
|
-
elementHide({ elementId: setting.id });
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
|
-
load() {
|
|
495
|
-
for (const module of modules()) {
|
|
496
|
-
if (!module.settingsScreen)
|
|
497
|
-
continue;
|
|
498
|
-
if (!module.settings || !Object.keys(module.settings).length)
|
|
499
|
-
module.registerDefaultSettings();
|
|
500
|
-
}
|
|
501
|
-
elementCreateSubscreenDiv();
|
|
502
|
-
const settingsElement = elementCreateSettingsDiv();
|
|
503
|
-
elementAppendToSubscreenDiv(settingsElement);
|
|
504
|
-
const subscreenTitle = elementCreateLabel({
|
|
505
|
-
type: 'label',
|
|
506
|
-
id: 'deeplib-subscreen-title',
|
|
507
|
-
label: getText('mainmenu.title').replace('$ModVersion', bcSdkMod.ModInfo.version) + ' ' + SupportHelper.getSupporter(),
|
|
508
|
-
});
|
|
509
|
-
elementAppendToSubscreenDiv(subscreenTitle);
|
|
510
|
-
if (this.name !== 'mainmenu') {
|
|
511
|
-
const exitButton = elementCreateButton({
|
|
512
|
-
type: 'button',
|
|
513
|
-
id: 'deeplib-exit',
|
|
514
|
-
position: [1815, 75],
|
|
515
|
-
size: [90, 90],
|
|
516
|
-
image: 'Icons/Exit.png',
|
|
517
|
-
onClick: () => {
|
|
518
|
-
setSubscreen('mainmenu');
|
|
519
|
-
},
|
|
520
|
-
tooltip: getText('settings.button.back_button_hint')
|
|
521
|
-
});
|
|
522
|
-
elementAppendToSubscreenDiv(exitButton);
|
|
523
|
-
}
|
|
524
|
-
const tooltip = elementCreateTooltip();
|
|
525
|
-
elementAppendToSubscreenDiv(tooltip);
|
|
526
|
-
this.pageStructure.forEach((s) => s.forEach((item) => {
|
|
527
|
-
let element;
|
|
528
|
-
switch (item.type) {
|
|
529
|
-
case 'text':
|
|
530
|
-
case 'number':
|
|
531
|
-
element = elementCreateInput(item);
|
|
532
|
-
break;
|
|
533
|
-
case 'checkbox':
|
|
534
|
-
element = elementCreateCheckbox(item);
|
|
535
|
-
break;
|
|
536
|
-
case 'button':
|
|
537
|
-
element = elementCreateButton(item);
|
|
538
|
-
break;
|
|
539
|
-
case 'label':
|
|
540
|
-
element = elementCreateLabel(item);
|
|
541
|
-
break;
|
|
542
|
-
}
|
|
543
|
-
elementAppendToSettingsDiv(element);
|
|
544
|
-
}));
|
|
545
|
-
CharacterAppearanceForceUpCharacter = Player.MemberNumber ?? -1;
|
|
546
|
-
}
|
|
547
|
-
run() {
|
|
548
|
-
const newTitle = getText('mainmenu.title').replace('$ModVersion', bcSdkMod.ModInfo.version) + ' ' + SupportHelper.getSupporter();
|
|
549
|
-
const oldTitle = ElementContent('deeplib-subscreen-title');
|
|
550
|
-
if (newTitle !== oldTitle) {
|
|
551
|
-
ElementContent('deeplib-subscreen-title', newTitle);
|
|
552
|
-
}
|
|
553
|
-
DrawCharacter(Player, 50, 50, 0.9, false);
|
|
554
|
-
if (this.pageStructure.length > 1) {
|
|
555
|
-
MainCanvas.textAlign = 'center';
|
|
556
|
-
PreferencePageChangeDraw(1595, 75, this.pageStructure.length);
|
|
557
|
-
MainCanvas.textAlign = 'left';
|
|
558
|
-
}
|
|
559
|
-
this.hideElements();
|
|
560
|
-
}
|
|
561
|
-
click() {
|
|
562
|
-
if (this.pageStructure.length > 1)
|
|
563
|
-
PreferencePageChangeClick(1595, 75, this.pageStructure.length);
|
|
564
|
-
}
|
|
565
|
-
exit() {
|
|
566
|
-
CharacterAppearanceForceUpCharacter = -1;
|
|
567
|
-
CharacterLoadCanvas(Player);
|
|
568
|
-
setSubscreen('mainmenu');
|
|
569
|
-
dataStore();
|
|
570
|
-
}
|
|
571
|
-
resize(onLoad = false) {
|
|
572
|
-
elementSetPosSizeFont({ element: elementGetSubscreenDiv() }, 0, 0, 2000, 1000);
|
|
573
|
-
if (this.name === 'mainmenu') {
|
|
574
|
-
elementSetPosSizeFont({ element: elementGetSettingsDiv() }, 530, 170, 800, 660);
|
|
575
|
-
}
|
|
576
|
-
else {
|
|
577
|
-
elementSetPosSizeFont({ element: elementGetSettingsDiv() }, 530, 170, 1000, 660);
|
|
578
|
-
}
|
|
579
|
-
elementSetPosSizeFont({ elementId: 'deeplib-subscreen-title' }, 530, 75, 800, 60);
|
|
580
|
-
elementSetPosition({ element: elementGetTooltip() }, 250, 850);
|
|
581
|
-
elementSetSize({ element: elementGetTooltip() }, 1500, 60);
|
|
582
|
-
BaseSubscreen.currentElements.forEach((item) => {
|
|
583
|
-
const options = item[1];
|
|
584
|
-
const elementDataAttrs = item[0].dataset;
|
|
585
|
-
if (options.position || elementDataAttrs.position) {
|
|
586
|
-
const position = elementDataAttrs?.position?.split('x');
|
|
587
|
-
const xPos = options?.position?.[0] || parseInt(position?.[0] || 0);
|
|
588
|
-
const yPos = options?.position?.[1] || parseInt(position?.[1] || 0);
|
|
589
|
-
elementSetPosition({ elementId: options.id }, xPos, yPos);
|
|
590
|
-
}
|
|
591
|
-
if (options.size || elementDataAttrs.size) {
|
|
592
|
-
const size = elementDataAttrs?.size?.split('x');
|
|
593
|
-
const width = options?.size?.[0] || parseInt(size?.[0] || 0);
|
|
594
|
-
const height = options?.size?.[1] || parseInt(size?.[1] || 0);
|
|
595
|
-
elementSetSize({ elementId: options.id }, width, height);
|
|
596
|
-
}
|
|
597
|
-
elementAdjustFontSize({ elementId: options.id });
|
|
598
|
-
});
|
|
599
|
-
}
|
|
600
|
-
unload() {
|
|
601
|
-
this.pageStructure.forEach((s) => s.forEach((item) => {
|
|
602
|
-
switch (item.type) {
|
|
603
|
-
case 'text':
|
|
604
|
-
item.setSettingValue(ElementValue(item.id));
|
|
605
|
-
break;
|
|
606
|
-
case 'checkbox': {
|
|
607
|
-
const elem = document.getElementById(item.id);
|
|
608
|
-
const checked = elem.checked;
|
|
609
|
-
item.setSettingValue(checked);
|
|
610
|
-
break;
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
}));
|
|
614
|
-
BaseSubscreen.currentElements = [];
|
|
615
|
-
elementRemoveSubscreenDiv();
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
// EXTERNAL MODULE: ./public/styles/DeepLib.css
|
|
620
|
-
var DeepLib = __webpack_require__(63);
|
|
621
|
-
;// ./src/Base/Initialization.ts
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
function initMod(initFunction, modules, pathToTranslationsFolder) {
|
|
625
|
-
const MOD_NAME = bcSdkMod.ModInfo.name;
|
|
626
|
-
deepLibLogger.debug(`Init wait for ${MOD_NAME}`);
|
|
627
|
-
if (CurrentScreen == null || CurrentScreen === 'Login') {
|
|
628
|
-
bcSdkMod.prototype.hookFunction('LoginResponse', 0, (args, next) => {
|
|
629
|
-
deepLibLogger.debug(`Init for ${MOD_NAME}! LoginResponse caught: `, args);
|
|
630
|
-
next(args);
|
|
631
|
-
const response = args[0];
|
|
632
|
-
if (response === 'InvalidNamePassword')
|
|
633
|
-
return next(args);
|
|
634
|
-
if (response && typeof response.Name === 'string' && typeof response.AccountName === 'string') {
|
|
635
|
-
init(initFunction, modules, pathToTranslationsFolder);
|
|
636
|
-
}
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
else {
|
|
640
|
-
deepLibLogger.debug(`Already logged in, initing ${MOD_NAME}`);
|
|
641
|
-
init(initFunction, modules, pathToTranslationsFolder);
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
async function init(initFunction, modules, pathToTranslationsFolder) {
|
|
645
|
-
const MOD_NAME = bcSdkMod.ModInfo.name;
|
|
646
|
-
const MOD_VERSION = bcSdkMod.ModInfo.version;
|
|
647
|
-
if (window[MOD_NAME + 'Loaded'])
|
|
648
|
-
return;
|
|
649
|
-
dataTake();
|
|
650
|
-
Style.inject('deeplib-style', DeepLib/* default */.A);
|
|
651
|
-
new Localization({ pathToTranslationsFolder: pathToTranslationsFolder });
|
|
652
|
-
await Localization.init();
|
|
653
|
-
if (!initModules(modules)) {
|
|
654
|
-
unloadMod();
|
|
655
|
-
return;
|
|
656
|
-
}
|
|
657
|
-
await initFunction();
|
|
658
|
-
VersionModule.checkVersionUpdate();
|
|
659
|
-
VersionModule.checkVersionMigration();
|
|
660
|
-
window[MOD_NAME + 'Loaded'] = true;
|
|
661
|
-
deepLibLogger.log(`Loaded ${MOD_NAME}! Version: ${MOD_VERSION}`);
|
|
662
|
-
}
|
|
663
|
-
function initModules(modulesToRegister) {
|
|
664
|
-
const MOD_NAME = bcSdkMod.ModInfo.name;
|
|
665
|
-
for (const module of modulesToRegister) {
|
|
666
|
-
registerModule(module);
|
|
667
|
-
}
|
|
668
|
-
for (const module of modules()) {
|
|
669
|
-
module.init();
|
|
856
|
+
// src/modules/gui.ts
|
|
857
|
+
var GUI = class _GUI extends BaseModule {
|
|
858
|
+
static {
|
|
859
|
+
__name(this, "GUI");
|
|
860
|
+
}
|
|
861
|
+
static instance = null;
|
|
862
|
+
_subscreens;
|
|
863
|
+
_mainMenu;
|
|
864
|
+
_currentSubscreen = null;
|
|
865
|
+
_modButtonOptions;
|
|
866
|
+
get subscreens() {
|
|
867
|
+
return this._subscreens;
|
|
868
|
+
}
|
|
869
|
+
get mainMenu() {
|
|
870
|
+
return this._mainMenu;
|
|
871
|
+
}
|
|
872
|
+
get currentSubscreen() {
|
|
873
|
+
return this._currentSubscreen;
|
|
874
|
+
}
|
|
875
|
+
set currentSubscreen(subscreen) {
|
|
876
|
+
if (this._currentSubscreen) {
|
|
877
|
+
this._currentSubscreen.unload();
|
|
878
|
+
}
|
|
879
|
+
if (typeof subscreen === "string") {
|
|
880
|
+
const scr = this._subscreens?.find((s) => s.name === subscreen);
|
|
881
|
+
if (!scr) throw `Failed to find screen name ${subscreen}`;
|
|
882
|
+
this._currentSubscreen = scr;
|
|
883
|
+
} else {
|
|
884
|
+
this._currentSubscreen = subscreen;
|
|
885
|
+
}
|
|
886
|
+
PreferenceMessage = "";
|
|
887
|
+
PreferencePageCurrent = 1;
|
|
888
|
+
if (this._currentSubscreen) {
|
|
889
|
+
this._currentSubscreen.load();
|
|
890
|
+
this._currentSubscreen.resize(true);
|
|
670
891
|
}
|
|
671
|
-
|
|
672
|
-
|
|
892
|
+
}
|
|
893
|
+
constructor(modButtonOptions) {
|
|
894
|
+
super();
|
|
895
|
+
if (_GUI.instance) {
|
|
896
|
+
throw new Error("Duplicate initialization");
|
|
673
897
|
}
|
|
674
898
|
for (const module of modules()) {
|
|
675
|
-
|
|
899
|
+
if (!module.settingsScreen) continue;
|
|
676
900
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
}
|
|
687
|
-
function unloadModules() {
|
|
901
|
+
this._mainMenu = new MainMenu(this);
|
|
902
|
+
this._subscreens = [this._mainMenu];
|
|
903
|
+
this._modButtonOptions = modButtonOptions;
|
|
904
|
+
_GUI.instance = this;
|
|
905
|
+
}
|
|
906
|
+
get defaultSettings() {
|
|
907
|
+
return null;
|
|
908
|
+
}
|
|
909
|
+
load() {
|
|
688
910
|
for (const module of modules()) {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
}
|
|
702
|
-
function getModule(moduleType) {
|
|
703
|
-
return modulesMap.get(moduleType);
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
;// ./src/Base/SettingDefinitions.ts
|
|
707
|
-
|
|
708
|
-
function getCurrentSubscreen() {
|
|
709
|
-
return GUI.instance && GUI.instance.currentSubscreen;
|
|
710
|
-
}
|
|
711
|
-
function setSubscreen(subscreen) {
|
|
712
|
-
if (!GUI.instance) {
|
|
713
|
-
throw new Error('Attempt to set subscreen before init');
|
|
714
|
-
}
|
|
715
|
-
GUI.instance.currentSubscreen = subscreen;
|
|
716
|
-
return GUI.instance.currentSubscreen;
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
;// ./src/Migrators/BaseMigrator.ts
|
|
720
|
-
class BaseMigrator {
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
;// ./src/Modules/GUI.ts
|
|
724
|
-
|
|
725
|
-
class GUI extends BaseModule {
|
|
726
|
-
static instance = null;
|
|
727
|
-
_subscreens;
|
|
728
|
-
_mainMenu;
|
|
729
|
-
_currentSubscreen = null;
|
|
730
|
-
_modButtonOptions;
|
|
731
|
-
get subscreens() {
|
|
732
|
-
return this._subscreens;
|
|
733
|
-
}
|
|
734
|
-
get mainMenu() {
|
|
735
|
-
return this._mainMenu;
|
|
736
|
-
}
|
|
737
|
-
get currentSubscreen() {
|
|
738
|
-
return this._currentSubscreen;
|
|
739
|
-
}
|
|
740
|
-
set currentSubscreen(subscreen) {
|
|
911
|
+
if (!module.settingsScreen) continue;
|
|
912
|
+
this._subscreens.push(new module.settingsScreen({}, module));
|
|
913
|
+
}
|
|
914
|
+
this._mainMenu.subscreens = this._subscreens;
|
|
915
|
+
PreferenceRegisterExtensionSetting({
|
|
916
|
+
Identifier: this._modButtonOptions.Identifier,
|
|
917
|
+
ButtonText: this._modButtonOptions.ButtonText,
|
|
918
|
+
Image: this._modButtonOptions.Image,
|
|
919
|
+
load: this._modButtonOptions.load || (() => {
|
|
920
|
+
setSubscreen(new MainMenu(this));
|
|
921
|
+
}),
|
|
922
|
+
run: this._modButtonOptions.run || (() => {
|
|
741
923
|
if (this._currentSubscreen) {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
this._currentSubscreen
|
|
924
|
+
MainCanvas.textAlign = "left";
|
|
925
|
+
this._currentSubscreen.run();
|
|
926
|
+
MainCanvas.textAlign = "center";
|
|
927
|
+
const newCanvasPosition = [MainCanvas.canvas.offsetLeft, MainCanvas.canvas.offsetTop, MainCanvas.canvas.clientWidth, MainCanvas.canvas.clientHeight];
|
|
928
|
+
if (!CommonArraysEqual(newCanvasPosition, DrawCanvasPosition)) {
|
|
929
|
+
DrawCanvasPosition = newCanvasPosition;
|
|
930
|
+
this._currentSubscreen.resize(false);
|
|
931
|
+
}
|
|
749
932
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
}
|
|
753
|
-
PreferenceMessage = '';
|
|
754
|
-
PreferencePageCurrent = 1;
|
|
933
|
+
}),
|
|
934
|
+
click: this._modButtonOptions.click || (() => {
|
|
755
935
|
if (this._currentSubscreen) {
|
|
756
|
-
|
|
757
|
-
this._currentSubscreen.resize(true);
|
|
936
|
+
this._currentSubscreen.click();
|
|
758
937
|
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
throw new Error('Duplicate initialization');
|
|
764
|
-
}
|
|
765
|
-
for (const module of modules()) {
|
|
766
|
-
if (!module.settingsScreen)
|
|
767
|
-
continue;
|
|
938
|
+
}),
|
|
939
|
+
exit: this._modButtonOptions.exit || (() => {
|
|
940
|
+
if (this._currentSubscreen) {
|
|
941
|
+
this._currentSubscreen.exit();
|
|
768
942
|
}
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
this.
|
|
772
|
-
|
|
773
|
-
}
|
|
774
|
-
get defaultSettings() {
|
|
775
|
-
return null;
|
|
776
|
-
}
|
|
777
|
-
load() {
|
|
778
|
-
for (const module of modules()) {
|
|
779
|
-
if (!module.settingsScreen)
|
|
780
|
-
continue;
|
|
781
|
-
this._subscreens.push(new module.settingsScreen(module));
|
|
943
|
+
}),
|
|
944
|
+
unload: this._modButtonOptions.unload || (() => {
|
|
945
|
+
if (this._currentSubscreen) {
|
|
946
|
+
this._currentSubscreen.unload();
|
|
782
947
|
}
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
Image: this._modButtonOptions.Image,
|
|
788
|
-
load: this._modButtonOptions.load || (() => {
|
|
789
|
-
setSubscreen(new MainMenu(this));
|
|
790
|
-
}),
|
|
791
|
-
run: this._modButtonOptions.run || (() => {
|
|
792
|
-
if (this._currentSubscreen) {
|
|
793
|
-
MainCanvas.textAlign = 'left';
|
|
794
|
-
this._currentSubscreen.run();
|
|
795
|
-
MainCanvas.textAlign = 'center';
|
|
796
|
-
const newCanvasPosition = [MainCanvas.canvas.offsetLeft, MainCanvas.canvas.offsetTop, MainCanvas.canvas.clientWidth, MainCanvas.canvas.clientHeight];
|
|
797
|
-
if (!CommonArraysEqual(newCanvasPosition, DrawCanvasPosition)) {
|
|
798
|
-
DrawCanvasPosition = newCanvasPosition;
|
|
799
|
-
this._currentSubscreen.resize(false);
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
}),
|
|
803
|
-
click: this._modButtonOptions.click || (() => {
|
|
804
|
-
if (this._currentSubscreen) {
|
|
805
|
-
this._currentSubscreen.click();
|
|
806
|
-
}
|
|
807
|
-
}),
|
|
808
|
-
exit: this._modButtonOptions.exit || (() => {
|
|
809
|
-
if (this._currentSubscreen) {
|
|
810
|
-
this._currentSubscreen.exit();
|
|
811
|
-
}
|
|
812
|
-
}),
|
|
813
|
-
unload: this._modButtonOptions.unload || (() => {
|
|
814
|
-
if (this._currentSubscreen) {
|
|
815
|
-
this._currentSubscreen.unload();
|
|
816
|
-
}
|
|
817
|
-
})
|
|
818
|
-
});
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
;// ./src/Modules/Version.ts
|
|
948
|
+
})
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
};
|
|
823
952
|
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
VersionModule.isItNewVersion = true;
|
|
843
|
-
VersionModule.saveVersion();
|
|
844
|
-
}
|
|
845
|
-
}
|
|
846
|
-
static checkVersionMigration() {
|
|
847
|
-
const PreviousVersion = VersionModule.loadVersion();
|
|
848
|
-
let saveRequired = false;
|
|
849
|
-
for (const migrator of VersionModule.Migrators) {
|
|
850
|
-
if (VersionModule.isNewVersion(PreviousVersion, migrator.MigrationVersion)) {
|
|
851
|
-
saveRequired = saveRequired || migrator.Migrate();
|
|
852
|
-
deepLibLogger.info(`Migrating ${bcSdkMod.ModInfo.name} from ${PreviousVersion} to ${migrator.MigrationVersion} with ${migrator.constructor.name}`);
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
if (saveRequired) {
|
|
856
|
-
dataStore();
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
static registerMigrator(migrator) {
|
|
860
|
-
VersionModule.Migrators.push(migrator);
|
|
861
|
-
}
|
|
862
|
-
static setNewVersionMessage(newVersionMessage) {
|
|
863
|
-
VersionModule.NewVersionMessage = newVersionMessage;
|
|
864
|
-
}
|
|
865
|
-
static sendNewVersionMessage() {
|
|
866
|
-
sendLocalMessage('deeplib-new-version', VersionModule.NewVersionMessage);
|
|
867
|
-
}
|
|
868
|
-
static isNewVersion(current, candidate) {
|
|
869
|
-
if (current !== undefined) {
|
|
870
|
-
const CURRENT_ = current.split('.'), CANDIDATE_ = candidate.split('.');
|
|
871
|
-
for (let i = 0; i < 3; i++) {
|
|
872
|
-
if (CURRENT_[i] === CANDIDATE_[i]) {
|
|
873
|
-
continue;
|
|
874
|
-
}
|
|
875
|
-
return CANDIDATE_[i] > CURRENT_[i];
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
if (current === undefined || current === '' || !current) {
|
|
879
|
-
return true;
|
|
953
|
+
// src/modules/version.ts
|
|
954
|
+
var VersionModule = class _VersionModule extends BaseModule {
|
|
955
|
+
static {
|
|
956
|
+
__name(this, "VersionModule");
|
|
957
|
+
}
|
|
958
|
+
static isItNewVersion = false;
|
|
959
|
+
static Version;
|
|
960
|
+
static NewVersionMessage = "";
|
|
961
|
+
static Migrators = [];
|
|
962
|
+
load() {
|
|
963
|
+
_VersionModule.Version = ModSdkManager.ModInfo.version;
|
|
964
|
+
ModSdkManager.prototype.hookFunction(
|
|
965
|
+
"ChatRoomSync",
|
|
966
|
+
HookPriority.Observe,
|
|
967
|
+
(args, next) => {
|
|
968
|
+
next(args);
|
|
969
|
+
if (modStorage.playerStorage.GlobalModule.doShowNewVersionMessage && _VersionModule.isItNewVersion) {
|
|
970
|
+
_VersionModule.sendNewVersionMessage();
|
|
880
971
|
}
|
|
881
|
-
|
|
972
|
+
},
|
|
973
|
+
"VersionModule"
|
|
974
|
+
);
|
|
975
|
+
}
|
|
976
|
+
static checkVersionUpdate() {
|
|
977
|
+
const PreviousVersion = _VersionModule.loadVersion();
|
|
978
|
+
const CurrentVersion = _VersionModule.Version;
|
|
979
|
+
if (_VersionModule.isNewVersion(PreviousVersion, CurrentVersion)) {
|
|
980
|
+
_VersionModule.isItNewVersion = true;
|
|
981
|
+
_VersionModule.checkVersionMigration();
|
|
982
|
+
_VersionModule.saveVersion();
|
|
983
|
+
}
|
|
984
|
+
modStorage.save();
|
|
985
|
+
}
|
|
986
|
+
static checkVersionMigration() {
|
|
987
|
+
const PreviousVersion = _VersionModule.loadVersion();
|
|
988
|
+
for (const migrator of _VersionModule.Migrators) {
|
|
989
|
+
if (_VersionModule.isNewVersion(PreviousVersion, migrator.MigrationVersion)) {
|
|
990
|
+
migrator.Migrate();
|
|
991
|
+
deepLibLogger.info(`Migrating ${ModSdkManager.ModInfo.name} from ${PreviousVersion} to ${migrator.MigrationVersion} with ${migrator.constructor.name}`);
|
|
992
|
+
}
|
|
882
993
|
}
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
994
|
+
}
|
|
995
|
+
static registerMigrator(migrator) {
|
|
996
|
+
_VersionModule.Migrators.push(migrator);
|
|
997
|
+
_VersionModule.Migrators.sort((a, b) => a.MigrationVersion.localeCompare(b.MigrationVersion));
|
|
998
|
+
}
|
|
999
|
+
static setNewVersionMessage(newVersionMessage) {
|
|
1000
|
+
_VersionModule.NewVersionMessage = newVersionMessage;
|
|
1001
|
+
}
|
|
1002
|
+
static sendNewVersionMessage() {
|
|
1003
|
+
sendLocalMessage("deeplib-new-version", _VersionModule.NewVersionMessage);
|
|
1004
|
+
}
|
|
1005
|
+
static isNewVersion(current, candidate) {
|
|
1006
|
+
if (current !== void 0) {
|
|
1007
|
+
const CURRENT_ = current.split("."), CANDIDATE_ = candidate.split(".");
|
|
1008
|
+
for (let i = 0; i < 3; i++) {
|
|
1009
|
+
if (CURRENT_[i] === CANDIDATE_[i]) {
|
|
1010
|
+
continue;
|
|
886
1011
|
}
|
|
1012
|
+
return CANDIDATE_[i] > CURRENT_[i];
|
|
1013
|
+
}
|
|
887
1014
|
}
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
}
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
;// ./src/Screens/Debug.ts
|
|
894
|
-
|
|
895
|
-
class GuiDebug extends BaseSubscreen {
|
|
896
|
-
get name() {
|
|
897
|
-
return 'debug';
|
|
898
|
-
}
|
|
899
|
-
get pageStructure() {
|
|
900
|
-
return [[
|
|
901
|
-
{
|
|
902
|
-
type: 'button',
|
|
903
|
-
roundness: 50,
|
|
904
|
-
id: 'test-deeplib-big-button',
|
|
905
|
-
size: [405, 80],
|
|
906
|
-
label: 'Big Button',
|
|
907
|
-
tooltip: 'This is a big button',
|
|
908
|
-
image: 'Icons/Exit.png',
|
|
909
|
-
onClick() {
|
|
910
|
-
deepLibLogger.info('Big Button Clicked');
|
|
911
|
-
}
|
|
912
|
-
},
|
|
913
|
-
{
|
|
914
|
-
type: 'button',
|
|
915
|
-
roundness: 5,
|
|
916
|
-
id: 'test-deeplib-small-button',
|
|
917
|
-
size: [90, 90],
|
|
918
|
-
tooltip: 'This is a small button',
|
|
919
|
-
image: 'Icons/Exit.png',
|
|
920
|
-
onClick() {
|
|
921
|
-
deepLibLogger.info('Small Button Clicked');
|
|
922
|
-
}
|
|
923
|
-
},
|
|
924
|
-
{
|
|
925
|
-
type: 'checkbox',
|
|
926
|
-
id: 'test-deeplib-checkbox',
|
|
927
|
-
label: 'Checkbox',
|
|
928
|
-
description: 'This is a checkbox',
|
|
929
|
-
checked: false,
|
|
930
|
-
getSettingValue() {
|
|
931
|
-
return true;
|
|
932
|
-
},
|
|
933
|
-
setSettingValue(val) {
|
|
934
|
-
deepLibLogger.info('Checkbox value:', val);
|
|
935
|
-
},
|
|
936
|
-
},
|
|
937
|
-
{
|
|
938
|
-
type: 'text',
|
|
939
|
-
id: 'test-deeplib-text-input',
|
|
940
|
-
label: 'Input',
|
|
941
|
-
description: 'This is a text input',
|
|
942
|
-
getElementValue() {
|
|
943
|
-
return 'Input Value';
|
|
944
|
-
},
|
|
945
|
-
setSettingValue(val) {
|
|
946
|
-
deepLibLogger.info('Input value:', val);
|
|
947
|
-
},
|
|
948
|
-
},
|
|
949
|
-
{
|
|
950
|
-
type: 'number',
|
|
951
|
-
id: 'test-deeplib-number-input',
|
|
952
|
-
label: 'Input',
|
|
953
|
-
description: 'This is a number input',
|
|
954
|
-
getElementValue() {
|
|
955
|
-
return '123';
|
|
956
|
-
},
|
|
957
|
-
setSettingValue(val) {
|
|
958
|
-
deepLibLogger.info('Input value:', val);
|
|
959
|
-
},
|
|
960
|
-
},
|
|
961
|
-
{
|
|
962
|
-
type: 'label',
|
|
963
|
-
id: 'test-deeplib-label',
|
|
964
|
-
label: 'Label',
|
|
965
|
-
description: 'This is a label',
|
|
966
|
-
}
|
|
967
|
-
]];
|
|
968
|
-
}
|
|
969
|
-
load() {
|
|
970
|
-
super.load();
|
|
971
|
-
}
|
|
972
|
-
run() {
|
|
973
|
-
super.run();
|
|
974
|
-
}
|
|
975
|
-
click() { }
|
|
976
|
-
exit() {
|
|
977
|
-
super.exit();
|
|
1015
|
+
if (current === void 0 || current === "" || !current) {
|
|
1016
|
+
return true;
|
|
978
1017
|
}
|
|
979
|
-
|
|
980
|
-
|
|
1018
|
+
return false;
|
|
1019
|
+
}
|
|
1020
|
+
static saveVersion() {
|
|
1021
|
+
if (modStorage.playerStorage) {
|
|
1022
|
+
Player[ModSdkManager.ModInfo.name].Version = _VersionModule.Version;
|
|
981
1023
|
}
|
|
982
|
-
}
|
|
983
|
-
|
|
984
|
-
|
|
1024
|
+
}
|
|
1025
|
+
static loadVersion() {
|
|
1026
|
+
return modStorage.playerStorage?.Version;
|
|
1027
|
+
}
|
|
1028
|
+
};
|
|
985
1029
|
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1030
|
+
// src/screens/debug.ts
|
|
1031
|
+
var GuiDebug = class extends BaseSubscreen {
|
|
1032
|
+
static {
|
|
1033
|
+
__name(this, "GuiDebug");
|
|
1034
|
+
}
|
|
1035
|
+
get name() {
|
|
1036
|
+
return "debug";
|
|
1037
|
+
}
|
|
1038
|
+
get pageStructure() {
|
|
1039
|
+
return [
|
|
1040
|
+
[
|
|
1041
|
+
{
|
|
1042
|
+
type: "button",
|
|
1043
|
+
id: "test-deeplib-big-button",
|
|
1044
|
+
size: [405, 80],
|
|
1045
|
+
label: "Big Button",
|
|
1046
|
+
tooltip: "This is a big button",
|
|
1047
|
+
image: "Icons/Exit.png",
|
|
1048
|
+
onClick() {
|
|
1049
|
+
deepLibLogger.info("Big Button Clicked");
|
|
1050
|
+
}
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
type: "button",
|
|
1054
|
+
id: "test-deeplib-small-button",
|
|
1055
|
+
size: [90, 90],
|
|
1056
|
+
tooltip: "This is a small button",
|
|
1057
|
+
image: "Icons/Exit.png",
|
|
1058
|
+
onClick() {
|
|
1059
|
+
deepLibLogger.info("Small Button Clicked");
|
|
1060
|
+
}
|
|
1061
|
+
},
|
|
1062
|
+
{
|
|
1063
|
+
type: "checkbox",
|
|
1064
|
+
id: "test-deeplib-checkbox",
|
|
1065
|
+
label: "Checkbox",
|
|
1066
|
+
description: "This is a checkbox",
|
|
1067
|
+
setElementValue() {
|
|
1068
|
+
return true;
|
|
1069
|
+
},
|
|
1070
|
+
setSettingValue(val) {
|
|
1071
|
+
deepLibLogger.info("Checkbox value:", val);
|
|
1072
|
+
}
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
type: "text",
|
|
1076
|
+
id: "test-deeplib-text-input",
|
|
1077
|
+
label: "Input",
|
|
1078
|
+
description: "This is a text input",
|
|
1079
|
+
setElementValue() {
|
|
1080
|
+
return "Input Value";
|
|
1081
|
+
},
|
|
1082
|
+
setSettingValue(val) {
|
|
1083
|
+
deepLibLogger.info("Input value:", val);
|
|
1084
|
+
}
|
|
1085
|
+
},
|
|
1086
|
+
{
|
|
1087
|
+
type: "number",
|
|
1088
|
+
id: "test-deeplib-number-input",
|
|
1089
|
+
label: "Input",
|
|
1090
|
+
description: "This is a number input",
|
|
1091
|
+
setElementValue() {
|
|
1092
|
+
return "123";
|
|
1093
|
+
},
|
|
1094
|
+
setSettingValue(val) {
|
|
1095
|
+
deepLibLogger.info("Input value:", val);
|
|
1096
|
+
}
|
|
1097
|
+
},
|
|
1098
|
+
{
|
|
1099
|
+
type: "label",
|
|
1100
|
+
id: "test-deeplib-label",
|
|
1101
|
+
label: "Label",
|
|
1102
|
+
description: "This is a label"
|
|
1057
1103
|
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
const debugButton = elementCreateButton({
|
|
1071
|
-
type: 'button',
|
|
1072
|
-
id: 'deeplib-debug-button',
|
|
1073
|
-
image: 'Assets/Female3DCG/Emoticon/Coffee/Icon.png',
|
|
1074
|
-
onClick: () => {
|
|
1075
|
-
this.setSubscreen(new GuiDebug());
|
|
1076
|
-
},
|
|
1077
|
-
size: [90, 90],
|
|
1078
|
-
position: [75, 75],
|
|
1079
|
-
});
|
|
1080
|
-
elementAppendToMiscDiv(debugButton);
|
|
1081
|
-
}
|
|
1082
|
-
run() {
|
|
1083
|
-
super.run();
|
|
1084
|
-
}
|
|
1085
|
-
click() { }
|
|
1086
|
-
exit() {
|
|
1087
|
-
CharacterAppearanceForceUpCharacter = -1;
|
|
1088
|
-
CharacterLoadCanvas(Player);
|
|
1089
|
-
this.setSubscreen(null);
|
|
1090
|
-
PreferenceSubscreenExtensionsClear();
|
|
1091
|
-
}
|
|
1092
|
-
resize() {
|
|
1093
|
-
super.resize();
|
|
1094
|
-
elementSetPosSizeFont({ elementId: 'deeplib-misc' }, 1500, 670, 405, 260);
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
function setMainMenuOptions(wikiLink, resetSubscreen) {
|
|
1098
|
-
MainMenu.wikiLink = wikiLink;
|
|
1099
|
-
MainMenu.resetSubscreen = resetSubscreen;
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
;// ./src/Screens/Support.ts
|
|
1103
|
-
|
|
1104
|
-
class SupportHelper {
|
|
1105
|
-
static thankYouList = ['Ellena', 'weboos', 'Jamie'];
|
|
1106
|
-
static thankYouNext = 0;
|
|
1107
|
-
static thankYou = '';
|
|
1108
|
-
static getSupporter() {
|
|
1109
|
-
if (SupportHelper.thankYouNext < CommonTime())
|
|
1110
|
-
SupportHelper.doNextThankYou();
|
|
1111
|
-
return `${getText('support.other.thankyou')}, ${SupportHelper.thankYou}`;
|
|
1112
|
-
}
|
|
1113
|
-
static doNextThankYou() {
|
|
1114
|
-
if (SupportHelper.thankYou && SupportHelper.thankYouList.length < 2)
|
|
1115
|
-
return;
|
|
1116
|
-
SupportHelper.thankYou = CommonRandomItemFromList(SupportHelper.thankYou, SupportHelper.thankYouList);
|
|
1117
|
-
SupportHelper.thankYouNext = CommonTime() + 5000;
|
|
1118
|
-
}
|
|
1119
|
-
}
|
|
1120
|
-
class GuiSupport extends BaseSubscreen {
|
|
1121
|
-
get name() {
|
|
1122
|
-
return 'Support';
|
|
1123
|
-
}
|
|
1124
|
-
get currentPage() {
|
|
1125
|
-
return [
|
|
1126
|
-
{
|
|
1127
|
-
type: 'button',
|
|
1128
|
-
id: 'deeplib-support-kofi',
|
|
1129
|
-
size: [405, 80],
|
|
1130
|
-
label: getText('support.button.ko-fi'),
|
|
1131
|
-
image: 'https://storage.ko-fi.com/cdn/nav-logo-stroke.png',
|
|
1132
|
-
onClick() {
|
|
1133
|
-
window.open('https://ko-fi.com/monikka_bc', '_blank');
|
|
1134
|
-
}
|
|
1135
|
-
},
|
|
1136
|
-
{
|
|
1137
|
-
type: 'button',
|
|
1138
|
-
id: 'deeplib-support-patreon',
|
|
1139
|
-
size: [405, 80],
|
|
1140
|
-
label: getText('support.button.patreon'),
|
|
1141
|
-
image: 'https://c5.patreon.com/external/favicon/rebrand/favicon-32.png?v=af5597c2ef',
|
|
1142
|
-
onClick() {
|
|
1143
|
-
window.open('https://patreon.com/monikka_bc', '_blank');
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
];
|
|
1147
|
-
}
|
|
1148
|
-
load() {
|
|
1149
|
-
SupportHelper.doNextThankYou();
|
|
1150
|
-
super.load();
|
|
1151
|
-
ElementRemove('deeplib-settngs');
|
|
1152
|
-
ElementCreateDiv('deeplib-gratitude');
|
|
1153
|
-
const elm = document.getElementById('deeplib-gratitude');
|
|
1154
|
-
ElementContent('deeplib-gratitude', gratitudeHtml);
|
|
1155
|
-
elementSetPosSizeFont({ element: elm }, 1000, 250, 400, 400);
|
|
1156
|
-
}
|
|
1157
|
-
run() {
|
|
1158
|
-
super.run();
|
|
1159
|
-
}
|
|
1160
|
-
click() {
|
|
1161
|
-
super.click();
|
|
1162
|
-
}
|
|
1163
|
-
exit() {
|
|
1164
|
-
ElementRemove('deeplib-gratitude');
|
|
1165
|
-
super.exit();
|
|
1166
|
-
}
|
|
1167
|
-
resize() {
|
|
1168
|
-
super.resize();
|
|
1169
|
-
elementSetPosSizeFont({ elementId: 'deeplib-gratitude' }, 1000, 250, 400, 400);
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
const gratitudeHtml = `
|
|
1173
|
-
<h1>Dear Supporters!</h1>
|
|
1174
|
-
<p>
|
|
1175
|
-
I want to take a moment to express my heartfelt gratitude for considering supporting me. Your willingness to stand by
|
|
1176
|
-
my side in this creative journey means the world to me, and I am truly humbled by your generosity.
|
|
1177
|
-
</p>
|
|
1178
|
-
<p>
|
|
1179
|
-
Your support goes far beyond the financial contributions; it represents belief in my work and a shared passion for
|
|
1180
|
-
what I do. Your encouragement inspires me to continue developing.
|
|
1181
|
-
</p>
|
|
1182
|
-
<p>
|
|
1183
|
-
Your support not only helps me sustain and grow as a developer, but also enables me to dedicate more time and
|
|
1184
|
-
resources to producing high-quality mods. It allows me to explore new ideas, enhance my skills, and bring even more
|
|
1185
|
-
meaningful and enjoyable content to you.
|
|
1186
|
-
</p>
|
|
1187
|
-
<p>Thank you all~</p>
|
|
1188
|
-
<p>With love, Monikka♥</p>
|
|
1189
|
-
`;
|
|
1190
|
-
|
|
1191
|
-
;// ./src/Utilities/Data.ts
|
|
1192
|
-
|
|
1193
|
-
const PlayerStorage = () => (typeof Player?.[bcSdkMod.ModInfo.name] === 'object' ?
|
|
1194
|
-
CommonCloneDeep(Player?.[bcSdkMod.ModInfo.name]) :
|
|
1195
|
-
undefined);
|
|
1196
|
-
const ExtensionStorage = () => Player.ExtensionSettings[bcSdkMod.ModInfo.name];
|
|
1197
|
-
function dataTake(modName = bcSdkMod.ModInfo.name) {
|
|
1198
|
-
if (ExtensionStorage()) {
|
|
1199
|
-
const parsed = JSON.parse(LZString.decompressFromBase64(ExtensionStorage()) || '');
|
|
1200
|
-
Player[modName] = Object.hasOwn(parsed, 'Version') ? parsed : undefined;
|
|
1201
|
-
}
|
|
1202
|
-
else {
|
|
1203
|
-
Player[modName] = {};
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
function dataStore() {
|
|
1207
|
-
const modName = bcSdkMod.ModInfo.name;
|
|
1208
|
-
const modVersion = bcSdkMod.ModInfo.version;
|
|
1209
|
-
if (!ExtensionStorage())
|
|
1210
|
-
Player.ExtensionSettings[modName] = '';
|
|
1211
|
-
const Data = {
|
|
1212
|
-
GlobalModule: {
|
|
1213
|
-
modEnabled: false,
|
|
1214
|
-
doShowNewVersionMessage: false
|
|
1104
|
+
],
|
|
1105
|
+
[
|
|
1106
|
+
{
|
|
1107
|
+
type: "button",
|
|
1108
|
+
id: "test-deeplib-big-button2",
|
|
1109
|
+
size: [405, 80],
|
|
1110
|
+
label: "Big Button",
|
|
1111
|
+
tooltip: "This is a big button",
|
|
1112
|
+
image: "Icons/Prev.png",
|
|
1113
|
+
onClick() {
|
|
1114
|
+
deepLibLogger.info("Big Button Clicked");
|
|
1115
|
+
}
|
|
1215
1116
|
},
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
}
|
|
1117
|
+
{
|
|
1118
|
+
type: "button",
|
|
1119
|
+
id: "test-deeplib-small-button2",
|
|
1120
|
+
size: [90, 90],
|
|
1121
|
+
tooltip: "This is a small button",
|
|
1122
|
+
image: "Icons/Next.png",
|
|
1123
|
+
onClick() {
|
|
1124
|
+
deepLibLogger.info("Small Button Clicked");
|
|
1125
|
+
}
|
|
1126
|
+
},
|
|
1127
|
+
{
|
|
1128
|
+
type: "checkbox",
|
|
1129
|
+
id: "test-deeplib-checkbox2",
|
|
1130
|
+
label: "Checkbox",
|
|
1131
|
+
description: "This is a checkbox",
|
|
1132
|
+
setElementValue() {
|
|
1133
|
+
return true;
|
|
1134
|
+
},
|
|
1135
|
+
setSettingValue(val) {
|
|
1136
|
+
deepLibLogger.info("Checkbox value:", val);
|
|
1137
|
+
}
|
|
1138
|
+
},
|
|
1139
|
+
{
|
|
1140
|
+
type: "text",
|
|
1141
|
+
id: "test-deeplib-text-input2",
|
|
1142
|
+
label: "Input",
|
|
1143
|
+
description: "This is a text input",
|
|
1144
|
+
setElementValue() {
|
|
1145
|
+
return "Input Value";
|
|
1146
|
+
},
|
|
1147
|
+
setSettingValue(val) {
|
|
1148
|
+
deepLibLogger.info("Input value:", val);
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
type: "number",
|
|
1153
|
+
id: "test-deeplib-number-input2",
|
|
1154
|
+
label: "Input",
|
|
1155
|
+
description: "This is a number input",
|
|
1156
|
+
setElementValue() {
|
|
1157
|
+
return "123";
|
|
1158
|
+
},
|
|
1159
|
+
setSettingValue(val) {
|
|
1160
|
+
deepLibLogger.info("Input value:", val);
|
|
1161
|
+
}
|
|
1162
|
+
},
|
|
1163
|
+
{
|
|
1164
|
+
type: "label",
|
|
1165
|
+
id: "test-deeplib-label2",
|
|
1166
|
+
label: "Label",
|
|
1167
|
+
description: "This is a label"
|
|
1168
|
+
}
|
|
1169
|
+
]
|
|
1170
|
+
];
|
|
1171
|
+
}
|
|
1172
|
+
};
|
|
1226
1173
|
|
|
1227
|
-
|
|
1228
|
-
function
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1174
|
+
// src/utilities/common.ts
|
|
1175
|
+
function deepMerge(target, source) {
|
|
1176
|
+
if (target === void 0) return source;
|
|
1177
|
+
if (source === void 0) return target;
|
|
1178
|
+
if (typeof target !== "object" || typeof source !== "object") {
|
|
1179
|
+
return source;
|
|
1180
|
+
}
|
|
1181
|
+
for (const key of Object.keys(source)) {
|
|
1182
|
+
if (Array.isArray(source[key]) && Array.isArray(target[key])) {
|
|
1183
|
+
target[key] = [...target[key], ...source[key]];
|
|
1184
|
+
} else if (typeof source[key] === "object" && source[key] !== null) {
|
|
1185
|
+
target[key] = deepMerge(target[key] || {}, source[key]);
|
|
1186
|
+
} else {
|
|
1187
|
+
target[key] = source[key];
|
|
1233
1188
|
}
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1189
|
+
}
|
|
1190
|
+
return target;
|
|
1191
|
+
}
|
|
1192
|
+
__name(deepMerge, "deepMerge");
|
|
1193
|
+
function shuffleArray(array) {
|
|
1194
|
+
const temp = JSON.parse(JSON.stringify(array));
|
|
1195
|
+
const ret = [];
|
|
1196
|
+
while (temp.length > 0) {
|
|
1197
|
+
const d = Math.floor(Math.random() * temp.length);
|
|
1198
|
+
ret.push(temp[d]);
|
|
1199
|
+
temp.splice(d, 1);
|
|
1200
|
+
}
|
|
1201
|
+
return ret;
|
|
1247
1202
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1203
|
+
__name(shuffleArray, "shuffleArray");
|
|
1204
|
+
function exportToGlobal(name, value) {
|
|
1205
|
+
const keys = name.split(".");
|
|
1206
|
+
let current = globalThis;
|
|
1207
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
1208
|
+
if (!current[keys[i]]) {
|
|
1209
|
+
current[keys[i]] = {};
|
|
1253
1210
|
}
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
return div;
|
|
1258
|
-
}
|
|
1259
|
-
function elementGetSettingsDiv() {
|
|
1260
|
-
return document.getElementById('deeplib-settings') ?? undefined;
|
|
1261
|
-
}
|
|
1262
|
-
function elementAppendToSettingsDiv(element) {
|
|
1263
|
-
return elementGetSettingsDiv()?.appendChild(element);
|
|
1264
|
-
}
|
|
1265
|
-
function elementCreateMiscDiv() {
|
|
1266
|
-
const miscDiv = elementGetMiscDiv();
|
|
1267
|
-
if (miscDiv) {
|
|
1268
|
-
console.error('Settings screen already exists');
|
|
1269
|
-
return miscDiv;
|
|
1270
|
-
}
|
|
1271
|
-
const div = document.createElement('div');
|
|
1272
|
-
div.id = 'deeplib-misc';
|
|
1273
|
-
div.classList.add('deeplib-misc');
|
|
1274
|
-
return div;
|
|
1275
|
-
}
|
|
1276
|
-
function elementGetMiscDiv() {
|
|
1277
|
-
return document.getElementById('deeplib-misc');
|
|
1278
|
-
}
|
|
1279
|
-
function elementAppendToMiscDiv(element) {
|
|
1280
|
-
return elementGetMiscDiv()?.appendChild(element);
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
;// ./src/Utilities/Elements/.ElementHelpers.ts
|
|
1284
|
-
|
|
1285
|
-
const mainCanvasHeight = 1000;
|
|
1286
|
-
const mainCanvasWidth = 2000;
|
|
1287
|
-
function getRelativeHeight(height) {
|
|
1288
|
-
return height * (MainCanvas.canvas.clientHeight / mainCanvasHeight);
|
|
1289
|
-
}
|
|
1290
|
-
function getRelativeWidth(width) {
|
|
1291
|
-
return width * (MainCanvas.canvas.clientWidth / mainCanvasWidth);
|
|
1292
|
-
}
|
|
1293
|
-
function getRelativeY(yPos) {
|
|
1294
|
-
return MainCanvas.canvas.offsetTop + yPos * (MainCanvas.canvas.clientHeight / mainCanvasHeight);
|
|
1295
|
-
}
|
|
1296
|
-
function getRelativeX(xPos) {
|
|
1297
|
-
return MainCanvas.canvas.offsetLeft + xPos * (MainCanvas.canvas.clientWidth / mainCanvasWidth);
|
|
1298
|
-
}
|
|
1299
|
-
function elementSetPosition(_, xPos, yPos) {
|
|
1300
|
-
const element = elementGet(_, 'elementSetPosition');
|
|
1301
|
-
if (!element)
|
|
1302
|
-
return;
|
|
1303
|
-
const Top = getRelativeY(yPos);
|
|
1304
|
-
const Left = getRelativeX(xPos);
|
|
1305
|
-
Object.assign(element.style, {
|
|
1306
|
-
position: 'fixed',
|
|
1307
|
-
left: Left + 'px',
|
|
1308
|
-
top: Top + 'px'
|
|
1309
|
-
});
|
|
1310
|
-
}
|
|
1311
|
-
function elementSetSize(_, width, height) {
|
|
1312
|
-
const element = elementGet(_, 'elementSetSize');
|
|
1313
|
-
if (!element)
|
|
1314
|
-
return;
|
|
1315
|
-
const Height = getRelativeHeight(height);
|
|
1316
|
-
const Width = getRelativeWidth(width);
|
|
1317
|
-
Object.assign(element.style, {
|
|
1318
|
-
width: Width + 'px',
|
|
1319
|
-
height: Height + 'px',
|
|
1320
|
-
});
|
|
1321
|
-
}
|
|
1322
|
-
function elementAdjustFontSize(_) {
|
|
1323
|
-
const element = elementGet(_, 'elementAdjustFontSize');
|
|
1324
|
-
if (!element)
|
|
1325
|
-
return;
|
|
1326
|
-
const Font = MainCanvas.canvas.clientWidth <= MainCanvas.canvas.clientHeight * 2 ? MainCanvas.canvas.clientWidth / 50 : MainCanvas.canvas.clientHeight / 25;
|
|
1327
|
-
Object.assign(element.style, {
|
|
1328
|
-
fontSize: Font + 'px',
|
|
1329
|
-
fontFamily: CommonGetFontName()
|
|
1330
|
-
});
|
|
1331
|
-
}
|
|
1332
|
-
function elementSetPosSizeFont(_, xPos, yPos, width, height) {
|
|
1333
|
-
if (elementGet(_, 'elementSetPosSizeFont') === null)
|
|
1334
|
-
return;
|
|
1335
|
-
elementSetPosition(_, xPos, yPos);
|
|
1336
|
-
elementSetSize(_, width, height);
|
|
1337
|
-
elementAdjustFontSize(_);
|
|
1338
|
-
}
|
|
1339
|
-
function elementHide(_) {
|
|
1340
|
-
const element = elementGet(_, 'elementHide');
|
|
1341
|
-
if (!element)
|
|
1342
|
-
return;
|
|
1343
|
-
element.style.display = 'none';
|
|
1344
|
-
}
|
|
1345
|
-
function elementUnhide(_) {
|
|
1346
|
-
const element = elementGet(_, 'elementUnhide');
|
|
1347
|
-
if (!element)
|
|
1348
|
-
return;
|
|
1349
|
-
element.style.display = '';
|
|
1211
|
+
current = current[keys[i]];
|
|
1212
|
+
}
|
|
1213
|
+
current[keys[keys.length - 1]] = value;
|
|
1350
1214
|
}
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1215
|
+
__name(exportToGlobal, "exportToGlobal");
|
|
1216
|
+
function deepMergeMatchingProperties(mergeTo, mergeFrom) {
|
|
1217
|
+
const mergedObject = { ...mergeTo };
|
|
1218
|
+
for (const key in mergeFrom) {
|
|
1219
|
+
if (mergeFrom[key] !== null && typeof mergeFrom[key] === "object") {
|
|
1220
|
+
mergedObject[key] = deepMergeMatchingProperties(mergedObject[key] || {}, mergeFrom[key]);
|
|
1221
|
+
} else if (key in mergedObject) {
|
|
1222
|
+
mergedObject[key] = mergeFrom[key];
|
|
1355
1223
|
}
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1224
|
+
}
|
|
1225
|
+
return mergedObject;
|
|
1226
|
+
}
|
|
1227
|
+
__name(deepMergeMatchingProperties, "deepMergeMatchingProperties");
|
|
1228
|
+
function hasGetter(obj, prop) {
|
|
1229
|
+
while (obj && obj !== Object.prototype) {
|
|
1230
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
1231
|
+
if (descriptor?.get) return true;
|
|
1232
|
+
obj = Object.getPrototypeOf(obj);
|
|
1233
|
+
}
|
|
1234
|
+
return false;
|
|
1235
|
+
}
|
|
1236
|
+
__name(hasGetter, "hasGetter");
|
|
1237
|
+
function hasSetter(obj, prop) {
|
|
1238
|
+
while (obj && obj !== Object.prototype) {
|
|
1239
|
+
const descriptor = Object.getOwnPropertyDescriptor(obj, prop);
|
|
1240
|
+
if (descriptor?.set) return true;
|
|
1241
|
+
obj = Object.getPrototypeOf(obj);
|
|
1242
|
+
}
|
|
1243
|
+
return false;
|
|
1244
|
+
}
|
|
1245
|
+
__name(hasSetter, "hasSetter");
|
|
1246
|
+
|
|
1247
|
+
// src/utilities/elements/advanced_elements.ts
|
|
1248
|
+
var advancedElement = {
|
|
1249
|
+
createButton: elementCreateButton,
|
|
1250
|
+
createCheckbox: elementCreateCheckbox,
|
|
1251
|
+
createInput: elementCreateInput,
|
|
1252
|
+
createLabel: elementCreateLabel,
|
|
1253
|
+
createCustom: elementCreateCustom,
|
|
1254
|
+
createTooltip: elementCreateTooltip,
|
|
1255
|
+
getTooltip: elementGetTooltip,
|
|
1256
|
+
setTooltip: elementSetTooltip,
|
|
1257
|
+
createBackNext: elementPrevNext
|
|
1258
|
+
};
|
|
1367
1259
|
function elementCreateButton(options) {
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
disabled: options.disabled,
|
|
1387
|
-
decoding: 'async',
|
|
1388
|
-
loading: 'lazy',
|
|
1389
|
-
src: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
|
|
1390
|
-
},
|
|
1391
|
-
dataAttributes: {
|
|
1392
|
-
'size': options.size?.join('x'),
|
|
1393
|
-
'position': options.position?.join('x'),
|
|
1394
|
-
},
|
|
1395
|
-
style: {
|
|
1396
|
-
'--image': `url("${options.image}")`,
|
|
1397
|
-
}
|
|
1398
|
-
},
|
|
1399
|
-
],
|
|
1400
|
-
style: {
|
|
1401
|
-
width: width,
|
|
1402
|
-
height: height,
|
|
1403
|
-
left: left,
|
|
1404
|
-
top: top,
|
|
1405
|
-
position: position,
|
|
1406
|
-
}
|
|
1407
|
-
},
|
|
1408
|
-
});
|
|
1409
|
-
BaseSubscreen.currentElements.push([button, options]);
|
|
1410
|
-
return button;
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1413
|
-
;// ./src/Utilities/Elements/Checkbox.ts
|
|
1414
|
-
|
|
1415
|
-
function elementCreateCheckbox(options) {
|
|
1416
|
-
const elem = document.getElementById(options.id);
|
|
1417
|
-
if (elem)
|
|
1418
|
-
return elem;
|
|
1419
|
-
const width = options.size ? getRelativeWidth(options.size[0]) + 'px' : '';
|
|
1420
|
-
const height = options.size ? getRelativeHeight(options.size[1]) + 'px' : '';
|
|
1421
|
-
const left = options.position ? getRelativeX(options.position[0]) + 'px' : '';
|
|
1422
|
-
const top = options.position ? getRelativeY(options.position[1]) + 'px' : '';
|
|
1423
|
-
const position = options.position ? 'fixed' : '';
|
|
1424
|
-
const retElem = ElementCreate({
|
|
1425
|
-
tag: 'div',
|
|
1426
|
-
classList: ['deeplib-checkbox-container'],
|
|
1427
|
-
style: {
|
|
1428
|
-
width: width,
|
|
1429
|
-
height: height,
|
|
1430
|
-
left: left,
|
|
1431
|
-
top: top,
|
|
1432
|
-
position: position,
|
|
1433
|
-
},
|
|
1434
|
-
dataAttributes: {
|
|
1435
|
-
'size': options.size?.join('x'),
|
|
1436
|
-
'position': options.position?.join('x'),
|
|
1437
|
-
},
|
|
1438
|
-
children: [
|
|
1439
|
-
{
|
|
1440
|
-
tag: 'input',
|
|
1441
|
-
classList: ['deeplib-input'],
|
|
1442
|
-
attributes: {
|
|
1443
|
-
type: 'checkbox',
|
|
1444
|
-
id: options.id,
|
|
1445
|
-
checked: options.getSettingValue() || undefined,
|
|
1446
|
-
},
|
|
1447
|
-
},
|
|
1448
|
-
{
|
|
1449
|
-
tag: 'label',
|
|
1450
|
-
classList: ['deeplib-text'],
|
|
1451
|
-
attributes: {
|
|
1452
|
-
for: options.id,
|
|
1453
|
-
},
|
|
1454
|
-
children: [options.label]
|
|
1455
|
-
},
|
|
1456
|
-
]
|
|
1457
|
-
});
|
|
1458
|
-
if (options.description) {
|
|
1459
|
-
retElem.addEventListener('mouseover', () => {
|
|
1460
|
-
elementSetTooltip(options.description);
|
|
1461
|
-
});
|
|
1462
|
-
retElem.addEventListener('mouseout', () => {
|
|
1463
|
-
elementSetTooltip('');
|
|
1464
|
-
});
|
|
1465
|
-
}
|
|
1466
|
-
BaseSubscreen.currentElements.push([retElem, options]);
|
|
1467
|
-
return retElem;
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
;// ./src/Utilities/Elements/Input.ts
|
|
1471
|
-
|
|
1472
|
-
function elementCreateInput(options) {
|
|
1473
|
-
const elem = document.getElementById(options.id);
|
|
1474
|
-
if (elem)
|
|
1475
|
-
return elem;
|
|
1476
|
-
const width = options.size ? getRelativeWidth(options.size[0]) + 'px' : '';
|
|
1477
|
-
const height = options.size ? getRelativeHeight(options.size[1]) + 'px' : '';
|
|
1478
|
-
const left = options.position ? getRelativeX(options.position[0]) + 'px' : '';
|
|
1479
|
-
const top = options.position ? getRelativeY(options.position[1]) + 'px' : '';
|
|
1480
|
-
const position = options.position ? 'fixed' : '';
|
|
1481
|
-
const retElem = ElementCreate({
|
|
1482
|
-
tag: 'div',
|
|
1483
|
-
classList: ['deeplib-input-container'],
|
|
1484
|
-
style: {
|
|
1485
|
-
width: width,
|
|
1486
|
-
height: height,
|
|
1487
|
-
left: left,
|
|
1488
|
-
top: top,
|
|
1489
|
-
position: position,
|
|
1490
|
-
},
|
|
1491
|
-
dataAttributes: {
|
|
1492
|
-
'size': options.size?.join('x'),
|
|
1493
|
-
'position': options.position?.join('x'),
|
|
1260
|
+
const elem = document.getElementById(options.id);
|
|
1261
|
+
if (elem) return elem;
|
|
1262
|
+
options.type = "button";
|
|
1263
|
+
const disabled = typeof options?.disabled === "function" ? options?.disabled() : options?.disabled;
|
|
1264
|
+
const button = ElementButton.Create(
|
|
1265
|
+
options.htmlOptions?.id ?? options.id,
|
|
1266
|
+
options.htmlOptions?.onClick ?? options?.onClick ?? (() => {
|
|
1267
|
+
}),
|
|
1268
|
+
deepMerge({
|
|
1269
|
+
tooltip: options.tooltip,
|
|
1270
|
+
label: options.label,
|
|
1271
|
+
labelPosition: "center"
|
|
1272
|
+
}, options.htmlOptions?.options),
|
|
1273
|
+
deepMerge({
|
|
1274
|
+
button: {
|
|
1275
|
+
classList: ["deeplib-button"],
|
|
1276
|
+
attributes: {
|
|
1277
|
+
disabled
|
|
1494
1278
|
},
|
|
1495
1279
|
children: [
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1280
|
+
options.image ? {
|
|
1281
|
+
tag: "img",
|
|
1282
|
+
attributes: {
|
|
1283
|
+
id: `${options.id}-image`,
|
|
1284
|
+
alt: "",
|
|
1285
|
+
decoding: "async",
|
|
1286
|
+
loading: "lazy",
|
|
1287
|
+
src: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"
|
|
1288
|
+
// 1x1 transparent image to get rid of broken image
|
|
1504
1289
|
},
|
|
1505
|
-
{
|
|
1506
|
-
|
|
1507
|
-
classList: ['deeplib-text'],
|
|
1508
|
-
attributes: {
|
|
1509
|
-
for: options.id,
|
|
1510
|
-
},
|
|
1511
|
-
children: [options.label]
|
|
1512
|
-
},
|
|
1513
|
-
{
|
|
1514
|
-
tag: 'div',
|
|
1515
|
-
classList: ['deeplib-underline'],
|
|
1290
|
+
style: {
|
|
1291
|
+
"--image": `url("${options.image}")`
|
|
1516
1292
|
}
|
|
1293
|
+
} : void 0
|
|
1517
1294
|
]
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
}
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
if (elem)
|
|
1541
|
-
return elem;
|
|
1542
|
-
const width = options.size ? getRelativeWidth(options.size[0]) + 'px' : '';
|
|
1543
|
-
const height = options.size ? getRelativeHeight(options.size[1]) + 'px' : '';
|
|
1544
|
-
const left = options.position ? getRelativeX(options.position[0]) + 'px' : '';
|
|
1545
|
-
const top = options.position ? getRelativeY(options.position[1]) + 'px' : '';
|
|
1546
|
-
const position = options.position ? 'fixed' : '';
|
|
1547
|
-
const retElem = ElementCreate({
|
|
1548
|
-
tag: 'span',
|
|
1549
|
-
classList: ['deeplib-label', 'deeplib-text'],
|
|
1295
|
+
}
|
|
1296
|
+
}, options.htmlOptions?.htmlOptions ?? {})
|
|
1297
|
+
);
|
|
1298
|
+
BaseSubscreen.currentElements.push([button, options]);
|
|
1299
|
+
return button;
|
|
1300
|
+
}
|
|
1301
|
+
__name(elementCreateButton, "elementCreateButton");
|
|
1302
|
+
function elementCreateCheckbox(options) {
|
|
1303
|
+
const elem = document.getElementById(options.id);
|
|
1304
|
+
if (elem) return elem;
|
|
1305
|
+
options.type = "checkbox";
|
|
1306
|
+
const disabled = typeof options?.disabled === "function" ? options?.disabled() : options?.disabled;
|
|
1307
|
+
const retElem = ElementCreate({
|
|
1308
|
+
tag: "div",
|
|
1309
|
+
classList: ["deeplib-checkbox-container"],
|
|
1310
|
+
attributes: {
|
|
1311
|
+
id: `${options.id}-container`
|
|
1312
|
+
},
|
|
1313
|
+
children: [
|
|
1314
|
+
deepMerge({
|
|
1315
|
+
tag: "input",
|
|
1316
|
+
classList: ["checkbox", "deeplib-input"],
|
|
1550
1317
|
attributes: {
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
'position': options.position?.join('x'),
|
|
1318
|
+
type: "checkbox",
|
|
1319
|
+
id: options.id,
|
|
1320
|
+
disabled,
|
|
1321
|
+
checked: options?.setElementValue?.() || void 0
|
|
1322
|
+
}
|
|
1323
|
+
}, options.htmlOptions),
|
|
1324
|
+
{
|
|
1325
|
+
tag: "label",
|
|
1326
|
+
classList: ["deeplib-text"],
|
|
1327
|
+
attributes: {
|
|
1328
|
+
for: options.id
|
|
1563
1329
|
},
|
|
1564
|
-
children: [
|
|
1565
|
-
|
|
1566
|
-
|
|
1330
|
+
children: [options.label]
|
|
1331
|
+
}
|
|
1332
|
+
],
|
|
1333
|
+
eventListeners: {
|
|
1334
|
+
change: /* @__PURE__ */ __name(() => {
|
|
1335
|
+
options?.setSettingValue?.(document.getElementById(options.id)?.checked);
|
|
1336
|
+
}, "change")
|
|
1337
|
+
}
|
|
1338
|
+
});
|
|
1339
|
+
if (options.description) {
|
|
1340
|
+
retElem.addEventListener("mouseover", () => {
|
|
1341
|
+
elementSetTooltip(options.description || "");
|
|
1567
1342
|
});
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1343
|
+
retElem.addEventListener("mouseout", () => {
|
|
1344
|
+
elementSetTooltip("");
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1347
|
+
BaseSubscreen.currentElements.push([retElem, options]);
|
|
1348
|
+
return retElem;
|
|
1349
|
+
}
|
|
1350
|
+
__name(elementCreateCheckbox, "elementCreateCheckbox");
|
|
1351
|
+
function elementCreateCustom(options) {
|
|
1352
|
+
const elem = document.getElementById(options.id);
|
|
1353
|
+
if (elem) return elem;
|
|
1354
|
+
options.type = "custom";
|
|
1355
|
+
const retElem = ElementCreate(options.htmlOptions);
|
|
1356
|
+
BaseSubscreen.currentElements.push([retElem, options]);
|
|
1357
|
+
return retElem;
|
|
1358
|
+
}
|
|
1359
|
+
__name(elementCreateCustom, "elementCreateCustom");
|
|
1360
|
+
function elementCreateInput(options) {
|
|
1361
|
+
const elem = document.getElementById(options.id);
|
|
1362
|
+
if (elem) return elem;
|
|
1363
|
+
const disabled = typeof options?.disabled === "function" ? options?.disabled() : options?.disabled;
|
|
1364
|
+
const retElem = ElementCreate({
|
|
1365
|
+
tag: "div",
|
|
1366
|
+
classList: ["deeplib-input-container"],
|
|
1367
|
+
attributes: {
|
|
1368
|
+
id: `${options.id}-container`
|
|
1369
|
+
},
|
|
1370
|
+
children: [
|
|
1371
|
+
deepMerge({
|
|
1372
|
+
tag: "input",
|
|
1373
|
+
classList: ["deeplib-input"],
|
|
1585
1374
|
attributes: {
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1375
|
+
type: options.type,
|
|
1376
|
+
id: options.id,
|
|
1377
|
+
placeholder: " ",
|
|
1378
|
+
disabled,
|
|
1379
|
+
value: options?.setElementValue?.() || void 0
|
|
1590
1380
|
}
|
|
1381
|
+
}, options.htmlOptions),
|
|
1382
|
+
options.label ? {
|
|
1383
|
+
tag: "label",
|
|
1384
|
+
classList: ["deeplib-text"],
|
|
1385
|
+
attributes: {
|
|
1386
|
+
for: options.id
|
|
1387
|
+
},
|
|
1388
|
+
children: [options.label]
|
|
1389
|
+
} : void 0
|
|
1390
|
+
],
|
|
1391
|
+
eventListeners: {
|
|
1392
|
+
input: /* @__PURE__ */ __name(() => {
|
|
1393
|
+
options?.setSettingValue?.(document.getElementById(options.id)?.value);
|
|
1394
|
+
}, "input")
|
|
1395
|
+
}
|
|
1396
|
+
});
|
|
1397
|
+
if (options.description) {
|
|
1398
|
+
retElem.addEventListener("mouseover", () => {
|
|
1399
|
+
elementSetTooltip(options.description || "");
|
|
1400
|
+
});
|
|
1401
|
+
retElem.addEventListener("mouseout", () => {
|
|
1402
|
+
elementSetTooltip("");
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
BaseSubscreen.currentElements.push([retElem, options]);
|
|
1406
|
+
return retElem;
|
|
1407
|
+
}
|
|
1408
|
+
__name(elementCreateInput, "elementCreateInput");
|
|
1409
|
+
function elementCreateLabel(options) {
|
|
1410
|
+
const elem = document.getElementById(options.id);
|
|
1411
|
+
if (elem) return elem;
|
|
1412
|
+
options.type = "label";
|
|
1413
|
+
const retElem = ElementCreate(deepMerge({
|
|
1414
|
+
tag: "span",
|
|
1415
|
+
classList: ["deeplib-label", "deeplib-text"],
|
|
1416
|
+
attributes: {
|
|
1417
|
+
id: options.id
|
|
1418
|
+
},
|
|
1419
|
+
children: [
|
|
1420
|
+
options.label
|
|
1421
|
+
]
|
|
1422
|
+
}, options.htmlOptions));
|
|
1423
|
+
if (options.description) {
|
|
1424
|
+
retElem.addEventListener("mouseover", () => {
|
|
1425
|
+
elementSetTooltip(options.description || "");
|
|
1591
1426
|
});
|
|
1592
|
-
|
|
1427
|
+
retElem.addEventListener("mouseout", () => {
|
|
1428
|
+
elementSetTooltip("");
|
|
1429
|
+
});
|
|
1430
|
+
}
|
|
1431
|
+
BaseSubscreen.currentElements.push([retElem, options]);
|
|
1432
|
+
return retElem;
|
|
1593
1433
|
}
|
|
1434
|
+
__name(elementCreateLabel, "elementCreateLabel");
|
|
1435
|
+
function elementCreateTooltip() {
|
|
1436
|
+
const element = ElementCreate({
|
|
1437
|
+
tag: "div",
|
|
1438
|
+
classList: ["deeplib-tooltip"],
|
|
1439
|
+
attributes: {
|
|
1440
|
+
id: "deeplib-tooltip"
|
|
1441
|
+
},
|
|
1442
|
+
style: {
|
|
1443
|
+
display: "none"
|
|
1444
|
+
}
|
|
1445
|
+
});
|
|
1446
|
+
return element;
|
|
1447
|
+
}
|
|
1448
|
+
__name(elementCreateTooltip, "elementCreateTooltip");
|
|
1594
1449
|
function elementGetTooltip() {
|
|
1595
|
-
|
|
1450
|
+
return document.getElementById("deeplib-tooltip") ?? void 0;
|
|
1596
1451
|
}
|
|
1452
|
+
__name(elementGetTooltip, "elementGetTooltip");
|
|
1597
1453
|
function elementSetTooltip(text) {
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1454
|
+
const element = document.getElementById("deeplib-tooltip");
|
|
1455
|
+
if (!element) return false;
|
|
1456
|
+
element.innerHTML = text;
|
|
1457
|
+
if (text === "") element.style.display = "none";
|
|
1458
|
+
else element.style.display = "";
|
|
1459
|
+
return true;
|
|
1460
|
+
}
|
|
1461
|
+
__name(elementSetTooltip, "elementSetTooltip");
|
|
1462
|
+
function elementPrevNext(options) {
|
|
1463
|
+
const elem = document.getElementById(options.id);
|
|
1464
|
+
if (elem) return elem;
|
|
1465
|
+
const setLabel = /* @__PURE__ */ __name((label) => {
|
|
1466
|
+
const elem2 = document.getElementById(`${options.id}-label`);
|
|
1467
|
+
if (!elem2) return false;
|
|
1468
|
+
elem2.textContent = label;
|
|
1469
|
+
}, "setLabel");
|
|
1470
|
+
const setPrevTooltip = /* @__PURE__ */ __name((tooltip) => {
|
|
1471
|
+
const elem2 = document.getElementById(`deeplib-prev-next-${options.id}-prev-button-tooltip`);
|
|
1472
|
+
if (!elem2) return false;
|
|
1473
|
+
elem2.textContent = tooltip;
|
|
1474
|
+
}, "setPrevTooltip");
|
|
1475
|
+
const setNextTooltip = /* @__PURE__ */ __name((tooltip) => {
|
|
1476
|
+
const elem2 = document.getElementById(`deeplib-prev-next-${options.id}-next-button-tooltip`);
|
|
1477
|
+
if (!elem2) return false;
|
|
1478
|
+
elem2.textContent = tooltip;
|
|
1479
|
+
}, "setNextTooltip");
|
|
1480
|
+
const retElem = ElementCreate({
|
|
1481
|
+
tag: "div",
|
|
1482
|
+
classList: ["deeplib-prev-next"],
|
|
1483
|
+
attributes: {
|
|
1484
|
+
id: options.id
|
|
1485
|
+
},
|
|
1486
|
+
children: [
|
|
1487
|
+
advancedElement.createButton({
|
|
1488
|
+
id: `deeplib-prev-next-${options.id}-prev-button`,
|
|
1489
|
+
image: `${PUBLIC_URL}/dl_images/arrow_left.svg`,
|
|
1490
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1491
|
+
options.back({
|
|
1492
|
+
setLabel,
|
|
1493
|
+
setBackTooltip: setPrevTooltip,
|
|
1494
|
+
setNextTooltip
|
|
1495
|
+
});
|
|
1496
|
+
}, "onClick"),
|
|
1497
|
+
tooltip: options.initialPrevTooltip,
|
|
1498
|
+
htmlOptions: {
|
|
1499
|
+
htmlOptions: {
|
|
1500
|
+
button: {
|
|
1501
|
+
classList: ["deeplib-prev-next-button"]
|
|
1502
|
+
}
|
|
1503
|
+
},
|
|
1504
|
+
options: {
|
|
1505
|
+
noStyling: true
|
|
1506
|
+
}
|
|
1616
1507
|
}
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
};
|
|
1624
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
1625
|
-
if (userAgent.includes('chrome') || userAgent.includes('firefox')) {
|
|
1626
|
-
const color = Logger.colorizeLog(level);
|
|
1627
|
-
args.forEach(arg => {
|
|
1628
|
-
if (typeof arg === 'string') {
|
|
1629
|
-
arg = `\n%c${arg}`;
|
|
1630
|
-
}
|
|
1631
|
-
});
|
|
1632
|
-
console.log(`%c${this.ModName}:`, color, ...args);
|
|
1508
|
+
}),
|
|
1509
|
+
advancedElement.createLabel({
|
|
1510
|
+
id: `${options.id}-label`,
|
|
1511
|
+
label: options.initialLabel,
|
|
1512
|
+
htmlOptions: {
|
|
1513
|
+
classList: ["deeplib-prev-next-label"]
|
|
1633
1514
|
}
|
|
1634
|
-
|
|
1635
|
-
|
|
1515
|
+
}),
|
|
1516
|
+
advancedElement.createButton({
|
|
1517
|
+
id: `deeplib-prev-next-${options.id}-next-button`,
|
|
1518
|
+
image: `${PUBLIC_URL}/dl_images/arrow_right.svg`,
|
|
1519
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1520
|
+
options.next({
|
|
1521
|
+
setLabel,
|
|
1522
|
+
setBackTooltip: setPrevTooltip,
|
|
1523
|
+
setNextTooltip
|
|
1524
|
+
});
|
|
1525
|
+
}, "onClick"),
|
|
1526
|
+
tooltip: options.initialNextTooltip,
|
|
1527
|
+
htmlOptions: {
|
|
1528
|
+
htmlOptions: {
|
|
1529
|
+
button: {
|
|
1530
|
+
classList: ["deeplib-prev-next-button"]
|
|
1531
|
+
}
|
|
1532
|
+
},
|
|
1533
|
+
options: {
|
|
1534
|
+
noStyling: true
|
|
1535
|
+
}
|
|
1636
1536
|
}
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1537
|
+
})
|
|
1538
|
+
]
|
|
1539
|
+
});
|
|
1540
|
+
return retElem;
|
|
1541
|
+
}
|
|
1542
|
+
__name(elementPrevNext, "elementPrevNext");
|
|
1543
|
+
var Modal = class _Modal {
|
|
1544
|
+
constructor(opts) {
|
|
1545
|
+
this.opts = opts;
|
|
1546
|
+
opts ??= {};
|
|
1547
|
+
opts.closeOnBackdrop ??= true;
|
|
1548
|
+
const promptId = `modal-prompt-${Date.now()}`;
|
|
1549
|
+
this.dialog = ElementCreate({
|
|
1550
|
+
tag: "dialog",
|
|
1551
|
+
classList: ["deeplib-modal"],
|
|
1552
|
+
attributes: {
|
|
1553
|
+
role: "dialog",
|
|
1554
|
+
"aria-modal": "true",
|
|
1555
|
+
"aria-labelledby": promptId
|
|
1556
|
+
},
|
|
1557
|
+
style: {
|
|
1558
|
+
fontFamily: CommonGetFontName()
|
|
1559
|
+
},
|
|
1560
|
+
children: [
|
|
1561
|
+
opts.prompt,
|
|
1562
|
+
{
|
|
1563
|
+
tag: "div",
|
|
1564
|
+
classList: ["deeplib-modal-prompt"],
|
|
1565
|
+
attributes: {
|
|
1566
|
+
id: promptId
|
|
1567
|
+
},
|
|
1568
|
+
children: [
|
|
1569
|
+
opts.input ? this.renderInput(opts.input) : void 0
|
|
1570
|
+
]
|
|
1571
|
+
},
|
|
1572
|
+
this.renderButtons()
|
|
1573
|
+
]
|
|
1574
|
+
});
|
|
1575
|
+
this.blocker = this.createBlocker();
|
|
1576
|
+
this.renderButtons();
|
|
1577
|
+
document.body.append(this.createBlocker(), this.dialog);
|
|
1578
|
+
this.setupFocusTrap();
|
|
1579
|
+
if (opts.timeoutMs) {
|
|
1580
|
+
this.timeoutId = window.setTimeout(() => this.close("timeout"), opts.timeoutMs);
|
|
1650
1581
|
}
|
|
1651
|
-
|
|
1652
|
-
|
|
1582
|
+
}
|
|
1583
|
+
static {
|
|
1584
|
+
__name(this, "Modal");
|
|
1585
|
+
}
|
|
1586
|
+
dialog;
|
|
1587
|
+
blocker;
|
|
1588
|
+
inputEl;
|
|
1589
|
+
timeoutId;
|
|
1590
|
+
static queue = [];
|
|
1591
|
+
static processing = false;
|
|
1592
|
+
show() {
|
|
1593
|
+
return _Modal.enqueue(this);
|
|
1594
|
+
}
|
|
1595
|
+
static async alert(msg, timeoutMs) {
|
|
1596
|
+
await new _Modal({ prompt: msg, buttons: [{ action: "close", text: "OK" }], timeoutMs }).show();
|
|
1597
|
+
}
|
|
1598
|
+
static async confirm(msg) {
|
|
1599
|
+
const [action] = await new _Modal({ prompt: msg, buttons: [{ text: "Cancel", action: "cancel" }, { text: "OK", action: "ok" }] }).show();
|
|
1600
|
+
return action === "ok";
|
|
1601
|
+
}
|
|
1602
|
+
static async prompt(msg, defaultValue = "") {
|
|
1603
|
+
const [action, value] = await new _Modal({ prompt: msg, timeoutMs: 0, input: { type: "input", defaultValue }, buttons: [{ text: "Cancel", action: "cancel" }, { text: "Submit", action: "submit" }] }).show();
|
|
1604
|
+
return action === "submit" ? value : null;
|
|
1605
|
+
}
|
|
1606
|
+
renderInput(cfg) {
|
|
1607
|
+
const el = document.createElement(cfg.type);
|
|
1608
|
+
el.classList.add("deeplib-modal-input");
|
|
1609
|
+
if (cfg.placeholder) el.placeholder = cfg.placeholder;
|
|
1610
|
+
if (cfg.readOnly) el.readOnly = true;
|
|
1611
|
+
if (cfg.defaultValue) el.value = cfg.defaultValue;
|
|
1612
|
+
if (cfg.type === "textarea") el.rows = 5;
|
|
1613
|
+
el.addEventListener("input", () => {
|
|
1614
|
+
const err = cfg.validate?.(el.value);
|
|
1615
|
+
el.setCustomValidity(err || "");
|
|
1616
|
+
});
|
|
1617
|
+
this.inputEl = el;
|
|
1618
|
+
return el;
|
|
1619
|
+
}
|
|
1620
|
+
renderButtons() {
|
|
1621
|
+
const container = document.createElement("div");
|
|
1622
|
+
container.classList.add("deeplib-modal-button-container");
|
|
1623
|
+
const btns = this.opts.buttons ? [...this.opts.buttons] : [];
|
|
1624
|
+
btns.forEach((b) => {
|
|
1625
|
+
const btn = advancedElement.createButton({
|
|
1626
|
+
label: b.text,
|
|
1627
|
+
id: `deeplib-modal-${b.action}`,
|
|
1628
|
+
disabled: b.disabled,
|
|
1629
|
+
onClick: /* @__PURE__ */ __name(() => this.close(b.action), "onClick")
|
|
1630
|
+
});
|
|
1631
|
+
container.append(btn);
|
|
1632
|
+
});
|
|
1633
|
+
return container;
|
|
1634
|
+
}
|
|
1635
|
+
createBlocker() {
|
|
1636
|
+
const blocker = document.createElement("div");
|
|
1637
|
+
blocker.classList.add("deeplib-modal-blocker");
|
|
1638
|
+
blocker.title = "Click to close";
|
|
1639
|
+
if (this.opts.closeOnBackdrop !== false)
|
|
1640
|
+
blocker.addEventListener("click", () => this.close("close"));
|
|
1641
|
+
return blocker;
|
|
1642
|
+
}
|
|
1643
|
+
setupFocusTrap() {
|
|
1644
|
+
const focusable = 'button, [href], input, textarea, select, [tabindex]:not([tabindex="-1"])';
|
|
1645
|
+
const elements = Array.from(this.dialog.querySelectorAll(focusable));
|
|
1646
|
+
const first = elements[0];
|
|
1647
|
+
const last = elements[elements.length - 1];
|
|
1648
|
+
this.dialog.addEventListener("keydown", (e) => {
|
|
1649
|
+
if (e.key === "Tab") {
|
|
1650
|
+
if (elements.length === 0) {
|
|
1651
|
+
e.preventDefault();
|
|
1652
|
+
return;
|
|
1653
|
+
}
|
|
1654
|
+
if (e.shiftKey) {
|
|
1655
|
+
if (document.activeElement === first) {
|
|
1656
|
+
last.focus();
|
|
1657
|
+
e.preventDefault();
|
|
1658
|
+
}
|
|
1659
|
+
} else {
|
|
1660
|
+
if (document.activeElement === last) {
|
|
1661
|
+
first.focus();
|
|
1662
|
+
e.preventDefault();
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
} else if (e.key === "Escape") {
|
|
1666
|
+
e.stopPropagation();
|
|
1667
|
+
this.close("close");
|
|
1668
|
+
}
|
|
1669
|
+
});
|
|
1670
|
+
window.requestAnimationFrame(() => {
|
|
1671
|
+
(this.inputEl || first)?.focus();
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
close(action) {
|
|
1675
|
+
if (this.timeoutId) clearTimeout(this.timeoutId);
|
|
1676
|
+
this.dialog.close();
|
|
1677
|
+
this.dialog.remove();
|
|
1678
|
+
this.blocker.remove();
|
|
1679
|
+
document.body.querySelector(".deeplib-modal-blocker")?.remove();
|
|
1680
|
+
const value = this.inputEl?.value ?? "";
|
|
1681
|
+
this.resolve([action, value]);
|
|
1682
|
+
_Modal.dequeue();
|
|
1683
|
+
}
|
|
1684
|
+
/**
|
|
1685
|
+
* An internal function where we will save promise function.
|
|
1686
|
+
*/
|
|
1687
|
+
resolve = /* @__PURE__ */ __name(() => {
|
|
1688
|
+
}, "resolve");
|
|
1689
|
+
/** A function that adds a modal to the queue and returns a promise */
|
|
1690
|
+
static enqueue(modal) {
|
|
1691
|
+
_Modal.queue.push(modal);
|
|
1692
|
+
if (!_Modal.processing) _Modal.dequeue();
|
|
1693
|
+
return new Promise((resolve) => modal.resolve = resolve);
|
|
1694
|
+
}
|
|
1695
|
+
/** A function that processes the queue, removing the first modal */
|
|
1696
|
+
static dequeue() {
|
|
1697
|
+
const modal = _Modal.queue.shift();
|
|
1698
|
+
if (modal) {
|
|
1699
|
+
_Modal.processing = true;
|
|
1700
|
+
modal.dialog.show();
|
|
1701
|
+
} else {
|
|
1702
|
+
_Modal.processing = false;
|
|
1653
1703
|
}
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1704
|
+
}
|
|
1705
|
+
};
|
|
1706
|
+
window.Modal = Modal;
|
|
1707
|
+
|
|
1708
|
+
// src/screens/main_menu.ts
|
|
1709
|
+
var MainMenu = class _MainMenu extends BaseSubscreen {
|
|
1710
|
+
static {
|
|
1711
|
+
__name(this, "MainMenu");
|
|
1712
|
+
}
|
|
1713
|
+
subscreens = [];
|
|
1714
|
+
static options = {};
|
|
1715
|
+
get name() {
|
|
1716
|
+
return "mainmenu";
|
|
1717
|
+
}
|
|
1718
|
+
constructor(module) {
|
|
1719
|
+
super({ drawCharacter: true }, module);
|
|
1720
|
+
this.subscreens = module.subscreens;
|
|
1721
|
+
}
|
|
1722
|
+
load() {
|
|
1723
|
+
if (!GUI.instance?.currentSubscreen) {
|
|
1724
|
+
this.setSubscreen(this);
|
|
1725
|
+
return;
|
|
1726
|
+
}
|
|
1727
|
+
super.load();
|
|
1728
|
+
const exitButton = advancedElement.createButton({
|
|
1729
|
+
id: "exit",
|
|
1730
|
+
size: [90, 90],
|
|
1731
|
+
image: `${PUBLIC_URL}/dl_images/exit.svg`,
|
|
1732
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1733
|
+
this.exit();
|
|
1734
|
+
}, "onClick"),
|
|
1735
|
+
tooltip: getText("settings.button.back_button_hint")
|
|
1736
|
+
});
|
|
1737
|
+
const menu = document.getElementById("deeplib-nav-menu");
|
|
1738
|
+
if (menu) {
|
|
1739
|
+
ElementMenu.AppendButton(menu, exitButton);
|
|
1740
|
+
}
|
|
1741
|
+
for (const screen of this.subscreens) {
|
|
1742
|
+
if (screen.name == "mainmenu") continue;
|
|
1743
|
+
const button = advancedElement.createButton({
|
|
1744
|
+
id: `${screen.name}-button`,
|
|
1745
|
+
image: screen.icon,
|
|
1746
|
+
label: getText(`mainmenu.button.${screen.name}`),
|
|
1747
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1748
|
+
this.setSubscreen(screen);
|
|
1749
|
+
}, "onClick"),
|
|
1750
|
+
size: [null, 90]
|
|
1751
|
+
});
|
|
1752
|
+
layoutElement.appendToSettingsDiv(button);
|
|
1753
|
+
}
|
|
1754
|
+
const miscDiv = layoutElement.createMiscDiv();
|
|
1755
|
+
layoutElement.appendToSubscreenDiv(miscDiv);
|
|
1756
|
+
if (_MainMenu.options.wikiLink) {
|
|
1757
|
+
const wikiButton = advancedElement.createButton({
|
|
1758
|
+
id: "deeplib-wiki-button",
|
|
1759
|
+
image: `${PUBLIC_URL}/dl_images/notebook.svg`,
|
|
1760
|
+
label: getText("mainmenu.button.wiki"),
|
|
1761
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1762
|
+
window.open(_MainMenu.options.wikiLink, "_blank");
|
|
1763
|
+
}, "onClick"),
|
|
1764
|
+
size: [null, 80]
|
|
1765
|
+
});
|
|
1766
|
+
layoutElement.appendToMiscDiv(wikiButton);
|
|
1767
|
+
}
|
|
1768
|
+
if (_MainMenu.options.repoLink) {
|
|
1769
|
+
const repoButton = advancedElement.createButton({
|
|
1770
|
+
id: "deeplib-repo-button",
|
|
1771
|
+
image: `${PUBLIC_URL}/dl_images/git.svg`,
|
|
1772
|
+
label: getText("mainmenu.button.repo"),
|
|
1773
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1774
|
+
window.open(_MainMenu.options.repoLink, "_blank");
|
|
1775
|
+
}, "onClick"),
|
|
1776
|
+
size: [null, 80]
|
|
1777
|
+
});
|
|
1778
|
+
layoutElement.appendToMiscDiv(repoButton);
|
|
1779
|
+
}
|
|
1780
|
+
if (_MainMenu.options.resetSubscreen) {
|
|
1781
|
+
const resetButton = advancedElement.createButton({
|
|
1782
|
+
id: "deeplib-reset-button",
|
|
1783
|
+
image: `${PUBLIC_URL}/dl_images/trash_bin.svg`,
|
|
1784
|
+
label: getText("mainmenu.button.reset"),
|
|
1785
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1786
|
+
this.setSubscreen(_MainMenu.options.resetSubscreen);
|
|
1787
|
+
}, "onClick"),
|
|
1788
|
+
size: [null, 80]
|
|
1789
|
+
});
|
|
1790
|
+
layoutElement.appendToMiscDiv(resetButton);
|
|
1791
|
+
}
|
|
1792
|
+
if (_MainMenu.options.importExportSubscreen) {
|
|
1793
|
+
const importExportButton = advancedElement.createButton({
|
|
1794
|
+
id: "deeplib-import-export-button",
|
|
1795
|
+
image: `${PUBLIC_URL}/dl_images/transfer.svg`,
|
|
1796
|
+
label: getText("mainmenu.button.import_export"),
|
|
1797
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1798
|
+
this.setSubscreen(_MainMenu.options.importExportSubscreen);
|
|
1799
|
+
}, "onClick"),
|
|
1800
|
+
size: [null, 80]
|
|
1801
|
+
});
|
|
1802
|
+
layoutElement.appendToMiscDiv(importExportButton);
|
|
1803
|
+
}
|
|
1804
|
+
if (IS_DEBUG) {
|
|
1805
|
+
const debugButton = advancedElement.createButton({
|
|
1806
|
+
id: "deeplib-debug-button",
|
|
1807
|
+
image: `${PUBLIC_URL}/dl_images/bug.svg`,
|
|
1808
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1809
|
+
this.setSubscreen(new GuiDebug());
|
|
1810
|
+
}, "onClick"),
|
|
1811
|
+
size: [90, 90]
|
|
1812
|
+
});
|
|
1813
|
+
if (menu) {
|
|
1814
|
+
ElementMenu.PrependItem(menu, debugButton);
|
|
1815
|
+
}
|
|
1663
1816
|
}
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1817
|
+
}
|
|
1818
|
+
run() {
|
|
1819
|
+
super.run();
|
|
1820
|
+
}
|
|
1821
|
+
click() {
|
|
1822
|
+
}
|
|
1823
|
+
exit() {
|
|
1824
|
+
CharacterAppearanceForceUpCharacter = -1;
|
|
1825
|
+
CharacterLoadCanvas(Player);
|
|
1826
|
+
this.setSubscreen(null);
|
|
1827
|
+
PreferenceSubscreenExtensionsClear();
|
|
1828
|
+
}
|
|
1829
|
+
resize() {
|
|
1830
|
+
super.resize();
|
|
1831
|
+
ElementSetPosition("deeplib-misc", 1905, 930, "bottom-right");
|
|
1832
|
+
ElementSetSize("deeplib-misc", 405, null);
|
|
1833
|
+
}
|
|
1834
|
+
static setOptions(mainMenuOptions) {
|
|
1835
|
+
_MainMenu.options = mainMenuOptions;
|
|
1836
|
+
}
|
|
1837
|
+
};
|
|
1666
1838
|
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1839
|
+
// src/screens/import_export.ts
|
|
1840
|
+
var GuiImportExport = class extends BaseSubscreen {
|
|
1841
|
+
static {
|
|
1842
|
+
__name(this, "GuiImportExport");
|
|
1843
|
+
}
|
|
1844
|
+
importExportOptions;
|
|
1845
|
+
get name() {
|
|
1846
|
+
return "import-export";
|
|
1847
|
+
}
|
|
1848
|
+
constructor(importExportOptions) {
|
|
1849
|
+
super({ drawCharacter: true });
|
|
1850
|
+
this.importExportOptions = importExportOptions;
|
|
1851
|
+
}
|
|
1852
|
+
load() {
|
|
1853
|
+
super.load();
|
|
1854
|
+
const importFromFileButton = advancedElement.createButton({
|
|
1855
|
+
id: "deeplib-import-file-button",
|
|
1856
|
+
size: [600, 90],
|
|
1857
|
+
image: `${PUBLIC_URL}/dl_images/file_import.svg`,
|
|
1858
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1859
|
+
this.dataImport("file");
|
|
1860
|
+
}, "onClick"),
|
|
1861
|
+
label: getText("import-export.button.import_file")
|
|
1680
1862
|
});
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
|
-
if (!msg)
|
|
1691
|
-
return;
|
|
1692
|
-
ServerSend('ChatRoomChat', {
|
|
1693
|
-
Content: 'DEEPLIB_CUSTOM_ACTION',
|
|
1694
|
-
Type: 'Action',
|
|
1695
|
-
Target: target ?? undefined,
|
|
1696
|
-
Dictionary: [
|
|
1697
|
-
{ Tag: 'MISSING TEXT IN "Interface.csv": DEEPLIB_CUSTOM_ACTION', Text: msg },
|
|
1698
|
-
...dictionary,
|
|
1699
|
-
],
|
|
1863
|
+
layoutElement.appendToSettingsDiv(importFromFileButton);
|
|
1864
|
+
const exportToFileButton = advancedElement.createButton({
|
|
1865
|
+
id: "deeplib-export-file-button",
|
|
1866
|
+
size: [600, 90],
|
|
1867
|
+
image: `${PUBLIC_URL}/dl_images/file_export.svg`,
|
|
1868
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1869
|
+
this.dataExport("file");
|
|
1870
|
+
}, "onClick"),
|
|
1871
|
+
label: getText("import-export.button.export_file")
|
|
1700
1872
|
});
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
}
|
|
1740
|
-
const removeCallback = bcSdkMod.SDK?.hookFunction(target, priority, hook);
|
|
1741
|
-
data.hooks.push({
|
|
1742
|
-
hook,
|
|
1743
|
-
priority,
|
|
1744
|
-
module,
|
|
1745
|
-
removeCallback
|
|
1746
|
-
});
|
|
1747
|
-
data.hooks.sort((a, b) => b.priority - a.priority);
|
|
1748
|
-
return removeCallback;
|
|
1873
|
+
layoutElement.appendToSettingsDiv(exportToFileButton);
|
|
1874
|
+
const importFromClipboardButton = advancedElement.createButton({
|
|
1875
|
+
id: "deeplib-import-clipboard-button",
|
|
1876
|
+
size: [600, 90],
|
|
1877
|
+
image: `${PUBLIC_URL}/dl_images/clipboard_import.svg`,
|
|
1878
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1879
|
+
this.dataImport("clipboard");
|
|
1880
|
+
}, "onClick"),
|
|
1881
|
+
label: getText("import-export.button.import_clipboard")
|
|
1882
|
+
});
|
|
1883
|
+
layoutElement.appendToSettingsDiv(importFromClipboardButton);
|
|
1884
|
+
const exportToClipboardButton = advancedElement.createButton({
|
|
1885
|
+
id: "deeplib-export-clipboard-button",
|
|
1886
|
+
size: [600, 90],
|
|
1887
|
+
image: `${PUBLIC_URL}/dl_images/clipboard_export.svg`,
|
|
1888
|
+
onClick: /* @__PURE__ */ __name(() => {
|
|
1889
|
+
this.dataExport("clipboard");
|
|
1890
|
+
}, "onClick"),
|
|
1891
|
+
label: getText("import-export.button.export_clipboard")
|
|
1892
|
+
});
|
|
1893
|
+
layoutElement.appendToSettingsDiv(exportToClipboardButton);
|
|
1894
|
+
}
|
|
1895
|
+
resize() {
|
|
1896
|
+
super.resize();
|
|
1897
|
+
}
|
|
1898
|
+
async dataExport(transferMethod) {
|
|
1899
|
+
try {
|
|
1900
|
+
const data = LZString.compressToBase64(JSON.stringify(modStorage.playerStorage));
|
|
1901
|
+
if (transferMethod === "clipboard") {
|
|
1902
|
+
await this.exportToClipboard(data);
|
|
1903
|
+
} else if (transferMethod === "file") {
|
|
1904
|
+
await this.exportToFile(data, "themed_settings");
|
|
1905
|
+
}
|
|
1906
|
+
this.importExportOptions.onExport?.();
|
|
1907
|
+
ToastManager.success("Data exported successfully.");
|
|
1908
|
+
} catch (error) {
|
|
1909
|
+
ToastManager.error("Data export failed.");
|
|
1910
|
+
deepLibLogger.error(`Data export failed for ${ModSdkManager.ModInfo.name}.`, error);
|
|
1749
1911
|
}
|
|
1750
|
-
|
|
1751
|
-
|
|
1912
|
+
}
|
|
1913
|
+
async dataImport(transferMethod) {
|
|
1914
|
+
try {
|
|
1915
|
+
let importedData = "";
|
|
1916
|
+
if (transferMethod === "clipboard") {
|
|
1917
|
+
importedData = await this.importFromClipboard() ?? null;
|
|
1918
|
+
} else if (transferMethod === "file") {
|
|
1919
|
+
importedData = await this.importFromFile() ?? null;
|
|
1920
|
+
}
|
|
1921
|
+
if (!importedData) {
|
|
1922
|
+
throw new Error("No data imported.");
|
|
1923
|
+
}
|
|
1924
|
+
const data = JSON.parse(LZString.decompressFromBase64(importedData) ?? "");
|
|
1925
|
+
if (!data) {
|
|
1926
|
+
throw new Error("Invalid data.");
|
|
1927
|
+
}
|
|
1928
|
+
modStorage.playerStorage = data;
|
|
1929
|
+
this.importExportOptions.onImport?.();
|
|
1930
|
+
ToastManager.success("Data imported successfully.");
|
|
1931
|
+
} catch (error) {
|
|
1932
|
+
ToastManager.error("Data import failed.");
|
|
1933
|
+
deepLibLogger.error(`Data import failed for ${ModSdkManager.ModInfo.name}.`, error);
|
|
1752
1934
|
}
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1935
|
+
}
|
|
1936
|
+
async exportToFile(data, defaultFileName) {
|
|
1937
|
+
const CUSTOM_EXTENSION = this.importExportOptions.customFileExtension.startsWith(".") ? this.importExportOptions.customFileExtension : "." + this.importExportOptions.customFileExtension;
|
|
1938
|
+
const suggestedName = defaultFileName.endsWith(CUSTOM_EXTENSION) ? defaultFileName : defaultFileName + CUSTOM_EXTENSION;
|
|
1939
|
+
if ("showSaveFilePicker" in window) {
|
|
1940
|
+
try {
|
|
1941
|
+
const handle = await window.showSaveFilePicker({
|
|
1942
|
+
suggestedName,
|
|
1943
|
+
types: [
|
|
1944
|
+
{
|
|
1945
|
+
description: "Custom Data Files",
|
|
1946
|
+
accept: { "text/plain": [CUSTOM_EXTENSION] }
|
|
1759
1947
|
}
|
|
1948
|
+
]
|
|
1949
|
+
});
|
|
1950
|
+
const writable = await handle.createWritable();
|
|
1951
|
+
await writable.write(data);
|
|
1952
|
+
await writable.close();
|
|
1953
|
+
} catch (error) {
|
|
1954
|
+
throw new Error("File save cancelled or failed: " + error.message);
|
|
1955
|
+
}
|
|
1956
|
+
} else {
|
|
1957
|
+
const fileName = await Modal.prompt("Enter file name", suggestedName);
|
|
1958
|
+
if (fileName === null) {
|
|
1959
|
+
return;
|
|
1960
|
+
} else if (fileName === "") {
|
|
1961
|
+
throw new Error("File name cannot be empty.");
|
|
1962
|
+
}
|
|
1963
|
+
const blob = new Blob([data], { type: "text/plain" });
|
|
1964
|
+
const link = ElementCreate({
|
|
1965
|
+
tag: "a",
|
|
1966
|
+
attributes: {
|
|
1967
|
+
href: URL.createObjectURL(blob),
|
|
1968
|
+
download: fileName.endsWith(CUSTOM_EXTENSION) ? fileName : fileName + CUSTOM_EXTENSION
|
|
1760
1969
|
}
|
|
1761
|
-
|
|
1970
|
+
});
|
|
1971
|
+
link.click();
|
|
1972
|
+
URL.revokeObjectURL(link.href);
|
|
1762
1973
|
}
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1974
|
+
}
|
|
1975
|
+
async importFromFile() {
|
|
1976
|
+
const CUSTOM_EXTENSION = this.importExportOptions.customFileExtension.startsWith(".") ? this.importExportOptions.customFileExtension : "." + this.importExportOptions.customFileExtension;
|
|
1977
|
+
async function importFromFileInternal(file) {
|
|
1978
|
+
if (!file.name.endsWith(CUSTOM_EXTENSION)) {
|
|
1979
|
+
throw new Error(`Invalid file type. Expected a ${CUSTOM_EXTENSION} file.`);
|
|
1980
|
+
}
|
|
1981
|
+
return new Promise((resolve, reject) => {
|
|
1982
|
+
const reader = new FileReader();
|
|
1983
|
+
reader.onload = () => resolve(reader.result);
|
|
1984
|
+
reader.onerror = () => reject(new Error("Failed to read file."));
|
|
1985
|
+
reader.readAsText(file);
|
|
1986
|
+
});
|
|
1987
|
+
}
|
|
1988
|
+
__name(importFromFileInternal, "importFromFileInternal");
|
|
1989
|
+
if ("showOpenFilePicker" in window) {
|
|
1990
|
+
try {
|
|
1991
|
+
const [fileHandle] = await window.showOpenFilePicker({
|
|
1992
|
+
types: [
|
|
1993
|
+
{
|
|
1994
|
+
description: "Custom Data Files",
|
|
1995
|
+
accept: { "text/plain": [CUSTOM_EXTENSION] }
|
|
1770
1996
|
}
|
|
1771
|
-
|
|
1772
|
-
|
|
1997
|
+
],
|
|
1998
|
+
multiple: false
|
|
1999
|
+
});
|
|
2000
|
+
const file = await fileHandle.getFile();
|
|
2001
|
+
return await importFromFileInternal(file);
|
|
2002
|
+
} catch (error) {
|
|
2003
|
+
throw new Error("File selection cancelled or failed: " + error.message);
|
|
2004
|
+
}
|
|
2005
|
+
} else {
|
|
2006
|
+
return new Promise((resolve, reject) => {
|
|
2007
|
+
const input = document.createElement("input");
|
|
2008
|
+
input.type = "file";
|
|
2009
|
+
input.accept = CUSTOM_EXTENSION;
|
|
2010
|
+
input.onchange = async (event) => {
|
|
2011
|
+
const file = event.target.files?.[0];
|
|
2012
|
+
if (file) {
|
|
2013
|
+
try {
|
|
2014
|
+
const data = await importFromFileInternal(file);
|
|
2015
|
+
resolve(data);
|
|
2016
|
+
} catch (error) {
|
|
2017
|
+
reject(error);
|
|
2018
|
+
}
|
|
2019
|
+
} else {
|
|
2020
|
+
reject(new Error("No file selected."));
|
|
2021
|
+
}
|
|
2022
|
+
};
|
|
2023
|
+
input.click();
|
|
2024
|
+
});
|
|
1773
2025
|
}
|
|
1774
|
-
}
|
|
1775
|
-
|
|
1776
|
-
|
|
2026
|
+
}
|
|
2027
|
+
async exportToClipboard(data) {
|
|
2028
|
+
return navigator.clipboard.writeText(data).catch((error) => {
|
|
2029
|
+
throw new Error("Failed to copy data to clipboard." + error);
|
|
2030
|
+
});
|
|
2031
|
+
}
|
|
2032
|
+
async importFromClipboard() {
|
|
2033
|
+
return Modal.prompt("Enter data to import").catch((error) => {
|
|
2034
|
+
throw new Error("Failed to read data from clipboard." + error);
|
|
2035
|
+
});
|
|
2036
|
+
}
|
|
2037
|
+
};
|
|
1777
2038
|
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
2039
|
+
// src/utilities/data.ts
|
|
2040
|
+
var ModStorage = class _ModStorage {
|
|
2041
|
+
static {
|
|
2042
|
+
__name(this, "ModStorage");
|
|
2043
|
+
}
|
|
2044
|
+
static _instance = null;
|
|
2045
|
+
modName;
|
|
2046
|
+
constructor(modName) {
|
|
2047
|
+
if (!_ModStorage._instance) {
|
|
2048
|
+
_ModStorage._instance = this;
|
|
2049
|
+
this.modName = modName;
|
|
2050
|
+
}
|
|
2051
|
+
this.modName ??= modName;
|
|
2052
|
+
return _ModStorage._instance;
|
|
2053
|
+
}
|
|
2054
|
+
get playerStorage() {
|
|
2055
|
+
return Player[this.modName];
|
|
2056
|
+
}
|
|
2057
|
+
set playerStorage(value) {
|
|
2058
|
+
Player[this.modName] = value;
|
|
2059
|
+
}
|
|
2060
|
+
get extensionStorage() {
|
|
2061
|
+
return Player.ExtensionSettings[this.modName];
|
|
2062
|
+
}
|
|
2063
|
+
set extensionStorage(value) {
|
|
2064
|
+
Player.ExtensionSettings[this.modName] = value;
|
|
2065
|
+
}
|
|
2066
|
+
setLocalStorage(key, value) {
|
|
2067
|
+
localStorage.setItem(`${this.modName}_${key}`, _ModStorage.dataCompress(value));
|
|
2068
|
+
}
|
|
2069
|
+
getLocalStorage(key) {
|
|
2070
|
+
const data = localStorage.getItem(`${this.modName}_${key}`);
|
|
2071
|
+
if (!data) return null;
|
|
2072
|
+
return _ModStorage.dataDecompress(data);
|
|
2073
|
+
}
|
|
2074
|
+
load() {
|
|
2075
|
+
if (this.extensionStorage) {
|
|
2076
|
+
const parsed = _ModStorage.dataDecompress(this.extensionStorage || "");
|
|
2077
|
+
if (parsed === null || !Object.hasOwn(parsed, "Version")) {
|
|
2078
|
+
this.playerStorage = {};
|
|
2079
|
+
} else {
|
|
2080
|
+
this.playerStorage = parsed;
|
|
2081
|
+
}
|
|
2082
|
+
;
|
|
2083
|
+
} else {
|
|
2084
|
+
this.playerStorage = {};
|
|
1804
2085
|
}
|
|
1805
|
-
}
|
|
2086
|
+
}
|
|
2087
|
+
save() {
|
|
2088
|
+
if (!this.extensionStorage) this.extensionStorage = "";
|
|
2089
|
+
this.extensionStorage = _ModStorage.dataCompress(this.playerStorage);
|
|
2090
|
+
ServerPlayerExtensionSettingsSync(this.modName);
|
|
2091
|
+
}
|
|
2092
|
+
static dataDecompress(string) {
|
|
2093
|
+
const d = LZString.decompressFromBase64(string);
|
|
2094
|
+
let data = null;
|
|
2095
|
+
try {
|
|
2096
|
+
const decoded = JSON.parse(d);
|
|
2097
|
+
data = decoded;
|
|
2098
|
+
} catch (error) {
|
|
2099
|
+
deepLibLogger.error(error);
|
|
2100
|
+
}
|
|
2101
|
+
return data;
|
|
2102
|
+
}
|
|
2103
|
+
static dataCompress(object) {
|
|
2104
|
+
return LZString.compressToBase64(JSON.stringify(object));
|
|
2105
|
+
}
|
|
2106
|
+
};
|
|
1806
2107
|
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
2108
|
+
// src/utilities/elements/element_helpers.ts
|
|
2109
|
+
var domUtil = {
|
|
2110
|
+
autoSetPosition,
|
|
2111
|
+
autoSetSize,
|
|
2112
|
+
hide,
|
|
2113
|
+
unhide,
|
|
2114
|
+
hasOverflow
|
|
2115
|
+
};
|
|
2116
|
+
function autoSetPosition(_, position) {
|
|
2117
|
+
let xPos = void 0;
|
|
2118
|
+
let yPos = void 0;
|
|
2119
|
+
if (Array.isArray(position)) {
|
|
2120
|
+
xPos = position[0];
|
|
2121
|
+
yPos = position[1];
|
|
2122
|
+
} else if (typeof position === "function") {
|
|
2123
|
+
const result = position();
|
|
2124
|
+
xPos = result[0];
|
|
2125
|
+
yPos = result[1];
|
|
2126
|
+
}
|
|
2127
|
+
if (xPos !== void 0 && yPos !== void 0) ElementSetPosition(_, xPos, yPos);
|
|
2128
|
+
}
|
|
2129
|
+
__name(autoSetPosition, "autoSetPosition");
|
|
2130
|
+
function autoSetSize(_, size) {
|
|
2131
|
+
let width = void 0;
|
|
2132
|
+
let height = void 0;
|
|
2133
|
+
if (Array.isArray(size)) {
|
|
2134
|
+
width = size[0];
|
|
2135
|
+
height = size[1];
|
|
2136
|
+
} else if (typeof size === "function") {
|
|
2137
|
+
const result = size();
|
|
2138
|
+
width = result[0];
|
|
2139
|
+
height = result[1];
|
|
2140
|
+
}
|
|
2141
|
+
if (width !== void 0 && height !== void 0) ElementSetSize(_, width, height);
|
|
2142
|
+
}
|
|
2143
|
+
__name(autoSetSize, "autoSetSize");
|
|
2144
|
+
function hide(_) {
|
|
2145
|
+
const element = ElementWrap(_);
|
|
2146
|
+
if (!element) return;
|
|
2147
|
+
element.style.display = "none";
|
|
2148
|
+
}
|
|
2149
|
+
__name(hide, "hide");
|
|
2150
|
+
function unhide(_) {
|
|
2151
|
+
const element = ElementWrap(_);
|
|
2152
|
+
if (!element) return;
|
|
2153
|
+
element.style.display = "";
|
|
2154
|
+
}
|
|
2155
|
+
__name(unhide, "unhide");
|
|
2156
|
+
function hasOverflow(el) {
|
|
2157
|
+
const element = ElementWrap(el);
|
|
2158
|
+
if (!element) return null;
|
|
2159
|
+
const vertical = element.scrollHeight > element.clientHeight;
|
|
2160
|
+
const horizontal = element.scrollWidth > element.clientWidth;
|
|
2161
|
+
return {
|
|
2162
|
+
any: vertical || horizontal,
|
|
2163
|
+
vertical,
|
|
2164
|
+
horizontal
|
|
2165
|
+
};
|
|
2166
|
+
}
|
|
2167
|
+
__name(hasOverflow, "hasOverflow");
|
|
2168
|
+
|
|
2169
|
+
// src/utilities/elements/layout_elements.ts
|
|
2170
|
+
var layoutElement = {
|
|
2171
|
+
createSubscreenDiv: elementCreateSubscreenDiv,
|
|
2172
|
+
getSubscreenDiv: elementGetSubscreenDiv,
|
|
2173
|
+
appendToSubscreenDiv: elementAppendToSubscreenDiv,
|
|
2174
|
+
removeSubscreenDiv: elementRemoveSubscreenDiv,
|
|
2175
|
+
createSettingsDiv: elementCreateSettingsDiv,
|
|
2176
|
+
getSettingsDiv: elementGetSettingsDiv,
|
|
2177
|
+
appendToSettingsDiv: elementAppendToSettingsDiv,
|
|
2178
|
+
removeSettingsDiv: elementRemoveSettingsDiv,
|
|
2179
|
+
createMiscDiv: elementCreateMiscDiv,
|
|
2180
|
+
getMiscDiv: elementGetMiscDiv,
|
|
2181
|
+
appendToMiscDiv: elementAppendToMiscDiv,
|
|
2182
|
+
removeMiscDiv: elementRemoveMiscDiv
|
|
2183
|
+
};
|
|
2184
|
+
function elementCreateSubscreenDiv() {
|
|
2185
|
+
const subscreenDiv = elementGetSubscreenDiv();
|
|
2186
|
+
if (subscreenDiv) {
|
|
2187
|
+
console.error("Subscreen already exists");
|
|
2188
|
+
return subscreenDiv;
|
|
2189
|
+
}
|
|
2190
|
+
const div = document.createElement("div");
|
|
2191
|
+
div.id = "deeplib-subscreen";
|
|
2192
|
+
div.classList.add("deeplib-subscreen", "HideOnPopup");
|
|
2193
|
+
return document.body.appendChild(div);
|
|
1828
2194
|
}
|
|
2195
|
+
__name(elementCreateSubscreenDiv, "elementCreateSubscreenDiv");
|
|
2196
|
+
function elementGetSubscreenDiv() {
|
|
2197
|
+
return document.getElementById("deeplib-subscreen") ?? void 0;
|
|
2198
|
+
}
|
|
2199
|
+
__name(elementGetSubscreenDiv, "elementGetSubscreenDiv");
|
|
2200
|
+
function elementRemoveSubscreenDiv() {
|
|
2201
|
+
return elementGetSubscreenDiv()?.remove();
|
|
2202
|
+
}
|
|
2203
|
+
__name(elementRemoveSubscreenDiv, "elementRemoveSubscreenDiv");
|
|
2204
|
+
function elementAppendToSubscreenDiv(...element) {
|
|
2205
|
+
return elementGetSubscreenDiv()?.append(...element);
|
|
2206
|
+
}
|
|
2207
|
+
__name(elementAppendToSubscreenDiv, "elementAppendToSubscreenDiv");
|
|
2208
|
+
function elementCreateSettingsDiv() {
|
|
2209
|
+
const settingsDiv = elementGetSettingsDiv();
|
|
2210
|
+
if (settingsDiv) {
|
|
2211
|
+
console.error("Settings screen already exists");
|
|
2212
|
+
return settingsDiv;
|
|
2213
|
+
}
|
|
2214
|
+
const div = document.createElement("div");
|
|
2215
|
+
div.id = "deeplib-settings";
|
|
2216
|
+
div.classList.add("deeplib-settings");
|
|
2217
|
+
return div;
|
|
2218
|
+
}
|
|
2219
|
+
__name(elementCreateSettingsDiv, "elementCreateSettingsDiv");
|
|
2220
|
+
function elementGetSettingsDiv() {
|
|
2221
|
+
return document.getElementById("deeplib-settings") ?? void 0;
|
|
2222
|
+
}
|
|
2223
|
+
__name(elementGetSettingsDiv, "elementGetSettingsDiv");
|
|
2224
|
+
function elementAppendToSettingsDiv(...element) {
|
|
2225
|
+
return elementGetSettingsDiv()?.append(...element);
|
|
2226
|
+
}
|
|
2227
|
+
__name(elementAppendToSettingsDiv, "elementAppendToSettingsDiv");
|
|
2228
|
+
function elementRemoveSettingsDiv() {
|
|
2229
|
+
return elementGetSettingsDiv()?.remove();
|
|
2230
|
+
}
|
|
2231
|
+
__name(elementRemoveSettingsDiv, "elementRemoveSettingsDiv");
|
|
2232
|
+
function elementCreateMiscDiv() {
|
|
2233
|
+
const miscDiv = elementGetMiscDiv();
|
|
2234
|
+
if (miscDiv) {
|
|
2235
|
+
console.error("Settings screen already exists");
|
|
2236
|
+
return miscDiv;
|
|
2237
|
+
}
|
|
2238
|
+
const div = document.createElement("div");
|
|
2239
|
+
div.id = "deeplib-misc";
|
|
2240
|
+
div.classList.add("deeplib-misc");
|
|
2241
|
+
return div;
|
|
2242
|
+
}
|
|
2243
|
+
__name(elementCreateMiscDiv, "elementCreateMiscDiv");
|
|
2244
|
+
function elementGetMiscDiv() {
|
|
2245
|
+
return document.getElementById("deeplib-misc");
|
|
2246
|
+
}
|
|
2247
|
+
__name(elementGetMiscDiv, "elementGetMiscDiv");
|
|
2248
|
+
function elementAppendToMiscDiv(...element) {
|
|
2249
|
+
return elementGetMiscDiv()?.append(...element);
|
|
2250
|
+
}
|
|
2251
|
+
__name(elementAppendToMiscDiv, "elementAppendToMiscDiv");
|
|
2252
|
+
function elementRemoveMiscDiv() {
|
|
2253
|
+
return elementGetMiscDiv()?.remove();
|
|
2254
|
+
}
|
|
2255
|
+
__name(elementRemoveMiscDiv, "elementRemoveMiscDiv");
|
|
1829
2256
|
|
|
1830
|
-
|
|
1831
|
-
class
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
2257
|
+
// src/utilities/logger.ts
|
|
2258
|
+
var Logger = class _Logger extends Array {
|
|
2259
|
+
static {
|
|
2260
|
+
__name(this, "Logger");
|
|
2261
|
+
}
|
|
2262
|
+
ModName = "DeepLib";
|
|
2263
|
+
constructor(modName) {
|
|
2264
|
+
super();
|
|
2265
|
+
if (modName) {
|
|
2266
|
+
this.ModName = modName;
|
|
1836
2267
|
}
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
2268
|
+
}
|
|
2269
|
+
_Log(level, ...args) {
|
|
2270
|
+
const logEntry = {
|
|
2271
|
+
logLevel: level,
|
|
2272
|
+
args: [...args],
|
|
2273
|
+
// trace: arguments.callee.caller.toString().split('\n'),
|
|
2274
|
+
date: new Date(Date.now())
|
|
2275
|
+
// `[${this.ModName}] ${formattedArgs}`
|
|
2276
|
+
};
|
|
2277
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
2278
|
+
if (userAgent.includes("chrome") || userAgent.includes("firefox")) {
|
|
2279
|
+
const color = _Logger.colorizeLog(level);
|
|
2280
|
+
args.forEach((arg) => {
|
|
2281
|
+
if (typeof arg === "string") {
|
|
2282
|
+
arg = `
|
|
2283
|
+
%c${arg}`;
|
|
1846
2284
|
}
|
|
2285
|
+
});
|
|
2286
|
+
console.log(`%c${this.ModName}:`, color, ...args);
|
|
2287
|
+
} else {
|
|
2288
|
+
console.log(`${this.ModName}:`, ...args);
|
|
1847
2289
|
}
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
2290
|
+
this.push(logEntry);
|
|
2291
|
+
}
|
|
2292
|
+
info(...args) {
|
|
2293
|
+
this._Log("info", ...args);
|
|
2294
|
+
}
|
|
2295
|
+
log(...args) {
|
|
2296
|
+
this._Log("log", ...args);
|
|
2297
|
+
}
|
|
2298
|
+
warn(...args) {
|
|
2299
|
+
this._Log("warn", ...args);
|
|
2300
|
+
}
|
|
2301
|
+
error(...args) {
|
|
2302
|
+
this._Log("error", ...args);
|
|
2303
|
+
}
|
|
2304
|
+
debug(...args) {
|
|
2305
|
+
this._Log("debug", ...args);
|
|
2306
|
+
}
|
|
2307
|
+
static colorizeLog(logLevel) {
|
|
2308
|
+
const colors = {
|
|
2309
|
+
info: "color: #32CCCC",
|
|
2310
|
+
log: "color: #CCCC32",
|
|
2311
|
+
warn: "color: #eec355",
|
|
2312
|
+
error: "color: #750b0b",
|
|
2313
|
+
debug: "color: #9E4BCF"
|
|
2314
|
+
};
|
|
2315
|
+
return colors[logLevel];
|
|
2316
|
+
}
|
|
2317
|
+
};
|
|
2318
|
+
var deepLibLogger = new Logger();
|
|
2319
|
+
|
|
2320
|
+
// src/utilities/messages.ts
|
|
2321
|
+
function sendLocalMessage(id, message, timeoutInSeconds) {
|
|
2322
|
+
const element = ElementCreate({
|
|
2323
|
+
tag: "div",
|
|
2324
|
+
classList: ["ChatMessage", "deeplib-message", "ChatMessageNonDialogue"],
|
|
2325
|
+
attributes: {
|
|
2326
|
+
id: id ?? `DEEPLIB_LOCAL_MESSAGE_${Date.now()}`,
|
|
2327
|
+
"data-time": ChatRoomCurrentTime(),
|
|
2328
|
+
"data-sender": Player.MemberNumber?.toString()
|
|
2329
|
+
},
|
|
2330
|
+
children: [
|
|
2331
|
+
{
|
|
2332
|
+
tag: "span",
|
|
2333
|
+
classList: ["deeplib-text"],
|
|
2334
|
+
innerHTML: message.replaceAll("\n ", "")
|
|
2335
|
+
},
|
|
2336
|
+
{
|
|
2337
|
+
tag: "br"
|
|
2338
|
+
},
|
|
2339
|
+
{
|
|
2340
|
+
tag: "a",
|
|
2341
|
+
classList: ["deeplib-text"],
|
|
2342
|
+
attributes: {
|
|
2343
|
+
href: "#"
|
|
2344
|
+
},
|
|
2345
|
+
innerHTML: "<b>Close (Click)</b>",
|
|
2346
|
+
eventListeners: {
|
|
2347
|
+
click: /* @__PURE__ */ __name(() => {
|
|
2348
|
+
element.remove();
|
|
2349
|
+
}, "click")
|
|
1855
2350
|
}
|
|
1856
|
-
|
|
1857
|
-
|
|
2351
|
+
}
|
|
2352
|
+
]
|
|
2353
|
+
});
|
|
2354
|
+
ChatRoomAppendChat(element);
|
|
2355
|
+
if (!timeoutInSeconds) return;
|
|
2356
|
+
setTimeout(() => element.remove(), timeoutInSeconds * 1e3);
|
|
2357
|
+
}
|
|
2358
|
+
__name(sendLocalMessage, "sendLocalMessage");
|
|
2359
|
+
function sendActionMessage(msg, target = void 0, dictionary = []) {
|
|
2360
|
+
if (!msg) return;
|
|
2361
|
+
ServerSend("ChatRoomChat", {
|
|
2362
|
+
Content: "DEEPLIB_CUSTOM_ACTION",
|
|
2363
|
+
Type: "Action",
|
|
2364
|
+
Target: target ?? void 0,
|
|
2365
|
+
Dictionary: [
|
|
2366
|
+
{ Tag: 'MISSING TEXT IN "Interface.csv": DEEPLIB_CUSTOM_ACTION', Text: msg },
|
|
2367
|
+
...dictionary
|
|
2368
|
+
]
|
|
2369
|
+
});
|
|
2370
|
+
}
|
|
2371
|
+
__name(sendActionMessage, "sendActionMessage");
|
|
2372
|
+
|
|
2373
|
+
// src/utilities/sdk.ts
|
|
2374
|
+
var import_bondage_club_mod_sdk = __toESM(require_bcmodsdk(), 1);
|
|
2375
|
+
var rawSdk = import_bondage_club_mod_sdk.default;
|
|
2376
|
+
var bcModSdkRef = rawSdk.default ?? rawSdk;
|
|
2377
|
+
var HookPriority = {
|
|
2378
|
+
Observe: 0,
|
|
2379
|
+
AddBehavior: 1,
|
|
2380
|
+
ModifyBehavior: 5,
|
|
2381
|
+
OverrideBehavior: 10,
|
|
2382
|
+
Top: 100
|
|
2383
|
+
};
|
|
2384
|
+
var ModSdkManager = class _ModSdkManager {
|
|
2385
|
+
static {
|
|
2386
|
+
__name(this, "ModSdkManager");
|
|
2387
|
+
}
|
|
2388
|
+
static SDK;
|
|
2389
|
+
static patchedFunctions = /* @__PURE__ */ new Map();
|
|
2390
|
+
static ModInfo;
|
|
2391
|
+
constructor(info, options) {
|
|
2392
|
+
_ModSdkManager.SDK = bcModSdkRef.registerMod(info, options);
|
|
2393
|
+
_ModSdkManager.ModInfo = info;
|
|
2394
|
+
}
|
|
2395
|
+
initPatchableFunction(target) {
|
|
2396
|
+
let result = _ModSdkManager.patchedFunctions.get(target);
|
|
2397
|
+
if (!result) {
|
|
2398
|
+
result = {
|
|
2399
|
+
name: target,
|
|
2400
|
+
hooks: []
|
|
2401
|
+
};
|
|
2402
|
+
_ModSdkManager.patchedFunctions.set(target, result);
|
|
2403
|
+
}
|
|
2404
|
+
return result;
|
|
2405
|
+
}
|
|
2406
|
+
hookFunction(target, priority, hook, module = null) {
|
|
2407
|
+
const data = this.initPatchableFunction(target);
|
|
2408
|
+
if (data.hooks.some((h) => h.hook === hook)) {
|
|
2409
|
+
return () => null;
|
|
2410
|
+
}
|
|
2411
|
+
const removeCallback = _ModSdkManager.SDK?.hookFunction(target, priority, hook);
|
|
2412
|
+
data.hooks.push({
|
|
2413
|
+
hook,
|
|
2414
|
+
priority,
|
|
2415
|
+
module,
|
|
2416
|
+
removeCallback
|
|
2417
|
+
});
|
|
2418
|
+
data.hooks.sort((a, b) => b.priority - a.priority);
|
|
2419
|
+
return removeCallback;
|
|
2420
|
+
}
|
|
2421
|
+
patchFunction(target, patches) {
|
|
2422
|
+
_ModSdkManager.SDK?.patchFunction(target, patches);
|
|
2423
|
+
}
|
|
2424
|
+
unpatchFunction(target) {
|
|
2425
|
+
_ModSdkManager.SDK?.removePatches(target);
|
|
2426
|
+
}
|
|
2427
|
+
removeHookByModule(target, module) {
|
|
2428
|
+
const data = this.initPatchableFunction(target);
|
|
2429
|
+
for (let i = data.hooks.length - 1; i >= 0; i--) {
|
|
2430
|
+
if (data.hooks[i].module === module) {
|
|
2431
|
+
data.hooks[i].removeCallback();
|
|
2432
|
+
data.hooks.splice(i, 1);
|
|
2433
|
+
}
|
|
1858
2434
|
}
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
translations[key.trim()] = value.trim();
|
|
2435
|
+
return true;
|
|
2436
|
+
}
|
|
2437
|
+
removeAllHooksByModule(module) {
|
|
2438
|
+
for (const data of _ModSdkManager.patchedFunctions.values()) {
|
|
2439
|
+
for (let i = data.hooks.length - 1; i >= 0; i--) {
|
|
2440
|
+
if (data.hooks[i].module === module) {
|
|
2441
|
+
data.hooks[i].removeCallback();
|
|
2442
|
+
data.hooks.splice(i, 1);
|
|
1868
2443
|
}
|
|
1869
|
-
|
|
2444
|
+
}
|
|
1870
2445
|
}
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
;// ./src/DeepLib.ts
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
2446
|
+
return true;
|
|
2447
|
+
}
|
|
2448
|
+
};
|
|
1902
2449
|
|
|
1903
|
-
|
|
2450
|
+
// src/utilities/style.ts
|
|
2451
|
+
var Style = {
|
|
2452
|
+
injectInline(styleId, styleSource) {
|
|
2453
|
+
const isStyleLoaded = document.getElementById(styleId);
|
|
2454
|
+
if (isStyleLoaded) return;
|
|
2455
|
+
const styleElement = document.createElement("style");
|
|
2456
|
+
styleElement.id = styleId;
|
|
2457
|
+
styleElement.appendChild(document.createTextNode(styleSource));
|
|
2458
|
+
document.head.appendChild(styleElement);
|
|
2459
|
+
},
|
|
2460
|
+
injectEmbed(styleId, styleLink) {
|
|
2461
|
+
const isStyleLoaded = document.getElementById(styleId);
|
|
2462
|
+
if (isStyleLoaded) return;
|
|
2463
|
+
const styleElement = document.createElement("link");
|
|
2464
|
+
styleElement.id = styleId;
|
|
2465
|
+
styleElement.rel = "stylesheet";
|
|
2466
|
+
styleElement.href = styleLink;
|
|
2467
|
+
document.head.appendChild(styleElement);
|
|
2468
|
+
},
|
|
2469
|
+
eject(id) {
|
|
2470
|
+
const style = document.getElementById(id);
|
|
2471
|
+
if (!style) return;
|
|
2472
|
+
style.remove();
|
|
2473
|
+
},
|
|
2474
|
+
reload(styleId, styleSource) {
|
|
2475
|
+
Style.eject(styleId);
|
|
2476
|
+
Style.injectInline(styleId, styleSource);
|
|
2477
|
+
},
|
|
2478
|
+
async fetch(link) {
|
|
2479
|
+
return fetch(link).then((res) => res.text());
|
|
2480
|
+
}
|
|
2481
|
+
};
|
|
1904
2482
|
|
|
1905
|
-
|
|
2483
|
+
// src/utilities/translation.ts
|
|
2484
|
+
var Localization = class _Localization {
|
|
2485
|
+
static {
|
|
2486
|
+
__name(this, "Localization");
|
|
2487
|
+
}
|
|
2488
|
+
static LibTranslation = {};
|
|
2489
|
+
static ModTranslation = {};
|
|
2490
|
+
static PathToModTranslation;
|
|
2491
|
+
static PathToLibTranslation = `${PUBLIC_URL}/dl_translations/`;
|
|
2492
|
+
static initialized = false;
|
|
2493
|
+
static async init(initOptions) {
|
|
2494
|
+
if (_Localization.initialized) return;
|
|
2495
|
+
_Localization.initialized = true;
|
|
2496
|
+
_Localization.PathToModTranslation = initOptions.pathToTranslationsFolder.endsWith("/") ? initOptions.pathToTranslationsFolder : initOptions.pathToTranslationsFolder + "/";
|
|
2497
|
+
const lang = TranslationLanguage.toLowerCase();
|
|
2498
|
+
const libTranslation = await _Localization.fetchLanguageFile(_Localization.PathToLibTranslation, lang);
|
|
2499
|
+
if (lang === "en") {
|
|
2500
|
+
_Localization.LibTranslation = libTranslation;
|
|
2501
|
+
} else {
|
|
2502
|
+
const fallbackTranslation = await _Localization.fetchLanguageFile(_Localization.PathToLibTranslation, "en");
|
|
2503
|
+
_Localization.LibTranslation = { ...fallbackTranslation, ...libTranslation };
|
|
2504
|
+
}
|
|
2505
|
+
const modTranslation = await _Localization.fetchLanguageFile(_Localization.PathToModTranslation, lang);
|
|
2506
|
+
if (lang === "en") {
|
|
2507
|
+
_Localization.ModTranslation = modTranslation;
|
|
2508
|
+
} else {
|
|
2509
|
+
const fallbackTranslation = await _Localization.fetchLanguageFile(_Localization.PathToModTranslation, "en");
|
|
2510
|
+
_Localization.ModTranslation = { ...fallbackTranslation, ...modTranslation };
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2513
|
+
static getTextMod(srcTag) {
|
|
2514
|
+
return _Localization.ModTranslation?.[srcTag] || void 0;
|
|
2515
|
+
}
|
|
2516
|
+
static getTextLib(srcTag) {
|
|
2517
|
+
return _Localization.LibTranslation?.[srcTag] || void 0;
|
|
2518
|
+
}
|
|
2519
|
+
static async fetchLanguageFile(baseUrl, lang) {
|
|
2520
|
+
const response = await fetch(`${baseUrl}${lang}.lang`);
|
|
2521
|
+
if (lang !== "en" && !response.ok) {
|
|
2522
|
+
return this.fetchLanguageFile(baseUrl, "en");
|
|
2523
|
+
}
|
|
2524
|
+
const langFileContent = await response.text();
|
|
2525
|
+
return this.parseLanguageFile(langFileContent);
|
|
2526
|
+
}
|
|
2527
|
+
static parseLanguageFile(content) {
|
|
2528
|
+
const translations = {};
|
|
2529
|
+
const lines = content.split("\n");
|
|
2530
|
+
for (const line of lines) {
|
|
2531
|
+
const trimmed = line.trim();
|
|
2532
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
2533
|
+
const [key, ...rest] = trimmed.split("=");
|
|
2534
|
+
translations[key.trim()] = rest.join("=").trim();
|
|
2535
|
+
}
|
|
2536
|
+
return translations;
|
|
2537
|
+
}
|
|
2538
|
+
};
|
|
2539
|
+
var getText = /* @__PURE__ */ __name((srcTag) => {
|
|
2540
|
+
return Localization.getTextMod(srcTag) || Localization.getTextLib(srcTag) || srcTag;
|
|
2541
|
+
}, "getText");
|
|
2542
|
+
export {
|
|
2543
|
+
BaseMigrator2 as BaseMigrator,
|
|
2544
|
+
BaseModule,
|
|
2545
|
+
BaseSubscreen,
|
|
2546
|
+
GUI,
|
|
2547
|
+
GuiDebug,
|
|
2548
|
+
GuiImportExport,
|
|
2549
|
+
HookPriority,
|
|
2550
|
+
Localization,
|
|
2551
|
+
Logger,
|
|
2552
|
+
MainMenu,
|
|
2553
|
+
ModSdkManager,
|
|
2554
|
+
ModStorage,
|
|
2555
|
+
Modal,
|
|
2556
|
+
Style,
|
|
2557
|
+
VersionModule,
|
|
2558
|
+
advancedElement,
|
|
2559
|
+
deepLibLogger,
|
|
2560
|
+
deepMerge,
|
|
2561
|
+
deepMergeMatchingProperties,
|
|
2562
|
+
domUtil,
|
|
2563
|
+
exportToGlobal,
|
|
2564
|
+
getCurrentSubscreen,
|
|
2565
|
+
getModule,
|
|
2566
|
+
getText,
|
|
2567
|
+
hasGetter,
|
|
2568
|
+
hasSetter,
|
|
2569
|
+
init,
|
|
2570
|
+
initMod,
|
|
2571
|
+
layoutElement,
|
|
2572
|
+
modStorage,
|
|
2573
|
+
modules,
|
|
2574
|
+
modulesMap,
|
|
2575
|
+
registerModule,
|
|
2576
|
+
sendActionMessage,
|
|
2577
|
+
sendLocalMessage,
|
|
2578
|
+
setSubscreen,
|
|
2579
|
+
shuffleArray,
|
|
2580
|
+
unloadMod
|
|
2581
|
+
};
|
|
2582
|
+
//# sourceMappingURL=deeplib.js.map
|