slimsdk 0.1.55 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/desktop/index.d.ts +13 -12
- package/dist/desktop/index.js +1228 -1967
- package/dist/desktop/index.js.map +1 -1
- package/dist/index-3POan8Vl.d.ts +94 -0
- package/dist/index-B4158M0u.d.ts +21 -0
- package/dist/index-BAQxKstM.d.ts +8 -0
- package/dist/index-BMqjxP9I.d.ts +11 -0
- package/dist/index-CD53Vh6h.d.ts +31 -0
- package/dist/index-CoYHkkyT.d.ts +14 -0
- package/dist/index-D5CUpF9v.d.ts +10 -0
- package/dist/index-DBhzpIiB.d.ts +32 -0
- package/dist/index-DCw_tM-R.d.ts +28 -0
- package/dist/{index-kr8P3eEW.d.ts → index-DWqF-tKY.d.ts} +7 -9
- package/dist/index-DzKPF0ja.d.ts +14 -0
- package/dist/index-jVam7Sxi.d.ts +15 -0
- package/dist/index-uQOR5bdy.d.ts +20 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/mobile/index.d.ts +13 -12
- package/dist/mobile/index.js +299 -808
- package/dist/mobile/index.js.map +1 -1
- package/dist/mod/button/index.d.ts +1 -1
- package/dist/mod/button/index.js +2 -2
- package/dist/mod/button/index.js.map +1 -1
- package/dist/mod/config/index.d.ts +52 -0
- package/dist/mod/{global → config}/index.js +45 -41
- package/dist/mod/config/index.js.map +1 -0
- package/dist/mod/cover/index.d.ts +1 -1
- package/dist/mod/cover/index.js +3 -3
- package/dist/mod/cover/index.js.map +1 -1
- package/dist/mod/dialog/index.d.ts +1 -1
- package/dist/mod/dialog/index.js +13 -13
- package/dist/mod/dialog/index.js.map +1 -1
- package/dist/mod/drawer/index.d.ts +1 -1
- package/dist/mod/drawer/index.js +8 -8
- package/dist/mod/drawer/index.js.map +1 -1
- package/dist/mod/drop/index.d.ts +1 -1
- package/dist/mod/drop/index.js +15 -15
- package/dist/mod/drop/index.js.map +1 -1
- package/dist/mod/hwlink/index.d.ts +2 -2
- package/dist/mod/hwlink/index.js +44 -656
- package/dist/mod/hwlink/index.js.map +1 -1
- package/dist/mod/index.d.ts +7 -7
- package/dist/mod/index.js +61 -59
- package/dist/mod/index.js.map +1 -1
- package/dist/mod/modal/index.d.ts +1 -1
- package/dist/mod/modal/index.js +12 -12
- package/dist/mod/modal/index.js.map +1 -1
- package/dist/mod/tabs/index.d.ts +1 -1
- package/dist/mod/tabs/index.js +8 -6
- package/dist/mod/tabs/index.js.map +1 -1
- package/dist/page/desktop/index.d.ts +3 -3
- package/dist/page/desktop/index.js +228 -801
- package/dist/page/desktop/index.js.map +1 -1
- package/dist/page/index.d.ts +7 -7
- package/dist/page/index.js +12 -12
- package/dist/page/index.js.map +1 -1
- package/dist/page/mobile/index.d.ts +2 -2
- package/dist/page/mobile/index.js +14 -14
- package/dist/page/mobile/index.js.map +1 -1
- package/dist/worker/hubworker.js +1 -1
- package/dist/worker/hubworker.js.map +1 -1
- package/package.json +6 -6
- package/dist/index-B2HHS23A.d.ts +0 -20
- package/dist/index-BQcJsVJ-.d.ts +0 -10
- package/dist/index-Bf_lg-oZ.d.ts +0 -339
- package/dist/index-ChdqOPJq.d.ts +0 -15
- package/dist/index-CzsSwSvp.d.ts +0 -21
- package/dist/index-D3tu8t6p.d.ts +0 -28
- package/dist/index-DQt71MNx.d.ts +0 -31
- package/dist/index-DZdXvqxA.d.ts +0 -10
- package/dist/index-DcvauYN8.d.ts +0 -14
- package/dist/index-Pd7FTiEW.d.ts +0 -32
- package/dist/index-QRbamarh.d.ts +0 -8
- package/dist/mod/global/index.d.ts +0 -57
- package/dist/mod/global/index.js.map +0 -1
package/dist/desktop/index.js
CHANGED
|
@@ -4,166 +4,10 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// src/page/desktop/index.ts
|
|
8
|
-
var desktop_exports = {};
|
|
9
|
-
__export(desktop_exports, {
|
|
10
|
-
Clear: () => Clear2,
|
|
11
|
-
Create: () => Create5,
|
|
12
|
-
Error: () => Error2,
|
|
13
|
-
FullLoad: () => FullLoad,
|
|
14
|
-
HwLink: () => HwLink,
|
|
15
|
-
Inform: () => Inform,
|
|
16
|
-
Loading: () => Loading,
|
|
17
|
-
NotFound: () => NotFound,
|
|
18
|
-
Ready: () => Ready
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// src/page/index.ts
|
|
22
|
-
var app = document.querySelector("#app");
|
|
23
|
-
var pageSpin = (
|
|
24
|
-
/*html*/
|
|
25
|
-
`
|
|
26
|
-
<div class="lds-spinner">
|
|
27
|
-
<div></div><div></div><div></div><div></div>
|
|
28
|
-
<div></div><div></div><div></div><div></div>
|
|
29
|
-
<div></div><div></div><div></div><div></div>
|
|
30
|
-
</div>
|
|
31
|
-
`
|
|
32
|
-
);
|
|
33
|
-
var smallSpin = `<div class="spinner s32"></div>`;
|
|
34
|
-
var Loading = (size = "default") => {
|
|
35
|
-
if (!app) return;
|
|
36
|
-
if (!app.querySelector("#page-loader")) {
|
|
37
|
-
const loader = document.createElement("div");
|
|
38
|
-
loader.id = "page-loader";
|
|
39
|
-
loader.className = "overlay center";
|
|
40
|
-
loader.innerHTML = size == "default" ? pageSpin : smallSpin;
|
|
41
|
-
app.appendChild(loader);
|
|
42
|
-
}
|
|
43
|
-
const content = app.querySelector("#app-content");
|
|
44
|
-
if (content) content.style.display = "none";
|
|
45
|
-
};
|
|
46
|
-
var Ready = (delay = 400) => {
|
|
47
|
-
new Promise((r) => setTimeout(r, delay)).then(() => {
|
|
48
|
-
clearLoader(true);
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
var Error2 = (err) => {
|
|
52
|
-
clearLoader(false);
|
|
53
|
-
if (!app) return;
|
|
54
|
-
const box = document.createElement("div");
|
|
55
|
-
box.className = "page-error";
|
|
56
|
-
box.innerHTML = /*html*/
|
|
57
|
-
`
|
|
58
|
-
<i class="icon red"></i>
|
|
59
|
-
<div class="topic">✦ \u0E40\u0E01\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14 ✦</div>
|
|
60
|
-
<div class="text">${err}</div>
|
|
61
|
-
`;
|
|
62
|
-
app.prepend(box);
|
|
63
|
-
throw err;
|
|
64
|
-
};
|
|
65
|
-
var NotFound = () => {
|
|
66
|
-
if (!app) return;
|
|
67
|
-
app.innerHTML = /*html*/
|
|
68
|
-
`
|
|
69
|
-
<div class="page-not-found">
|
|
70
|
-
<h1>4<i class="fas fa-ghost"></i>4</h1>
|
|
71
|
-
<h2>Error 404 Page Not Found</h2>
|
|
72
|
-
<p>Sorry, the page cannot be accessed</p>
|
|
73
|
-
</div>
|
|
74
|
-
`;
|
|
75
|
-
};
|
|
76
|
-
var FullLoad = () => {
|
|
77
|
-
clearNavbar();
|
|
78
|
-
if (!app) return;
|
|
79
|
-
app.classList.add("full-page");
|
|
80
|
-
app.innerHTML = /*html*/
|
|
81
|
-
`
|
|
82
|
-
<div class="page-full-load">
|
|
83
|
-
<div class="spinner"></div>
|
|
84
|
-
<div class="text">Slim<br>Loading</div>
|
|
85
|
-
</div>
|
|
86
|
-
`;
|
|
87
|
-
};
|
|
88
|
-
var Inform = (params) => {
|
|
89
|
-
clearNavbar();
|
|
90
|
-
if (!app) return;
|
|
91
|
-
app.classList.add("full-page");
|
|
92
|
-
app.innerHTML = /*html*/
|
|
93
|
-
`
|
|
94
|
-
<div class="page-inform ${params.color}">
|
|
95
|
-
<div class="icon solid">${params.icon}</div>
|
|
96
|
-
<div class="msg">${params.msg}</div>
|
|
97
|
-
<button class="lg ${params.color}" shadow="true">
|
|
98
|
-
${params.btnTxt}
|
|
99
|
-
</button>
|
|
100
|
-
</div>
|
|
101
|
-
`;
|
|
102
|
-
const btn = app.querySelector("button");
|
|
103
|
-
btn.onclick = () => window.location.replace(params.btnUrl);
|
|
104
|
-
};
|
|
105
|
-
var clearNavbar = () => {
|
|
106
|
-
const topbar = document.querySelector("#topbar");
|
|
107
|
-
const tabbar = document.querySelector("#tabbar");
|
|
108
|
-
const sidebar = document.querySelector("#sidebar");
|
|
109
|
-
if (topbar) topbar.remove();
|
|
110
|
-
if (tabbar) tabbar.remove();
|
|
111
|
-
if (sidebar) sidebar.remove();
|
|
112
|
-
if (app) app.className = "";
|
|
113
|
-
};
|
|
114
|
-
var clearLoader = (showContent) => {
|
|
115
|
-
if (!app) return;
|
|
116
|
-
const loader = app.querySelector("#page-loader");
|
|
117
|
-
if (loader) {
|
|
118
|
-
loader.style.animation = "fade-out 0.4s forwards";
|
|
119
|
-
loader.onanimationend = () => loader.remove();
|
|
120
|
-
}
|
|
121
|
-
const content = app.querySelector("#app-content");
|
|
122
|
-
if (content) content.style.display = showContent ? "block" : "none";
|
|
123
|
-
};
|
|
124
|
-
|
|
125
7
|
// package.json
|
|
126
|
-
var version = "0.
|
|
8
|
+
var version = "0.2.0";
|
|
127
9
|
|
|
128
|
-
// src/
|
|
129
|
-
var gbvar = {
|
|
130
|
-
UNIX_TIME: 0,
|
|
131
|
-
app: {
|
|
132
|
-
UUID: "",
|
|
133
|
-
NAME: "",
|
|
134
|
-
VERSION: "",
|
|
135
|
-
RELEASE: ""
|
|
136
|
-
},
|
|
137
|
-
api: {
|
|
138
|
-
URL: "",
|
|
139
|
-
TOKEN: ""
|
|
140
|
-
},
|
|
141
|
-
hub: {
|
|
142
|
-
LOGIN: "https://wkrh.info/oauth/v1/authorize",
|
|
143
|
-
OAUTH: "https://wkrh.info:8850/oauth/v1",
|
|
144
|
-
API: "https://wkrh.info:8850/api/v1",
|
|
145
|
-
WSS: "wss://wkrh.info:8855/ws",
|
|
146
|
-
UUID: ""
|
|
147
|
-
},
|
|
148
|
-
hwl: {
|
|
149
|
-
HOST: "ws://localhost:8844/ws",
|
|
150
|
-
FILE: "https://wkrh.info/app/hwlink/hwlink_setup.exe"
|
|
151
|
-
},
|
|
152
|
-
user: {
|
|
153
|
-
ACCT: 0,
|
|
154
|
-
ACTYPE: 0,
|
|
155
|
-
ACROLE: 0,
|
|
156
|
-
ACNAME: "",
|
|
157
|
-
PICTURE: "",
|
|
158
|
-
AGCY: 0,
|
|
159
|
-
DVSN: 0,
|
|
160
|
-
SECT: 0,
|
|
161
|
-
DEPT: "0,0",
|
|
162
|
-
AGCY_NAME: "",
|
|
163
|
-
DVSN_NAME: "",
|
|
164
|
-
SECT_NAME: ""
|
|
165
|
-
}
|
|
166
|
-
};
|
|
10
|
+
// src/config/global.ts
|
|
167
11
|
var info = () => `sdk ${version}`;
|
|
168
12
|
var init = (params) => {
|
|
169
13
|
if (params?.svcWorker) svcWorker(params.svcWorker);
|
|
@@ -198,9 +42,9 @@ var hideTabbar = () => {
|
|
|
198
42
|
}
|
|
199
43
|
});
|
|
200
44
|
};
|
|
201
|
-
var
|
|
45
|
+
var app = document.querySelector("#app");
|
|
202
46
|
var btnToTop = () => {
|
|
203
|
-
if (!
|
|
47
|
+
if (!app) return;
|
|
204
48
|
const totop = document.createElement("div");
|
|
205
49
|
totop.id = "totop";
|
|
206
50
|
totop.innerHTML = /* html */
|
|
@@ -210,23 +54,23 @@ var btnToTop = () => {
|
|
|
210
54
|
`;
|
|
211
55
|
document.body.appendChild(totop);
|
|
212
56
|
totop.querySelector("#btn-totop").onclick = () => {
|
|
213
|
-
|
|
57
|
+
app.scrollTo({ top: 0, behavior: "smooth" });
|
|
214
58
|
};
|
|
215
|
-
|
|
216
|
-
if (
|
|
59
|
+
app.addEventListener("scroll", () => {
|
|
60
|
+
if (app.scrollTop > 1e3) {
|
|
217
61
|
totop.style.display = "block";
|
|
218
|
-
if (
|
|
219
|
-
|
|
62
|
+
if (app.classList.contains("tabbar")) {
|
|
63
|
+
app.style.paddingBottom = "116px";
|
|
220
64
|
} else {
|
|
221
|
-
|
|
65
|
+
app.style.paddingBottom = "60px";
|
|
222
66
|
}
|
|
223
67
|
} else {
|
|
224
68
|
totop.style.display = "";
|
|
225
|
-
|
|
69
|
+
app.style.paddingBottom = "";
|
|
226
70
|
}
|
|
227
|
-
const tabsMobile =
|
|
71
|
+
const tabsMobile = app.querySelector(".slim-tabs.mobile .tabs-header");
|
|
228
72
|
if (!tabsMobile) return;
|
|
229
|
-
if (
|
|
73
|
+
if (app.scrollTop > 10) {
|
|
230
74
|
tabsMobile.style.boxShadow = `rgba(0, 0, 0, 0.16) 0px 1px 4px`;
|
|
231
75
|
} else {
|
|
232
76
|
tabsMobile.style.boxShadow = "";
|
|
@@ -234,214 +78,92 @@ var btnToTop = () => {
|
|
|
234
78
|
});
|
|
235
79
|
};
|
|
236
80
|
|
|
237
|
-
// src/
|
|
238
|
-
var
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
81
|
+
// src/config/index.ts
|
|
82
|
+
var cfg = {
|
|
83
|
+
UNIX_TIME: 0,
|
|
84
|
+
app: {
|
|
85
|
+
UUID: "",
|
|
86
|
+
NAME: "",
|
|
87
|
+
SECRET: "",
|
|
88
|
+
VERSION: "",
|
|
89
|
+
RELEASE: "",
|
|
90
|
+
CALLBACK: ""
|
|
91
|
+
},
|
|
92
|
+
api: {
|
|
93
|
+
URL: "",
|
|
94
|
+
TOKEN: ""
|
|
95
|
+
},
|
|
96
|
+
hub: {
|
|
97
|
+
LOGIN: "https://wkrh.info/oauth/v1/authorize",
|
|
98
|
+
OAUTH: "https://wkrh.info:8850/oauth/v1",
|
|
99
|
+
API: "https://wkrh.info:8850/api/v1",
|
|
100
|
+
WSS: "wss://wkrh.info:8855/ws",
|
|
101
|
+
UUID: ""
|
|
102
|
+
},
|
|
103
|
+
hwl: {
|
|
104
|
+
HOST: "ws://localhost:8844/ws",
|
|
105
|
+
FILE: "https://wkrh.info/app/hwlink/hwlink_setup.exe"
|
|
106
|
+
},
|
|
107
|
+
user: {
|
|
108
|
+
sub: 0,
|
|
109
|
+
name: "",
|
|
110
|
+
utyp: "",
|
|
111
|
+
unit: "",
|
|
112
|
+
unit_id: 0,
|
|
113
|
+
role_id: 0,
|
|
114
|
+
metadata: {
|
|
115
|
+
emp_type: "",
|
|
116
|
+
emp_level: "",
|
|
117
|
+
position: ""
|
|
118
|
+
},
|
|
119
|
+
picture: ""
|
|
259
120
|
}
|
|
260
121
|
};
|
|
261
|
-
var acdInit = () => {
|
|
262
|
-
const acdItem = document.querySelectorAll(".acd-item");
|
|
263
|
-
acdItem.forEach((elm) => {
|
|
264
|
-
const topic = elm.querySelector(".topic");
|
|
265
|
-
const panel = elm.querySelector(".panel");
|
|
266
|
-
if (topic) topic.onclick = () => {
|
|
267
|
-
elm.classList.toggle("active");
|
|
268
|
-
if (!panel) return;
|
|
269
|
-
if (elm.classList.contains("active")) {
|
|
270
|
-
panel.style.maxHeight = `${panel.scrollHeight}px`;
|
|
271
|
-
} else {
|
|
272
|
-
panel.style.maxHeight = "";
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
});
|
|
276
|
-
};
|
|
277
122
|
|
|
278
|
-
// src/
|
|
279
|
-
var
|
|
280
|
-
__export(
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
123
|
+
// src/page/desktop/index.ts
|
|
124
|
+
var desktop_exports = {};
|
|
125
|
+
__export(desktop_exports, {
|
|
126
|
+
clear: () => clear2,
|
|
127
|
+
create: () => create,
|
|
128
|
+
error: () => error,
|
|
129
|
+
fullLoad: () => fullLoad,
|
|
130
|
+
hwLink: () => hwLink,
|
|
131
|
+
inform: () => inform,
|
|
132
|
+
loading: () => loading2,
|
|
133
|
+
notFound: () => notFound,
|
|
134
|
+
ready: () => ready
|
|
287
135
|
});
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
);
|
|
297
|
-
var
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
);
|
|
305
|
-
var tmpBtnClose = (
|
|
306
|
-
/* html */
|
|
307
|
-
`
|
|
308
|
-
<button class="solid blue" type="button" id="btn-close">
|
|
309
|
-
<i></i>\u0E1B\u0E34\u0E14\u0E2B\u0E19\u0E49\u0E32
|
|
310
|
-
</button>
|
|
311
|
-
`
|
|
312
|
-
);
|
|
313
|
-
var Create = (params) => {
|
|
314
|
-
const icon = params.icon ? params.icon : "";
|
|
315
|
-
const title = params.title ? params.title : "Modal Title";
|
|
316
|
-
const body = params.body ? params.body : "Modal Body";
|
|
317
|
-
const width = params.width ? params.width : "100%";
|
|
318
|
-
const align = params.button?.align ? params.button?.align : "";
|
|
319
|
-
const doc = params.target ? params.target : app3;
|
|
320
|
-
let button = "";
|
|
321
|
-
if (params.button?.cancel) button += tmpBtnCancel;
|
|
322
|
-
if (params.button?.close) button += tmpBtnClose;
|
|
323
|
-
if (params.button?.save) button += tmpBtnSave;
|
|
324
|
-
const modal = document.createElement("div");
|
|
325
|
-
modal.className = "overlay slim-modal";
|
|
326
|
-
modal.innerHTML = /*html*/
|
|
136
|
+
|
|
137
|
+
// src/mod/dialog/index.ts
|
|
138
|
+
var dialog_exports = {};
|
|
139
|
+
__export(dialog_exports, {
|
|
140
|
+
alert: () => alert,
|
|
141
|
+
confirm: () => confirm,
|
|
142
|
+
toast: () => toast
|
|
143
|
+
});
|
|
144
|
+
var app2 = document.querySelector("#app");
|
|
145
|
+
var confirm = (message, params) => new Promise((resolve) => {
|
|
146
|
+
if (!app2) return;
|
|
147
|
+
const doc = params && params?.target ? params.target : app2;
|
|
148
|
+
const color = params && params?.color ? params.color : "green";
|
|
149
|
+
const dialog = document.createElement("div");
|
|
150
|
+
dialog.className = "overlay slim-dialog";
|
|
151
|
+
dialog.innerHTML = /*html*/
|
|
327
152
|
`
|
|
328
|
-
<
|
|
329
|
-
<div class="
|
|
330
|
-
<
|
|
331
|
-
<i class="icon pad">${icon}</i>${title}
|
|
332
|
-
<button id="btn-exit" type="button"
|
|
333
|
-
class="icon"></button>
|
|
334
|
-
</div>
|
|
335
|
-
<div class="body">${body}</div>
|
|
336
|
-
<div class="footer ${align}">${button}</div>
|
|
337
|
-
<div class="loader">
|
|
338
|
-
<div class="spinner s28"></div>
|
|
339
|
-
</div>
|
|
153
|
+
<div class="confirm ${color}">
|
|
154
|
+
<div class="header">
|
|
155
|
+
<i class="icon solid"></i> Slim Confirm
|
|
340
156
|
</div>
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
content.classList.add("modal-in");
|
|
352
|
-
modal.classList.add("overlay-in");
|
|
353
|
-
content.addEventListener("animationend", () => {
|
|
354
|
-
if (content.classList.contains("modal-in")) {
|
|
355
|
-
content.classList.remove("modal-in");
|
|
356
|
-
modal.classList.remove("overlay-in");
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
const hashChange = () => {
|
|
360
|
-
const hash = window.location.hash.replaceAll("#", "");
|
|
361
|
-
if (hash != "modal") done();
|
|
362
|
-
};
|
|
363
|
-
const done = () => {
|
|
364
|
-
destroy(modal);
|
|
365
|
-
if (window.location.hash == "#modal") history.back();
|
|
366
|
-
window.removeEventListener("hashchange", hashChange);
|
|
367
|
-
};
|
|
368
|
-
window.addEventListener("hashchange", hashChange);
|
|
369
|
-
const btnExit = modal.querySelector("#btn-exit");
|
|
370
|
-
const btnCancel = modal.querySelector("#btn-cancel");
|
|
371
|
-
const btnClose = modal.querySelector("#btn-close");
|
|
372
|
-
if (btnExit) {
|
|
373
|
-
btnExit.focus();
|
|
374
|
-
btnExit.onclick = done;
|
|
375
|
-
}
|
|
376
|
-
if (btnCancel) btnCancel.onclick = done;
|
|
377
|
-
if (btnClose) btnClose.onclick = done;
|
|
378
|
-
return modal;
|
|
379
|
-
};
|
|
380
|
-
var Close = (modal) => new Promise((resolve) => {
|
|
381
|
-
modal.querySelector("#btn-exit").click();
|
|
382
|
-
const content = modal.querySelector(".content");
|
|
383
|
-
content.addEventListener("animationend", () => resolve());
|
|
384
|
-
});
|
|
385
|
-
var destroy = (modal) => {
|
|
386
|
-
const content = modal.querySelector(".content");
|
|
387
|
-
content.classList.add("modal-out");
|
|
388
|
-
modal.classList.add("overlay-out");
|
|
389
|
-
content.addEventListener("animationend", () => {
|
|
390
|
-
if (content.classList.contains("modal-out")) {
|
|
391
|
-
modal.style.display = "none";
|
|
392
|
-
modal.remove();
|
|
393
|
-
}
|
|
394
|
-
});
|
|
395
|
-
};
|
|
396
|
-
var Loading3 = (modal) => {
|
|
397
|
-
const body = modal.querySelector(".body");
|
|
398
|
-
const loader = modal.querySelector(".loader");
|
|
399
|
-
if (body) body.style.visibility = "hidden";
|
|
400
|
-
if (loader) loader.style.display = "flex";
|
|
401
|
-
};
|
|
402
|
-
var Ready2 = (modal) => {
|
|
403
|
-
const body = modal.querySelector(".body");
|
|
404
|
-
const loader = modal.querySelector(".loader");
|
|
405
|
-
if (body) body.style.visibility = "visible";
|
|
406
|
-
if (loader) loader.style.display = "none";
|
|
407
|
-
};
|
|
408
|
-
var Hidden = (modal) => {
|
|
409
|
-
modal.style.display = "none";
|
|
410
|
-
};
|
|
411
|
-
var Visible = (modal) => {
|
|
412
|
-
modal.style.display = "block";
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
// src/mod/dialog/index.ts
|
|
416
|
-
var dialog_exports = {};
|
|
417
|
-
__export(dialog_exports, {
|
|
418
|
-
Alert: () => Alert,
|
|
419
|
-
Confirm: () => Confirm,
|
|
420
|
-
Toast: () => Toast
|
|
421
|
-
});
|
|
422
|
-
var app4 = document.querySelector("#app");
|
|
423
|
-
var Confirm = (message, params) => new Promise((resolve) => {
|
|
424
|
-
if (!app4) return;
|
|
425
|
-
const doc = params && params?.target ? params.target : app4;
|
|
426
|
-
const color = params && params?.color ? params.color : "green";
|
|
427
|
-
const dialog = document.createElement("div");
|
|
428
|
-
dialog.className = "overlay slim-dialog";
|
|
429
|
-
dialog.innerHTML = /*html*/
|
|
430
|
-
`
|
|
431
|
-
<div class="confirm ${color}">
|
|
432
|
-
<div class="header">
|
|
433
|
-
<i class="icon solid"></i> Slim Confirm
|
|
434
|
-
</div>
|
|
435
|
-
<div class="message">${message}</div>
|
|
436
|
-
<div class="footer">
|
|
437
|
-
<button class="lg gray left" id="btn-no">
|
|
438
|
-
<i></i>\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01
|
|
439
|
-
</button>
|
|
440
|
-
<button class="lg ${color} right" id="btn-yes">
|
|
441
|
-
<i></i>\u0E15\u0E01\u0E25\u0E07
|
|
442
|
-
</button>
|
|
443
|
-
</div>
|
|
444
|
-
</div>
|
|
157
|
+
<div class="message">${message}</div>
|
|
158
|
+
<div class="footer">
|
|
159
|
+
<button class="lg gray left" id="btn-no">
|
|
160
|
+
<i></i>\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01
|
|
161
|
+
</button>
|
|
162
|
+
<button class="lg ${color} right" id="btn-yes">
|
|
163
|
+
<i></i>\u0E15\u0E01\u0E25\u0E07
|
|
164
|
+
</button>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
445
167
|
`;
|
|
446
168
|
doc.appendChild(dialog);
|
|
447
169
|
dialog.querySelector("#btn-yes").focus();
|
|
@@ -454,9 +176,9 @@ var Confirm = (message, params) => new Promise((resolve) => {
|
|
|
454
176
|
resolve(false);
|
|
455
177
|
};
|
|
456
178
|
});
|
|
457
|
-
var
|
|
458
|
-
if (!
|
|
459
|
-
const doc = params && params?.target ? params.target :
|
|
179
|
+
var alert = (message, params) => new Promise((resolve) => {
|
|
180
|
+
if (!app2) return;
|
|
181
|
+
const doc = params && params?.target ? params.target : app2;
|
|
460
182
|
const type = params && params?.type ? params.type : "success";
|
|
461
183
|
let color = "";
|
|
462
184
|
let icon = "";
|
|
@@ -495,9 +217,9 @@ var Alert = (message, params) => new Promise((resolve) => {
|
|
|
495
217
|
resolve();
|
|
496
218
|
};
|
|
497
219
|
});
|
|
498
|
-
var
|
|
499
|
-
if (!
|
|
500
|
-
const doc = params && params?.target ? params.target :
|
|
220
|
+
var toast = (message, params) => new Promise((resolve) => {
|
|
221
|
+
if (!app2) return;
|
|
222
|
+
const doc = params && params?.target ? params.target : app2;
|
|
501
223
|
const type = params && params?.type ? params.type : "success";
|
|
502
224
|
let color = "";
|
|
503
225
|
let icon = "";
|
|
@@ -517,20 +239,20 @@ var Toast = (message, params) => new Promise((resolve) => {
|
|
|
517
239
|
color = "blue";
|
|
518
240
|
icon = "";
|
|
519
241
|
}
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
|
|
242
|
+
const toast2 = document.createElement("div");
|
|
243
|
+
toast2.className = `slim-toast ${color}`;
|
|
244
|
+
toast2.innerHTML = /*html*/
|
|
523
245
|
`
|
|
524
246
|
<i class="icon">${icon}</i>
|
|
525
247
|
<span class="text">${message}</span>
|
|
526
248
|
`;
|
|
527
|
-
doc.appendChild(
|
|
528
|
-
|
|
249
|
+
doc.appendChild(toast2);
|
|
250
|
+
toast2.classList.add("show");
|
|
529
251
|
let count = 0;
|
|
530
|
-
|
|
252
|
+
toast2.onanimationend = () => {
|
|
531
253
|
count++;
|
|
532
254
|
if (count == 2) {
|
|
533
|
-
|
|
255
|
+
toast2.remove();
|
|
534
256
|
resolve();
|
|
535
257
|
}
|
|
536
258
|
};
|
|
@@ -611,795 +333,350 @@ var jwtParse = (token) => {
|
|
|
611
333
|
}
|
|
612
334
|
};
|
|
613
335
|
|
|
614
|
-
// src/
|
|
615
|
-
var
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
<div id="page-svchub" class="cover">
|
|
619
|
-
<div class="cover-bar">Hardware Link</div>
|
|
620
|
-
<div class="cover-body border">
|
|
621
|
-
<!-- svcinfo -->
|
|
622
|
-
<div id="svcinfo">
|
|
623
|
-
<div class="box-tb">
|
|
624
|
-
<div class="topic">HwLink</div>
|
|
625
|
-
<div class="text" id="hwlink">:</div>
|
|
626
|
-
</div>
|
|
627
|
-
<div class="box-tb">
|
|
628
|
-
<div class="topic">AutoUp</div>
|
|
629
|
-
<div class="text" id="autoup">:</div>
|
|
630
|
-
</div>
|
|
631
|
-
<div class="box-tb">
|
|
632
|
-
<div class="topic">CSUUID</div>
|
|
633
|
-
<div class="text" id="csuuid">:</div>
|
|
634
|
-
</div>
|
|
635
|
-
</div>
|
|
636
|
-
<hr>
|
|
637
|
-
<!-- device -->
|
|
638
|
-
<div id="device">
|
|
639
|
-
<div class="box-tb">
|
|
640
|
-
<div class="topic">\u0E2B\u0E19\u0E48\u0E27\u0E22\u0E07\u0E32\u0E19</div>
|
|
641
|
-
<div class="text" id="agcy">:</div>
|
|
642
|
-
</div>
|
|
643
|
-
<div class="box-tb">
|
|
644
|
-
<div class="topic">\u0E01\u0E25\u0E38\u0E48\u0E21\u0E07\u0E32\u0E19</div>
|
|
645
|
-
<div class="text" id="dept">:</div>
|
|
646
|
-
</div>
|
|
647
|
-
<div class="box-tb">
|
|
648
|
-
<div class="topic">\u0E0A\u0E37\u0E48\u0E2D\u0E2D\u0E38\u0E1B\u0E01\u0E23\u0E13\u0E4C</div>
|
|
649
|
-
<div class="text" id="dname">:</div>
|
|
650
|
-
</div>
|
|
651
|
-
<div class="box-tb">
|
|
652
|
-
<div class="topic">\u0E40\u0E25\u0E02\u0E17\u0E23\u0E31\u0E1E\u0E22\u0E4C\u0E2A\u0E34\u0E19</div>
|
|
653
|
-
<div class="text" id="assno">:</div>
|
|
654
|
-
</div>
|
|
655
|
-
<button id="btn-edit" class="circle sm blue"
|
|
656
|
-
shadow="true"></button>
|
|
657
|
-
</div>
|
|
658
|
-
<hr>
|
|
659
|
-
<!-- hwinfo -->
|
|
660
|
-
<div id="hwinfo">
|
|
661
|
-
<div class="box-tb">
|
|
662
|
-
<div class="topic">Hostname</div>
|
|
663
|
-
<div class="text" id="host">:</div>
|
|
664
|
-
</div>
|
|
665
|
-
<div class="box-tb">
|
|
666
|
-
<div class="topic">Platform</div>
|
|
667
|
-
<div class="text" id="os">:</div>
|
|
668
|
-
</div>
|
|
669
|
-
<div class="box-tb">
|
|
670
|
-
<div class="topic">CpuModel</div>
|
|
671
|
-
<div class="text" id="cpu">:</div>
|
|
672
|
-
</div>
|
|
673
|
-
<div class="box-tb">
|
|
674
|
-
<div class="topic">Memory</div>
|
|
675
|
-
<div class="text" id="mem">:</div>
|
|
676
|
-
</div>
|
|
677
|
-
<div class="box-tb">
|
|
678
|
-
<div class="topic">Uptime</div>
|
|
679
|
-
<div class="text" id="uptime">:</div>
|
|
680
|
-
</div>
|
|
681
|
-
</div>
|
|
682
|
-
<hr>
|
|
683
|
-
<!-- x -->
|
|
684
|
-
<div id="">
|
|
685
|
-
<div class="box-tb">
|
|
686
|
-
<div class="topic">SmartCard</div>
|
|
687
|
-
<div class="text" id="">:</div>
|
|
688
|
-
</div>
|
|
689
|
-
<div class="box-tb">
|
|
690
|
-
<div class="topic">Biometric</div>
|
|
691
|
-
<div class="text" id="">:</div>
|
|
692
|
-
</div>
|
|
693
|
-
</div>
|
|
694
|
-
</div>
|
|
695
|
-
</div>
|
|
696
|
-
<style>
|
|
697
|
-
#page-svchub {
|
|
698
|
-
margin: auto;
|
|
699
|
-
max-width: 600px;
|
|
700
|
-
min-width: 480px;
|
|
701
|
-
line-height: 1.5;
|
|
702
|
-
}
|
|
703
|
-
#page-svchub .topic {
|
|
704
|
-
float: left;
|
|
705
|
-
width: 100px;
|
|
706
|
-
font-weight: 600;
|
|
707
|
-
}
|
|
708
|
-
#page-svchub .text {
|
|
709
|
-
float: left;
|
|
710
|
-
width: calc(100% - 100px);
|
|
711
|
-
}
|
|
712
|
-
#page-svchub #device {
|
|
713
|
-
position: relative;
|
|
714
|
-
}
|
|
715
|
-
#page-svchub #btn-edit {
|
|
716
|
-
position: absolute;
|
|
717
|
-
top: 0;
|
|
718
|
-
right: 0;
|
|
719
|
-
}
|
|
720
|
-
</style>
|
|
721
|
-
`
|
|
722
|
-
);
|
|
723
|
-
var frmDevice = (
|
|
724
|
-
/*html*/
|
|
725
|
-
`
|
|
726
|
-
<div id="frm-device" class="cover grid">
|
|
727
|
-
<div class="input-box span">
|
|
728
|
-
<select id="inp-agcy" required></select>
|
|
729
|
-
<div class="label">\u0E2B\u0E19\u0E48\u0E27\u0E22\u0E07\u0E32\u0E19 *</div>
|
|
730
|
-
</div>
|
|
731
|
-
<div class="input-box span">
|
|
732
|
-
<select id="inp-dept"></select>
|
|
733
|
-
<div class="label">\u0E01\u0E25\u0E38\u0E48\u0E21\u0E07\u0E32\u0E19/\u0E2A\u0E48\u0E27\u0E19\u0E07\u0E32\u0E19</div>
|
|
734
|
-
</div>
|
|
735
|
-
<div class="input-box span">
|
|
736
|
-
<input type="text" id="inp-name" maxlength="100" required>
|
|
737
|
-
<div class="label">\u0E0A\u0E37\u0E48\u0E2D\u0E2D\u0E38\u0E1B\u0E01\u0E23\u0E13\u0E4C *</div>
|
|
738
|
-
</div>
|
|
739
|
-
</div>
|
|
740
|
-
<style>
|
|
741
|
-
#frm-device {
|
|
742
|
-
gap: 5px;
|
|
743
|
-
}
|
|
744
|
-
#frm-device .dvsn {
|
|
745
|
-
font-weight: 600;
|
|
746
|
-
}
|
|
747
|
-
#frm-device .sect {
|
|
748
|
-
font-style: italic;
|
|
749
|
-
}
|
|
750
|
-
</style>
|
|
751
|
-
`
|
|
752
|
-
);
|
|
753
|
-
|
|
754
|
-
// src/svchub/api/agency/agcy.ts
|
|
755
|
-
var agcy_exports = {};
|
|
756
|
-
__export(agcy_exports, {
|
|
757
|
-
Read: () => Read,
|
|
758
|
-
Set: () => Set
|
|
759
|
-
});
|
|
760
|
-
var Read = (agcy) => new Promise((resolve, reject) => {
|
|
761
|
-
let url = `/agcy`;
|
|
762
|
-
if (agcy) url = `/agcy/${agcy}`;
|
|
763
|
-
fetch(gbvar.hub.API + url, {
|
|
764
|
-
method: "GET",
|
|
765
|
-
headers: gbvar.api.HEADERS
|
|
766
|
-
}).then((resp) => {
|
|
767
|
-
if (!resp.ok) throw resp;
|
|
768
|
-
return resp.json();
|
|
769
|
-
}).then((json) => {
|
|
770
|
-
resolve(json);
|
|
771
|
-
}).catch((err) => reject(err));
|
|
336
|
+
// src/mod/built-in/button/index.ts
|
|
337
|
+
var button_exports = {};
|
|
338
|
+
__export(button_exports, {
|
|
339
|
+
loading: () => loading
|
|
772
340
|
});
|
|
773
|
-
var
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
341
|
+
var loading = (btn, state = false) => {
|
|
342
|
+
if (state) {
|
|
343
|
+
btn.querySelector(".btn-loader")?.remove();
|
|
344
|
+
btn.style.color = "transparent";
|
|
345
|
+
btn.style.position = "relative";
|
|
346
|
+
btn.style.pointerEvents = "none";
|
|
347
|
+
const loader = document.createElement("div");
|
|
348
|
+
loader.className = "btn-loader";
|
|
349
|
+
loader.innerHTML = `<div class="spinner s22"></div>`;
|
|
350
|
+
btn.appendChild(loader);
|
|
351
|
+
} else {
|
|
352
|
+
btn.querySelector(".btn-loader")?.remove();
|
|
353
|
+
btn.style.color = "";
|
|
354
|
+
btn.style.position = "";
|
|
355
|
+
btn.style.pointerEvents = "";
|
|
356
|
+
}
|
|
785
357
|
};
|
|
786
358
|
|
|
787
|
-
// src/
|
|
788
|
-
var
|
|
789
|
-
__export(
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
const url = `/agcy/${agcy}/dept`;
|
|
795
|
-
fetch(gbvar.hub.API + url, {
|
|
796
|
-
method: "GET",
|
|
797
|
-
headers: gbvar.api.HEADERS
|
|
798
|
-
}).then((resp) => {
|
|
799
|
-
if (!resp.ok) throw resp;
|
|
800
|
-
return resp.json();
|
|
801
|
-
}).then((json) => {
|
|
802
|
-
resolve(json);
|
|
803
|
-
}).catch((err) => reject(err));
|
|
359
|
+
// src/mod/drop/index.ts
|
|
360
|
+
var drop_exports = {};
|
|
361
|
+
__export(drop_exports, {
|
|
362
|
+
clear: () => clear,
|
|
363
|
+
menu: () => menu,
|
|
364
|
+
select: () => select,
|
|
365
|
+
update: () => update
|
|
804
366
|
});
|
|
805
|
-
var
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
const opt = document.createElement("option");
|
|
811
|
-
opt.value = `${val.dvsn},${val.sect}`;
|
|
812
|
-
if (val.sect == 0) {
|
|
813
|
-
opt.text = `${val.name}`;
|
|
814
|
-
opt.style.fontWeight = "600";
|
|
815
|
-
} else {
|
|
816
|
-
opt.text = `- ${val.name}`;
|
|
817
|
-
opt.style.fontStyle = "italic";
|
|
818
|
-
}
|
|
819
|
-
elm.appendChild(opt);
|
|
820
|
-
}
|
|
821
|
-
}).catch((err) => console.error(err));
|
|
822
|
-
};
|
|
823
|
-
|
|
824
|
-
// src/svchub/api/account/index.ts
|
|
825
|
-
var account_exports = {};
|
|
826
|
-
__export(account_exports, {
|
|
827
|
-
Create: () => Create3,
|
|
828
|
-
Read: () => Read4,
|
|
829
|
-
Update: () => Update,
|
|
830
|
-
access: () => access_exports
|
|
831
|
-
});
|
|
832
|
-
|
|
833
|
-
// src/svchub/api/account/access.ts
|
|
834
|
-
var access_exports = {};
|
|
835
|
-
__export(access_exports, {
|
|
836
|
-
Create: () => Create2,
|
|
837
|
-
Read: () => Read3
|
|
838
|
-
});
|
|
839
|
-
|
|
840
|
-
// src/lib/dateTime.ts
|
|
841
|
-
var TH_MONTH = [
|
|
842
|
-
"\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21",
|
|
843
|
-
"\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C",
|
|
844
|
-
"\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21",
|
|
845
|
-
"\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19",
|
|
846
|
-
"\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21",
|
|
847
|
-
"\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19",
|
|
848
|
-
"\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21",
|
|
849
|
-
"\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21",
|
|
850
|
-
"\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19",
|
|
851
|
-
"\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21",
|
|
852
|
-
"\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19",
|
|
853
|
-
"\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21"
|
|
854
|
-
];
|
|
855
|
-
var TH_MONTH_SHORT = [
|
|
856
|
-
"\u0E21.\u0E04.",
|
|
857
|
-
"\u0E01.\u0E1E.",
|
|
858
|
-
"\u0E21\u0E35.\u0E04.",
|
|
859
|
-
"\u0E40\u0E21.\u0E22.",
|
|
860
|
-
"\u0E1E.\u0E04.",
|
|
861
|
-
"\u0E21\u0E34.\u0E22.",
|
|
862
|
-
"\u0E01.\u0E04.",
|
|
863
|
-
"\u0E2A.\u0E04.",
|
|
864
|
-
"\u0E01.\u0E22.",
|
|
865
|
-
"\u0E15.\u0E04.",
|
|
866
|
-
"\u0E1E.\u0E22.",
|
|
867
|
-
"\u0E18.\u0E04."
|
|
868
|
-
];
|
|
869
|
-
var FY_MONTH = [
|
|
870
|
-
"\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21",
|
|
871
|
-
"\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19",
|
|
872
|
-
"\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21",
|
|
873
|
-
"\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21",
|
|
874
|
-
"\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C",
|
|
875
|
-
"\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21",
|
|
876
|
-
"\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19",
|
|
877
|
-
"\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21",
|
|
878
|
-
"\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19",
|
|
879
|
-
"\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21",
|
|
880
|
-
"\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21",
|
|
881
|
-
"\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19"
|
|
882
|
-
];
|
|
883
|
-
var FY_MONTH_SHORT = [
|
|
884
|
-
"\u0E15.\u0E04.",
|
|
885
|
-
"\u0E1E.\u0E22.",
|
|
886
|
-
"\u0E18.\u0E04.",
|
|
887
|
-
"\u0E21.\u0E04.",
|
|
888
|
-
"\u0E01.\u0E1E.",
|
|
889
|
-
"\u0E21\u0E35.\u0E04.",
|
|
890
|
-
"\u0E40\u0E21.\u0E22.",
|
|
891
|
-
"\u0E1E.\u0E04.",
|
|
892
|
-
"\u0E21\u0E34.\u0E22.",
|
|
893
|
-
"\u0E01.\u0E04.",
|
|
894
|
-
"\u0E2A.\u0E04.",
|
|
895
|
-
"\u0E01.\u0E22."
|
|
896
|
-
];
|
|
897
|
-
var PERIOD_TEXT = ["", "\u0E40\u0E27\u0E23\u0E14\u0E36\u0E01", "\u0E40\u0E27\u0E23\u0E40\u0E0A\u0E49\u0E32", "\u0E40\u0E27\u0E23\u0E1A\u0E48\u0E32\u0E22"];
|
|
898
|
-
var curTime = () => (/* @__PURE__ */ new Date()).getTime();
|
|
899
|
-
var curDate = () => {
|
|
900
|
-
const dt = /* @__PURE__ */ new Date();
|
|
901
|
-
const yy = dt.getFullYear();
|
|
902
|
-
const mm = String(dt.getMonth() + 1).padStart(2, "0");
|
|
903
|
-
const dd = String(dt.getDate()).padStart(2, "0");
|
|
904
|
-
return `${yy}-${mm}-${dd}`;
|
|
905
|
-
};
|
|
906
|
-
var curMonth = () => {
|
|
907
|
-
const dt = /* @__PURE__ */ new Date();
|
|
908
|
-
const yy = dt.getFullYear();
|
|
909
|
-
const mm = String(dt.getMonth() + 1).padStart(2, "0");
|
|
910
|
-
return `${yy}-${mm}`;
|
|
911
|
-
};
|
|
912
|
-
var curYear = (yearType = "") => {
|
|
913
|
-
const dt = /* @__PURE__ */ new Date();
|
|
914
|
-
const mm = dt.getMonth() + 1;
|
|
915
|
-
if ((yearType == "fyear" || yearType == "fy") && mm > 9) {
|
|
916
|
-
return dt.getFullYear() + 1;
|
|
917
|
-
}
|
|
918
|
-
return dt.getFullYear();
|
|
919
|
-
};
|
|
920
|
-
var timeToStr = (unixtime, format = "") => {
|
|
921
|
-
if (typeof unixtime != "number") {
|
|
922
|
-
return "";
|
|
923
|
-
}
|
|
924
|
-
const unix = new Date(Number(unixtime));
|
|
925
|
-
const yy = unix.getFullYear();
|
|
926
|
-
const mm = String(unix.getMonth() + 1).padStart(2, "0");
|
|
927
|
-
const dd = String(unix.getDate()).padStart(2, "0");
|
|
928
|
-
const H = String(unix.getHours()).padStart(2, "0");
|
|
929
|
-
const M = String(unix.getMinutes()).padStart(2, "0");
|
|
930
|
-
const S = String(unix.getSeconds()).padStart(2, "0");
|
|
931
|
-
if (format == "date") {
|
|
932
|
-
return `${yy}-${mm}-${dd}`;
|
|
933
|
-
}
|
|
934
|
-
if (format == "time") {
|
|
935
|
-
return `${H}:${M}:${S}`;
|
|
936
|
-
}
|
|
937
|
-
return `${yy}-${mm}-${dd} ${H}:${M}:${S}`;
|
|
367
|
+
var menu = (drop) => {
|
|
368
|
+
const dropBtn = drop.querySelector(".drop-btn");
|
|
369
|
+
const content = drop.querySelector(".drop-content");
|
|
370
|
+
if (!dropBtn || !content) return;
|
|
371
|
+
setBtnEvent(dropBtn, content);
|
|
938
372
|
};
|
|
939
|
-
var
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
if (H >= 0 && H < 8) return { num: 1, text: PERIOD_TEXT[1] };
|
|
946
|
-
if (H >= 8 && H < 16) return { num: 2, text: PERIOD_TEXT[2] };
|
|
947
|
-
if (H >= 16) return { num: 3, text: PERIOD_TEXT[3] };
|
|
948
|
-
return { num: 0, text: "" };
|
|
373
|
+
var select = (drop, icon, callBack) => {
|
|
374
|
+
const dropBtn = drop.querySelector(".drop-btn");
|
|
375
|
+
const content = drop.querySelector(".drop-content");
|
|
376
|
+
if (!dropBtn || !content) return;
|
|
377
|
+
setBtnEvent(dropBtn, content);
|
|
378
|
+
update(drop, icon, callBack);
|
|
949
379
|
};
|
|
950
|
-
var
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
const
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
380
|
+
var update = (drop, icon, callBack) => {
|
|
381
|
+
const select2 = drop.querySelector("select");
|
|
382
|
+
const content = drop.querySelector(".drop-content");
|
|
383
|
+
if (!select2 || !content) return;
|
|
384
|
+
let elmIcon = "";
|
|
385
|
+
if (icon) elmIcon = `<span style="margin-right: 6px;">${icon}</span>`;
|
|
386
|
+
content.innerHTML = "";
|
|
387
|
+
const option = select2.querySelectorAll("option");
|
|
388
|
+
option.forEach((opt) => {
|
|
389
|
+
const item = document.createElement("a");
|
|
390
|
+
item.innerHTML = `${elmIcon}${opt.text}`;
|
|
391
|
+
content.appendChild(item);
|
|
392
|
+
item.onclick = () => {
|
|
393
|
+
opt.selected = true;
|
|
394
|
+
clearSelected();
|
|
395
|
+
if (callBack) {
|
|
396
|
+
callBack(opt.value, opt.text);
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
});
|
|
400
|
+
const clearSelected = () => {
|
|
401
|
+
const index = select2.selectedIndex;
|
|
402
|
+
const list = content.querySelectorAll("a");
|
|
403
|
+
list.forEach((el, i) => {
|
|
404
|
+
if (i == index) {
|
|
405
|
+
el.classList.add("selected");
|
|
406
|
+
} else {
|
|
407
|
+
el.classList.remove("selected");
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
};
|
|
411
|
+
clearSelected();
|
|
964
412
|
};
|
|
965
|
-
var
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
if (format == 1) return `${dd}/${mm}/${yy} ${H}:${M}`;
|
|
983
|
-
if (format == 2) return `${dd}/${mm}/${yy} ${H}:${M}:${S}`;
|
|
984
|
-
if (format == 10) return `${dd} ${TH_MONTH[Number(mm) - 1]} ${yy}`;
|
|
985
|
-
if (format == 11) return `${dd} ${TH_MONTH_SHORT[Number(mm) - 1]} ${String(yy).slice(-2)}`;
|
|
986
|
-
if (format == 12) return `${dd} ${TH_MONTH[Number(mm) - 1]} ${yy} \u0E40\u0E27\u0E25\u0E32 ${H}:${M} \u0E19.`;
|
|
987
|
-
if (format == 13) return `${dd} ${TH_MONTH_SHORT[Number(mm) - 1]} ${String(yy).slice(-2)} ${H}:${M}`;
|
|
988
|
-
if (format == 20) return `${TH_MONTH[Number(mm) - 1]} ${yy}`;
|
|
989
|
-
if (format == 21) return `${TH_MONTH_SHORT[Number(mm) - 1]} ${yy}`;
|
|
990
|
-
if (format == 22) return `${TH_MONTH_SHORT[Number(mm) - 1]} ${String(yy).slice(-2)}`;
|
|
991
|
-
return "";
|
|
413
|
+
var setBtnEvent = (btn, content) => {
|
|
414
|
+
btn.onclick = () => {
|
|
415
|
+
if (content.style.display == "block") {
|
|
416
|
+
content.style.animation = "fade-out 0.4s forwards";
|
|
417
|
+
content.onanimationend = () => {
|
|
418
|
+
content.style.animation = "";
|
|
419
|
+
content.style.display = "";
|
|
420
|
+
};
|
|
421
|
+
} else {
|
|
422
|
+
clear();
|
|
423
|
+
content.style.animation = "fade-in 0.4s forwards";
|
|
424
|
+
content.style.display = "block";
|
|
425
|
+
content.onanimationend = () => {
|
|
426
|
+
content.style.animation = "";
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
};
|
|
992
430
|
};
|
|
993
|
-
var
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
return Math.round((date2 - date1) / (1e3 * 60 * 60 * 24));
|
|
431
|
+
var clear = () => {
|
|
432
|
+
const drop = document.querySelectorAll(".drop-content");
|
|
433
|
+
drop.forEach((el) => {
|
|
434
|
+
if (el.style.display == "block") {
|
|
435
|
+
el.style.animation = "fade-out 0.4s forwards";
|
|
436
|
+
el.onanimationend = () => {
|
|
437
|
+
el.style.animation = "";
|
|
438
|
+
el.style.display = "";
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
});
|
|
1005
442
|
};
|
|
1006
|
-
|
|
1007
|
-
if (!
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
443
|
+
window.addEventListener("click", (e) => {
|
|
444
|
+
if (!e.target.matches(".drop-btn")) clear();
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
// src/page/index.ts
|
|
448
|
+
var app3 = document.querySelector("#app");
|
|
449
|
+
var pageSpin = (
|
|
450
|
+
/*html*/
|
|
451
|
+
`
|
|
452
|
+
<div class="lds-spinner">
|
|
453
|
+
<div></div><div></div><div></div><div></div>
|
|
454
|
+
<div></div><div></div><div></div><div></div>
|
|
455
|
+
<div></div><div></div><div></div><div></div>
|
|
456
|
+
</div>
|
|
457
|
+
`
|
|
458
|
+
);
|
|
459
|
+
var smallSpin = `<div class="spinner s32"></div>`;
|
|
460
|
+
var loading2 = (size = "default") => {
|
|
461
|
+
if (!app3) return;
|
|
462
|
+
if (!app3.querySelector("#page-loader")) {
|
|
463
|
+
const loader = document.createElement("div");
|
|
464
|
+
loader.id = "page-loader";
|
|
465
|
+
loader.className = "overlay center";
|
|
466
|
+
loader.innerHTML = size == "default" ? pageSpin : smallSpin;
|
|
467
|
+
app3.appendChild(loader);
|
|
1012
468
|
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
const date1 = new Date(start);
|
|
1016
|
-
const date2 = new Date(stop);
|
|
1017
|
-
let msec = date2.getTime() - date1.getTime();
|
|
1018
|
-
const hh = Math.floor(msec / 1e3 / 60 / 60);
|
|
1019
|
-
msec -= hh * 1e3 * 60 * 60;
|
|
1020
|
-
const mm = Math.floor(msec / 1e3 / 60);
|
|
1021
|
-
msec -= mm * 1e3 * 60;
|
|
1022
|
-
const ss = Math.floor(msec / 1e3);
|
|
1023
|
-
msec -= ss * 1e3;
|
|
1024
|
-
return { h: hh, m: mm, s: ss };
|
|
469
|
+
const content = app3.querySelector("#app-content");
|
|
470
|
+
if (content) content.style.display = "none";
|
|
1025
471
|
};
|
|
1026
|
-
var
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
}
|
|
1030
|
-
const now = /* @__PURE__ */ new Date();
|
|
1031
|
-
const nowYear = now.getFullYear();
|
|
1032
|
-
const nowMonth = now.getMonth();
|
|
1033
|
-
const nowDate = now.getDate();
|
|
1034
|
-
const [yy, mm, dd] = date.split("-");
|
|
1035
|
-
const birth = new Date(Number(yy), Number(mm) - 1, Number(dd));
|
|
1036
|
-
const birthYear = birth.getFullYear();
|
|
1037
|
-
const birthMonth = birth.getMonth();
|
|
1038
|
-
const birthDate = birth.getDate();
|
|
1039
|
-
let yearAge = nowYear - birthYear;
|
|
1040
|
-
let monthAge = 0;
|
|
1041
|
-
let dateAge = 0;
|
|
1042
|
-
if (nowMonth >= birthMonth) {
|
|
1043
|
-
monthAge = nowMonth - birthMonth;
|
|
1044
|
-
} else {
|
|
1045
|
-
yearAge--;
|
|
1046
|
-
monthAge = 12 + nowMonth - birthMonth;
|
|
1047
|
-
}
|
|
1048
|
-
if (nowDate >= birthDate) {
|
|
1049
|
-
dateAge = nowDate - birthDate;
|
|
1050
|
-
} else {
|
|
1051
|
-
monthAge--;
|
|
1052
|
-
dateAge = 31 + nowDate - birthDate;
|
|
1053
|
-
if (monthAge < 0) {
|
|
1054
|
-
monthAge = 11;
|
|
1055
|
-
yearAge--;
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
return {
|
|
1059
|
-
years: yearAge,
|
|
1060
|
-
months: monthAge,
|
|
1061
|
-
days: dateAge
|
|
1062
|
-
};
|
|
472
|
+
var ready = (delay = 400) => {
|
|
473
|
+
new Promise((r) => setTimeout(r, delay)).then(() => {
|
|
474
|
+
clearLoader(true);
|
|
475
|
+
});
|
|
1063
476
|
};
|
|
1064
|
-
var
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
477
|
+
var error = (err) => {
|
|
478
|
+
clearLoader(false);
|
|
479
|
+
if (!app3) return;
|
|
480
|
+
const box = document.createElement("div");
|
|
481
|
+
box.className = "page-error";
|
|
482
|
+
box.innerHTML = /*html*/
|
|
483
|
+
`
|
|
484
|
+
<i class="icon red"></i>
|
|
485
|
+
<div class="topic">✦ \u0E40\u0E01\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14 ✦</div>
|
|
486
|
+
<div class="text">${err}</div>
|
|
487
|
+
`;
|
|
488
|
+
app3.prepend(box);
|
|
489
|
+
throw err;
|
|
1077
490
|
};
|
|
1078
|
-
var
|
|
1079
|
-
if (!
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
491
|
+
var notFound = () => {
|
|
492
|
+
if (!app3) return;
|
|
493
|
+
app3.innerHTML = /*html*/
|
|
494
|
+
`
|
|
495
|
+
<div class="page-not-found">
|
|
496
|
+
<h1>4<i class="fas fa-ghost"></i>4</h1>
|
|
497
|
+
<h2>Error 404 Page Not Found</h2>
|
|
498
|
+
<p>Sorry, the page cannot be accessed</p>
|
|
499
|
+
</div>
|
|
500
|
+
`;
|
|
1087
501
|
};
|
|
1088
|
-
var
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
502
|
+
var fullLoad = () => {
|
|
503
|
+
clearNavbar();
|
|
504
|
+
if (!app3) return;
|
|
505
|
+
app3.classList.add("full-page");
|
|
506
|
+
app3.innerHTML = /*html*/
|
|
507
|
+
`
|
|
508
|
+
<div class="page-full-load">
|
|
509
|
+
<div class="spinner"></div>
|
|
510
|
+
<div class="text">Slim<br>Loading</div>
|
|
511
|
+
</div>
|
|
512
|
+
`;
|
|
1097
513
|
};
|
|
1098
|
-
var
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
514
|
+
var inform = (params) => {
|
|
515
|
+
clearNavbar();
|
|
516
|
+
if (!app3) return;
|
|
517
|
+
app3.classList.add("full-page");
|
|
518
|
+
app3.innerHTML = /*html*/
|
|
519
|
+
`
|
|
520
|
+
<div class="page-inform ${params.color}">
|
|
521
|
+
<div class="icon solid">${params.icon}</div>
|
|
522
|
+
<div class="msg">${params.msg}</div>
|
|
523
|
+
<button class="lg ${params.color}" shadow="true">
|
|
524
|
+
${params.btnTxt}
|
|
525
|
+
</button>
|
|
526
|
+
</div>
|
|
527
|
+
`;
|
|
528
|
+
const btn = app3.querySelector("button");
|
|
529
|
+
btn.onclick = () => window.location.replace(params.btnUrl);
|
|
530
|
+
};
|
|
531
|
+
var clearNavbar = () => {
|
|
532
|
+
const topbar = document.querySelector("#topbar");
|
|
533
|
+
const tabbar = document.querySelector("#tabbar");
|
|
534
|
+
const sidebar = document.querySelector("#sidebar");
|
|
535
|
+
if (topbar) topbar.remove();
|
|
536
|
+
if (tabbar) tabbar.remove();
|
|
537
|
+
if (sidebar) sidebar.remove();
|
|
538
|
+
if (app3) app3.className = "";
|
|
539
|
+
};
|
|
540
|
+
var clearLoader = (showContent) => {
|
|
541
|
+
if (!app3) return;
|
|
542
|
+
const loader = app3.querySelector("#page-loader");
|
|
543
|
+
if (loader) {
|
|
544
|
+
loader.style.animation = "fade-out 0.4s forwards";
|
|
545
|
+
loader.onanimationend = () => loader.remove();
|
|
546
|
+
}
|
|
547
|
+
const content = app3.querySelector("#app-content");
|
|
548
|
+
if (content) content.style.display = showContent ? "block" : "none";
|
|
1105
549
|
};
|
|
1106
550
|
|
|
1107
|
-
// src/svchub/
|
|
1108
|
-
var
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
if (!resp.ok) throw resp;
|
|
1196
|
-
return resp.json();
|
|
1197
|
-
}).then((json) => {
|
|
1198
|
-
resolve(json);
|
|
1199
|
-
}).catch((err) => reject(err));
|
|
1200
|
-
});
|
|
1201
|
-
|
|
1202
|
-
// src/svchub/hwlink/device.ts
|
|
1203
|
-
var Create4 = (csid) => new Promise((resolve, reject) => {
|
|
1204
|
-
const modal = Create({
|
|
1205
|
-
title: "\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E04\u0E2D\u0E21\u0E1E\u0E34\u0E27\u0E40\u0E15\u0E2D\u0E23\u0E4C",
|
|
1206
|
-
icon: "",
|
|
1207
|
-
width: "400px",
|
|
1208
|
-
body: frmDevice,
|
|
1209
|
-
button: { save: true, cancel: true }
|
|
1210
|
-
});
|
|
1211
|
-
const inpAgcy = modal.querySelector("#inp-agcy");
|
|
1212
|
-
const inpDept = modal.querySelector("#inp-dept");
|
|
1213
|
-
const inpName = modal.querySelector("#inp-name");
|
|
1214
|
-
inpAgcy.onchange = () => {
|
|
1215
|
-
Set2(Number(inpAgcy.value), inpDept);
|
|
1216
|
-
};
|
|
1217
|
-
(async () => {
|
|
1218
|
-
await Set(inpAgcy);
|
|
1219
|
-
await Set2(Number(inpAgcy.value), inpDept);
|
|
1220
|
-
Ready2(modal);
|
|
1221
|
-
})();
|
|
1222
|
-
const form = modal.querySelector("form");
|
|
1223
|
-
if (form) form.onsubmit = async (e) => {
|
|
1224
|
-
e.preventDefault();
|
|
1225
|
-
Hidden(modal);
|
|
1226
|
-
const res = await Confirm("\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19.! \u0E01\u0E32\u0E23\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25");
|
|
1227
|
-
Visible(modal);
|
|
1228
|
-
if (res) {
|
|
1229
|
-
Loading3(modal);
|
|
1230
|
-
const newAgcy = Number(inpAgcy.value);
|
|
1231
|
-
const [dvsn, sect] = inpDept.value.split(",");
|
|
1232
|
-
const params = {
|
|
1233
|
-
agcy: newAgcy,
|
|
1234
|
-
dvsn: dvsn ? Number(dvsn) : 0,
|
|
1235
|
-
sect: sect ? Number(sect) : 0,
|
|
1236
|
-
actype: 2,
|
|
1237
|
-
// อุปกรณ์
|
|
1238
|
-
acrole: 8,
|
|
1239
|
-
// คอมพิวเตอร์
|
|
1240
|
-
acuuid: strCheck(csid),
|
|
1241
|
-
profile: {
|
|
1242
|
-
dvtype: 1,
|
|
1243
|
-
// คอมพิวเตอร์
|
|
1244
|
-
name: strCheck(inpName.value)
|
|
1245
|
-
}
|
|
1246
|
-
};
|
|
1247
|
-
await Create3(newAgcy, params).then(() => {
|
|
1248
|
-
Close(modal);
|
|
1249
|
-
Toast("\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25 \u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08.!", { type: "success" });
|
|
1250
|
-
resolve();
|
|
1251
|
-
}).catch((err) => {
|
|
1252
|
-
Close(modal);
|
|
1253
|
-
Alert("\u0E40\u0E01\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14...!", { type: "failure" });
|
|
1254
|
-
reject(err);
|
|
1255
|
-
});
|
|
551
|
+
// src/svchub/hwlink/template.ts
|
|
552
|
+
var template = (
|
|
553
|
+
/*html*/
|
|
554
|
+
`
|
|
555
|
+
<div id="page-svchub" class="cover">
|
|
556
|
+
<div class="cover-bar">Hardware Link</div>
|
|
557
|
+
<div class="cover-body border">
|
|
558
|
+
<!-- svcinfo -->
|
|
559
|
+
<div id="svcinfo">
|
|
560
|
+
<div class="box-tb">
|
|
561
|
+
<div class="topic">HwLink</div>
|
|
562
|
+
<div class="text" id="hwlink">:</div>
|
|
563
|
+
</div>
|
|
564
|
+
<div class="box-tb">
|
|
565
|
+
<div class="topic">AutoUp</div>
|
|
566
|
+
<div class="text" id="autoup">:</div>
|
|
567
|
+
</div>
|
|
568
|
+
<div class="box-tb">
|
|
569
|
+
<div class="topic">CSUUID</div>
|
|
570
|
+
<div class="text" id="csuuid">:</div>
|
|
571
|
+
</div>
|
|
572
|
+
</div>
|
|
573
|
+
<hr>
|
|
574
|
+
<!-- device -->
|
|
575
|
+
<div id="device">
|
|
576
|
+
<div class="box-tb">
|
|
577
|
+
<div class="topic">\u0E2B\u0E19\u0E48\u0E27\u0E22\u0E07\u0E32\u0E19</div>
|
|
578
|
+
<div class="text" id="">:</div>
|
|
579
|
+
</div>
|
|
580
|
+
<div class="box-tb">
|
|
581
|
+
<div class="topic">\u0E01\u0E25\u0E38\u0E48\u0E21\u0E07\u0E32\u0E19</div>
|
|
582
|
+
<div class="text" id="">:</div>
|
|
583
|
+
</div>
|
|
584
|
+
<div class="box-tb">
|
|
585
|
+
<div class="topic">\u0E0A\u0E37\u0E48\u0E2D\u0E2D\u0E38\u0E1B\u0E01\u0E23\u0E13\u0E4C</div>
|
|
586
|
+
<div class="text" id="">:</div>
|
|
587
|
+
</div>
|
|
588
|
+
<div class="box-tb">
|
|
589
|
+
<div class="topic">\u0E40\u0E25\u0E02\u0E17\u0E23\u0E31\u0E1E\u0E22\u0E4C\u0E2A\u0E34\u0E19</div>
|
|
590
|
+
<div class="text" id="">:</div>
|
|
591
|
+
</div>
|
|
592
|
+
<button id="btn-edit" class="circle sm blue"
|
|
593
|
+
shadow="true"></button>
|
|
594
|
+
</div>
|
|
595
|
+
<hr>
|
|
596
|
+
<!-- hwinfo -->
|
|
597
|
+
<div id="hwinfo">
|
|
598
|
+
<div class="box-tb">
|
|
599
|
+
<div class="topic">Hostname</div>
|
|
600
|
+
<div class="text" id="host">:</div>
|
|
601
|
+
</div>
|
|
602
|
+
<div class="box-tb">
|
|
603
|
+
<div class="topic">Platform</div>
|
|
604
|
+
<div class="text" id="os">:</div>
|
|
605
|
+
</div>
|
|
606
|
+
<div class="box-tb">
|
|
607
|
+
<div class="topic">CpuModel</div>
|
|
608
|
+
<div class="text" id="cpu">:</div>
|
|
609
|
+
</div>
|
|
610
|
+
<div class="box-tb">
|
|
611
|
+
<div class="topic">Memory</div>
|
|
612
|
+
<div class="text" id="mem">:</div>
|
|
613
|
+
</div>
|
|
614
|
+
<div class="box-tb">
|
|
615
|
+
<div class="topic">Uptime</div>
|
|
616
|
+
<div class="text" id="uptime">:</div>
|
|
617
|
+
</div>
|
|
618
|
+
</div>
|
|
619
|
+
<hr>
|
|
620
|
+
<!-- x -->
|
|
621
|
+
<div id="">
|
|
622
|
+
<div class="box-tb">
|
|
623
|
+
<div class="topic">SmartCard</div>
|
|
624
|
+
<div class="text" id="">:</div>
|
|
625
|
+
</div>
|
|
626
|
+
<div class="box-tb">
|
|
627
|
+
<div class="topic">Biometric</div>
|
|
628
|
+
<div class="text" id="">:</div>
|
|
629
|
+
</div>
|
|
630
|
+
</div>
|
|
631
|
+
</div>
|
|
632
|
+
</div>
|
|
633
|
+
<style>
|
|
634
|
+
#page-svchub {
|
|
635
|
+
margin: auto;
|
|
636
|
+
max-width: 600px;
|
|
637
|
+
min-width: 480px;
|
|
638
|
+
line-height: 1.5;
|
|
1256
639
|
}
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
title: "\u0E41\u0E01\u0E49\u0E44\u0E02\u0E23\u0E32\u0E22\u0E25\u0E30\u0E40\u0E2D\u0E35\u0E22\u0E14",
|
|
1262
|
-
icon: "",
|
|
1263
|
-
width: "400px",
|
|
1264
|
-
body: frmDevice,
|
|
1265
|
-
button: { save: true, cancel: true }
|
|
1266
|
-
});
|
|
1267
|
-
const inpAgcy = modal.querySelector("#inp-agcy");
|
|
1268
|
-
const inpDept = modal.querySelector("#inp-dept");
|
|
1269
|
-
const inpName = modal.querySelector("#inp-name");
|
|
1270
|
-
inpAgcy.onchange = () => {
|
|
1271
|
-
Set2(Number(inpAgcy.value), inpDept);
|
|
1272
|
-
};
|
|
1273
|
-
(async () => {
|
|
1274
|
-
await Read4(agcy, acct).then(async (resp) => {
|
|
1275
|
-
const data = resp.data;
|
|
1276
|
-
const profile = data.profile;
|
|
1277
|
-
await Set(inpAgcy);
|
|
1278
|
-
await Set2(data.agcy, inpDept);
|
|
1279
|
-
inpAgcy.value = String(data.agcy);
|
|
1280
|
-
inpDept.value = data.dvsn ? `${data.dvsn},${data.sect}` : "";
|
|
1281
|
-
inpName.value = profile.name;
|
|
1282
|
-
}).catch((err) => console.error(err));
|
|
1283
|
-
Ready2(modal);
|
|
1284
|
-
})();
|
|
1285
|
-
const form = modal.querySelector("form");
|
|
1286
|
-
if (form) form.onsubmit = async (e) => {
|
|
1287
|
-
e.preventDefault();
|
|
1288
|
-
Hidden(modal);
|
|
1289
|
-
const res = await Confirm("\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19.! \u0E01\u0E32\u0E23\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25");
|
|
1290
|
-
Visible(modal);
|
|
1291
|
-
if (res) {
|
|
1292
|
-
Loading3(modal);
|
|
1293
|
-
const newAgcy = Number(inpAgcy.value);
|
|
1294
|
-
const [dvsn, sect] = inpDept.value.split(",");
|
|
1295
|
-
const params = {
|
|
1296
|
-
agcy: newAgcy,
|
|
1297
|
-
dvsn: dvsn ? Number(dvsn) : 0,
|
|
1298
|
-
sect: sect ? Number(sect) : 0,
|
|
1299
|
-
actype: 2,
|
|
1300
|
-
// อุปกรณ์
|
|
1301
|
-
acrole: 8,
|
|
1302
|
-
// คอมพิวเตอร์
|
|
1303
|
-
acuuid: strCheck(csid),
|
|
1304
|
-
profile: {
|
|
1305
|
-
dvtype: 1,
|
|
1306
|
-
// คอมพิวเตอร์
|
|
1307
|
-
name: strCheck(inpName.value)
|
|
1308
|
-
}
|
|
1309
|
-
};
|
|
1310
|
-
await Update(agcy, acct, params).then(() => {
|
|
1311
|
-
Close(modal);
|
|
1312
|
-
Toast("\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25 \u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08.!", { type: "success" });
|
|
1313
|
-
resolve();
|
|
1314
|
-
}).catch((err) => {
|
|
1315
|
-
Close(modal);
|
|
1316
|
-
Alert("\u0E40\u0E01\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14...!", { type: "failure" });
|
|
1317
|
-
reject(err);
|
|
1318
|
-
});
|
|
640
|
+
#page-svchub .topic {
|
|
641
|
+
float: left;
|
|
642
|
+
width: 100px;
|
|
643
|
+
font-weight: 600;
|
|
1319
644
|
}
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
const modal = Create({
|
|
1324
|
-
title: "\u0E01\u0E23\u0E2D\u0E01\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19",
|
|
1325
|
-
icon: "",
|
|
1326
|
-
width: "230px",
|
|
1327
|
-
body: (
|
|
1328
|
-
/*html*/
|
|
1329
|
-
`
|
|
1330
|
-
<div class="cover">
|
|
1331
|
-
<input type="password" id="inp-pass"
|
|
1332
|
-
value="admin@wkr" style="width: 100%;">
|
|
1333
|
-
</div>
|
|
1334
|
-
`
|
|
1335
|
-
),
|
|
1336
|
-
button: { save: true, cancel: true, align: "center" }
|
|
1337
|
-
});
|
|
1338
|
-
Ready2(modal);
|
|
1339
|
-
const inpPass = modal.querySelector("#inp-pass");
|
|
1340
|
-
inpPass?.focus();
|
|
1341
|
-
const form = modal.querySelector("form");
|
|
1342
|
-
if (form) form.onsubmit = async (e) => {
|
|
1343
|
-
e.preventDefault();
|
|
1344
|
-
const pass = inpPass?.value?.trim();
|
|
1345
|
-
if (pass === "admin@wkr") {
|
|
1346
|
-
await Close(modal);
|
|
1347
|
-
resolve(true);
|
|
1348
|
-
} else {
|
|
1349
|
-
await Alert("\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19.! \u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07", { type: "failure" });
|
|
1350
|
-
inpPass?.focus();
|
|
645
|
+
#page-svchub .text {
|
|
646
|
+
float: left;
|
|
647
|
+
width: calc(100% - 100px);
|
|
1351
648
|
}
|
|
1352
|
-
|
|
1353
|
-
|
|
649
|
+
#page-svchub #device {
|
|
650
|
+
position: relative;
|
|
651
|
+
}
|
|
652
|
+
#page-svchub #btn-edit {
|
|
653
|
+
position: absolute;
|
|
654
|
+
top: 0;
|
|
655
|
+
right: 0;
|
|
656
|
+
}
|
|
657
|
+
</style>
|
|
658
|
+
`
|
|
659
|
+
);
|
|
1354
660
|
|
|
1355
661
|
// src/svchub/hwlink/index.ts
|
|
1356
|
-
var
|
|
1357
|
-
var AGCY;
|
|
1358
|
-
var ACCT;
|
|
1359
|
-
var CSID;
|
|
662
|
+
var app4 = document.querySelector("#app");
|
|
1360
663
|
var isREADY;
|
|
1361
664
|
var WSSVC;
|
|
1362
|
-
var
|
|
1363
|
-
|
|
1364
|
-
if (!app5) return;
|
|
665
|
+
var hwLink = () => {
|
|
666
|
+
if (!app4) return;
|
|
1365
667
|
const content = document.createElement("div");
|
|
1366
668
|
content.id = "app-content";
|
|
1367
669
|
content.innerHTML = template;
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
boxDv = app5.querySelector("#device");
|
|
1371
|
-
const btnEdit = app5.querySelector("#btn-edit");
|
|
1372
|
-
if (btnEdit) btnEdit.onclick = async () => {
|
|
1373
|
-
if (await PwdChk()) {
|
|
1374
|
-
if (AGCY > 0 && ACCT > 0 && CSID != "") {
|
|
1375
|
-
Update2(AGCY, ACCT, CSID).then(() => {
|
|
1376
|
-
Loading2(boxDv, true);
|
|
1377
|
-
WSSVC.send('{"head": "KEYRST"}');
|
|
1378
|
-
}).catch((err) => console.error(err));
|
|
1379
|
-
} else {
|
|
1380
|
-
Create4(CSID).then(() => {
|
|
1381
|
-
Loading2(boxDv, true);
|
|
1382
|
-
WSSVC.send('{"head": "KEYRST"}');
|
|
1383
|
-
}).catch((err) => console.error(err));
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
};
|
|
1387
|
-
Loading();
|
|
1388
|
-
AGCY = 0;
|
|
1389
|
-
ACCT = 0;
|
|
1390
|
-
CSID = "";
|
|
670
|
+
app4.classList.add("full-page");
|
|
671
|
+
app4.appendChild(content);
|
|
1391
672
|
isREADY = false;
|
|
1392
|
-
|
|
1393
|
-
const btn = app5.querySelectorAll("button");
|
|
1394
|
-
btn.forEach((elm) => elm.style.display = "none");
|
|
1395
|
-
}
|
|
673
|
+
loading2();
|
|
1396
674
|
wsSvc();
|
|
1397
675
|
};
|
|
1398
676
|
var wsSvc = () => {
|
|
1399
|
-
WSSVC = new WebSocket(
|
|
677
|
+
WSSVC = new WebSocket(cfg.hwl.HOST);
|
|
1400
678
|
WSSVC.onopen = () => {
|
|
1401
679
|
hwinfo();
|
|
1402
|
-
dvinfo();
|
|
1403
680
|
T_hwinfo = setInterval(hwinfo, 1e3 * 10);
|
|
1404
681
|
};
|
|
1405
682
|
WSSVC.onclose = () => {
|
|
@@ -1410,30 +687,26 @@ var wsSvc = () => {
|
|
|
1410
687
|
const resp = JSON.parse(e.data);
|
|
1411
688
|
const head = resp.head ? resp.head : "";
|
|
1412
689
|
const data = resp.data ? resp.data : "";
|
|
1413
|
-
if (head == "CSUUID")
|
|
1414
|
-
if (head == "HWINFO") setHwInfo(data);
|
|
1415
|
-
if (head == "DVINFO") {
|
|
690
|
+
if (head == "CSUUID") {
|
|
1416
691
|
if (!isREADY) {
|
|
1417
692
|
isREADY = true;
|
|
1418
|
-
|
|
693
|
+
ready();
|
|
1419
694
|
}
|
|
1420
|
-
setDvInfo(data);
|
|
1421
|
-
Loading2(boxDv, false);
|
|
1422
695
|
}
|
|
696
|
+
if (head == "HWINFO") setHwInfo(data);
|
|
1423
697
|
};
|
|
1424
698
|
let T_hwinfo;
|
|
1425
699
|
const hwinfo = () => WSSVC.send('{"head": "HWINFO"}');
|
|
1426
|
-
const dvinfo = () => WSSVC.send('{"head": "DVINFO"}');
|
|
1427
700
|
};
|
|
1428
701
|
var setHwInfo = (data) => {
|
|
1429
|
-
if (!
|
|
702
|
+
if (!app4) return;
|
|
1430
703
|
const svc = data.svc;
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
704
|
+
app4.querySelector("#hwlink").innerText = `: ${svc.hwlink}`;
|
|
705
|
+
app4.querySelector("#autoup").innerText = `: ${svc.autoup}`;
|
|
706
|
+
app4.querySelector("#csuuid").innerText = `: ${data.csuuid}`;
|
|
1434
707
|
const cpu = data.cpu;
|
|
1435
708
|
const mem = data.mem;
|
|
1436
|
-
const hwinfo =
|
|
709
|
+
const hwinfo = app4.querySelector("#hwinfo");
|
|
1437
710
|
const uptime = Number(data.uptime);
|
|
1438
711
|
const hh = Math.floor(uptime / 3600);
|
|
1439
712
|
const mm = Math.floor(uptime % 3600 / 60);
|
|
@@ -1443,381 +716,525 @@ var setHwInfo = (data) => {
|
|
|
1443
716
|
hwinfo.querySelector("#host").innerText = `: ${data.hostname}`;
|
|
1444
717
|
hwinfo.querySelector("#os").innerText = `: ${data.platform}`;
|
|
1445
718
|
hwinfo.querySelector("#cpu").innerText = `: ${cpu.model}`;
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
};
|
|
1449
|
-
var setDvInfo = (data) => {
|
|
1450
|
-
if (!app5 || !data.acct || Number(data.acct) == 0) return;
|
|
1451
|
-
AGCY = Number(data.agcy);
|
|
1452
|
-
ACCT = Number(data.acct);
|
|
1453
|
-
let dept = data.dvsn_name;
|
|
1454
|
-
if (Number(data.sect) > 0) {
|
|
1455
|
-
dept += ` - ${data.sect_name}`;
|
|
1456
|
-
}
|
|
1457
|
-
app5.querySelector("#agcy").innerText = `: ${data.agcy_name}`;
|
|
1458
|
-
app5.querySelector("#dept").innerText = `: ${dept}`;
|
|
1459
|
-
app5.querySelector("#dname").innerText = `: ${data.acname}`;
|
|
719
|
+
app4.querySelector("#mem").innerText = `: ${mem_text}`;
|
|
720
|
+
app4.querySelector("#uptime").innerText = `: ${hh} h ${mm} m`;
|
|
1460
721
|
};
|
|
1461
722
|
|
|
1462
|
-
// src/
|
|
1463
|
-
var
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
723
|
+
// src/page/desktop/index.ts
|
|
724
|
+
var app5 = document.querySelector("#app");
|
|
725
|
+
var create = (params) => {
|
|
726
|
+
if (!app5) return false;
|
|
727
|
+
const uri = params.uri ? params.uri : "";
|
|
728
|
+
const size = params.size ? params.size : "";
|
|
729
|
+
const topbar = params.topbar ? params.topbar : "";
|
|
730
|
+
const sidebar = params.sidebar ? params.sidebar : "";
|
|
731
|
+
const template2 = params.template ? params.template : "";
|
|
732
|
+
const content = document.createElement("div");
|
|
733
|
+
content.id = "app-content";
|
|
734
|
+
content.innerHTML = template2;
|
|
735
|
+
app5.appendChild(content);
|
|
736
|
+
let newNav = false;
|
|
737
|
+
if (size == "full") {
|
|
738
|
+
app5.classList.add("full-page");
|
|
739
|
+
navRemove();
|
|
1477
740
|
} else {
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
741
|
+
app5.classList.remove("full-page");
|
|
742
|
+
if (!document.querySelector("#topbar")) {
|
|
743
|
+
navCreate({ topbar, sidebar });
|
|
744
|
+
newNav = true;
|
|
745
|
+
}
|
|
746
|
+
navActive(uri);
|
|
1482
747
|
}
|
|
748
|
+
return newNav;
|
|
1483
749
|
};
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
750
|
+
var navCreate = (params) => {
|
|
751
|
+
const topbar = document.createElement("nav");
|
|
752
|
+
const sidebar = document.createElement("nav");
|
|
753
|
+
topbar.id = "topbar";
|
|
754
|
+
sidebar.id = "sidebar";
|
|
755
|
+
topbar.innerHTML = params.topbar;
|
|
756
|
+
sidebar.innerHTML = params.sidebar;
|
|
757
|
+
document.body.prepend(topbar, sidebar);
|
|
758
|
+
const setScreen = () => {
|
|
759
|
+
const scWidth = window.innerWidth ? window.innerWidth : screen.width;
|
|
760
|
+
const scHeight = window.innerHeight ? window.innerHeight : screen.height;
|
|
761
|
+
const boxScreen = topbar.querySelector("#screen");
|
|
762
|
+
if (boxScreen) boxScreen.innerHTML = `${scWidth}x${scHeight}`;
|
|
763
|
+
if (scWidth < 600) navMenu(true);
|
|
764
|
+
else navMenu(false);
|
|
765
|
+
};
|
|
766
|
+
setScreen();
|
|
767
|
+
window.addEventListener("resize", setScreen);
|
|
768
|
+
const dropUser = topbar.querySelector("#drop-user");
|
|
769
|
+
if (dropUser) menu(dropUser);
|
|
770
|
+
const logout2 = () => {
|
|
771
|
+
confirm("\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19..! \u0E01\u0E32\u0E23\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E23\u0E30\u0E1A\u0E1A").then((res) => {
|
|
772
|
+
if (res) window.location.replace("/logout");
|
|
773
|
+
});
|
|
774
|
+
};
|
|
775
|
+
const navLogout = document.querySelectorAll("#nav-logout");
|
|
776
|
+
navLogout.forEach((el) => el.onclick = logout2);
|
|
777
|
+
navHwLink();
|
|
1498
778
|
};
|
|
1499
|
-
var
|
|
1500
|
-
const
|
|
1501
|
-
const
|
|
1502
|
-
if (
|
|
1503
|
-
|
|
1504
|
-
Update3(drop, icon, callBack);
|
|
779
|
+
var navRemove = () => {
|
|
780
|
+
const topbar = document.querySelector("#topbar");
|
|
781
|
+
const sidebar = document.querySelector("#sidebar");
|
|
782
|
+
if (topbar) topbar.remove();
|
|
783
|
+
if (sidebar) sidebar.remove();
|
|
1505
784
|
};
|
|
1506
|
-
var
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
if (
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
785
|
+
var navActive = (uri) => {
|
|
786
|
+
if (uri.indexOf("#") > 0) {
|
|
787
|
+
uri = uri.substring(0, uri.indexOf("#"));
|
|
788
|
+
}
|
|
789
|
+
clearNavActive();
|
|
790
|
+
if (!uri) return;
|
|
791
|
+
const sideBtn = document.querySelectorAll("#sidebar button");
|
|
792
|
+
sideBtn.forEach((btn) => {
|
|
793
|
+
const path = btn.getAttribute("href");
|
|
794
|
+
if (!btn.disabled && uri == path) {
|
|
795
|
+
btn.classList.add("active");
|
|
796
|
+
if (btn.classList.contains("grp-btn")) {
|
|
797
|
+
const menu2 = btn.parentNode?.querySelector(".submenu");
|
|
798
|
+
const grpBtn = btn.parentNode?.querySelector(".grp-btn");
|
|
799
|
+
if (menu2 && grpBtn) {
|
|
800
|
+
menu2.style.maxHeight = "400px";
|
|
801
|
+
grpBtn.classList.add("bar");
|
|
802
|
+
}
|
|
1523
803
|
}
|
|
1524
|
-
|
|
804
|
+
if (btn.classList.contains("sub-btn")) {
|
|
805
|
+
const menu2 = btn.parentNode;
|
|
806
|
+
const grpBtn = menu2.parentNode?.querySelector(".grp-btn");
|
|
807
|
+
if (menu2 && grpBtn && menu2.classList.contains("submenu")) {
|
|
808
|
+
menu2.style.maxHeight = "400px";
|
|
809
|
+
grpBtn.classList.add("active");
|
|
810
|
+
grpBtn.classList.remove("bar");
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
}
|
|
1525
814
|
});
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
815
|
+
};
|
|
816
|
+
var clearNavActive = () => {
|
|
817
|
+
const sideBtn = document.querySelectorAll("#sidebar button");
|
|
818
|
+
sideBtn.forEach((btn) => btn.classList.remove("active"));
|
|
819
|
+
const subMenu = document.querySelectorAll("#sidebar .submenu");
|
|
820
|
+
subMenu.forEach((elm) => elm.style.maxHeight = "0");
|
|
821
|
+
};
|
|
822
|
+
var navMenu = (state) => {
|
|
823
|
+
const navMenu2 = document.querySelector("#topbar #nav-menu");
|
|
824
|
+
const sidebar = document.querySelector("#sidebar");
|
|
825
|
+
if (!navMenu2 || !sidebar) return;
|
|
826
|
+
if (state) {
|
|
827
|
+
navMenu2.onclick = () => {
|
|
828
|
+
const posLeft = sidebar.getBoundingClientRect().left;
|
|
829
|
+
if (posLeft == 0) {
|
|
830
|
+
sidebar.classList.remove("menu-in");
|
|
831
|
+
sidebar.classList.add("menu-out");
|
|
1532
832
|
} else {
|
|
1533
|
-
|
|
833
|
+
sidebar.classList.remove("menu-out");
|
|
834
|
+
sidebar.classList.add("menu-in");
|
|
1534
835
|
}
|
|
1535
|
-
}
|
|
1536
|
-
}
|
|
1537
|
-
|
|
836
|
+
};
|
|
837
|
+
} else {
|
|
838
|
+
navMenu2.onclick = null;
|
|
839
|
+
sidebar.classList.remove("menu-in");
|
|
840
|
+
sidebar.classList.remove("menu-out");
|
|
841
|
+
}
|
|
1538
842
|
};
|
|
1539
|
-
var
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
843
|
+
var clear2 = () => {
|
|
844
|
+
const sidebar = document.querySelector("#sidebar");
|
|
845
|
+
if (!sidebar) return;
|
|
846
|
+
const scWidth = window.innerWidth ? window.innerWidth : screen.width;
|
|
847
|
+
const posLeft = sidebar.getBoundingClientRect().left;
|
|
848
|
+
if (scWidth < 600 && posLeft == 0) {
|
|
849
|
+
sidebar.classList.remove("menu-in");
|
|
850
|
+
sidebar.classList.add("menu-out");
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
window.addEventListener("click", (e) => {
|
|
854
|
+
if (!e.target.matches("#nav-menu")) clear2();
|
|
855
|
+
});
|
|
856
|
+
var navHwLink = () => {
|
|
857
|
+
const btnHwl = document.querySelector("#nav-hwlink");
|
|
858
|
+
if (!btnHwl) return;
|
|
859
|
+
const agent = navigator.userAgent.toLowerCase();
|
|
860
|
+
if (agent.indexOf("win") != -1) {
|
|
861
|
+
btnHwl.style.display = "block";
|
|
862
|
+
btnHwl.onclick = () => {
|
|
863
|
+
loading(btnHwl, true);
|
|
864
|
+
const ws = new WebSocket(cfg.hwl.HOST);
|
|
865
|
+
ws.onerror = () => {
|
|
866
|
+
download();
|
|
867
|
+
done();
|
|
1546
868
|
};
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
content.onanimationend = () => {
|
|
1552
|
-
content.style.animation = "";
|
|
869
|
+
ws.onopen = () => {
|
|
870
|
+
ws.close();
|
|
871
|
+
winPopup(500, 485, "hwlink", "/hwlink");
|
|
872
|
+
done();
|
|
1553
873
|
};
|
|
1554
|
-
|
|
874
|
+
const done = () => {
|
|
875
|
+
loading(btnHwl, false);
|
|
876
|
+
};
|
|
877
|
+
};
|
|
878
|
+
} else {
|
|
879
|
+
btnHwl.style.display = "none";
|
|
880
|
+
}
|
|
881
|
+
const download = () => {
|
|
882
|
+
const url = cfg.hwl.FILE;
|
|
883
|
+
const link = document.createElement("a");
|
|
884
|
+
link.href = url;
|
|
885
|
+
link.download = String(url.split("/").pop());
|
|
886
|
+
document.body.appendChild(link);
|
|
887
|
+
link.click();
|
|
888
|
+
document.body.removeChild(link);
|
|
1555
889
|
};
|
|
1556
890
|
};
|
|
1557
|
-
var
|
|
1558
|
-
const
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
891
|
+
var onlineStatus = () => {
|
|
892
|
+
const boxTime = document.querySelector("#box-time");
|
|
893
|
+
const svTime = document.querySelector("#box-time #sv-time");
|
|
894
|
+
const svDate = document.querySelector("#box-time #sv-date");
|
|
895
|
+
if (!boxTime || !svTime || !svDate) return;
|
|
896
|
+
if (window.navigator.onLine) {
|
|
897
|
+
boxTime.classList.remove("offline");
|
|
898
|
+
svTime.innerHTML = " ";
|
|
899
|
+
svDate.innerHTML = " ";
|
|
900
|
+
} else {
|
|
901
|
+
boxTime.classList.add("offline");
|
|
902
|
+
svTime.innerHTML = "network";
|
|
903
|
+
svDate.innerHTML = "OFFLINE";
|
|
904
|
+
}
|
|
1568
905
|
};
|
|
1569
|
-
window.addEventListener("
|
|
1570
|
-
|
|
906
|
+
window.addEventListener("online", onlineStatus);
|
|
907
|
+
window.addEventListener("offline", onlineStatus);
|
|
908
|
+
|
|
909
|
+
// src/page/docs.ts
|
|
910
|
+
var docs_exports = {};
|
|
911
|
+
__export(docs_exports, {
|
|
912
|
+
changelog: () => changelog,
|
|
913
|
+
privacy: () => privacy
|
|
1571
914
|
});
|
|
915
|
+
var privacy = async () => {
|
|
916
|
+
const url = "https://cdn.jsdelivr.net/gh/wkrdev/.github/docs/privacy.md";
|
|
917
|
+
const resp = await fetch(url);
|
|
918
|
+
if (resp.ok) {
|
|
919
|
+
return await resp.text();
|
|
920
|
+
}
|
|
921
|
+
return "";
|
|
922
|
+
};
|
|
923
|
+
var changelog = async (app9 = 1) => {
|
|
924
|
+
const url = `/apps/${app9}/logs`;
|
|
925
|
+
const resp = await fetch(cfg.hub.API + url);
|
|
926
|
+
if (resp.ok) {
|
|
927
|
+
const json = await resp.json();
|
|
928
|
+
return json.data;
|
|
929
|
+
}
|
|
930
|
+
return "";
|
|
931
|
+
};
|
|
1572
932
|
|
|
1573
|
-
// src/
|
|
1574
|
-
var
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
933
|
+
// src/lib/index.ts
|
|
934
|
+
var lib_exports = {};
|
|
935
|
+
__export(lib_exports, {
|
|
936
|
+
FY_MONTH: () => FY_MONTH,
|
|
937
|
+
FY_MONTH_SHORT: () => FY_MONTH_SHORT,
|
|
938
|
+
PERIOD_TEXT: () => PERIOD_TEXT,
|
|
939
|
+
THAI_DIGIT: () => THAI_DIGIT,
|
|
940
|
+
TH_MONTH: () => TH_MONTH,
|
|
941
|
+
TH_MONTH_SHORT: () => TH_MONTH_SHORT,
|
|
942
|
+
ageToBirth: () => ageToBirth,
|
|
943
|
+
cidCheck: () => cidCheck,
|
|
944
|
+
cookie: () => cookie_exports,
|
|
945
|
+
curDate: () => curDate,
|
|
946
|
+
curMonth: () => curMonth,
|
|
947
|
+
curTime: () => curTime,
|
|
948
|
+
curYear: () => curYear,
|
|
949
|
+
dateDiff: () => dateDiff,
|
|
950
|
+
geo: () => geoLocate_exports,
|
|
951
|
+
getAge: () => getAge,
|
|
952
|
+
isToday: () => isToday,
|
|
953
|
+
jwtParse: () => jwtParse,
|
|
954
|
+
numFormat: () => numFormat,
|
|
955
|
+
setYear: () => setYear,
|
|
956
|
+
shiftIndex: () => shiftIndex,
|
|
957
|
+
strCheck: () => strCheck,
|
|
958
|
+
strFormat: () => strFormat,
|
|
959
|
+
thaiDate: () => thaiDate,
|
|
960
|
+
thaiDigit: () => thaiDigit,
|
|
961
|
+
thbText: () => thbText,
|
|
962
|
+
timeDiff: () => timeDiff,
|
|
963
|
+
timeToStr: () => timeToStr,
|
|
964
|
+
toBase64: () => toBase64,
|
|
965
|
+
toDbDate: () => toDbDate,
|
|
966
|
+
toThaiDate: () => toThaiDate,
|
|
967
|
+
winPopup: () => winPopup,
|
|
968
|
+
zeroFill: () => zeroFill
|
|
969
|
+
});
|
|
970
|
+
|
|
971
|
+
// src/lib/dateTime.ts
|
|
972
|
+
var TH_MONTH = [
|
|
973
|
+
"\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21",
|
|
974
|
+
"\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C",
|
|
975
|
+
"\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21",
|
|
976
|
+
"\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19",
|
|
977
|
+
"\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21",
|
|
978
|
+
"\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19",
|
|
979
|
+
"\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21",
|
|
980
|
+
"\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21",
|
|
981
|
+
"\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19",
|
|
982
|
+
"\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21",
|
|
983
|
+
"\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19",
|
|
984
|
+
"\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21"
|
|
985
|
+
];
|
|
986
|
+
var TH_MONTH_SHORT = [
|
|
987
|
+
"\u0E21.\u0E04.",
|
|
988
|
+
"\u0E01.\u0E1E.",
|
|
989
|
+
"\u0E21\u0E35.\u0E04.",
|
|
990
|
+
"\u0E40\u0E21.\u0E22.",
|
|
991
|
+
"\u0E1E.\u0E04.",
|
|
992
|
+
"\u0E21\u0E34.\u0E22.",
|
|
993
|
+
"\u0E01.\u0E04.",
|
|
994
|
+
"\u0E2A.\u0E04.",
|
|
995
|
+
"\u0E01.\u0E22.",
|
|
996
|
+
"\u0E15.\u0E04.",
|
|
997
|
+
"\u0E1E.\u0E22.",
|
|
998
|
+
"\u0E18.\u0E04."
|
|
999
|
+
];
|
|
1000
|
+
var FY_MONTH = [
|
|
1001
|
+
"\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21",
|
|
1002
|
+
"\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19",
|
|
1003
|
+
"\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21",
|
|
1004
|
+
"\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21",
|
|
1005
|
+
"\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C",
|
|
1006
|
+
"\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21",
|
|
1007
|
+
"\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19",
|
|
1008
|
+
"\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21",
|
|
1009
|
+
"\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19",
|
|
1010
|
+
"\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21",
|
|
1011
|
+
"\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21",
|
|
1012
|
+
"\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19"
|
|
1013
|
+
];
|
|
1014
|
+
var FY_MONTH_SHORT = [
|
|
1015
|
+
"\u0E15.\u0E04.",
|
|
1016
|
+
"\u0E1E.\u0E22.",
|
|
1017
|
+
"\u0E18.\u0E04.",
|
|
1018
|
+
"\u0E21.\u0E04.",
|
|
1019
|
+
"\u0E01.\u0E1E.",
|
|
1020
|
+
"\u0E21\u0E35.\u0E04.",
|
|
1021
|
+
"\u0E40\u0E21.\u0E22.",
|
|
1022
|
+
"\u0E1E.\u0E04.",
|
|
1023
|
+
"\u0E21\u0E34.\u0E22.",
|
|
1024
|
+
"\u0E01.\u0E04.",
|
|
1025
|
+
"\u0E2A.\u0E04.",
|
|
1026
|
+
"\u0E01.\u0E22."
|
|
1027
|
+
];
|
|
1028
|
+
var PERIOD_TEXT = ["", "\u0E40\u0E27\u0E23\u0E14\u0E36\u0E01", "\u0E40\u0E27\u0E23\u0E40\u0E0A\u0E49\u0E32", "\u0E40\u0E27\u0E23\u0E1A\u0E48\u0E32\u0E22"];
|
|
1029
|
+
var curTime = () => (/* @__PURE__ */ new Date()).getTime();
|
|
1030
|
+
var curDate = () => {
|
|
1031
|
+
const dt = /* @__PURE__ */ new Date();
|
|
1032
|
+
const yy = dt.getFullYear();
|
|
1033
|
+
const mm = String(dt.getMonth() + 1).padStart(2, "0");
|
|
1034
|
+
const dd = String(dt.getDate()).padStart(2, "0");
|
|
1035
|
+
return `${yy}-${mm}-${dd}`;
|
|
1036
|
+
};
|
|
1037
|
+
var curMonth = () => {
|
|
1038
|
+
const dt = /* @__PURE__ */ new Date();
|
|
1039
|
+
const yy = dt.getFullYear();
|
|
1040
|
+
const mm = String(dt.getMonth() + 1).padStart(2, "0");
|
|
1041
|
+
return `${yy}-${mm}`;
|
|
1042
|
+
};
|
|
1043
|
+
var curYear = (yearType = "") => {
|
|
1044
|
+
const dt = /* @__PURE__ */ new Date();
|
|
1045
|
+
const mm = dt.getMonth() + 1;
|
|
1046
|
+
if ((yearType == "fyear" || yearType == "fy") && mm > 9) {
|
|
1047
|
+
return dt.getFullYear() + 1;
|
|
1597
1048
|
}
|
|
1598
|
-
return
|
|
1049
|
+
return dt.getFullYear();
|
|
1599
1050
|
};
|
|
1600
|
-
var
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
const
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
const dropUser = topbar.querySelector("#drop-user");
|
|
1619
|
-
if (dropUser) Menu(dropUser);
|
|
1620
|
-
const logout = () => {
|
|
1621
|
-
Confirm("\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19..! \u0E01\u0E32\u0E23\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E23\u0E30\u0E1A\u0E1A").then((res) => {
|
|
1622
|
-
if (res) window.location.replace("/logout");
|
|
1623
|
-
});
|
|
1624
|
-
};
|
|
1625
|
-
const navLogout = document.querySelectorAll("#nav-logout");
|
|
1626
|
-
navLogout.forEach((el) => el.onclick = logout);
|
|
1627
|
-
navHwLink();
|
|
1051
|
+
var timeToStr = (unixtime, format = "") => {
|
|
1052
|
+
if (typeof unixtime != "number") {
|
|
1053
|
+
return "";
|
|
1054
|
+
}
|
|
1055
|
+
const unix = new Date(Number(unixtime));
|
|
1056
|
+
const yy = unix.getFullYear();
|
|
1057
|
+
const mm = String(unix.getMonth() + 1).padStart(2, "0");
|
|
1058
|
+
const dd = String(unix.getDate()).padStart(2, "0");
|
|
1059
|
+
const H = String(unix.getHours()).padStart(2, "0");
|
|
1060
|
+
const M = String(unix.getMinutes()).padStart(2, "0");
|
|
1061
|
+
const S = String(unix.getSeconds()).padStart(2, "0");
|
|
1062
|
+
if (format == "date") {
|
|
1063
|
+
return `${yy}-${mm}-${dd}`;
|
|
1064
|
+
}
|
|
1065
|
+
if (format == "time") {
|
|
1066
|
+
return `${H}:${M}:${S}`;
|
|
1067
|
+
}
|
|
1068
|
+
return `${yy}-${mm}-${dd} ${H}:${M}:${S}`;
|
|
1628
1069
|
};
|
|
1629
|
-
var
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1070
|
+
var shiftIndex = (unixtime = 0) => {
|
|
1071
|
+
if (typeof unixtime != "number") {
|
|
1072
|
+
return { num: 0, text: "" };
|
|
1073
|
+
}
|
|
1074
|
+
const unix = unixtime ? new Date(unixtime) : /* @__PURE__ */ new Date();
|
|
1075
|
+
const H = unix.getHours();
|
|
1076
|
+
if (H >= 0 && H < 8) return { num: 1, text: PERIOD_TEXT[1] };
|
|
1077
|
+
if (H >= 8 && H < 16) return { num: 2, text: PERIOD_TEXT[2] };
|
|
1078
|
+
if (H >= 16) return { num: 3, text: PERIOD_TEXT[3] };
|
|
1079
|
+
return { num: 0, text: "" };
|
|
1634
1080
|
};
|
|
1635
|
-
var
|
|
1636
|
-
|
|
1637
|
-
|
|
1081
|
+
var setYear = (el, min = 2020, txt = "") => {
|
|
1082
|
+
const dt = /* @__PURE__ */ new Date();
|
|
1083
|
+
let year = dt.getFullYear();
|
|
1084
|
+
const month = dt.getMonth() + 1;
|
|
1085
|
+
if (month > 6 && month <= 12) {
|
|
1086
|
+
year++;
|
|
1087
|
+
}
|
|
1088
|
+
el.innerHTML = '<option value="">- \u0E40\u0E25\u0E37\u0E2D\u0E01 -</option>';
|
|
1089
|
+
for (let y = min; y <= year; y++) {
|
|
1090
|
+
const option = document.createElement("option");
|
|
1091
|
+
option.value = `${y}`;
|
|
1092
|
+
option.text = `${txt} ${y + 543}`;
|
|
1093
|
+
el.appendChild(option);
|
|
1638
1094
|
}
|
|
1639
|
-
clearNavActive();
|
|
1640
|
-
if (!uri) return;
|
|
1641
|
-
const sideBtn = document.querySelectorAll("#sidebar button");
|
|
1642
|
-
sideBtn.forEach((btn) => {
|
|
1643
|
-
const path = btn.getAttribute("href");
|
|
1644
|
-
if (!btn.disabled && uri == path) {
|
|
1645
|
-
btn.classList.add("active");
|
|
1646
|
-
if (btn.classList.contains("grp-btn")) {
|
|
1647
|
-
const menu = btn.parentNode?.querySelector(".submenu");
|
|
1648
|
-
const grpBtn = btn.parentNode?.querySelector(".grp-btn");
|
|
1649
|
-
if (menu && grpBtn) {
|
|
1650
|
-
menu.style.maxHeight = "400px";
|
|
1651
|
-
grpBtn.classList.add("bar");
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
|
-
if (btn.classList.contains("sub-btn")) {
|
|
1655
|
-
const menu = btn.parentNode;
|
|
1656
|
-
const grpBtn = menu.parentNode?.querySelector(".grp-btn");
|
|
1657
|
-
if (menu && grpBtn && menu.classList.contains("submenu")) {
|
|
1658
|
-
menu.style.maxHeight = "400px";
|
|
1659
|
-
grpBtn.classList.add("active");
|
|
1660
|
-
grpBtn.classList.remove("bar");
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
|
-
});
|
|
1665
1095
|
};
|
|
1666
|
-
var
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1096
|
+
var thaiDate = (date, format = 0) => {
|
|
1097
|
+
if (typeof date == "string" && date.indexOf("0000-00-00") >= 0) {
|
|
1098
|
+
return "";
|
|
1099
|
+
}
|
|
1100
|
+
if (typeof date == "string") {
|
|
1101
|
+
date = date.trim();
|
|
1102
|
+
date = date.replace(" ", "T");
|
|
1103
|
+
}
|
|
1104
|
+
const dt = new Date(date);
|
|
1105
|
+
if (isNaN(dt.getTime())) return "";
|
|
1106
|
+
const yy = dt.getFullYear() + 543;
|
|
1107
|
+
const mm = String(dt.getMonth() + 1).padStart(2, "0");
|
|
1108
|
+
const dd = String(dt.getDate()).padStart(2, "0");
|
|
1109
|
+
const H = String(dt.getHours()).padStart(2, "0");
|
|
1110
|
+
const M = String(dt.getMinutes()).padStart(2, "0");
|
|
1111
|
+
const S = String(dt.getSeconds()).padStart(2, "0");
|
|
1112
|
+
if (format == 0) return `${dd}/${mm}/${yy}`;
|
|
1113
|
+
if (format == 1) return `${dd}/${mm}/${yy} ${H}:${M}`;
|
|
1114
|
+
if (format == 2) return `${dd}/${mm}/${yy} ${H}:${M}:${S}`;
|
|
1115
|
+
if (format == 10) return `${dd} ${TH_MONTH[Number(mm) - 1]} ${yy}`;
|
|
1116
|
+
if (format == 11) return `${dd} ${TH_MONTH_SHORT[Number(mm) - 1]} ${String(yy).slice(-2)}`;
|
|
1117
|
+
if (format == 12) return `${dd} ${TH_MONTH[Number(mm) - 1]} ${yy} \u0E40\u0E27\u0E25\u0E32 ${H}:${M} \u0E19.`;
|
|
1118
|
+
if (format == 13) return `${dd} ${TH_MONTH_SHORT[Number(mm) - 1]} ${String(yy).slice(-2)} ${H}:${M}`;
|
|
1119
|
+
if (format == 20) return `${TH_MONTH[Number(mm) - 1]} ${yy}`;
|
|
1120
|
+
if (format == 21) return `${TH_MONTH_SHORT[Number(mm) - 1]} ${yy}`;
|
|
1121
|
+
if (format == 22) return `${TH_MONTH_SHORT[Number(mm) - 1]} ${String(yy).slice(-2)}`;
|
|
1122
|
+
return "";
|
|
1671
1123
|
};
|
|
1672
|
-
var
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
if (
|
|
1677
|
-
|
|
1678
|
-
const posLeft = sidebar.getBoundingClientRect().left;
|
|
1679
|
-
if (posLeft == 0) {
|
|
1680
|
-
sidebar.classList.remove("menu-in");
|
|
1681
|
-
sidebar.classList.add("menu-out");
|
|
1682
|
-
} else {
|
|
1683
|
-
sidebar.classList.remove("menu-out");
|
|
1684
|
-
sidebar.classList.add("menu-in");
|
|
1685
|
-
}
|
|
1686
|
-
};
|
|
1687
|
-
} else {
|
|
1688
|
-
navMenu2.onclick = null;
|
|
1689
|
-
sidebar.classList.remove("menu-in");
|
|
1690
|
-
sidebar.classList.remove("menu-out");
|
|
1124
|
+
var dateDiff = (start, stop) => {
|
|
1125
|
+
if (!start || start.indexOf("0000-00-00") >= 0) {
|
|
1126
|
+
return 0;
|
|
1127
|
+
}
|
|
1128
|
+
if (!stop || stop.indexOf("0000-00-00") >= 0) {
|
|
1129
|
+
return 0;
|
|
1691
1130
|
}
|
|
1131
|
+
const [y1, m1, d1] = start.split("-");
|
|
1132
|
+
const [y2, m2, d2] = stop.split("-");
|
|
1133
|
+
const date1 = new Date(Number(y1), Number(m1) - 1, Number(d1)).getTime();
|
|
1134
|
+
const date2 = new Date(Number(y2), Number(m2) - 1, Number(d2)).getTime();
|
|
1135
|
+
return Math.round((date2 - date1) / (1e3 * 60 * 60 * 24));
|
|
1692
1136
|
};
|
|
1693
|
-
var
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
sidebar.classList.remove("menu-in");
|
|
1700
|
-
sidebar.classList.add("menu-out");
|
|
1137
|
+
var timeDiff = (start, stop) => {
|
|
1138
|
+
if (!start || start.indexOf("0000-00-00") >= 0) {
|
|
1139
|
+
return { h: 0, m: 0, s: 0 };
|
|
1140
|
+
}
|
|
1141
|
+
if (!stop || stop.indexOf("0000-00-00") >= 0) {
|
|
1142
|
+
return { h: 0, m: 0, s: 0 };
|
|
1701
1143
|
}
|
|
1144
|
+
start = start.replace(" ", "T");
|
|
1145
|
+
stop = stop.replace(" ", "T");
|
|
1146
|
+
const date1 = new Date(start);
|
|
1147
|
+
const date2 = new Date(stop);
|
|
1148
|
+
let msec = date2.getTime() - date1.getTime();
|
|
1149
|
+
const hh = Math.floor(msec / 1e3 / 60 / 60);
|
|
1150
|
+
msec -= hh * 1e3 * 60 * 60;
|
|
1151
|
+
const mm = Math.floor(msec / 1e3 / 60);
|
|
1152
|
+
msec -= mm * 1e3 * 60;
|
|
1153
|
+
const ss = Math.floor(msec / 1e3);
|
|
1154
|
+
msec -= ss * 1e3;
|
|
1155
|
+
return { h: hh, m: mm, s: ss };
|
|
1702
1156
|
};
|
|
1703
|
-
|
|
1704
|
-
if (!
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
const
|
|
1708
|
-
|
|
1709
|
-
const
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
winPopup(500, 485, "hwlink", "/hwlink");
|
|
1722
|
-
done();
|
|
1723
|
-
};
|
|
1724
|
-
const done = () => {
|
|
1725
|
-
Loading4(btnHwl, false);
|
|
1726
|
-
};
|
|
1727
|
-
};
|
|
1157
|
+
var getAge = (date) => {
|
|
1158
|
+
if (!date || date.indexOf("0000-00-00") >= 0) {
|
|
1159
|
+
return { years: 0, months: 0, days: 0 };
|
|
1160
|
+
}
|
|
1161
|
+
const now = /* @__PURE__ */ new Date();
|
|
1162
|
+
const nowYear = now.getFullYear();
|
|
1163
|
+
const nowMonth = now.getMonth();
|
|
1164
|
+
const nowDate = now.getDate();
|
|
1165
|
+
const [yy, mm, dd] = date.split("-");
|
|
1166
|
+
const birth = new Date(Number(yy), Number(mm) - 1, Number(dd));
|
|
1167
|
+
const birthYear = birth.getFullYear();
|
|
1168
|
+
const birthMonth = birth.getMonth();
|
|
1169
|
+
const birthDate = birth.getDate();
|
|
1170
|
+
let yearAge = nowYear - birthYear;
|
|
1171
|
+
let monthAge = 0;
|
|
1172
|
+
let dateAge = 0;
|
|
1173
|
+
if (nowMonth >= birthMonth) {
|
|
1174
|
+
monthAge = nowMonth - birthMonth;
|
|
1728
1175
|
} else {
|
|
1729
|
-
|
|
1176
|
+
yearAge--;
|
|
1177
|
+
monthAge = 12 + nowMonth - birthMonth;
|
|
1730
1178
|
}
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1179
|
+
if (nowDate >= birthDate) {
|
|
1180
|
+
dateAge = nowDate - birthDate;
|
|
1181
|
+
} else {
|
|
1182
|
+
monthAge--;
|
|
1183
|
+
dateAge = 31 + nowDate - birthDate;
|
|
1184
|
+
if (monthAge < 0) {
|
|
1185
|
+
monthAge = 11;
|
|
1186
|
+
yearAge--;
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
return {
|
|
1190
|
+
years: yearAge,
|
|
1191
|
+
months: monthAge,
|
|
1192
|
+
days: dateAge
|
|
1739
1193
|
};
|
|
1740
1194
|
};
|
|
1741
|
-
var
|
|
1742
|
-
const
|
|
1743
|
-
const
|
|
1744
|
-
const
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1195
|
+
var ageToBirth = (year, month, day) => {
|
|
1196
|
+
const y = Number(year);
|
|
1197
|
+
const m = Number(month);
|
|
1198
|
+
const d = Number(day);
|
|
1199
|
+
const dt = new Date(
|
|
1200
|
+
(/* @__PURE__ */ new Date()).getFullYear() - y,
|
|
1201
|
+
(/* @__PURE__ */ new Date()).getMonth() - m,
|
|
1202
|
+
(/* @__PURE__ */ new Date()).getDate() - d
|
|
1203
|
+
);
|
|
1204
|
+
const yy = dt.getFullYear();
|
|
1205
|
+
const mm = String(dt.getMonth() + 1).padStart(2, "0");
|
|
1206
|
+
const dd = String(dt.getDate()).padStart(2, "0");
|
|
1207
|
+
return `${yy}-${mm}-${dd}`;
|
|
1208
|
+
};
|
|
1209
|
+
var toDbDate = (date) => {
|
|
1210
|
+
if (!date || date.indexOf("0000-00-00") >= 0) {
|
|
1211
|
+
return "";
|
|
1754
1212
|
}
|
|
1213
|
+
const dt = new Date(date);
|
|
1214
|
+
const yy = dt.getFullYear() - 543;
|
|
1215
|
+
const mm = String(dt.getMonth() + 1).padStart(2, "0");
|
|
1216
|
+
const dd = String(dt.getDate()).padStart(2, "0");
|
|
1217
|
+
return `${yy}-${mm}-${dd}`;
|
|
1755
1218
|
};
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
// src/page/docs.ts
|
|
1760
|
-
var docs_exports = {};
|
|
1761
|
-
__export(docs_exports, {
|
|
1762
|
-
changelog: () => changelog,
|
|
1763
|
-
privacy: () => privacy
|
|
1764
|
-
});
|
|
1765
|
-
var privacy = async () => {
|
|
1766
|
-
const url = "https://cdn.jsdelivr.net/gh/wkrdev/.github/docs/privacy.md";
|
|
1767
|
-
const resp = await fetch(url);
|
|
1768
|
-
if (resp.ok) {
|
|
1769
|
-
return await resp.text();
|
|
1219
|
+
var toThaiDate = (date) => {
|
|
1220
|
+
if (!date || date.indexOf("0000-00-00") >= 0) {
|
|
1221
|
+
return "";
|
|
1770
1222
|
}
|
|
1771
|
-
|
|
1223
|
+
const dt = new Date(date);
|
|
1224
|
+
const yy = dt.getFullYear() + 543;
|
|
1225
|
+
const mm = String(dt.getMonth() + 1).padStart(2, "0");
|
|
1226
|
+
const dd = String(dt.getDate()).padStart(2, "0");
|
|
1227
|
+
return `${yy}-${mm}-${dd}`;
|
|
1772
1228
|
};
|
|
1773
|
-
var
|
|
1774
|
-
const
|
|
1775
|
-
const
|
|
1776
|
-
if (
|
|
1777
|
-
|
|
1778
|
-
return json.data;
|
|
1229
|
+
var isToday = (date) => {
|
|
1230
|
+
const input = new Date(date);
|
|
1231
|
+
const today = /* @__PURE__ */ new Date();
|
|
1232
|
+
if (input.setHours(0, 0, 0, 0) == today.setHours(0, 0, 0, 0)) {
|
|
1233
|
+
return true;
|
|
1779
1234
|
}
|
|
1780
|
-
return
|
|
1235
|
+
return false;
|
|
1781
1236
|
};
|
|
1782
1237
|
|
|
1783
|
-
// src/lib/index.ts
|
|
1784
|
-
var lib_exports = {};
|
|
1785
|
-
__export(lib_exports, {
|
|
1786
|
-
FY_MONTH: () => FY_MONTH,
|
|
1787
|
-
FY_MONTH_SHORT: () => FY_MONTH_SHORT,
|
|
1788
|
-
PERIOD_TEXT: () => PERIOD_TEXT,
|
|
1789
|
-
THAI_DIGIT: () => THAI_DIGIT,
|
|
1790
|
-
TH_MONTH: () => TH_MONTH,
|
|
1791
|
-
TH_MONTH_SHORT: () => TH_MONTH_SHORT,
|
|
1792
|
-
ageToBirth: () => ageToBirth,
|
|
1793
|
-
cidCheck: () => cidCheck,
|
|
1794
|
-
cookie: () => cookie_exports,
|
|
1795
|
-
curDate: () => curDate,
|
|
1796
|
-
curMonth: () => curMonth,
|
|
1797
|
-
curTime: () => curTime,
|
|
1798
|
-
curYear: () => curYear,
|
|
1799
|
-
dateDiff: () => dateDiff,
|
|
1800
|
-
geo: () => geoLocate_exports,
|
|
1801
|
-
getAge: () => getAge,
|
|
1802
|
-
isToday: () => isToday,
|
|
1803
|
-
jwtParse: () => jwtParse,
|
|
1804
|
-
numFormat: () => numFormat,
|
|
1805
|
-
setYear: () => setYear,
|
|
1806
|
-
shiftIndex: () => shiftIndex,
|
|
1807
|
-
strCheck: () => strCheck,
|
|
1808
|
-
strFormat: () => strFormat,
|
|
1809
|
-
thaiDate: () => thaiDate,
|
|
1810
|
-
thaiDigit: () => thaiDigit,
|
|
1811
|
-
thbText: () => thbText,
|
|
1812
|
-
timeDiff: () => timeDiff,
|
|
1813
|
-
timeToStr: () => timeToStr,
|
|
1814
|
-
toBase64: () => toBase64,
|
|
1815
|
-
toDbDate: () => toDbDate,
|
|
1816
|
-
toThaiDate: () => toThaiDate,
|
|
1817
|
-
winPopup: () => winPopup,
|
|
1818
|
-
zeroFill: () => zeroFill
|
|
1819
|
-
});
|
|
1820
|
-
|
|
1821
1238
|
// src/lib/geoLocate.ts
|
|
1822
1239
|
var geoLocate_exports = {};
|
|
1823
1240
|
__export(geoLocate_exports, {
|
|
@@ -1872,9 +1289,9 @@ var getPosition = (params) => new Promise((resolve, reject) => {
|
|
|
1872
1289
|
});
|
|
1873
1290
|
} else reject("not support geolocation");
|
|
1874
1291
|
});
|
|
1875
|
-
var watchPosition = (success,
|
|
1292
|
+
var watchPosition = (success, error2) => {
|
|
1876
1293
|
if (navigator.geolocation) {
|
|
1877
|
-
return navigator.geolocation.watchPosition(success,
|
|
1294
|
+
return navigator.geolocation.watchPosition(success, error2, {
|
|
1878
1295
|
enableHighAccuracy: true,
|
|
1879
1296
|
timeout: 5e3,
|
|
1880
1297
|
maximumAge: 0
|
|
@@ -1898,14 +1315,14 @@ var toAddress = async (position) => {
|
|
|
1898
1315
|
// src/lib/cookie.ts
|
|
1899
1316
|
var cookie_exports = {};
|
|
1900
1317
|
__export(cookie_exports, {
|
|
1901
|
-
clear: () =>
|
|
1318
|
+
clear: () => clear3,
|
|
1902
1319
|
getItem: () => getItem,
|
|
1903
1320
|
removeItem: () => removeItem,
|
|
1904
1321
|
setItem: () => setItem
|
|
1905
1322
|
});
|
|
1906
1323
|
var setItem = (key, val, exp) => {
|
|
1907
1324
|
const d = /* @__PURE__ */ new Date();
|
|
1908
|
-
d.setTime(d.getTime() +
|
|
1325
|
+
d.setTime(d.getTime() + 1e3 * exp);
|
|
1909
1326
|
const expires = "expires=" + d.toUTCString();
|
|
1910
1327
|
document.cookie = `${key}=${val};${expires};path=/`;
|
|
1911
1328
|
};
|
|
@@ -1917,7 +1334,7 @@ var getItem = (key) => {
|
|
|
1917
1334
|
var removeItem = (key) => {
|
|
1918
1335
|
document.cookie = `${key}=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;`;
|
|
1919
1336
|
};
|
|
1920
|
-
var
|
|
1337
|
+
var clear3 = () => {
|
|
1921
1338
|
document.cookie.split(";").forEach((cookie) => {
|
|
1922
1339
|
const eqPos = cookie.indexOf("=");
|
|
1923
1340
|
const name = eqPos > -1 ? cookie.substring(0, eqPos) : cookie;
|
|
@@ -2047,6 +1464,47 @@ var fitSize = (elm, delay = 0) => {
|
|
|
2047
1464
|
}, delay);
|
|
2048
1465
|
};
|
|
2049
1466
|
|
|
1467
|
+
// src/mod/built-in/cover/index.ts
|
|
1468
|
+
var cover_exports = {};
|
|
1469
|
+
__export(cover_exports, {
|
|
1470
|
+
acdInit: () => acdInit,
|
|
1471
|
+
loading: () => loading3
|
|
1472
|
+
});
|
|
1473
|
+
var loading3 = (cover, state = false, align = "top", hide = true) => {
|
|
1474
|
+
const inner = cover.querySelectorAll("*");
|
|
1475
|
+
if (state) {
|
|
1476
|
+
cover.querySelector(".cover-loader")?.remove();
|
|
1477
|
+
cover.style.position = "relative";
|
|
1478
|
+
if (hide) inner.forEach((el) => el.style.visibility = "hidden");
|
|
1479
|
+
const loader = document.createElement("div");
|
|
1480
|
+
loader.className = `cover-loader ${align}`;
|
|
1481
|
+
loader.innerHTML = `<div class="spinner s28"></div>`;
|
|
1482
|
+
cover.appendChild(loader);
|
|
1483
|
+
} else {
|
|
1484
|
+
new Promise((r) => setTimeout(r, 400)).then(() => {
|
|
1485
|
+
cover.querySelector(".cover-loader")?.remove();
|
|
1486
|
+
cover.style.position = "";
|
|
1487
|
+
inner.forEach((el) => el.style.visibility = "");
|
|
1488
|
+
});
|
|
1489
|
+
}
|
|
1490
|
+
};
|
|
1491
|
+
var acdInit = () => {
|
|
1492
|
+
const acdItem = document.querySelectorAll(".acd-item");
|
|
1493
|
+
acdItem.forEach((elm) => {
|
|
1494
|
+
const topic = elm.querySelector(".topic");
|
|
1495
|
+
const panel = elm.querySelector(".panel");
|
|
1496
|
+
if (topic) topic.onclick = () => {
|
|
1497
|
+
elm.classList.toggle("active");
|
|
1498
|
+
if (!panel) return;
|
|
1499
|
+
if (elm.classList.contains("active")) {
|
|
1500
|
+
panel.style.maxHeight = `${panel.scrollHeight}px`;
|
|
1501
|
+
} else {
|
|
1502
|
+
panel.style.maxHeight = "";
|
|
1503
|
+
}
|
|
1504
|
+
};
|
|
1505
|
+
});
|
|
1506
|
+
};
|
|
1507
|
+
|
|
2050
1508
|
// src/mod/camera/index.ts
|
|
2051
1509
|
var camera_exports = {};
|
|
2052
1510
|
__export(camera_exports, {
|
|
@@ -2199,13 +1657,13 @@ var camReady = (cam) => {
|
|
|
2199
1657
|
// src/mod/drawer/index.ts
|
|
2200
1658
|
var drawer_exports = {};
|
|
2201
1659
|
__export(drawer_exports, {
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
1660
|
+
close: () => close,
|
|
1661
|
+
create: () => create2,
|
|
1662
|
+
loading: () => loading4,
|
|
1663
|
+
ready: () => ready2
|
|
2206
1664
|
});
|
|
2207
|
-
var
|
|
2208
|
-
var
|
|
1665
|
+
var app6 = document.querySelector("#app");
|
|
1666
|
+
var create2 = (params) => {
|
|
2209
1667
|
const name = params.name ? params.name : "drawer";
|
|
2210
1668
|
const size = params.size ? params.size : "mobile";
|
|
2211
1669
|
const drawer = document.createElement("div");
|
|
@@ -2239,7 +1697,7 @@ var Create6 = (params) => {
|
|
|
2239
1697
|
if (hash != name && hash != "modal") done();
|
|
2240
1698
|
};
|
|
2241
1699
|
const done = () => {
|
|
2242
|
-
|
|
1700
|
+
destroy(drawer);
|
|
2243
1701
|
if (window.location.hash == `#${name}`) history.back();
|
|
2244
1702
|
window.removeEventListener("hashchange", hashChange);
|
|
2245
1703
|
};
|
|
@@ -2254,10 +1712,10 @@ var Create6 = (params) => {
|
|
|
2254
1712
|
return drawer;
|
|
2255
1713
|
};
|
|
2256
1714
|
var openMobile = (drawer) => {
|
|
2257
|
-
if (!
|
|
2258
|
-
const offset =
|
|
1715
|
+
if (!app6) return;
|
|
1716
|
+
const offset = app6.getBoundingClientRect();
|
|
2259
1717
|
const appRight = offset.right;
|
|
2260
|
-
const appWidth =
|
|
1718
|
+
const appWidth = app6.offsetWidth;
|
|
2261
1719
|
drawer.style.left = `${appRight}px`;
|
|
2262
1720
|
const css = document.createElement("style");
|
|
2263
1721
|
drawer.appendChild(css);
|
|
@@ -2273,7 +1731,7 @@ var openMobile = (drawer) => {
|
|
|
2273
1731
|
to {transform: translateX(0);}
|
|
2274
1732
|
}
|
|
2275
1733
|
`);
|
|
2276
|
-
const content =
|
|
1734
|
+
const content = app6.querySelector("#app-content");
|
|
2277
1735
|
if (content) content.style.animation = "drawer-push-app 0.4s forwards";
|
|
2278
1736
|
drawer.style.animation = "drawer-in 0.4s forwards";
|
|
2279
1737
|
const header = drawer.querySelector(".drawer-header");
|
|
@@ -2289,53 +1747,192 @@ var openMobile = (drawer) => {
|
|
|
2289
1747
|
}
|
|
2290
1748
|
};
|
|
2291
1749
|
};
|
|
2292
|
-
var
|
|
2293
|
-
drawer.querySelector("#btn-exit").click();
|
|
2294
|
-
drawer.addEventListener("animationend", () => resolve());
|
|
1750
|
+
var close = (drawer) => new Promise((resolve) => {
|
|
1751
|
+
drawer.querySelector("#btn-exit").click();
|
|
1752
|
+
drawer.addEventListener("animationend", () => resolve());
|
|
1753
|
+
});
|
|
1754
|
+
var destroy = (drawer) => {
|
|
1755
|
+
if (!app6) return;
|
|
1756
|
+
if (drawer.classList.contains("mobile")) {
|
|
1757
|
+
const content = app6.querySelector("#app-content");
|
|
1758
|
+
if (content) content.style.animation = "drawer-pull-app 0.4s forwards";
|
|
1759
|
+
drawer.style.animation = "drawer-out 0.4s forwards";
|
|
1760
|
+
drawer.addEventListener("animationend", () => {
|
|
1761
|
+
if (content) content.style.animation = "unset";
|
|
1762
|
+
drawer.remove();
|
|
1763
|
+
});
|
|
1764
|
+
} else {
|
|
1765
|
+
drawer.style.animation = "slide-out-left 0.4s forwards";
|
|
1766
|
+
drawer.addEventListener("animationend", () => {
|
|
1767
|
+
drawer.remove();
|
|
1768
|
+
});
|
|
1769
|
+
}
|
|
1770
|
+
const modal = document.querySelectorAll(".slim-modal");
|
|
1771
|
+
modal.forEach((el) => el.remove());
|
|
1772
|
+
const dialog = document.querySelectorAll(".slim-dialog");
|
|
1773
|
+
dialog.forEach((el) => el.remove());
|
|
1774
|
+
};
|
|
1775
|
+
var loading4 = (drawer) => {
|
|
1776
|
+
const body = drawer.querySelector(".drawer-body");
|
|
1777
|
+
const loader = drawer.querySelector(".loader");
|
|
1778
|
+
if (body) body.style.display = "none";
|
|
1779
|
+
if (loader) loader.style.display = "flex";
|
|
1780
|
+
};
|
|
1781
|
+
var ready2 = (drawer) => {
|
|
1782
|
+
const body = drawer.querySelector(".drawer-body");
|
|
1783
|
+
const loader = drawer.querySelector(".loader");
|
|
1784
|
+
if (body) body.style.display = "block";
|
|
1785
|
+
if (loader) loader.style.display = "none";
|
|
1786
|
+
};
|
|
1787
|
+
|
|
1788
|
+
// src/mod/modal/index.ts
|
|
1789
|
+
var modal_exports = {};
|
|
1790
|
+
__export(modal_exports, {
|
|
1791
|
+
close: () => close2,
|
|
1792
|
+
create: () => create3,
|
|
1793
|
+
hidden: () => hidden,
|
|
1794
|
+
loading: () => loading5,
|
|
1795
|
+
ready: () => ready3,
|
|
1796
|
+
visible: () => visible
|
|
1797
|
+
});
|
|
1798
|
+
var app7 = document.querySelector("#app");
|
|
1799
|
+
var tmpBtnSave = (
|
|
1800
|
+
/* html */
|
|
1801
|
+
`
|
|
1802
|
+
<button class="solid green" type="submit">
|
|
1803
|
+
<i></i>\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01
|
|
1804
|
+
</button>
|
|
1805
|
+
`
|
|
1806
|
+
);
|
|
1807
|
+
var tmpBtnCancel = (
|
|
1808
|
+
/* html */
|
|
1809
|
+
`
|
|
1810
|
+
<button class="solid gray" type="button" id="btn-cancel">
|
|
1811
|
+
<i></i>\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01
|
|
1812
|
+
</button>
|
|
1813
|
+
`
|
|
1814
|
+
);
|
|
1815
|
+
var tmpBtnClose = (
|
|
1816
|
+
/* html */
|
|
1817
|
+
`
|
|
1818
|
+
<button class="solid blue" type="button" id="btn-close">
|
|
1819
|
+
<i></i>\u0E1B\u0E34\u0E14\u0E2B\u0E19\u0E49\u0E32
|
|
1820
|
+
</button>
|
|
1821
|
+
`
|
|
1822
|
+
);
|
|
1823
|
+
var create3 = (params) => {
|
|
1824
|
+
const icon = params.icon ? params.icon : "";
|
|
1825
|
+
const title = params.title ? params.title : "Modal Title";
|
|
1826
|
+
const body = params.body ? params.body : "Modal Body";
|
|
1827
|
+
const width = params.width ? params.width : "100%";
|
|
1828
|
+
const align = params.button?.align ? params.button?.align : "";
|
|
1829
|
+
const doc = params.target ? params.target : app7;
|
|
1830
|
+
let button = "";
|
|
1831
|
+
if (params.button?.cancel) button += tmpBtnCancel;
|
|
1832
|
+
if (params.button?.close) button += tmpBtnClose;
|
|
1833
|
+
if (params.button?.save) button += tmpBtnSave;
|
|
1834
|
+
const modal = document.createElement("div");
|
|
1835
|
+
modal.className = "overlay slim-modal";
|
|
1836
|
+
modal.innerHTML = /*html*/
|
|
1837
|
+
`
|
|
1838
|
+
<form>
|
|
1839
|
+
<div class="content" style="width: ${width};">
|
|
1840
|
+
<div class="header">
|
|
1841
|
+
<i class="icon pad">${icon}</i>${title}
|
|
1842
|
+
<button id="btn-exit" type="button"
|
|
1843
|
+
class="icon"></button>
|
|
1844
|
+
</div>
|
|
1845
|
+
<div class="body">${body}</div>
|
|
1846
|
+
<div class="footer ${align}">${button}</div>
|
|
1847
|
+
<div class="loader">
|
|
1848
|
+
<div class="spinner s28"></div>
|
|
1849
|
+
</div>
|
|
1850
|
+
</div>
|
|
1851
|
+
</form>
|
|
1852
|
+
`;
|
|
1853
|
+
if (!doc) return modal;
|
|
1854
|
+
doc.appendChild(modal);
|
|
1855
|
+
if (width == "auto") {
|
|
1856
|
+
const content2 = modal.querySelector(".content");
|
|
1857
|
+
if (content2) content2.style.maxWidth = `450px`;
|
|
1858
|
+
}
|
|
1859
|
+
window.location.hash = "modal";
|
|
1860
|
+
const content = modal.querySelector(".content");
|
|
1861
|
+
content.classList.add("modal-in");
|
|
1862
|
+
modal.classList.add("overlay-in");
|
|
1863
|
+
content.addEventListener("animationend", () => {
|
|
1864
|
+
if (content.classList.contains("modal-in")) {
|
|
1865
|
+
content.classList.remove("modal-in");
|
|
1866
|
+
modal.classList.remove("overlay-in");
|
|
1867
|
+
}
|
|
1868
|
+
});
|
|
1869
|
+
const hashChange = () => {
|
|
1870
|
+
const hash = window.location.hash.replaceAll("#", "");
|
|
1871
|
+
if (hash != "modal") done();
|
|
1872
|
+
};
|
|
1873
|
+
const done = () => {
|
|
1874
|
+
destroy2(modal);
|
|
1875
|
+
if (window.location.hash == "#modal") history.back();
|
|
1876
|
+
window.removeEventListener("hashchange", hashChange);
|
|
1877
|
+
};
|
|
1878
|
+
window.addEventListener("hashchange", hashChange);
|
|
1879
|
+
const btnExit = modal.querySelector("#btn-exit");
|
|
1880
|
+
const btnCancel = modal.querySelector("#btn-cancel");
|
|
1881
|
+
const btnClose = modal.querySelector("#btn-close");
|
|
1882
|
+
if (btnExit) {
|
|
1883
|
+
btnExit.focus();
|
|
1884
|
+
btnExit.onclick = done;
|
|
1885
|
+
}
|
|
1886
|
+
if (btnCancel) btnCancel.onclick = done;
|
|
1887
|
+
if (btnClose) btnClose.onclick = done;
|
|
1888
|
+
return modal;
|
|
1889
|
+
};
|
|
1890
|
+
var close2 = (modal) => new Promise((resolve) => {
|
|
1891
|
+
modal.querySelector("#btn-exit").click();
|
|
1892
|
+
const content = modal.querySelector(".content");
|
|
1893
|
+
content.addEventListener("animationend", () => resolve());
|
|
2295
1894
|
});
|
|
2296
|
-
var destroy2 = (
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
} else {
|
|
2307
|
-
drawer.style.animation = "slide-out-left 0.4s forwards";
|
|
2308
|
-
drawer.addEventListener("animationend", () => {
|
|
2309
|
-
drawer.remove();
|
|
2310
|
-
});
|
|
2311
|
-
}
|
|
2312
|
-
const modal = document.querySelectorAll(".slim-modal");
|
|
2313
|
-
modal.forEach((el) => el.remove());
|
|
2314
|
-
const dialog = document.querySelectorAll(".slim-dialog");
|
|
2315
|
-
dialog.forEach((el) => el.remove());
|
|
1895
|
+
var destroy2 = (modal) => {
|
|
1896
|
+
const content = modal.querySelector(".content");
|
|
1897
|
+
content.classList.add("modal-out");
|
|
1898
|
+
modal.classList.add("overlay-out");
|
|
1899
|
+
content.addEventListener("animationend", () => {
|
|
1900
|
+
if (content.classList.contains("modal-out")) {
|
|
1901
|
+
modal.style.display = "none";
|
|
1902
|
+
modal.remove();
|
|
1903
|
+
}
|
|
1904
|
+
});
|
|
2316
1905
|
};
|
|
2317
|
-
var
|
|
2318
|
-
const body =
|
|
2319
|
-
const loader =
|
|
2320
|
-
if (body) body.style.
|
|
1906
|
+
var loading5 = (modal) => {
|
|
1907
|
+
const body = modal.querySelector(".body");
|
|
1908
|
+
const loader = modal.querySelector(".loader");
|
|
1909
|
+
if (body) body.style.visibility = "hidden";
|
|
2321
1910
|
if (loader) loader.style.display = "flex";
|
|
2322
1911
|
};
|
|
2323
|
-
var
|
|
2324
|
-
const body =
|
|
2325
|
-
const loader =
|
|
2326
|
-
if (body) body.style.
|
|
1912
|
+
var ready3 = (modal) => {
|
|
1913
|
+
const body = modal.querySelector(".body");
|
|
1914
|
+
const loader = modal.querySelector(".loader");
|
|
1915
|
+
if (body) body.style.visibility = "visible";
|
|
2327
1916
|
if (loader) loader.style.display = "none";
|
|
2328
1917
|
};
|
|
1918
|
+
var hidden = (modal) => {
|
|
1919
|
+
modal.style.display = "none";
|
|
1920
|
+
};
|
|
1921
|
+
var visible = (modal) => {
|
|
1922
|
+
modal.style.display = "block";
|
|
1923
|
+
};
|
|
2329
1924
|
|
|
2330
1925
|
// src/mod/tabs/index.ts
|
|
2331
1926
|
var tabs_exports = {};
|
|
2332
1927
|
__export(tabs_exports, {
|
|
2333
|
-
|
|
1928
|
+
init: () => init2,
|
|
1929
|
+
loading: () => loading6,
|
|
1930
|
+
ready: () => ready4,
|
|
2334
1931
|
setActive: () => setActive
|
|
2335
1932
|
});
|
|
2336
1933
|
var ignore = ["camera", "drawer", "modal"];
|
|
2337
1934
|
var hashIgnore = (hash) => ignore.includes(hash);
|
|
2338
|
-
var
|
|
1935
|
+
var init2 = (tabs, onChange) => {
|
|
2339
1936
|
const tbtn = tabs.querySelectorAll(".tabs-btn");
|
|
2340
1937
|
tbtn.forEach((elm) => {
|
|
2341
1938
|
const dataHash = elm.getAttribute("data-hash");
|
|
@@ -2361,13 +1958,13 @@ var Init = (tabs, onChange) => {
|
|
|
2361
1958
|
elm.classList.remove("active");
|
|
2362
1959
|
}
|
|
2363
1960
|
});
|
|
2364
|
-
|
|
2365
|
-
onChange(index, () =>
|
|
1961
|
+
loading6(tabs, index);
|
|
1962
|
+
onChange(index, () => ready4(tabs, index));
|
|
2366
1963
|
};
|
|
2367
1964
|
tabsChange();
|
|
2368
1965
|
window.onhashchange = tabsChange;
|
|
2369
1966
|
};
|
|
2370
|
-
var
|
|
1967
|
+
var loading6 = (tabs, index) => {
|
|
2371
1968
|
const tbtn = tabs.querySelectorAll(".tabs-btn")[index];
|
|
2372
1969
|
const body = tabs.querySelector(".tabs-body");
|
|
2373
1970
|
const inner = tbtn.querySelectorAll("*");
|
|
@@ -2395,7 +1992,7 @@ var tabsLoading = (tabs, index) => {
|
|
|
2395
1992
|
}
|
|
2396
1993
|
}
|
|
2397
1994
|
};
|
|
2398
|
-
var
|
|
1995
|
+
var ready4 = (tabs, index) => {
|
|
2399
1996
|
const tbtn = tabs.querySelectorAll(".tabs-btn")[index];
|
|
2400
1997
|
const body = tabs.querySelector(".tabs-body");
|
|
2401
1998
|
const inner = tbtn.querySelectorAll("*");
|
|
@@ -2425,10 +2022,10 @@ var setActive = (tbtn, index) => {
|
|
|
2425
2022
|
// src/svchub/oauth/index.ts
|
|
2426
2023
|
var oauth_exports = {};
|
|
2427
2024
|
__export(oauth_exports, {
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2025
|
+
authMW: () => authMW,
|
|
2026
|
+
callback: () => callback,
|
|
2027
|
+
login: () => login,
|
|
2028
|
+
logout: () => logout
|
|
2432
2029
|
});
|
|
2433
2030
|
|
|
2434
2031
|
// src/svchub/oauth/template.ts
|
|
@@ -2448,9 +2045,44 @@ var tempLogout = (
|
|
|
2448
2045
|
`
|
|
2449
2046
|
);
|
|
2450
2047
|
|
|
2048
|
+
// src/svchub/api/auth/index.ts
|
|
2049
|
+
var auth_exports = {};
|
|
2050
|
+
__export(auth_exports, {
|
|
2051
|
+
getToken: () => getToken,
|
|
2052
|
+
getUserInfo: () => getUserInfo
|
|
2053
|
+
});
|
|
2054
|
+
var getToken = (params) => new Promise((resolve, reject) => {
|
|
2055
|
+
fetch(cfg.hub.OAUTH + "/token", {
|
|
2056
|
+
method: "POST",
|
|
2057
|
+
headers: { "Content-Type": "application/json; charset=utf-8" },
|
|
2058
|
+
body: JSON.stringify(params)
|
|
2059
|
+
}).then((resp) => {
|
|
2060
|
+
if (!resp.ok) throw resp;
|
|
2061
|
+
return resp.json();
|
|
2062
|
+
}).then((json) => {
|
|
2063
|
+
resolve(json);
|
|
2064
|
+
}).catch((err) => reject(err));
|
|
2065
|
+
});
|
|
2066
|
+
var getUserInfo = (token) => new Promise((resolve, reject) => {
|
|
2067
|
+
let headers = cfg.api.HEADERS;
|
|
2068
|
+
if (token) headers = new Headers({
|
|
2069
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
2070
|
+
"Authorization": `Bearer ${token}`
|
|
2071
|
+
});
|
|
2072
|
+
fetch(cfg.hub.OAUTH + "/userinfo", {
|
|
2073
|
+
method: "GET",
|
|
2074
|
+
headers
|
|
2075
|
+
}).then((resp) => {
|
|
2076
|
+
if (!resp.ok) throw resp;
|
|
2077
|
+
return resp.json();
|
|
2078
|
+
}).then((json) => {
|
|
2079
|
+
resolve(json);
|
|
2080
|
+
}).catch((err) => reject(err));
|
|
2081
|
+
});
|
|
2082
|
+
|
|
2451
2083
|
// src/svchub/oauth/midware.ts
|
|
2452
2084
|
var IGNORE = ["__NOT_FOUND__", "login", "logout", "callback"];
|
|
2453
|
-
var
|
|
2085
|
+
var authMW = async (route, ignore2) => {
|
|
2454
2086
|
ignore2?.forEach((val) => IGNORE.push(val));
|
|
2455
2087
|
if (IGNORE.includes(route)) {
|
|
2456
2088
|
console.log("ignore :", route);
|
|
@@ -2470,39 +2102,35 @@ var Midware = async (route, ignore2) => {
|
|
|
2470
2102
|
} catch {
|
|
2471
2103
|
gotoLogin();
|
|
2472
2104
|
}
|
|
2473
|
-
|
|
2474
|
-
|
|
2105
|
+
cfg.api.TOKEN = token;
|
|
2106
|
+
cfg.api.HEADERS = new Headers({
|
|
2475
2107
|
"Content-Type": "application/json; charset=utf-8",
|
|
2476
|
-
"Authorization": `Bearer ${
|
|
2108
|
+
"Authorization": `Bearer ${cfg.api.TOKEN}`
|
|
2477
2109
|
});
|
|
2478
2110
|
const session = sessionStorage.getItem("ACCESS_SESSION");
|
|
2479
2111
|
if (!session) {
|
|
2480
|
-
await
|
|
2112
|
+
await getUserInfo().then((resp) => {
|
|
2481
2113
|
const data = resp.data;
|
|
2482
|
-
setProfile(data
|
|
2114
|
+
setProfile(data);
|
|
2483
2115
|
sessionStorage.setItem("ACCESS_SESSION", JSON.stringify(data));
|
|
2484
2116
|
}).catch(() => gotoLogin());
|
|
2485
2117
|
} else {
|
|
2486
2118
|
const data = JSON.parse(session);
|
|
2487
|
-
setProfile(data
|
|
2488
|
-
}
|
|
2489
|
-
};
|
|
2490
|
-
var setProfile = (
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
gbvar.user.PICTURE = profile.picture;
|
|
2500
|
-
gbvar.user.AGCY_NAME = profile.agcy_name;
|
|
2501
|
-
gbvar.user.DVSN_NAME = profile.dvsn_name;
|
|
2502
|
-
gbvar.user.SECT_NAME = profile.sect_name;
|
|
2119
|
+
setProfile(data);
|
|
2120
|
+
}
|
|
2121
|
+
};
|
|
2122
|
+
var setProfile = (user) => {
|
|
2123
|
+
cfg.user.sub = user.sub;
|
|
2124
|
+
cfg.user.name = user.name;
|
|
2125
|
+
cfg.user.utyp = user.utyp;
|
|
2126
|
+
cfg.user.unit = user.unit;
|
|
2127
|
+
cfg.user.unit_id = user.unit_id;
|
|
2128
|
+
cfg.user.role_id = user.role_id;
|
|
2129
|
+
cfg.user.picture = user.picture ? user.picture : "";
|
|
2130
|
+
if (user.metadata) cfg.user.metadata = user.metadata;
|
|
2503
2131
|
};
|
|
2504
2132
|
var gotoLogin = () => {
|
|
2505
|
-
|
|
2133
|
+
clear3();
|
|
2506
2134
|
localStorage.clear();
|
|
2507
2135
|
sessionStorage.clear();
|
|
2508
2136
|
window.location.replace("/login");
|
|
@@ -2511,26 +2139,27 @@ var gotoLogin = () => {
|
|
|
2511
2139
|
|
|
2512
2140
|
// src/svchub/oauth/index.ts
|
|
2513
2141
|
var app8 = document.querySelector("#app");
|
|
2514
|
-
var
|
|
2142
|
+
var login = () => {
|
|
2515
2143
|
clearCache();
|
|
2516
2144
|
const state = Math.random().toString(36).slice(-8);
|
|
2517
2145
|
sessionStorage.setItem("OAUTH_STATE", state);
|
|
2518
2146
|
const query = new URLSearchParams({
|
|
2519
2147
|
response_type: "token",
|
|
2520
|
-
client_id:
|
|
2148
|
+
client_id: cfg.app.UUID,
|
|
2149
|
+
redirect_uri: cfg.app.CALLBACK,
|
|
2521
2150
|
state
|
|
2522
2151
|
}).toString();
|
|
2523
|
-
const url = `${
|
|
2152
|
+
const url = `${cfg.hub.LOGIN}?${query}`;
|
|
2524
2153
|
window.location.replace(url);
|
|
2525
2154
|
};
|
|
2526
|
-
var
|
|
2155
|
+
var logout = () => {
|
|
2527
2156
|
clearCache();
|
|
2528
2157
|
if (!app8) return;
|
|
2529
2158
|
app8.innerHTML = tempLogout;
|
|
2530
2159
|
app8.classList.add("full-page");
|
|
2531
2160
|
const content = app8.querySelector("#content");
|
|
2532
2161
|
const loader = app8.querySelector("#loader");
|
|
2533
|
-
new Promise((r) => setTimeout(r,
|
|
2162
|
+
new Promise((r) => setTimeout(r, 400)).then(() => {
|
|
2534
2163
|
content.style.display = "block";
|
|
2535
2164
|
loader.style.display = "none";
|
|
2536
2165
|
});
|
|
@@ -2538,7 +2167,7 @@ var Logout = () => {
|
|
|
2538
2167
|
window.location.replace("/login");
|
|
2539
2168
|
};
|
|
2540
2169
|
};
|
|
2541
|
-
var
|
|
2170
|
+
var callback = () => {
|
|
2542
2171
|
const search = window.location.search;
|
|
2543
2172
|
const query = new URLSearchParams(search);
|
|
2544
2173
|
const state = query.get("state");
|
|
@@ -2557,7 +2186,7 @@ var Callback = () => {
|
|
|
2557
2186
|
window.location.replace("/");
|
|
2558
2187
|
};
|
|
2559
2188
|
var clearCache = () => {
|
|
2560
|
-
|
|
2189
|
+
clear3();
|
|
2561
2190
|
localStorage.clear();
|
|
2562
2191
|
sessionStorage.clear();
|
|
2563
2192
|
};
|
|
@@ -2565,376 +2194,8 @@ var clearCache = () => {
|
|
|
2565
2194
|
// src/svchub/api/index.ts
|
|
2566
2195
|
var api_exports = {};
|
|
2567
2196
|
__export(api_exports, {
|
|
2568
|
-
|
|
2569
|
-
agcy: () => agcy_exports,
|
|
2570
|
-
dept: () => dept_exports,
|
|
2571
|
-
dvsn: () => dvsn_exports,
|
|
2572
|
-
oauth: () => oauth_exports2,
|
|
2573
|
-
sect: () => sect_exports,
|
|
2574
|
-
stat: () => static_exports
|
|
2575
|
-
});
|
|
2576
|
-
|
|
2577
|
-
// src/svchub/api/static/index.ts
|
|
2578
|
-
var static_exports = {};
|
|
2579
|
-
__export(static_exports, {
|
|
2580
|
-
acrole: () => acrole_exports,
|
|
2581
|
-
actype: () => actype_exports,
|
|
2582
|
-
dvtype: () => dvtype_exports,
|
|
2583
|
-
hmposn: () => hmposn_exports,
|
|
2584
|
-
hmrank: () => hmrank_exports,
|
|
2585
|
-
hmtype: () => hmtype_exports,
|
|
2586
|
-
sctype: () => sctype_exports,
|
|
2587
|
-
vdtype: () => vdtype_exports
|
|
2588
|
-
});
|
|
2589
|
-
|
|
2590
|
-
// src/svchub/api/static/acrole.ts
|
|
2591
|
-
var acrole_exports = {};
|
|
2592
|
-
__export(acrole_exports, {
|
|
2593
|
-
Read: () => Read5,
|
|
2594
|
-
Set: () => Set3
|
|
2595
|
-
});
|
|
2596
|
-
var Read5 = () => new Promise((resolve, reject) => {
|
|
2597
|
-
const url = `/stat/acrole`;
|
|
2598
|
-
fetch(gbvar.hub.API + url, {
|
|
2599
|
-
method: "GET",
|
|
2600
|
-
headers: gbvar.api.HEADERS
|
|
2601
|
-
}).then((resp) => {
|
|
2602
|
-
if (!resp.ok) throw resp;
|
|
2603
|
-
return resp.json();
|
|
2604
|
-
}).then((json) => {
|
|
2605
|
-
resolve(json);
|
|
2606
|
-
}).catch((err) => reject(err));
|
|
2607
|
-
});
|
|
2608
|
-
var Set3 = async (elm) => {
|
|
2609
|
-
elm.innerHTML = '<option value="">- \u0E40\u0E25\u0E37\u0E2D\u0E01 -</option>';
|
|
2610
|
-
await Read5().then((resp) => {
|
|
2611
|
-
const data = resp.data;
|
|
2612
|
-
for (const val of data) {
|
|
2613
|
-
const opt = document.createElement("option");
|
|
2614
|
-
opt.value = `${val.id}`;
|
|
2615
|
-
opt.text = `${val.name}`;
|
|
2616
|
-
elm.appendChild(opt);
|
|
2617
|
-
}
|
|
2618
|
-
}).catch((err) => console.error(err));
|
|
2619
|
-
};
|
|
2620
|
-
|
|
2621
|
-
// src/svchub/api/static/actype.ts
|
|
2622
|
-
var actype_exports = {};
|
|
2623
|
-
__export(actype_exports, {
|
|
2624
|
-
Read: () => Read6,
|
|
2625
|
-
Set: () => Set4
|
|
2626
|
-
});
|
|
2627
|
-
var Read6 = () => new Promise((resolve, reject) => {
|
|
2628
|
-
const url = `/stat/actype`;
|
|
2629
|
-
fetch(gbvar.hub.API + url, {
|
|
2630
|
-
method: "GET",
|
|
2631
|
-
headers: gbvar.api.HEADERS
|
|
2632
|
-
}).then((resp) => {
|
|
2633
|
-
if (!resp.ok) throw resp;
|
|
2634
|
-
return resp.json();
|
|
2635
|
-
}).then((json) => {
|
|
2636
|
-
resolve(json);
|
|
2637
|
-
}).catch((err) => reject(err));
|
|
2638
|
-
});
|
|
2639
|
-
var Set4 = async (elm) => {
|
|
2640
|
-
elm.innerHTML = '<option value="">- \u0E40\u0E25\u0E37\u0E2D\u0E01 -</option>';
|
|
2641
|
-
await Read6().then((resp) => {
|
|
2642
|
-
const data = resp.data;
|
|
2643
|
-
for (const val of data) {
|
|
2644
|
-
const opt = document.createElement("option");
|
|
2645
|
-
opt.value = `${val.id}`;
|
|
2646
|
-
opt.text = `${val.name}`;
|
|
2647
|
-
elm.appendChild(opt);
|
|
2648
|
-
}
|
|
2649
|
-
}).catch((err) => console.error(err));
|
|
2650
|
-
};
|
|
2651
|
-
|
|
2652
|
-
// src/svchub/api/static/dvtype.ts
|
|
2653
|
-
var dvtype_exports = {};
|
|
2654
|
-
__export(dvtype_exports, {
|
|
2655
|
-
Read: () => Read7,
|
|
2656
|
-
Set: () => Set5
|
|
2657
|
-
});
|
|
2658
|
-
var Read7 = () => new Promise((resolve, reject) => {
|
|
2659
|
-
const url = `/stat/dvtype`;
|
|
2660
|
-
fetch(gbvar.hub.API + url, {
|
|
2661
|
-
method: "GET",
|
|
2662
|
-
headers: gbvar.api.HEADERS
|
|
2663
|
-
}).then((resp) => {
|
|
2664
|
-
if (!resp.ok) throw resp;
|
|
2665
|
-
return resp.json();
|
|
2666
|
-
}).then((json) => {
|
|
2667
|
-
resolve(json);
|
|
2668
|
-
}).catch((err) => reject(err));
|
|
2669
|
-
});
|
|
2670
|
-
var Set5 = async (elm) => {
|
|
2671
|
-
elm.innerHTML = '<option value="">- \u0E40\u0E25\u0E37\u0E2D\u0E01 -</option>';
|
|
2672
|
-
await Read7().then((resp) => {
|
|
2673
|
-
const data = resp.data;
|
|
2674
|
-
for (const val of data) {
|
|
2675
|
-
const opt = document.createElement("option");
|
|
2676
|
-
opt.value = `${val.id}`;
|
|
2677
|
-
opt.text = `${val.name}`;
|
|
2678
|
-
elm.appendChild(opt);
|
|
2679
|
-
}
|
|
2680
|
-
}).catch((err) => console.error(err));
|
|
2681
|
-
};
|
|
2682
|
-
|
|
2683
|
-
// src/svchub/api/static/hmtype.ts
|
|
2684
|
-
var hmtype_exports = {};
|
|
2685
|
-
__export(hmtype_exports, {
|
|
2686
|
-
Read: () => Read8,
|
|
2687
|
-
Set: () => Set6
|
|
2688
|
-
});
|
|
2689
|
-
var Read8 = () => new Promise((resolve, reject) => {
|
|
2690
|
-
const url = `/stat/hmtype`;
|
|
2691
|
-
fetch(gbvar.hub.API + url, {
|
|
2692
|
-
method: "GET",
|
|
2693
|
-
headers: gbvar.api.HEADERS
|
|
2694
|
-
}).then((resp) => {
|
|
2695
|
-
if (!resp.ok) throw resp;
|
|
2696
|
-
return resp.json();
|
|
2697
|
-
}).then((json) => {
|
|
2698
|
-
resolve(json);
|
|
2699
|
-
}).catch((err) => reject(err));
|
|
2700
|
-
});
|
|
2701
|
-
var Set6 = async (elm) => {
|
|
2702
|
-
elm.innerHTML = '<option value="">- \u0E40\u0E25\u0E37\u0E2D\u0E01 -</option>';
|
|
2703
|
-
await Read8().then((resp) => {
|
|
2704
|
-
const data = resp.data;
|
|
2705
|
-
for (const val of data) {
|
|
2706
|
-
const opt = document.createElement("option");
|
|
2707
|
-
opt.value = `${val.id}`;
|
|
2708
|
-
opt.text = `${val.name}`;
|
|
2709
|
-
elm.appendChild(opt);
|
|
2710
|
-
}
|
|
2711
|
-
}).catch((err) => console.error(err));
|
|
2712
|
-
};
|
|
2713
|
-
|
|
2714
|
-
// src/svchub/api/static/hmposn.ts
|
|
2715
|
-
var hmposn_exports = {};
|
|
2716
|
-
__export(hmposn_exports, {
|
|
2717
|
-
Read: () => Read9,
|
|
2718
|
-
Set: () => Set7
|
|
2719
|
-
});
|
|
2720
|
-
var Read9 = () => new Promise((resolve, reject) => {
|
|
2721
|
-
const url = `/stat/hmposn`;
|
|
2722
|
-
fetch(gbvar.hub.API + url, {
|
|
2723
|
-
method: "GET",
|
|
2724
|
-
headers: gbvar.api.HEADERS
|
|
2725
|
-
}).then((resp) => {
|
|
2726
|
-
if (!resp.ok) throw resp;
|
|
2727
|
-
return resp.json();
|
|
2728
|
-
}).then((json) => {
|
|
2729
|
-
resolve(json);
|
|
2730
|
-
}).catch((err) => reject(err));
|
|
2731
|
-
});
|
|
2732
|
-
var Set7 = async (elm) => {
|
|
2733
|
-
elm.innerHTML = '<option value="">- \u0E40\u0E25\u0E37\u0E2D\u0E01 -</option>';
|
|
2734
|
-
await Read9().then((resp) => {
|
|
2735
|
-
const data = resp.data;
|
|
2736
|
-
for (const val of data) {
|
|
2737
|
-
const opt = document.createElement("option");
|
|
2738
|
-
opt.value = `${val.id}`;
|
|
2739
|
-
opt.text = `${val.name}`;
|
|
2740
|
-
elm.appendChild(opt);
|
|
2741
|
-
}
|
|
2742
|
-
}).catch((err) => console.error(err));
|
|
2743
|
-
};
|
|
2744
|
-
|
|
2745
|
-
// src/svchub/api/static/hmrank.ts
|
|
2746
|
-
var hmrank_exports = {};
|
|
2747
|
-
__export(hmrank_exports, {
|
|
2748
|
-
Read: () => Read10,
|
|
2749
|
-
Set: () => Set8
|
|
2750
|
-
});
|
|
2751
|
-
var Read10 = () => new Promise((resolve, reject) => {
|
|
2752
|
-
const url = `/stat/hmrank`;
|
|
2753
|
-
fetch(gbvar.hub.API + url, {
|
|
2754
|
-
method: "GET",
|
|
2755
|
-
headers: gbvar.api.HEADERS
|
|
2756
|
-
}).then((resp) => {
|
|
2757
|
-
if (!resp.ok) throw resp;
|
|
2758
|
-
return resp.json();
|
|
2759
|
-
}).then((json) => {
|
|
2760
|
-
resolve(json);
|
|
2761
|
-
}).catch((err) => reject(err));
|
|
2762
|
-
});
|
|
2763
|
-
var Set8 = async (elm) => {
|
|
2764
|
-
elm.innerHTML = '<option value="">- \u0E40\u0E25\u0E37\u0E2D\u0E01 -</option>';
|
|
2765
|
-
await Read10().then((resp) => {
|
|
2766
|
-
const data = resp.data;
|
|
2767
|
-
for (const val of data) {
|
|
2768
|
-
const opt = document.createElement("option");
|
|
2769
|
-
opt.value = `${val.id}`;
|
|
2770
|
-
opt.text = `${val.name}`;
|
|
2771
|
-
elm.appendChild(opt);
|
|
2772
|
-
}
|
|
2773
|
-
}).catch((err) => console.error(err));
|
|
2774
|
-
};
|
|
2775
|
-
|
|
2776
|
-
// src/svchub/api/static/sctype.ts
|
|
2777
|
-
var sctype_exports = {};
|
|
2778
|
-
__export(sctype_exports, {
|
|
2779
|
-
Read: () => Read11,
|
|
2780
|
-
Set: () => Set9
|
|
2781
|
-
});
|
|
2782
|
-
var Read11 = () => new Promise((resolve, reject) => {
|
|
2783
|
-
const url = `/stat/sctype`;
|
|
2784
|
-
fetch(gbvar.hub.API + url, {
|
|
2785
|
-
method: "GET",
|
|
2786
|
-
headers: gbvar.api.HEADERS
|
|
2787
|
-
}).then((resp) => {
|
|
2788
|
-
if (!resp.ok) throw resp;
|
|
2789
|
-
return resp.json();
|
|
2790
|
-
}).then((json) => {
|
|
2791
|
-
resolve(json);
|
|
2792
|
-
}).catch((err) => reject(err));
|
|
2793
|
-
});
|
|
2794
|
-
var Set9 = async (elm) => {
|
|
2795
|
-
elm.innerHTML = '<option value="">- \u0E40\u0E25\u0E37\u0E2D\u0E01 -</option>';
|
|
2796
|
-
await Read11().then((resp) => {
|
|
2797
|
-
const data = resp.data;
|
|
2798
|
-
for (const val of data) {
|
|
2799
|
-
const opt = document.createElement("option");
|
|
2800
|
-
opt.value = `${val.id}`;
|
|
2801
|
-
opt.text = `${val.name}`;
|
|
2802
|
-
elm.appendChild(opt);
|
|
2803
|
-
}
|
|
2804
|
-
}).catch((err) => console.error(err));
|
|
2805
|
-
};
|
|
2806
|
-
|
|
2807
|
-
// src/svchub/api/static/vdtype.ts
|
|
2808
|
-
var vdtype_exports = {};
|
|
2809
|
-
__export(vdtype_exports, {
|
|
2810
|
-
Read: () => Read12,
|
|
2811
|
-
Set: () => Set10
|
|
2812
|
-
});
|
|
2813
|
-
var Read12 = () => new Promise((resolve, reject) => {
|
|
2814
|
-
const url = `/stat/vdtype`;
|
|
2815
|
-
fetch(gbvar.hub.API + url, {
|
|
2816
|
-
method: "GET",
|
|
2817
|
-
headers: gbvar.api.HEADERS
|
|
2818
|
-
}).then((resp) => {
|
|
2819
|
-
if (!resp.ok) throw resp;
|
|
2820
|
-
return resp.json();
|
|
2821
|
-
}).then((json) => {
|
|
2822
|
-
resolve(json);
|
|
2823
|
-
}).catch((err) => reject(err));
|
|
2824
|
-
});
|
|
2825
|
-
var Set10 = async (elm) => {
|
|
2826
|
-
elm.innerHTML = '<option value="">- \u0E40\u0E25\u0E37\u0E2D\u0E01 -</option>';
|
|
2827
|
-
await Read12().then((resp) => {
|
|
2828
|
-
const data = resp.data;
|
|
2829
|
-
for (const val of data) {
|
|
2830
|
-
const opt = document.createElement("option");
|
|
2831
|
-
opt.value = `${val.id}`;
|
|
2832
|
-
opt.text = `${val.name}`;
|
|
2833
|
-
elm.appendChild(opt);
|
|
2834
|
-
}
|
|
2835
|
-
}).catch((err) => console.error(err));
|
|
2836
|
-
};
|
|
2837
|
-
|
|
2838
|
-
// src/svchub/api/oauth/index.ts
|
|
2839
|
-
var oauth_exports2 = {};
|
|
2840
|
-
__export(oauth_exports2, {
|
|
2841
|
-
Token: () => Token,
|
|
2842
|
-
UserInfo: () => UserInfo
|
|
2843
|
-
});
|
|
2844
|
-
var Token = (params) => new Promise((resolve, reject) => {
|
|
2845
|
-
fetch(gbvar.hub.OAUTH + "/token", {
|
|
2846
|
-
method: "POST",
|
|
2847
|
-
headers: { "Content-Type": "application/json; charset=utf-8" },
|
|
2848
|
-
body: JSON.stringify(params)
|
|
2849
|
-
}).then((resp) => {
|
|
2850
|
-
if (!resp.ok) throw resp;
|
|
2851
|
-
return resp.json();
|
|
2852
|
-
}).then((json) => {
|
|
2853
|
-
resolve(json);
|
|
2854
|
-
}).catch((err) => reject(err));
|
|
2855
|
-
});
|
|
2856
|
-
var UserInfo = (token) => new Promise((resolve, reject) => {
|
|
2857
|
-
let headers = gbvar.api.HEADERS;
|
|
2858
|
-
if (token) headers = new Headers({
|
|
2859
|
-
"Content-Type": "application/json; charset=utf-8",
|
|
2860
|
-
"Authorization": `Bearer ${token}`
|
|
2861
|
-
});
|
|
2862
|
-
fetch(gbvar.hub.OAUTH + "/userinfo", {
|
|
2863
|
-
method: "GET",
|
|
2864
|
-
headers
|
|
2865
|
-
}).then((resp) => {
|
|
2866
|
-
if (!resp.ok) throw resp;
|
|
2867
|
-
return resp.json();
|
|
2868
|
-
}).then((json) => {
|
|
2869
|
-
resolve(json);
|
|
2870
|
-
}).catch((err) => reject(err));
|
|
2871
|
-
});
|
|
2872
|
-
|
|
2873
|
-
// src/svchub/api/agency/dvsn.ts
|
|
2874
|
-
var dvsn_exports = {};
|
|
2875
|
-
__export(dvsn_exports, {
|
|
2876
|
-
Read: () => Read13,
|
|
2877
|
-
Set: () => Set11
|
|
2878
|
-
});
|
|
2879
|
-
var Read13 = (agcy, dvsn) => new Promise((resolve, reject) => {
|
|
2880
|
-
let url = `/agcy/${agcy}/dvsn`;
|
|
2881
|
-
if (dvsn) url = `/agcy/${agcy}/dvsn/${dvsn}`;
|
|
2882
|
-
fetch(gbvar.hub.API + url, {
|
|
2883
|
-
method: "GET",
|
|
2884
|
-
headers: gbvar.api.HEADERS
|
|
2885
|
-
}).then((resp) => {
|
|
2886
|
-
if (!resp.ok) throw resp;
|
|
2887
|
-
return resp.json();
|
|
2888
|
-
}).then((json) => {
|
|
2889
|
-
resolve(json);
|
|
2890
|
-
}).catch((err) => reject(err));
|
|
2197
|
+
auth: () => auth_exports
|
|
2891
2198
|
});
|
|
2892
|
-
var Set11 = async (agcy, elm) => {
|
|
2893
|
-
elm.innerHTML = '<option value="">- \u0E40\u0E25\u0E37\u0E2D\u0E01 -</option>';
|
|
2894
|
-
await Read13(agcy).then((resp) => {
|
|
2895
|
-
const data = resp.data;
|
|
2896
|
-
for (const val of data) {
|
|
2897
|
-
const name = val.short ? val.short : val.name;
|
|
2898
|
-
const opt = document.createElement("option");
|
|
2899
|
-
opt.value = `${val.id}`;
|
|
2900
|
-
opt.text = name;
|
|
2901
|
-
elm.appendChild(opt);
|
|
2902
|
-
}
|
|
2903
|
-
}).catch((err) => console.error(err));
|
|
2904
|
-
};
|
|
2905
|
-
|
|
2906
|
-
// src/svchub/api/agency/sect.ts
|
|
2907
|
-
var sect_exports = {};
|
|
2908
|
-
__export(sect_exports, {
|
|
2909
|
-
Read: () => Read14,
|
|
2910
|
-
Set: () => Set12
|
|
2911
|
-
});
|
|
2912
|
-
var Read14 = (agcy, dvsn, sect) => new Promise((resolve, reject) => {
|
|
2913
|
-
let url = `/agcy/${agcy}/dvsn/${dvsn}/sect`;
|
|
2914
|
-
if (sect) url = `/agcy/${agcy}/dvsn/${dvsn}/sect/${sect}`;
|
|
2915
|
-
fetch(gbvar.hub.API + url, {
|
|
2916
|
-
method: "GET",
|
|
2917
|
-
headers: gbvar.api.HEADERS
|
|
2918
|
-
}).then((resp) => {
|
|
2919
|
-
if (!resp.ok) throw resp;
|
|
2920
|
-
return resp.json();
|
|
2921
|
-
}).then((json) => {
|
|
2922
|
-
resolve(json);
|
|
2923
|
-
}).catch((err) => reject(err));
|
|
2924
|
-
});
|
|
2925
|
-
var Set12 = async (agcy, dvsn, elm) => {
|
|
2926
|
-
elm.innerHTML = '<option value="">- \u0E40\u0E25\u0E37\u0E2D\u0E01 -</option>';
|
|
2927
|
-
await Read14(agcy, dvsn).then((resp) => {
|
|
2928
|
-
const data = resp.data;
|
|
2929
|
-
for (const val of data) {
|
|
2930
|
-
const name = val.short ? val.short : val.name;
|
|
2931
|
-
const opt = document.createElement("option");
|
|
2932
|
-
opt.value = `${val.id}`;
|
|
2933
|
-
opt.text = name;
|
|
2934
|
-
elm.appendChild(opt);
|
|
2935
|
-
}
|
|
2936
|
-
}).catch((err) => console.error(err));
|
|
2937
|
-
};
|
|
2938
2199
|
|
|
2939
2200
|
// src/svchub/wss/index.ts
|
|
2940
2201
|
var wss_exports = {};
|
|
@@ -2944,25 +2205,25 @@ __export(wss_exports, {
|
|
|
2944
2205
|
});
|
|
2945
2206
|
var newTask = (worker) => {
|
|
2946
2207
|
if (!window.Worker) return;
|
|
2947
|
-
|
|
2948
|
-
|
|
2208
|
+
cfg.hub.TASK = new worker();
|
|
2209
|
+
cfg.hub.TASK.postMessage({
|
|
2949
2210
|
head: "INIT",
|
|
2950
2211
|
data: {
|
|
2951
|
-
url:
|
|
2952
|
-
app:
|
|
2953
|
-
uid:
|
|
2954
|
-
ver:
|
|
2212
|
+
url: cfg.hub.WSS,
|
|
2213
|
+
app: cfg.app.NAME,
|
|
2214
|
+
uid: cfg.app.UUID,
|
|
2215
|
+
ver: cfg.app.VERSION
|
|
2955
2216
|
}
|
|
2956
2217
|
});
|
|
2957
|
-
|
|
2218
|
+
cfg.hub.TASK.addEventListener("message", (e) => {
|
|
2958
2219
|
const json = e.data;
|
|
2959
2220
|
const head = json.head ? json.head : "";
|
|
2960
2221
|
const data = json.data ? json.data : "";
|
|
2961
2222
|
if (head == "ACCEPT") {
|
|
2962
2223
|
rspAccept(data);
|
|
2963
|
-
|
|
2224
|
+
cfg.hub.TASK?.postMessage({
|
|
2964
2225
|
head: "VERIFY",
|
|
2965
|
-
data:
|
|
2226
|
+
data: cfg.api.TOKEN
|
|
2966
2227
|
});
|
|
2967
2228
|
}
|
|
2968
2229
|
if (head == "DISCON") rspDiscon();
|
|
@@ -2975,11 +2236,11 @@ var newTask = (worker) => {
|
|
|
2975
2236
|
};
|
|
2976
2237
|
var checkUpdate = (min = 10) => {
|
|
2977
2238
|
return setInterval(() => {
|
|
2978
|
-
|
|
2239
|
+
cfg.hub.TASK?.postMessage({
|
|
2979
2240
|
head: "LATEST",
|
|
2980
2241
|
data: {
|
|
2981
|
-
app:
|
|
2982
|
-
uid:
|
|
2242
|
+
app: cfg.app.NAME,
|
|
2243
|
+
uid: cfg.app.UUID
|
|
2983
2244
|
}
|
|
2984
2245
|
});
|
|
2985
2246
|
}, 1e3 * 60 * min);
|
|
@@ -2987,30 +2248,30 @@ var checkUpdate = (min = 10) => {
|
|
|
2987
2248
|
var rspBrdMsg = (brd) => {
|
|
2988
2249
|
if (brd.cmd == "LOGS") console.log(brd.msg);
|
|
2989
2250
|
if (brd.cmd == "TIME") setTime(brd.msg);
|
|
2990
|
-
if (brd.cmd == "RESULT" && brd.to ==
|
|
2251
|
+
if (brd.cmd == "RESULT" && brd.to == cfg.hub.UUID) {
|
|
2991
2252
|
console.log(brd.cmd, "From:", brd.from);
|
|
2992
2253
|
console.log(brd.msg);
|
|
2993
2254
|
}
|
|
2994
|
-
if (brd.cmd == "CONRST" && (brd.to ==
|
|
2255
|
+
if (brd.cmd == "CONRST" && (brd.to == cfg.hub.UUID || brd.to == "@all")) {
|
|
2995
2256
|
sessionStorage.clear();
|
|
2996
2257
|
window.location.reload();
|
|
2997
2258
|
}
|
|
2998
|
-
if (brd.cmd == "LOGOUT" && (brd.to ==
|
|
2259
|
+
if (brd.cmd == "LOGOUT" && (brd.to == cfg.hub.UUID || brd.to == "@all")) {
|
|
2999
2260
|
localStorage.clear();
|
|
3000
2261
|
sessionStorage.clear();
|
|
3001
2262
|
window.location.reload();
|
|
3002
2263
|
}
|
|
3003
|
-
if (brd.cmd == "NOTIFY" && (brd.to ==
|
|
2264
|
+
if (brd.cmd == "NOTIFY" && (brd.to == cfg.hub.UUID || brd.to == "@all")) {
|
|
3004
2265
|
brdNotify(brd.msg);
|
|
3005
2266
|
}
|
|
3006
2267
|
if (brd.cmd == "") console.log(brd.msg);
|
|
3007
2268
|
};
|
|
3008
2269
|
var rspAccept = (data) => {
|
|
3009
|
-
|
|
3010
|
-
console.log("hub-uuid:",
|
|
2270
|
+
cfg.hub.UUID = data.uuid ? data.uuid : "";
|
|
2271
|
+
console.log("hub-uuid:", cfg.hub.UUID);
|
|
3011
2272
|
const boxTime = document.querySelector("#topbar #box-time");
|
|
3012
2273
|
if (boxTime) boxTime.classList.remove("offline");
|
|
3013
|
-
|
|
2274
|
+
toast("\u0E40\u0E0A\u0E37\u0E48\u0E2D\u0E21\u0E15\u0E48\u0E2D Server \u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08.!", { type: "success" });
|
|
3014
2275
|
};
|
|
3015
2276
|
var rspDiscon = () => {
|
|
3016
2277
|
const boxTime = document.querySelector("#topbar #box-time");
|
|
@@ -3021,23 +2282,23 @@ var rspDiscon = () => {
|
|
|
3021
2282
|
if (svTime) svTime.innerText = "server";
|
|
3022
2283
|
if (svDate) svDate.innerText = "OFFLINE";
|
|
3023
2284
|
}
|
|
3024
|
-
|
|
2285
|
+
toast("\u0E02\u0E32\u0E14\u0E01\u0E32\u0E23\u0E40\u0E0A\u0E37\u0E48\u0E2D\u0E21\u0E15\u0E48\u0E2D Server.!", { type: "failure" });
|
|
3025
2286
|
};
|
|
3026
2287
|
var rspLatest = (data) => {
|
|
3027
|
-
if (
|
|
2288
|
+
if (cfg.app.UUID == data.appuuid && cfg.app.NAME == data.appname) {
|
|
3028
2289
|
const path = window.location.pathname;
|
|
3029
|
-
if (path != "/changelog" &&
|
|
2290
|
+
if (path != "/changelog" && cfg.app.RELEASE != data.release) {
|
|
3030
2291
|
window.location.replace("/changelog");
|
|
3031
2292
|
}
|
|
3032
2293
|
}
|
|
3033
2294
|
};
|
|
3034
2295
|
var setTime = (data) => {
|
|
3035
2296
|
if (typeof data.unix != "number") return;
|
|
3036
|
-
|
|
2297
|
+
cfg.UNIX_TIME = Number(data.unix);
|
|
3037
2298
|
const svTime = document.querySelector("#topbar #box-time #sv-time");
|
|
3038
2299
|
const svDate = document.querySelector("#topbar #box-time #sv-date");
|
|
3039
2300
|
if (svTime && svDate) {
|
|
3040
|
-
const [date, time] = timeToStr(
|
|
2301
|
+
const [date, time] = timeToStr(cfg.UNIX_TIME).split(" ");
|
|
3041
2302
|
svTime.innerText = time;
|
|
3042
2303
|
svDate.innerText = thaiDate(date, 11);
|
|
3043
2304
|
}
|
|
@@ -3055,8 +2316,8 @@ var brdNotify = (data) => {
|
|
|
3055
2316
|
};
|
|
3056
2317
|
export {
|
|
3057
2318
|
api_exports as apiHub,
|
|
2319
|
+
cfg,
|
|
3058
2320
|
docs_exports as docs,
|
|
3059
|
-
gbvar,
|
|
3060
2321
|
info,
|
|
3061
2322
|
init,
|
|
3062
2323
|
lib_exports as lib,
|