slimsdk 0.1.55 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -5
- package/dist/desktop/index.css +0 -48
- package/dist/desktop/index.css.map +1 -1
- package/dist/desktop/index.d.ts +14 -13
- package/dist/desktop/index.js +1476 -1972
- package/dist/desktop/index.js.map +1 -1
- package/dist/docs-BHtSyl34.d.ts +10 -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-COGi5mfY.d.ts +28 -0
- package/dist/index-COUeXLOQ.d.ts +3 -0
- package/dist/index-CoYHkkyT.d.ts +14 -0
- package/dist/{index-kr8P3eEW.d.ts → index-Cvng8f_u.d.ts} +10 -9
- package/dist/index-D5CUpF9v.d.ts +10 -0
- package/dist/index-DBhzpIiB.d.ts +32 -0
- package/dist/index-D_o5c-YA.d.ts +134 -0
- 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 +194 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/mobile/index.css +0 -48
- package/dist/mobile/index.css.map +1 -1
- package/dist/mobile/index.d.ts +13 -12
- package/dist/mobile/index.js +542 -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/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/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/svchub/index.d.ts +2 -0
- package/dist/svchub/index.js +760 -0
- package/dist/svchub/index.js.map +1 -0
- package/dist/worker/hubworker.js +1 -1
- package/dist/worker/hubworker.js.map +1 -1
- package/package.json +7 -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 +0 -117
- package/dist/mod/global/index.js.map +0 -1
- package/dist/mod/hwlink/index.d.ts +0 -3
- package/dist/mod/hwlink/index.js +0 -873
- package/dist/mod/hwlink/index.js.map +0 -1
- package/dist/mod/hwlink/style.css +0 -1134
- package/dist/mod/hwlink/style.css.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.1
|
|
8
|
+
var version = "0.2.1";
|
|
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}`;
|
|
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);
|
|
911
372
|
};
|
|
912
|
-
var
|
|
913
|
-
const
|
|
914
|
-
const
|
|
915
|
-
if (
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
return dt.getFullYear();
|
|
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);
|
|
919
379
|
};
|
|
920
|
-
var
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
const
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
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();
|
|
938
412
|
};
|
|
939
|
-
var
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
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
|
+
};
|
|
949
430
|
};
|
|
950
|
-
var
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
option.text = `${txt} ${y + 543}`;
|
|
962
|
-
el.appendChild(option);
|
|
963
|
-
}
|
|
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
|
+
});
|
|
964
442
|
};
|
|
965
|
-
|
|
966
|
-
if (
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
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);
|
|
972
468
|
}
|
|
973
|
-
const
|
|
974
|
-
if (
|
|
975
|
-
const yy = dt.getFullYear() + 543;
|
|
976
|
-
const mm = String(dt.getMonth() + 1).padStart(2, "0");
|
|
977
|
-
const dd = String(dt.getDate()).padStart(2, "0");
|
|
978
|
-
const H = String(dt.getHours()).padStart(2, "0");
|
|
979
|
-
const M = String(dt.getMinutes()).padStart(2, "0");
|
|
980
|
-
const S = String(dt.getSeconds()).padStart(2, "0");
|
|
981
|
-
if (format == 0) return `${dd}/${mm}/${yy}`;
|
|
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 "";
|
|
469
|
+
const content = app3.querySelector("#app-content");
|
|
470
|
+
if (content) content.style.display = "none";
|
|
992
471
|
};
|
|
993
|
-
var
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
}
|
|
997
|
-
if (!stop || stop.indexOf("0000-00-00") >= 0) {
|
|
998
|
-
return 0;
|
|
999
|
-
}
|
|
1000
|
-
const [y1, m1, d1] = start.split("-");
|
|
1001
|
-
const [y2, m2, d2] = stop.split("-");
|
|
1002
|
-
const date1 = new Date(Number(y1), Number(m1) - 1, Number(d1)).getTime();
|
|
1003
|
-
const date2 = new Date(Number(y2), Number(m2) - 1, Number(d2)).getTime();
|
|
1004
|
-
return Math.round((date2 - date1) / (1e3 * 60 * 60 * 24));
|
|
472
|
+
var ready = (delay = 400) => {
|
|
473
|
+
new Promise((r) => setTimeout(r, delay)).then(() => {
|
|
474
|
+
clearLoader(true);
|
|
475
|
+
});
|
|
1005
476
|
};
|
|
1006
|
-
var
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
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 };
|
|
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;
|
|
1025
490
|
};
|
|
1026
|
-
var
|
|
1027
|
-
if (!
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
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
|
-
};
|
|
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
|
+
`;
|
|
1063
501
|
};
|
|
1064
|
-
var
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
const dd = String(dt.getDate()).padStart(2, "0");
|
|
1076
|
-
return `${yy}-${mm}-${dd}`;
|
|
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
|
+
`;
|
|
1077
513
|
};
|
|
1078
|
-
var
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
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);
|
|
1087
530
|
};
|
|
1088
|
-
var
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
return `${yy}-${mm}-${dd}`;
|
|
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 = "";
|
|
1097
539
|
};
|
|
1098
|
-
var
|
|
1099
|
-
|
|
1100
|
-
const
|
|
1101
|
-
if (
|
|
1102
|
-
|
|
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();
|
|
1103
546
|
}
|
|
1104
|
-
|
|
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,526 @@ 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
|
-
|
|
719
|
+
app4.querySelector("#mem").innerText = `: ${mem_text}`;
|
|
720
|
+
app4.querySelector("#uptime").innerText = `: ${hh} h ${mm} m`;
|
|
721
|
+
};
|
|
722
|
+
|
|
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();
|
|
740
|
+
} else {
|
|
741
|
+
app5.classList.remove("full-page");
|
|
742
|
+
if (!document.querySelector("#topbar")) {
|
|
743
|
+
navCreate({ topbar, sidebar });
|
|
744
|
+
newNav = true;
|
|
745
|
+
}
|
|
746
|
+
navActive(uri);
|
|
747
|
+
}
|
|
748
|
+
return newNav;
|
|
749
|
+
};
|
|
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();
|
|
778
|
+
};
|
|
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();
|
|
784
|
+
};
|
|
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
|
+
}
|
|
803
|
+
}
|
|
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
|
+
}
|
|
814
|
+
});
|
|
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");
|
|
832
|
+
} else {
|
|
833
|
+
sidebar.classList.remove("menu-out");
|
|
834
|
+
sidebar.classList.add("menu-in");
|
|
835
|
+
}
|
|
836
|
+
};
|
|
837
|
+
} else {
|
|
838
|
+
navMenu2.onclick = null;
|
|
839
|
+
sidebar.classList.remove("menu-in");
|
|
840
|
+
sidebar.classList.remove("menu-out");
|
|
841
|
+
}
|
|
842
|
+
};
|
|
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();
|
|
868
|
+
};
|
|
869
|
+
ws.onopen = () => {
|
|
870
|
+
ws.close();
|
|
871
|
+
winPopup(500, 485, "hwlink", "/hwlink");
|
|
872
|
+
done();
|
|
873
|
+
};
|
|
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);
|
|
889
|
+
};
|
|
1448
890
|
};
|
|
1449
|
-
var
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
if (
|
|
1455
|
-
|
|
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";
|
|
1456
904
|
}
|
|
1457
|
-
app5.querySelector("#agcy").innerText = `: ${data.agcy_name}`;
|
|
1458
|
-
app5.querySelector("#dept").innerText = `: ${dept}`;
|
|
1459
|
-
app5.querySelector("#dname").innerText = `: ${data.acname}`;
|
|
1460
905
|
};
|
|
906
|
+
window.addEventListener("online", onlineStatus);
|
|
907
|
+
window.addEventListener("offline", onlineStatus);
|
|
1461
908
|
|
|
1462
|
-
// src/
|
|
1463
|
-
var
|
|
1464
|
-
__export(
|
|
1465
|
-
|
|
909
|
+
// src/page/docs.ts
|
|
910
|
+
var docs_exports = {};
|
|
911
|
+
__export(docs_exports, {
|
|
912
|
+
changelog: () => changelog,
|
|
913
|
+
privacy: () => privacy
|
|
1466
914
|
});
|
|
1467
|
-
var
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
btn.style.pointerEvents = "";
|
|
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;
|
|
1482
929
|
}
|
|
930
|
+
return "";
|
|
1483
931
|
};
|
|
1484
932
|
|
|
1485
|
-
// src/
|
|
1486
|
-
var
|
|
1487
|
-
__export(
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
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
|
+
md5Hash: () => md5Hash,
|
|
955
|
+
numFormat: () => numFormat,
|
|
956
|
+
setYear: () => setYear,
|
|
957
|
+
shiftIndex: () => shiftIndex,
|
|
958
|
+
strCheck: () => strCheck,
|
|
959
|
+
strFormat: () => strFormat,
|
|
960
|
+
thaiDate: () => thaiDate,
|
|
961
|
+
thaiDigit: () => thaiDigit,
|
|
962
|
+
thbText: () => thbText,
|
|
963
|
+
timeDiff: () => timeDiff,
|
|
964
|
+
timeToStr: () => timeToStr,
|
|
965
|
+
toBase64: () => toBase64,
|
|
966
|
+
toDbDate: () => toDbDate,
|
|
967
|
+
toThaiDate: () => toThaiDate,
|
|
968
|
+
winPopup: () => winPopup,
|
|
969
|
+
zeroFill: () => zeroFill
|
|
1492
970
|
});
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
971
|
+
|
|
972
|
+
// src/lib/dateTime.ts
|
|
973
|
+
var TH_MONTH = [
|
|
974
|
+
"\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21",
|
|
975
|
+
"\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C",
|
|
976
|
+
"\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21",
|
|
977
|
+
"\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19",
|
|
978
|
+
"\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21",
|
|
979
|
+
"\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19",
|
|
980
|
+
"\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21",
|
|
981
|
+
"\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21",
|
|
982
|
+
"\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19",
|
|
983
|
+
"\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21",
|
|
984
|
+
"\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19",
|
|
985
|
+
"\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21"
|
|
986
|
+
];
|
|
987
|
+
var TH_MONTH_SHORT = [
|
|
988
|
+
"\u0E21.\u0E04.",
|
|
989
|
+
"\u0E01.\u0E1E.",
|
|
990
|
+
"\u0E21\u0E35.\u0E04.",
|
|
991
|
+
"\u0E40\u0E21.\u0E22.",
|
|
992
|
+
"\u0E1E.\u0E04.",
|
|
993
|
+
"\u0E21\u0E34.\u0E22.",
|
|
994
|
+
"\u0E01.\u0E04.",
|
|
995
|
+
"\u0E2A.\u0E04.",
|
|
996
|
+
"\u0E01.\u0E22.",
|
|
997
|
+
"\u0E15.\u0E04.",
|
|
998
|
+
"\u0E1E.\u0E22.",
|
|
999
|
+
"\u0E18.\u0E04."
|
|
1000
|
+
];
|
|
1001
|
+
var FY_MONTH = [
|
|
1002
|
+
"\u0E15\u0E38\u0E25\u0E32\u0E04\u0E21",
|
|
1003
|
+
"\u0E1E\u0E24\u0E28\u0E08\u0E34\u0E01\u0E32\u0E22\u0E19",
|
|
1004
|
+
"\u0E18\u0E31\u0E19\u0E27\u0E32\u0E04\u0E21",
|
|
1005
|
+
"\u0E21\u0E01\u0E23\u0E32\u0E04\u0E21",
|
|
1006
|
+
"\u0E01\u0E38\u0E21\u0E20\u0E32\u0E1E\u0E31\u0E19\u0E18\u0E4C",
|
|
1007
|
+
"\u0E21\u0E35\u0E19\u0E32\u0E04\u0E21",
|
|
1008
|
+
"\u0E40\u0E21\u0E29\u0E32\u0E22\u0E19",
|
|
1009
|
+
"\u0E1E\u0E24\u0E29\u0E20\u0E32\u0E04\u0E21",
|
|
1010
|
+
"\u0E21\u0E34\u0E16\u0E38\u0E19\u0E32\u0E22\u0E19",
|
|
1011
|
+
"\u0E01\u0E23\u0E01\u0E0E\u0E32\u0E04\u0E21",
|
|
1012
|
+
"\u0E2A\u0E34\u0E07\u0E2B\u0E32\u0E04\u0E21",
|
|
1013
|
+
"\u0E01\u0E31\u0E19\u0E22\u0E32\u0E22\u0E19"
|
|
1014
|
+
];
|
|
1015
|
+
var FY_MONTH_SHORT = [
|
|
1016
|
+
"\u0E15.\u0E04.",
|
|
1017
|
+
"\u0E1E.\u0E22.",
|
|
1018
|
+
"\u0E18.\u0E04.",
|
|
1019
|
+
"\u0E21.\u0E04.",
|
|
1020
|
+
"\u0E01.\u0E1E.",
|
|
1021
|
+
"\u0E21\u0E35.\u0E04.",
|
|
1022
|
+
"\u0E40\u0E21.\u0E22.",
|
|
1023
|
+
"\u0E1E.\u0E04.",
|
|
1024
|
+
"\u0E21\u0E34.\u0E22.",
|
|
1025
|
+
"\u0E01.\u0E04.",
|
|
1026
|
+
"\u0E2A.\u0E04.",
|
|
1027
|
+
"\u0E01.\u0E22."
|
|
1028
|
+
];
|
|
1029
|
+
var PERIOD_TEXT = ["", "\u0E40\u0E27\u0E23\u0E14\u0E36\u0E01", "\u0E40\u0E27\u0E23\u0E40\u0E0A\u0E49\u0E32", "\u0E40\u0E27\u0E23\u0E1A\u0E48\u0E32\u0E22"];
|
|
1030
|
+
var curTime = () => (/* @__PURE__ */ new Date()).getTime();
|
|
1031
|
+
var curDate = () => {
|
|
1032
|
+
const dt = /* @__PURE__ */ new Date();
|
|
1033
|
+
const yy = dt.getFullYear();
|
|
1034
|
+
const mm = String(dt.getMonth() + 1).padStart(2, "0");
|
|
1035
|
+
const dd = String(dt.getDate()).padStart(2, "0");
|
|
1036
|
+
return `${yy}-${mm}-${dd}`;
|
|
1538
1037
|
};
|
|
1539
|
-
var
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
content.style.animation = "";
|
|
1545
|
-
content.style.display = "";
|
|
1546
|
-
};
|
|
1547
|
-
} else {
|
|
1548
|
-
Clear();
|
|
1549
|
-
content.style.animation = "fade-in 0.4s forwards";
|
|
1550
|
-
content.style.display = "block";
|
|
1551
|
-
content.onanimationend = () => {
|
|
1552
|
-
content.style.animation = "";
|
|
1553
|
-
};
|
|
1554
|
-
}
|
|
1555
|
-
};
|
|
1038
|
+
var curMonth = () => {
|
|
1039
|
+
const dt = /* @__PURE__ */ new Date();
|
|
1040
|
+
const yy = dt.getFullYear();
|
|
1041
|
+
const mm = String(dt.getMonth() + 1).padStart(2, "0");
|
|
1042
|
+
return `${yy}-${mm}`;
|
|
1556
1043
|
};
|
|
1557
|
-
var
|
|
1558
|
-
const
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
el.style.display = "";
|
|
1565
|
-
};
|
|
1566
|
-
}
|
|
1567
|
-
});
|
|
1044
|
+
var curYear = (yearType = "") => {
|
|
1045
|
+
const dt = /* @__PURE__ */ new Date();
|
|
1046
|
+
const mm = dt.getMonth() + 1;
|
|
1047
|
+
if ((yearType == "fyear" || yearType == "fy") && mm > 9) {
|
|
1048
|
+
return dt.getFullYear() + 1;
|
|
1049
|
+
}
|
|
1050
|
+
return dt.getFullYear();
|
|
1568
1051
|
};
|
|
1569
|
-
|
|
1570
|
-
if (
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
const
|
|
1578
|
-
const
|
|
1579
|
-
const
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
const content = document.createElement("div");
|
|
1583
|
-
content.id = "app-content";
|
|
1584
|
-
content.innerHTML = template2;
|
|
1585
|
-
app6.appendChild(content);
|
|
1586
|
-
let newNav = false;
|
|
1587
|
-
if (size == "full") {
|
|
1588
|
-
app6.classList.add("full-page");
|
|
1589
|
-
navRemove();
|
|
1590
|
-
} else {
|
|
1591
|
-
app6.classList.remove("full-page");
|
|
1592
|
-
if (!document.querySelector("#topbar")) {
|
|
1593
|
-
navCreate({ topbar, sidebar });
|
|
1594
|
-
newNav = true;
|
|
1595
|
-
}
|
|
1596
|
-
navActive(uri);
|
|
1052
|
+
var timeToStr = (unixtime, format = "") => {
|
|
1053
|
+
if (typeof unixtime != "number") {
|
|
1054
|
+
return "";
|
|
1055
|
+
}
|
|
1056
|
+
const unix = new Date(Number(unixtime));
|
|
1057
|
+
const yy = unix.getFullYear();
|
|
1058
|
+
const mm = String(unix.getMonth() + 1).padStart(2, "0");
|
|
1059
|
+
const dd = String(unix.getDate()).padStart(2, "0");
|
|
1060
|
+
const H = String(unix.getHours()).padStart(2, "0");
|
|
1061
|
+
const M = String(unix.getMinutes()).padStart(2, "0");
|
|
1062
|
+
const S = String(unix.getSeconds()).padStart(2, "0");
|
|
1063
|
+
if (format == "date") {
|
|
1064
|
+
return `${yy}-${mm}-${dd}`;
|
|
1597
1065
|
}
|
|
1598
|
-
|
|
1599
|
-
}
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
const sidebar = document.createElement("nav");
|
|
1603
|
-
topbar.id = "topbar";
|
|
1604
|
-
sidebar.id = "sidebar";
|
|
1605
|
-
topbar.innerHTML = params.topbar;
|
|
1606
|
-
sidebar.innerHTML = params.sidebar;
|
|
1607
|
-
document.body.prepend(topbar, sidebar);
|
|
1608
|
-
const setScreen = () => {
|
|
1609
|
-
const scWidth = window.innerWidth ? window.innerWidth : screen.width;
|
|
1610
|
-
const scHeight = window.innerHeight ? window.innerHeight : screen.height;
|
|
1611
|
-
const boxScreen = topbar.querySelector("#screen");
|
|
1612
|
-
if (boxScreen) boxScreen.innerHTML = `${scWidth}x${scHeight}`;
|
|
1613
|
-
if (scWidth < 600) navMenu(true);
|
|
1614
|
-
else navMenu(false);
|
|
1615
|
-
};
|
|
1616
|
-
setScreen();
|
|
1617
|
-
window.addEventListener("resize", setScreen);
|
|
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();
|
|
1066
|
+
if (format == "time") {
|
|
1067
|
+
return `${H}:${M}:${S}`;
|
|
1068
|
+
}
|
|
1069
|
+
return `${yy}-${mm}-${dd} ${H}:${M}:${S}`;
|
|
1628
1070
|
};
|
|
1629
|
-
var
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1071
|
+
var shiftIndex = (unixtime = 0) => {
|
|
1072
|
+
if (typeof unixtime != "number") {
|
|
1073
|
+
return { num: 0, text: "" };
|
|
1074
|
+
}
|
|
1075
|
+
const unix = unixtime ? new Date(unixtime) : /* @__PURE__ */ new Date();
|
|
1076
|
+
const H = unix.getHours();
|
|
1077
|
+
if (H >= 0 && H < 8) return { num: 1, text: PERIOD_TEXT[1] };
|
|
1078
|
+
if (H >= 8 && H < 16) return { num: 2, text: PERIOD_TEXT[2] };
|
|
1079
|
+
if (H >= 16) return { num: 3, text: PERIOD_TEXT[3] };
|
|
1080
|
+
return { num: 0, text: "" };
|
|
1634
1081
|
};
|
|
1635
|
-
var
|
|
1636
|
-
|
|
1637
|
-
|
|
1082
|
+
var setYear = (el, min = 2020, txt = "") => {
|
|
1083
|
+
const dt = /* @__PURE__ */ new Date();
|
|
1084
|
+
let year = dt.getFullYear();
|
|
1085
|
+
const month = dt.getMonth() + 1;
|
|
1086
|
+
if (month > 6 && month <= 12) {
|
|
1087
|
+
year++;
|
|
1088
|
+
}
|
|
1089
|
+
el.innerHTML = '<option value="">- \u0E40\u0E25\u0E37\u0E2D\u0E01 -</option>';
|
|
1090
|
+
for (let y = min; y <= year; y++) {
|
|
1091
|
+
const option = document.createElement("option");
|
|
1092
|
+
option.value = `${y}`;
|
|
1093
|
+
option.text = `${txt} ${y + 543}`;
|
|
1094
|
+
el.appendChild(option);
|
|
1638
1095
|
}
|
|
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
1096
|
};
|
|
1666
|
-
var
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1097
|
+
var thaiDate = (date, format = 0) => {
|
|
1098
|
+
if (typeof date == "string" && date.indexOf("0000-00-00") >= 0) {
|
|
1099
|
+
return "";
|
|
1100
|
+
}
|
|
1101
|
+
if (typeof date == "string") {
|
|
1102
|
+
date = date.trim();
|
|
1103
|
+
date = date.replace(" ", "T");
|
|
1104
|
+
}
|
|
1105
|
+
const dt = new Date(date);
|
|
1106
|
+
if (isNaN(dt.getTime())) return "";
|
|
1107
|
+
const yy = dt.getFullYear() + 543;
|
|
1108
|
+
const mm = String(dt.getMonth() + 1).padStart(2, "0");
|
|
1109
|
+
const dd = String(dt.getDate()).padStart(2, "0");
|
|
1110
|
+
const H = String(dt.getHours()).padStart(2, "0");
|
|
1111
|
+
const M = String(dt.getMinutes()).padStart(2, "0");
|
|
1112
|
+
const S = String(dt.getSeconds()).padStart(2, "0");
|
|
1113
|
+
if (format == 0) return `${dd}/${mm}/${yy}`;
|
|
1114
|
+
if (format == 1) return `${dd}/${mm}/${yy} ${H}:${M}`;
|
|
1115
|
+
if (format == 2) return `${dd}/${mm}/${yy} ${H}:${M}:${S}`;
|
|
1116
|
+
if (format == 10) return `${dd} ${TH_MONTH[Number(mm) - 1]} ${yy}`;
|
|
1117
|
+
if (format == 11) return `${dd} ${TH_MONTH_SHORT[Number(mm) - 1]} ${String(yy).slice(-2)}`;
|
|
1118
|
+
if (format == 12) return `${dd} ${TH_MONTH[Number(mm) - 1]} ${yy} \u0E40\u0E27\u0E25\u0E32 ${H}:${M} \u0E19.`;
|
|
1119
|
+
if (format == 13) return `${dd} ${TH_MONTH_SHORT[Number(mm) - 1]} ${String(yy).slice(-2)} ${H}:${M}`;
|
|
1120
|
+
if (format == 20) return `${TH_MONTH[Number(mm) - 1]} ${yy}`;
|
|
1121
|
+
if (format == 21) return `${TH_MONTH_SHORT[Number(mm) - 1]} ${yy}`;
|
|
1122
|
+
if (format == 22) return `${TH_MONTH_SHORT[Number(mm) - 1]} ${String(yy).slice(-2)}`;
|
|
1123
|
+
return "";
|
|
1671
1124
|
};
|
|
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");
|
|
1125
|
+
var dateDiff = (start, stop) => {
|
|
1126
|
+
if (!start || start.indexOf("0000-00-00") >= 0) {
|
|
1127
|
+
return 0;
|
|
1128
|
+
}
|
|
1129
|
+
if (!stop || stop.indexOf("0000-00-00") >= 0) {
|
|
1130
|
+
return 0;
|
|
1691
1131
|
}
|
|
1132
|
+
const [y1, m1, d1] = start.split("-");
|
|
1133
|
+
const [y2, m2, d2] = stop.split("-");
|
|
1134
|
+
const date1 = new Date(Number(y1), Number(m1) - 1, Number(d1)).getTime();
|
|
1135
|
+
const date2 = new Date(Number(y2), Number(m2) - 1, Number(d2)).getTime();
|
|
1136
|
+
return Math.round((date2 - date1) / (1e3 * 60 * 60 * 24));
|
|
1692
1137
|
};
|
|
1693
|
-
var
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
sidebar.classList.remove("menu-in");
|
|
1700
|
-
sidebar.classList.add("menu-out");
|
|
1138
|
+
var timeDiff = (start, stop) => {
|
|
1139
|
+
if (!start || start.indexOf("0000-00-00") >= 0) {
|
|
1140
|
+
return { h: 0, m: 0, s: 0 };
|
|
1141
|
+
}
|
|
1142
|
+
if (!stop || stop.indexOf("0000-00-00") >= 0) {
|
|
1143
|
+
return { h: 0, m: 0, s: 0 };
|
|
1701
1144
|
}
|
|
1145
|
+
start = start.replace(" ", "T");
|
|
1146
|
+
stop = stop.replace(" ", "T");
|
|
1147
|
+
const date1 = new Date(start);
|
|
1148
|
+
const date2 = new Date(stop);
|
|
1149
|
+
let msec = date2.getTime() - date1.getTime();
|
|
1150
|
+
const hh = Math.floor(msec / 1e3 / 60 / 60);
|
|
1151
|
+
msec -= hh * 1e3 * 60 * 60;
|
|
1152
|
+
const mm = Math.floor(msec / 1e3 / 60);
|
|
1153
|
+
msec -= mm * 1e3 * 60;
|
|
1154
|
+
const ss = Math.floor(msec / 1e3);
|
|
1155
|
+
msec -= ss * 1e3;
|
|
1156
|
+
return { h: hh, m: mm, s: ss };
|
|
1702
1157
|
};
|
|
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
|
-
};
|
|
1158
|
+
var getAge = (date) => {
|
|
1159
|
+
if (!date || date.indexOf("0000-00-00") >= 0) {
|
|
1160
|
+
return { years: 0, months: 0, days: 0 };
|
|
1161
|
+
}
|
|
1162
|
+
const now = /* @__PURE__ */ new Date();
|
|
1163
|
+
const nowYear = now.getFullYear();
|
|
1164
|
+
const nowMonth = now.getMonth();
|
|
1165
|
+
const nowDate = now.getDate();
|
|
1166
|
+
const [yy, mm, dd] = date.split("-");
|
|
1167
|
+
const birth = new Date(Number(yy), Number(mm) - 1, Number(dd));
|
|
1168
|
+
const birthYear = birth.getFullYear();
|
|
1169
|
+
const birthMonth = birth.getMonth();
|
|
1170
|
+
const birthDate = birth.getDate();
|
|
1171
|
+
let yearAge = nowYear - birthYear;
|
|
1172
|
+
let monthAge = 0;
|
|
1173
|
+
let dateAge = 0;
|
|
1174
|
+
if (nowMonth >= birthMonth) {
|
|
1175
|
+
monthAge = nowMonth - birthMonth;
|
|
1728
1176
|
} else {
|
|
1729
|
-
|
|
1177
|
+
yearAge--;
|
|
1178
|
+
monthAge = 12 + nowMonth - birthMonth;
|
|
1730
1179
|
}
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1180
|
+
if (nowDate >= birthDate) {
|
|
1181
|
+
dateAge = nowDate - birthDate;
|
|
1182
|
+
} else {
|
|
1183
|
+
monthAge--;
|
|
1184
|
+
dateAge = 31 + nowDate - birthDate;
|
|
1185
|
+
if (monthAge < 0) {
|
|
1186
|
+
monthAge = 11;
|
|
1187
|
+
yearAge--;
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
return {
|
|
1191
|
+
years: yearAge,
|
|
1192
|
+
months: monthAge,
|
|
1193
|
+
days: dateAge
|
|
1739
1194
|
};
|
|
1740
1195
|
};
|
|
1741
|
-
var
|
|
1742
|
-
const
|
|
1743
|
-
const
|
|
1744
|
-
const
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1196
|
+
var ageToBirth = (year, month, day) => {
|
|
1197
|
+
const y = Number(year);
|
|
1198
|
+
const m = Number(month);
|
|
1199
|
+
const d = Number(day);
|
|
1200
|
+
const dt = new Date(
|
|
1201
|
+
(/* @__PURE__ */ new Date()).getFullYear() - y,
|
|
1202
|
+
(/* @__PURE__ */ new Date()).getMonth() - m,
|
|
1203
|
+
(/* @__PURE__ */ new Date()).getDate() - d
|
|
1204
|
+
);
|
|
1205
|
+
const yy = dt.getFullYear();
|
|
1206
|
+
const mm = String(dt.getMonth() + 1).padStart(2, "0");
|
|
1207
|
+
const dd = String(dt.getDate()).padStart(2, "0");
|
|
1208
|
+
return `${yy}-${mm}-${dd}`;
|
|
1209
|
+
};
|
|
1210
|
+
var toDbDate = (date) => {
|
|
1211
|
+
if (!date || date.indexOf("0000-00-00") >= 0) {
|
|
1212
|
+
return "";
|
|
1754
1213
|
}
|
|
1214
|
+
const dt = new Date(date);
|
|
1215
|
+
const yy = dt.getFullYear() - 543;
|
|
1216
|
+
const mm = String(dt.getMonth() + 1).padStart(2, "0");
|
|
1217
|
+
const dd = String(dt.getDate()).padStart(2, "0");
|
|
1218
|
+
return `${yy}-${mm}-${dd}`;
|
|
1755
1219
|
};
|
|
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();
|
|
1220
|
+
var toThaiDate = (date) => {
|
|
1221
|
+
if (!date || date.indexOf("0000-00-00") >= 0) {
|
|
1222
|
+
return "";
|
|
1770
1223
|
}
|
|
1771
|
-
|
|
1224
|
+
const dt = new Date(date);
|
|
1225
|
+
const yy = dt.getFullYear() + 543;
|
|
1226
|
+
const mm = String(dt.getMonth() + 1).padStart(2, "0");
|
|
1227
|
+
const dd = String(dt.getDate()).padStart(2, "0");
|
|
1228
|
+
return `${yy}-${mm}-${dd}`;
|
|
1772
1229
|
};
|
|
1773
|
-
var
|
|
1774
|
-
const
|
|
1775
|
-
const
|
|
1776
|
-
if (
|
|
1777
|
-
|
|
1778
|
-
return json.data;
|
|
1230
|
+
var isToday = (date) => {
|
|
1231
|
+
const input = new Date(date);
|
|
1232
|
+
const today = /* @__PURE__ */ new Date();
|
|
1233
|
+
if (input.setHours(0, 0, 0, 0) == today.setHours(0, 0, 0, 0)) {
|
|
1234
|
+
return true;
|
|
1779
1235
|
}
|
|
1780
|
-
return
|
|
1236
|
+
return false;
|
|
1781
1237
|
};
|
|
1782
1238
|
|
|
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
1239
|
// src/lib/geoLocate.ts
|
|
1822
1240
|
var geoLocate_exports = {};
|
|
1823
1241
|
__export(geoLocate_exports, {
|
|
@@ -1872,9 +1290,9 @@ var getPosition = (params) => new Promise((resolve, reject) => {
|
|
|
1872
1290
|
});
|
|
1873
1291
|
} else reject("not support geolocation");
|
|
1874
1292
|
});
|
|
1875
|
-
var watchPosition = (success,
|
|
1293
|
+
var watchPosition = (success, error2) => {
|
|
1876
1294
|
if (navigator.geolocation) {
|
|
1877
|
-
return navigator.geolocation.watchPosition(success,
|
|
1295
|
+
return navigator.geolocation.watchPosition(success, error2, {
|
|
1878
1296
|
enableHighAccuracy: true,
|
|
1879
1297
|
timeout: 5e3,
|
|
1880
1298
|
maximumAge: 0
|
|
@@ -1898,14 +1316,14 @@ var toAddress = async (position) => {
|
|
|
1898
1316
|
// src/lib/cookie.ts
|
|
1899
1317
|
var cookie_exports = {};
|
|
1900
1318
|
__export(cookie_exports, {
|
|
1901
|
-
clear: () =>
|
|
1319
|
+
clear: () => clear3,
|
|
1902
1320
|
getItem: () => getItem,
|
|
1903
1321
|
removeItem: () => removeItem,
|
|
1904
1322
|
setItem: () => setItem
|
|
1905
1323
|
});
|
|
1906
1324
|
var setItem = (key, val, exp) => {
|
|
1907
1325
|
const d = /* @__PURE__ */ new Date();
|
|
1908
|
-
d.setTime(d.getTime() +
|
|
1326
|
+
d.setTime(d.getTime() + 1e3 * exp);
|
|
1909
1327
|
const expires = "expires=" + d.toUTCString();
|
|
1910
1328
|
document.cookie = `${key}=${val};${expires};path=/`;
|
|
1911
1329
|
};
|
|
@@ -1917,7 +1335,7 @@ var getItem = (key) => {
|
|
|
1917
1335
|
var removeItem = (key) => {
|
|
1918
1336
|
document.cookie = `${key}=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;`;
|
|
1919
1337
|
};
|
|
1920
|
-
var
|
|
1338
|
+
var clear3 = () => {
|
|
1921
1339
|
document.cookie.split(";").forEach((cookie) => {
|
|
1922
1340
|
const eqPos = cookie.indexOf("=");
|
|
1923
1341
|
const name = eqPos > -1 ? cookie.substring(0, eqPos) : cookie;
|
|
@@ -2017,6 +1435,198 @@ function ThaiBahtText(input) {
|
|
|
2017
1435
|
}
|
|
2018
1436
|
var thbText = ThaiBahtText;
|
|
2019
1437
|
|
|
1438
|
+
// src/lib/md5.ts
|
|
1439
|
+
function safeAdd(x, y) {
|
|
1440
|
+
const lsw = (x & 65535) + (y & 65535);
|
|
1441
|
+
const msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
|
1442
|
+
return msw << 16 | lsw & 65535;
|
|
1443
|
+
}
|
|
1444
|
+
function bitRotateLeft(num, cnt) {
|
|
1445
|
+
return num << cnt | num >>> 32 - cnt;
|
|
1446
|
+
}
|
|
1447
|
+
function md5cmn(q, a, b, x, s, t) {
|
|
1448
|
+
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
|
|
1449
|
+
}
|
|
1450
|
+
function md5ff(a, b, c, d, x, s, t) {
|
|
1451
|
+
return md5cmn(b & c | ~b & d, a, b, x, s, t);
|
|
1452
|
+
}
|
|
1453
|
+
function md5gg(a, b, c, d, x, s, t) {
|
|
1454
|
+
return md5cmn(b & d | c & ~d, a, b, x, s, t);
|
|
1455
|
+
}
|
|
1456
|
+
function md5hh(a, b, c, d, x, s, t) {
|
|
1457
|
+
return md5cmn(b ^ c ^ d, a, b, x, s, t);
|
|
1458
|
+
}
|
|
1459
|
+
function md5ii(a, b, c, d, x, s, t) {
|
|
1460
|
+
return md5cmn(c ^ (b | ~d), a, b, x, s, t);
|
|
1461
|
+
}
|
|
1462
|
+
function binlMD5(x, len) {
|
|
1463
|
+
x[len >> 5] |= 128 << len % 32;
|
|
1464
|
+
x[(len + 64 >>> 9 << 4) + 14] = len;
|
|
1465
|
+
let i;
|
|
1466
|
+
let olda;
|
|
1467
|
+
let oldb;
|
|
1468
|
+
let oldc;
|
|
1469
|
+
let oldd;
|
|
1470
|
+
let a = 1732584193;
|
|
1471
|
+
let b = -271733879;
|
|
1472
|
+
let c = -1732584194;
|
|
1473
|
+
let d = 271733878;
|
|
1474
|
+
for (i = 0; i < x.length; i += 16) {
|
|
1475
|
+
olda = a;
|
|
1476
|
+
oldb = b;
|
|
1477
|
+
oldc = c;
|
|
1478
|
+
oldd = d;
|
|
1479
|
+
a = md5ff(a, b, c, d, x[i], 7, -680876936);
|
|
1480
|
+
d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
|
|
1481
|
+
c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
|
|
1482
|
+
b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
|
1483
|
+
a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
|
|
1484
|
+
d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
|
1485
|
+
c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
|
1486
|
+
b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
|
|
1487
|
+
a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
|
1488
|
+
d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
|
1489
|
+
c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
|
|
1490
|
+
b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
|
1491
|
+
a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
|
1492
|
+
d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
|
|
1493
|
+
c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
|
1494
|
+
b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
|
1495
|
+
a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
|
|
1496
|
+
d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
|
1497
|
+
c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
|
|
1498
|
+
b = md5gg(b, c, d, a, x[i], 20, -373897302);
|
|
1499
|
+
a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
|
|
1500
|
+
d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
|
|
1501
|
+
c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
|
|
1502
|
+
b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
|
|
1503
|
+
a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
|
|
1504
|
+
d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
|
1505
|
+
c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
|
|
1506
|
+
b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
|
1507
|
+
a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
|
1508
|
+
d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
|
|
1509
|
+
c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
|
1510
|
+
b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
|
1511
|
+
a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
|
|
1512
|
+
d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
|
1513
|
+
c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
|
1514
|
+
b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
|
|
1515
|
+
a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
|
1516
|
+
d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
|
1517
|
+
c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
|
|
1518
|
+
b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
|
1519
|
+
a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
|
|
1520
|
+
d = md5hh(d, a, b, c, x[i], 11, -358537222);
|
|
1521
|
+
c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
|
|
1522
|
+
b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
|
|
1523
|
+
a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
|
|
1524
|
+
d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
|
|
1525
|
+
c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
|
|
1526
|
+
b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
|
|
1527
|
+
a = md5ii(a, b, c, d, x[i], 6, -198630844);
|
|
1528
|
+
d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
|
1529
|
+
c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
|
1530
|
+
b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
|
|
1531
|
+
a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
|
1532
|
+
d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
|
1533
|
+
c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
|
|
1534
|
+
b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
|
1535
|
+
a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
|
1536
|
+
d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
|
|
1537
|
+
c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
|
1538
|
+
b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
|
1539
|
+
a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
|
|
1540
|
+
d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
|
1541
|
+
c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
|
|
1542
|
+
b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
|
|
1543
|
+
a = safeAdd(a, olda);
|
|
1544
|
+
b = safeAdd(b, oldb);
|
|
1545
|
+
c = safeAdd(c, oldc);
|
|
1546
|
+
d = safeAdd(d, oldd);
|
|
1547
|
+
}
|
|
1548
|
+
return [a, b, c, d];
|
|
1549
|
+
}
|
|
1550
|
+
function binl2rstr(input) {
|
|
1551
|
+
let i;
|
|
1552
|
+
let output = "";
|
|
1553
|
+
const length32 = input.length * 32;
|
|
1554
|
+
for (i = 0; i < length32; i += 8) {
|
|
1555
|
+
output += String.fromCharCode(input[i >> 5] >>> i % 32 & 255);
|
|
1556
|
+
}
|
|
1557
|
+
return output;
|
|
1558
|
+
}
|
|
1559
|
+
function rstr2binl(input) {
|
|
1560
|
+
let i;
|
|
1561
|
+
const output = [];
|
|
1562
|
+
output[(input.length >> 2) - 1] = void 0;
|
|
1563
|
+
for (i = 0; i < output.length; i += 1) {
|
|
1564
|
+
output[i] = 0;
|
|
1565
|
+
}
|
|
1566
|
+
const length8 = input.length * 8;
|
|
1567
|
+
for (i = 0; i < length8; i += 8) {
|
|
1568
|
+
output[i >> 5] |= (input.charCodeAt(i / 8) & 255) << i % 32;
|
|
1569
|
+
}
|
|
1570
|
+
return output;
|
|
1571
|
+
}
|
|
1572
|
+
function rstrMD5(s) {
|
|
1573
|
+
return binl2rstr(binlMD5(rstr2binl(s), s.length * 8));
|
|
1574
|
+
}
|
|
1575
|
+
function rstrHMACMD5(key, data) {
|
|
1576
|
+
let i;
|
|
1577
|
+
let bkey = rstr2binl(key);
|
|
1578
|
+
const ipad = [];
|
|
1579
|
+
const opad = [];
|
|
1580
|
+
ipad[15] = opad[15] = void 0;
|
|
1581
|
+
if (bkey.length > 16) {
|
|
1582
|
+
bkey = binlMD5(bkey, key.length * 8);
|
|
1583
|
+
}
|
|
1584
|
+
for (i = 0; i < 16; i += 1) {
|
|
1585
|
+
ipad[i] = bkey[i] ^ 909522486;
|
|
1586
|
+
opad[i] = bkey[i] ^ 1549556828;
|
|
1587
|
+
}
|
|
1588
|
+
const hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
|
|
1589
|
+
return binl2rstr(binlMD5(opad.concat(hash), 512 + 128));
|
|
1590
|
+
}
|
|
1591
|
+
function rstr2hex(input) {
|
|
1592
|
+
const hexTab = "0123456789abcdef";
|
|
1593
|
+
let output = "";
|
|
1594
|
+
let x;
|
|
1595
|
+
let i;
|
|
1596
|
+
for (i = 0; i < input.length; i += 1) {
|
|
1597
|
+
x = input.charCodeAt(i);
|
|
1598
|
+
output += hexTab.charAt(x >>> 4 & 15) + hexTab.charAt(x & 15);
|
|
1599
|
+
}
|
|
1600
|
+
return output;
|
|
1601
|
+
}
|
|
1602
|
+
function str2rstrUTF8(input) {
|
|
1603
|
+
return decodeURIComponent(encodeURIComponent(input));
|
|
1604
|
+
}
|
|
1605
|
+
function rawMD5(s) {
|
|
1606
|
+
return rstrMD5(str2rstrUTF8(s));
|
|
1607
|
+
}
|
|
1608
|
+
function hexMD5(s) {
|
|
1609
|
+
return rstr2hex(rawMD5(s));
|
|
1610
|
+
}
|
|
1611
|
+
function rawHMACMD5(k, d) {
|
|
1612
|
+
return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d));
|
|
1613
|
+
}
|
|
1614
|
+
function hexHMACMD5(k, d) {
|
|
1615
|
+
return rstr2hex(rawHMACMD5(k, d));
|
|
1616
|
+
}
|
|
1617
|
+
function md5Hash(string, key, raw) {
|
|
1618
|
+
if (!key) {
|
|
1619
|
+
if (!raw) {
|
|
1620
|
+
return hexMD5(string);
|
|
1621
|
+
}
|
|
1622
|
+
return rawMD5(string);
|
|
1623
|
+
}
|
|
1624
|
+
if (!raw) {
|
|
1625
|
+
return hexHMACMD5(key, string);
|
|
1626
|
+
}
|
|
1627
|
+
return rawHMACMD5(key, string);
|
|
1628
|
+
}
|
|
1629
|
+
|
|
2020
1630
|
// src/mod/index.ts
|
|
2021
1631
|
var mod_exports = {};
|
|
2022
1632
|
__export(mod_exports, {
|
|
@@ -2047,6 +1657,47 @@ var fitSize = (elm, delay = 0) => {
|
|
|
2047
1657
|
}, delay);
|
|
2048
1658
|
};
|
|
2049
1659
|
|
|
1660
|
+
// src/mod/built-in/cover/index.ts
|
|
1661
|
+
var cover_exports = {};
|
|
1662
|
+
__export(cover_exports, {
|
|
1663
|
+
acdInit: () => acdInit,
|
|
1664
|
+
loading: () => loading3
|
|
1665
|
+
});
|
|
1666
|
+
var loading3 = (cover, state = false, align = "top", hide = true) => {
|
|
1667
|
+
const inner = cover.querySelectorAll("*");
|
|
1668
|
+
if (state) {
|
|
1669
|
+
cover.querySelector(".cover-loader")?.remove();
|
|
1670
|
+
cover.style.position = "relative";
|
|
1671
|
+
if (hide) inner.forEach((el) => el.style.visibility = "hidden");
|
|
1672
|
+
const loader = document.createElement("div");
|
|
1673
|
+
loader.className = `cover-loader ${align}`;
|
|
1674
|
+
loader.innerHTML = `<div class="spinner s28"></div>`;
|
|
1675
|
+
cover.appendChild(loader);
|
|
1676
|
+
} else {
|
|
1677
|
+
new Promise((r) => setTimeout(r, 400)).then(() => {
|
|
1678
|
+
cover.querySelector(".cover-loader")?.remove();
|
|
1679
|
+
cover.style.position = "";
|
|
1680
|
+
inner.forEach((el) => el.style.visibility = "");
|
|
1681
|
+
});
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1684
|
+
var acdInit = () => {
|
|
1685
|
+
const acdItem = document.querySelectorAll(".acd-item");
|
|
1686
|
+
acdItem.forEach((elm) => {
|
|
1687
|
+
const topic = elm.querySelector(".topic");
|
|
1688
|
+
const panel = elm.querySelector(".panel");
|
|
1689
|
+
if (topic) topic.onclick = () => {
|
|
1690
|
+
elm.classList.toggle("active");
|
|
1691
|
+
if (!panel) return;
|
|
1692
|
+
if (elm.classList.contains("active")) {
|
|
1693
|
+
panel.style.maxHeight = `${panel.scrollHeight}px`;
|
|
1694
|
+
} else {
|
|
1695
|
+
panel.style.maxHeight = "";
|
|
1696
|
+
}
|
|
1697
|
+
};
|
|
1698
|
+
});
|
|
1699
|
+
};
|
|
1700
|
+
|
|
2050
1701
|
// src/mod/camera/index.ts
|
|
2051
1702
|
var camera_exports = {};
|
|
2052
1703
|
__export(camera_exports, {
|
|
@@ -2199,13 +1850,13 @@ var camReady = (cam) => {
|
|
|
2199
1850
|
// src/mod/drawer/index.ts
|
|
2200
1851
|
var drawer_exports = {};
|
|
2201
1852
|
__export(drawer_exports, {
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
1853
|
+
close: () => close,
|
|
1854
|
+
create: () => create2,
|
|
1855
|
+
loading: () => loading4,
|
|
1856
|
+
ready: () => ready2
|
|
2206
1857
|
});
|
|
2207
|
-
var
|
|
2208
|
-
var
|
|
1858
|
+
var app6 = document.querySelector("#app");
|
|
1859
|
+
var create2 = (params) => {
|
|
2209
1860
|
const name = params.name ? params.name : "drawer";
|
|
2210
1861
|
const size = params.size ? params.size : "mobile";
|
|
2211
1862
|
const drawer = document.createElement("div");
|
|
@@ -2239,7 +1890,7 @@ var Create6 = (params) => {
|
|
|
2239
1890
|
if (hash != name && hash != "modal") done();
|
|
2240
1891
|
};
|
|
2241
1892
|
const done = () => {
|
|
2242
|
-
|
|
1893
|
+
destroy(drawer);
|
|
2243
1894
|
if (window.location.hash == `#${name}`) history.back();
|
|
2244
1895
|
window.removeEventListener("hashchange", hashChange);
|
|
2245
1896
|
};
|
|
@@ -2254,10 +1905,10 @@ var Create6 = (params) => {
|
|
|
2254
1905
|
return drawer;
|
|
2255
1906
|
};
|
|
2256
1907
|
var openMobile = (drawer) => {
|
|
2257
|
-
if (!
|
|
2258
|
-
const offset =
|
|
1908
|
+
if (!app6) return;
|
|
1909
|
+
const offset = app6.getBoundingClientRect();
|
|
2259
1910
|
const appRight = offset.right;
|
|
2260
|
-
const appWidth =
|
|
1911
|
+
const appWidth = app6.offsetWidth;
|
|
2261
1912
|
drawer.style.left = `${appRight}px`;
|
|
2262
1913
|
const css = document.createElement("style");
|
|
2263
1914
|
drawer.appendChild(css);
|
|
@@ -2273,7 +1924,7 @@ var openMobile = (drawer) => {
|
|
|
2273
1924
|
to {transform: translateX(0);}
|
|
2274
1925
|
}
|
|
2275
1926
|
`);
|
|
2276
|
-
const content =
|
|
1927
|
+
const content = app6.querySelector("#app-content");
|
|
2277
1928
|
if (content) content.style.animation = "drawer-push-app 0.4s forwards";
|
|
2278
1929
|
drawer.style.animation = "drawer-in 0.4s forwards";
|
|
2279
1930
|
const header = drawer.querySelector(".drawer-header");
|
|
@@ -2289,53 +1940,192 @@ var openMobile = (drawer) => {
|
|
|
2289
1940
|
}
|
|
2290
1941
|
};
|
|
2291
1942
|
};
|
|
2292
|
-
var
|
|
2293
|
-
drawer.querySelector("#btn-exit").click();
|
|
2294
|
-
drawer.addEventListener("animationend", () => resolve());
|
|
1943
|
+
var close = (drawer) => new Promise((resolve) => {
|
|
1944
|
+
drawer.querySelector("#btn-exit").click();
|
|
1945
|
+
drawer.addEventListener("animationend", () => resolve());
|
|
1946
|
+
});
|
|
1947
|
+
var destroy = (drawer) => {
|
|
1948
|
+
if (!app6) return;
|
|
1949
|
+
if (drawer.classList.contains("mobile")) {
|
|
1950
|
+
const content = app6.querySelector("#app-content");
|
|
1951
|
+
if (content) content.style.animation = "drawer-pull-app 0.4s forwards";
|
|
1952
|
+
drawer.style.animation = "drawer-out 0.4s forwards";
|
|
1953
|
+
drawer.addEventListener("animationend", () => {
|
|
1954
|
+
if (content) content.style.animation = "unset";
|
|
1955
|
+
drawer.remove();
|
|
1956
|
+
});
|
|
1957
|
+
} else {
|
|
1958
|
+
drawer.style.animation = "slide-out-left 0.4s forwards";
|
|
1959
|
+
drawer.addEventListener("animationend", () => {
|
|
1960
|
+
drawer.remove();
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
const modal = document.querySelectorAll(".slim-modal");
|
|
1964
|
+
modal.forEach((el) => el.remove());
|
|
1965
|
+
const dialog = document.querySelectorAll(".slim-dialog");
|
|
1966
|
+
dialog.forEach((el) => el.remove());
|
|
1967
|
+
};
|
|
1968
|
+
var loading4 = (drawer) => {
|
|
1969
|
+
const body = drawer.querySelector(".drawer-body");
|
|
1970
|
+
const loader = drawer.querySelector(".loader");
|
|
1971
|
+
if (body) body.style.display = "none";
|
|
1972
|
+
if (loader) loader.style.display = "flex";
|
|
1973
|
+
};
|
|
1974
|
+
var ready2 = (drawer) => {
|
|
1975
|
+
const body = drawer.querySelector(".drawer-body");
|
|
1976
|
+
const loader = drawer.querySelector(".loader");
|
|
1977
|
+
if (body) body.style.display = "block";
|
|
1978
|
+
if (loader) loader.style.display = "none";
|
|
1979
|
+
};
|
|
1980
|
+
|
|
1981
|
+
// src/mod/modal/index.ts
|
|
1982
|
+
var modal_exports = {};
|
|
1983
|
+
__export(modal_exports, {
|
|
1984
|
+
close: () => close2,
|
|
1985
|
+
create: () => create3,
|
|
1986
|
+
hidden: () => hidden,
|
|
1987
|
+
loading: () => loading5,
|
|
1988
|
+
ready: () => ready3,
|
|
1989
|
+
visible: () => visible
|
|
1990
|
+
});
|
|
1991
|
+
var app7 = document.querySelector("#app");
|
|
1992
|
+
var tmpBtnSave = (
|
|
1993
|
+
/* html */
|
|
1994
|
+
`
|
|
1995
|
+
<button class="solid green" type="submit">
|
|
1996
|
+
<i></i>\u0E1A\u0E31\u0E19\u0E17\u0E36\u0E01
|
|
1997
|
+
</button>
|
|
1998
|
+
`
|
|
1999
|
+
);
|
|
2000
|
+
var tmpBtnCancel = (
|
|
2001
|
+
/* html */
|
|
2002
|
+
`
|
|
2003
|
+
<button class="solid gray" type="button" id="btn-cancel">
|
|
2004
|
+
<i></i>\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01
|
|
2005
|
+
</button>
|
|
2006
|
+
`
|
|
2007
|
+
);
|
|
2008
|
+
var tmpBtnClose = (
|
|
2009
|
+
/* html */
|
|
2010
|
+
`
|
|
2011
|
+
<button class="solid blue" type="button" id="btn-close">
|
|
2012
|
+
<i></i>\u0E1B\u0E34\u0E14\u0E2B\u0E19\u0E49\u0E32
|
|
2013
|
+
</button>
|
|
2014
|
+
`
|
|
2015
|
+
);
|
|
2016
|
+
var create3 = (params) => {
|
|
2017
|
+
const icon = params.icon ? params.icon : "";
|
|
2018
|
+
const title = params.title ? params.title : "Modal Title";
|
|
2019
|
+
const body = params.body ? params.body : "Modal Body";
|
|
2020
|
+
const width = params.width ? params.width : "100%";
|
|
2021
|
+
const align = params.button?.align ? params.button?.align : "";
|
|
2022
|
+
const doc = params.target ? params.target : app7;
|
|
2023
|
+
let button = "";
|
|
2024
|
+
if (params.button?.cancel) button += tmpBtnCancel;
|
|
2025
|
+
if (params.button?.close) button += tmpBtnClose;
|
|
2026
|
+
if (params.button?.save) button += tmpBtnSave;
|
|
2027
|
+
const modal = document.createElement("div");
|
|
2028
|
+
modal.className = "overlay slim-modal";
|
|
2029
|
+
modal.innerHTML = /*html*/
|
|
2030
|
+
`
|
|
2031
|
+
<form>
|
|
2032
|
+
<div class="content" style="width: ${width};">
|
|
2033
|
+
<div class="header">
|
|
2034
|
+
<i class="icon pad">${icon}</i>${title}
|
|
2035
|
+
<button id="btn-exit" type="button"
|
|
2036
|
+
class="icon"></button>
|
|
2037
|
+
</div>
|
|
2038
|
+
<div class="body">${body}</div>
|
|
2039
|
+
<div class="footer ${align}">${button}</div>
|
|
2040
|
+
<div class="loader">
|
|
2041
|
+
<div class="spinner s28"></div>
|
|
2042
|
+
</div>
|
|
2043
|
+
</div>
|
|
2044
|
+
</form>
|
|
2045
|
+
`;
|
|
2046
|
+
if (!doc) return modal;
|
|
2047
|
+
doc.appendChild(modal);
|
|
2048
|
+
if (width == "auto") {
|
|
2049
|
+
const content2 = modal.querySelector(".content");
|
|
2050
|
+
if (content2) content2.style.maxWidth = `450px`;
|
|
2051
|
+
}
|
|
2052
|
+
window.location.hash = "modal";
|
|
2053
|
+
const content = modal.querySelector(".content");
|
|
2054
|
+
content.classList.add("modal-in");
|
|
2055
|
+
modal.classList.add("overlay-in");
|
|
2056
|
+
content.addEventListener("animationend", () => {
|
|
2057
|
+
if (content.classList.contains("modal-in")) {
|
|
2058
|
+
content.classList.remove("modal-in");
|
|
2059
|
+
modal.classList.remove("overlay-in");
|
|
2060
|
+
}
|
|
2061
|
+
});
|
|
2062
|
+
const hashChange = () => {
|
|
2063
|
+
const hash = window.location.hash.replaceAll("#", "");
|
|
2064
|
+
if (hash != "modal") done();
|
|
2065
|
+
};
|
|
2066
|
+
const done = () => {
|
|
2067
|
+
destroy2(modal);
|
|
2068
|
+
if (window.location.hash == "#modal") history.back();
|
|
2069
|
+
window.removeEventListener("hashchange", hashChange);
|
|
2070
|
+
};
|
|
2071
|
+
window.addEventListener("hashchange", hashChange);
|
|
2072
|
+
const btnExit = modal.querySelector("#btn-exit");
|
|
2073
|
+
const btnCancel = modal.querySelector("#btn-cancel");
|
|
2074
|
+
const btnClose = modal.querySelector("#btn-close");
|
|
2075
|
+
if (btnExit) {
|
|
2076
|
+
btnExit.focus();
|
|
2077
|
+
btnExit.onclick = done;
|
|
2078
|
+
}
|
|
2079
|
+
if (btnCancel) btnCancel.onclick = done;
|
|
2080
|
+
if (btnClose) btnClose.onclick = done;
|
|
2081
|
+
return modal;
|
|
2082
|
+
};
|
|
2083
|
+
var close2 = (modal) => new Promise((resolve) => {
|
|
2084
|
+
modal.querySelector("#btn-exit").click();
|
|
2085
|
+
const content = modal.querySelector(".content");
|
|
2086
|
+
content.addEventListener("animationend", () => resolve());
|
|
2295
2087
|
});
|
|
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());
|
|
2088
|
+
var destroy2 = (modal) => {
|
|
2089
|
+
const content = modal.querySelector(".content");
|
|
2090
|
+
content.classList.add("modal-out");
|
|
2091
|
+
modal.classList.add("overlay-out");
|
|
2092
|
+
content.addEventListener("animationend", () => {
|
|
2093
|
+
if (content.classList.contains("modal-out")) {
|
|
2094
|
+
modal.style.display = "none";
|
|
2095
|
+
modal.remove();
|
|
2096
|
+
}
|
|
2097
|
+
});
|
|
2316
2098
|
};
|
|
2317
|
-
var
|
|
2318
|
-
const body =
|
|
2319
|
-
const loader =
|
|
2320
|
-
if (body) body.style.
|
|
2099
|
+
var loading5 = (modal) => {
|
|
2100
|
+
const body = modal.querySelector(".body");
|
|
2101
|
+
const loader = modal.querySelector(".loader");
|
|
2102
|
+
if (body) body.style.visibility = "hidden";
|
|
2321
2103
|
if (loader) loader.style.display = "flex";
|
|
2322
2104
|
};
|
|
2323
|
-
var
|
|
2324
|
-
const body =
|
|
2325
|
-
const loader =
|
|
2326
|
-
if (body) body.style.
|
|
2105
|
+
var ready3 = (modal) => {
|
|
2106
|
+
const body = modal.querySelector(".body");
|
|
2107
|
+
const loader = modal.querySelector(".loader");
|
|
2108
|
+
if (body) body.style.visibility = "visible";
|
|
2327
2109
|
if (loader) loader.style.display = "none";
|
|
2328
2110
|
};
|
|
2111
|
+
var hidden = (modal) => {
|
|
2112
|
+
modal.style.display = "none";
|
|
2113
|
+
};
|
|
2114
|
+
var visible = (modal) => {
|
|
2115
|
+
modal.style.display = "block";
|
|
2116
|
+
};
|
|
2329
2117
|
|
|
2330
2118
|
// src/mod/tabs/index.ts
|
|
2331
2119
|
var tabs_exports = {};
|
|
2332
2120
|
__export(tabs_exports, {
|
|
2333
|
-
|
|
2121
|
+
init: () => init2,
|
|
2122
|
+
loading: () => loading6,
|
|
2123
|
+
ready: () => ready4,
|
|
2334
2124
|
setActive: () => setActive
|
|
2335
2125
|
});
|
|
2336
2126
|
var ignore = ["camera", "drawer", "modal"];
|
|
2337
2127
|
var hashIgnore = (hash) => ignore.includes(hash);
|
|
2338
|
-
var
|
|
2128
|
+
var init2 = (tabs, onChange) => {
|
|
2339
2129
|
const tbtn = tabs.querySelectorAll(".tabs-btn");
|
|
2340
2130
|
tbtn.forEach((elm) => {
|
|
2341
2131
|
const dataHash = elm.getAttribute("data-hash");
|
|
@@ -2361,13 +2151,13 @@ var Init = (tabs, onChange) => {
|
|
|
2361
2151
|
elm.classList.remove("active");
|
|
2362
2152
|
}
|
|
2363
2153
|
});
|
|
2364
|
-
|
|
2365
|
-
onChange(index, () =>
|
|
2154
|
+
loading6(tabs, index);
|
|
2155
|
+
onChange(index, () => ready4(tabs, index));
|
|
2366
2156
|
};
|
|
2367
2157
|
tabsChange();
|
|
2368
2158
|
window.onhashchange = tabsChange;
|
|
2369
2159
|
};
|
|
2370
|
-
var
|
|
2160
|
+
var loading6 = (tabs, index) => {
|
|
2371
2161
|
const tbtn = tabs.querySelectorAll(".tabs-btn")[index];
|
|
2372
2162
|
const body = tabs.querySelector(".tabs-body");
|
|
2373
2163
|
const inner = tbtn.querySelectorAll("*");
|
|
@@ -2395,7 +2185,7 @@ var tabsLoading = (tabs, index) => {
|
|
|
2395
2185
|
}
|
|
2396
2186
|
}
|
|
2397
2187
|
};
|
|
2398
|
-
var
|
|
2188
|
+
var ready4 = (tabs, index) => {
|
|
2399
2189
|
const tbtn = tabs.querySelectorAll(".tabs-btn")[index];
|
|
2400
2190
|
const body = tabs.querySelector(".tabs-body");
|
|
2401
2191
|
const inner = tbtn.querySelectorAll("*");
|
|
@@ -2425,10 +2215,10 @@ var setActive = (tbtn, index) => {
|
|
|
2425
2215
|
// src/svchub/oauth/index.ts
|
|
2426
2216
|
var oauth_exports = {};
|
|
2427
2217
|
__export(oauth_exports, {
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2218
|
+
authMW: () => authMW,
|
|
2219
|
+
callback: () => callback,
|
|
2220
|
+
login: () => login,
|
|
2221
|
+
logout: () => logout
|
|
2432
2222
|
});
|
|
2433
2223
|
|
|
2434
2224
|
// src/svchub/oauth/template.ts
|
|
@@ -2445,12 +2235,97 @@ var tempLogout = (
|
|
|
2445
2235
|
<!-- loader -->
|
|
2446
2236
|
<div id="loader"></div>
|
|
2447
2237
|
</div>
|
|
2238
|
+
<style>
|
|
2239
|
+
#app:has(#page-logout) {
|
|
2240
|
+
padding: 0;
|
|
2241
|
+
}
|
|
2242
|
+
#page-logout {
|
|
2243
|
+
width: 100%;
|
|
2244
|
+
height: 100%;
|
|
2245
|
+
position: fixed;
|
|
2246
|
+
display: flex;
|
|
2247
|
+
flex-direction: column;
|
|
2248
|
+
justify-content: center;
|
|
2249
|
+
align-items: center;
|
|
2250
|
+
background-position: center;
|
|
2251
|
+
background-repeat: no-repeat;
|
|
2252
|
+
background-size: cover;
|
|
2253
|
+
background-image: url('https://cdn.jsdelivr.net/npm/slimsdk/dist/assets/bg/bg-01.jpg');
|
|
2254
|
+
}
|
|
2255
|
+
#page-logout #content {
|
|
2256
|
+
display: none;
|
|
2257
|
+
text-align: center;
|
|
2258
|
+
animation: fadeIn 0.4s;
|
|
2259
|
+
}
|
|
2260
|
+
#page-logout #content .logo {
|
|
2261
|
+
margin: auto;
|
|
2262
|
+
width: 150px;
|
|
2263
|
+
height: 150px;
|
|
2264
|
+
margin-bottom: 20px;
|
|
2265
|
+
border-radius: 50%;
|
|
2266
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
2267
|
+
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2),
|
|
2268
|
+
0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
|
2269
|
+
}
|
|
2270
|
+
#page-logout #content .logo img {
|
|
2271
|
+
width: 100%;
|
|
2272
|
+
height: 100%;
|
|
2273
|
+
border-radius: 50%;
|
|
2274
|
+
}
|
|
2275
|
+
#page-logout #content #btn-login {
|
|
2276
|
+
box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 6px,
|
|
2277
|
+
rgba(0, 0, 0, 0.23) 0px 3px 6px;
|
|
2278
|
+
}
|
|
2279
|
+
#page-logout #loader {
|
|
2280
|
+
width: 110px;
|
|
2281
|
+
height: 110px;
|
|
2282
|
+
border-radius: 50%;
|
|
2283
|
+
border: 11px solid #E5E7EB;
|
|
2284
|
+
border-color: #E5E7EB #06B6D4 #E5E7EB #06B6D4;
|
|
2285
|
+
animation: spin 2s linear infinite;
|
|
2286
|
+
}
|
|
2287
|
+
</style>
|
|
2448
2288
|
`
|
|
2449
2289
|
);
|
|
2450
2290
|
|
|
2291
|
+
// src/svchub/api/auth/index.ts
|
|
2292
|
+
var auth_exports = {};
|
|
2293
|
+
__export(auth_exports, {
|
|
2294
|
+
getToken: () => getToken,
|
|
2295
|
+
getUserInfo: () => getUserInfo
|
|
2296
|
+
});
|
|
2297
|
+
var getToken = (params) => new Promise((resolve, reject) => {
|
|
2298
|
+
fetch(cfg.hub.OAUTH + "/token", {
|
|
2299
|
+
method: "POST",
|
|
2300
|
+
headers: { "Content-Type": "application/json; charset=utf-8" },
|
|
2301
|
+
body: JSON.stringify(params)
|
|
2302
|
+
}).then((resp) => {
|
|
2303
|
+
if (!resp.ok) throw resp;
|
|
2304
|
+
return resp.json();
|
|
2305
|
+
}).then((json) => {
|
|
2306
|
+
resolve(json);
|
|
2307
|
+
}).catch((err) => reject(err));
|
|
2308
|
+
});
|
|
2309
|
+
var getUserInfo = (token) => new Promise((resolve, reject) => {
|
|
2310
|
+
let headers = cfg.api.HEADERS;
|
|
2311
|
+
if (token) headers = new Headers({
|
|
2312
|
+
"Content-Type": "application/json; charset=utf-8",
|
|
2313
|
+
"Authorization": `Bearer ${token}`
|
|
2314
|
+
});
|
|
2315
|
+
fetch(cfg.hub.OAUTH + "/userinfo", {
|
|
2316
|
+
method: "GET",
|
|
2317
|
+
headers
|
|
2318
|
+
}).then((resp) => {
|
|
2319
|
+
if (!resp.ok) throw resp;
|
|
2320
|
+
return resp.json();
|
|
2321
|
+
}).then((json) => {
|
|
2322
|
+
resolve(json);
|
|
2323
|
+
}).catch((err) => reject(err));
|
|
2324
|
+
});
|
|
2325
|
+
|
|
2451
2326
|
// src/svchub/oauth/midware.ts
|
|
2452
2327
|
var IGNORE = ["__NOT_FOUND__", "login", "logout", "callback"];
|
|
2453
|
-
var
|
|
2328
|
+
var authMW = async (route, ignore2) => {
|
|
2454
2329
|
ignore2?.forEach((val) => IGNORE.push(val));
|
|
2455
2330
|
if (IGNORE.includes(route)) {
|
|
2456
2331
|
console.log("ignore :", route);
|
|
@@ -2470,39 +2345,35 @@ var Midware = async (route, ignore2) => {
|
|
|
2470
2345
|
} catch {
|
|
2471
2346
|
gotoLogin();
|
|
2472
2347
|
}
|
|
2473
|
-
|
|
2474
|
-
|
|
2348
|
+
cfg.api.TOKEN = token;
|
|
2349
|
+
cfg.api.HEADERS = new Headers({
|
|
2475
2350
|
"Content-Type": "application/json; charset=utf-8",
|
|
2476
|
-
"Authorization": `Bearer ${
|
|
2351
|
+
"Authorization": `Bearer ${cfg.api.TOKEN}`
|
|
2477
2352
|
});
|
|
2478
2353
|
const session = sessionStorage.getItem("ACCESS_SESSION");
|
|
2479
2354
|
if (!session) {
|
|
2480
|
-
await
|
|
2355
|
+
await getUserInfo().then((resp) => {
|
|
2481
2356
|
const data = resp.data;
|
|
2482
|
-
setProfile(data
|
|
2357
|
+
setProfile(data);
|
|
2483
2358
|
sessionStorage.setItem("ACCESS_SESSION", JSON.stringify(data));
|
|
2484
2359
|
}).catch(() => gotoLogin());
|
|
2485
2360
|
} else {
|
|
2486
2361
|
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;
|
|
2362
|
+
setProfile(data);
|
|
2363
|
+
}
|
|
2364
|
+
};
|
|
2365
|
+
var setProfile = (user) => {
|
|
2366
|
+
cfg.user.sub = user.sub;
|
|
2367
|
+
cfg.user.name = user.name;
|
|
2368
|
+
cfg.user.utyp = user.utyp;
|
|
2369
|
+
cfg.user.unit = user.unit;
|
|
2370
|
+
cfg.user.unit_id = user.unit_id;
|
|
2371
|
+
cfg.user.role_id = user.role_id;
|
|
2372
|
+
cfg.user.picture = user.picture ? user.picture : "";
|
|
2373
|
+
if (user.metadata) cfg.user.metadata = user.metadata;
|
|
2503
2374
|
};
|
|
2504
2375
|
var gotoLogin = () => {
|
|
2505
|
-
|
|
2376
|
+
clear3();
|
|
2506
2377
|
localStorage.clear();
|
|
2507
2378
|
sessionStorage.clear();
|
|
2508
2379
|
window.location.replace("/login");
|
|
@@ -2511,26 +2382,27 @@ var gotoLogin = () => {
|
|
|
2511
2382
|
|
|
2512
2383
|
// src/svchub/oauth/index.ts
|
|
2513
2384
|
var app8 = document.querySelector("#app");
|
|
2514
|
-
var
|
|
2385
|
+
var login = () => {
|
|
2515
2386
|
clearCache();
|
|
2516
2387
|
const state = Math.random().toString(36).slice(-8);
|
|
2517
2388
|
sessionStorage.setItem("OAUTH_STATE", state);
|
|
2518
2389
|
const query = new URLSearchParams({
|
|
2519
2390
|
response_type: "token",
|
|
2520
|
-
client_id:
|
|
2391
|
+
client_id: cfg.app.UUID,
|
|
2392
|
+
redirect_uri: cfg.app.CALLBACK,
|
|
2521
2393
|
state
|
|
2522
2394
|
}).toString();
|
|
2523
|
-
const url = `${
|
|
2395
|
+
const url = `${cfg.hub.LOGIN}?${query}`;
|
|
2524
2396
|
window.location.replace(url);
|
|
2525
2397
|
};
|
|
2526
|
-
var
|
|
2398
|
+
var logout = () => {
|
|
2527
2399
|
clearCache();
|
|
2528
2400
|
if (!app8) return;
|
|
2529
2401
|
app8.innerHTML = tempLogout;
|
|
2530
2402
|
app8.classList.add("full-page");
|
|
2531
2403
|
const content = app8.querySelector("#content");
|
|
2532
2404
|
const loader = app8.querySelector("#loader");
|
|
2533
|
-
new Promise((r) => setTimeout(r,
|
|
2405
|
+
new Promise((r) => setTimeout(r, 400)).then(() => {
|
|
2534
2406
|
content.style.display = "block";
|
|
2535
2407
|
loader.style.display = "none";
|
|
2536
2408
|
});
|
|
@@ -2538,7 +2410,7 @@ var Logout = () => {
|
|
|
2538
2410
|
window.location.replace("/login");
|
|
2539
2411
|
};
|
|
2540
2412
|
};
|
|
2541
|
-
var
|
|
2413
|
+
var callback = () => {
|
|
2542
2414
|
const search = window.location.search;
|
|
2543
2415
|
const query = new URLSearchParams(search);
|
|
2544
2416
|
const state = query.get("state");
|
|
@@ -2557,7 +2429,7 @@ var Callback = () => {
|
|
|
2557
2429
|
window.location.replace("/");
|
|
2558
2430
|
};
|
|
2559
2431
|
var clearCache = () => {
|
|
2560
|
-
|
|
2432
|
+
clear3();
|
|
2561
2433
|
localStorage.clear();
|
|
2562
2434
|
sessionStorage.clear();
|
|
2563
2435
|
};
|
|
@@ -2565,376 +2437,8 @@ var clearCache = () => {
|
|
|
2565
2437
|
// src/svchub/api/index.ts
|
|
2566
2438
|
var api_exports = {};
|
|
2567
2439
|
__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));
|
|
2440
|
+
auth: () => auth_exports
|
|
2891
2441
|
});
|
|
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
2442
|
|
|
2939
2443
|
// src/svchub/wss/index.ts
|
|
2940
2444
|
var wss_exports = {};
|
|
@@ -2944,25 +2448,25 @@ __export(wss_exports, {
|
|
|
2944
2448
|
});
|
|
2945
2449
|
var newTask = (worker) => {
|
|
2946
2450
|
if (!window.Worker) return;
|
|
2947
|
-
|
|
2948
|
-
|
|
2451
|
+
cfg.hub.TASK = new worker();
|
|
2452
|
+
cfg.hub.TASK.postMessage({
|
|
2949
2453
|
head: "INIT",
|
|
2950
2454
|
data: {
|
|
2951
|
-
url:
|
|
2952
|
-
app:
|
|
2953
|
-
uid:
|
|
2954
|
-
ver:
|
|
2455
|
+
url: cfg.hub.WSS,
|
|
2456
|
+
app: cfg.app.NAME,
|
|
2457
|
+
uid: cfg.app.UUID,
|
|
2458
|
+
ver: cfg.app.VERSION
|
|
2955
2459
|
}
|
|
2956
2460
|
});
|
|
2957
|
-
|
|
2461
|
+
cfg.hub.TASK.addEventListener("message", (e) => {
|
|
2958
2462
|
const json = e.data;
|
|
2959
2463
|
const head = json.head ? json.head : "";
|
|
2960
2464
|
const data = json.data ? json.data : "";
|
|
2961
2465
|
if (head == "ACCEPT") {
|
|
2962
2466
|
rspAccept(data);
|
|
2963
|
-
|
|
2467
|
+
cfg.hub.TASK?.postMessage({
|
|
2964
2468
|
head: "VERIFY",
|
|
2965
|
-
data:
|
|
2469
|
+
data: cfg.api.TOKEN
|
|
2966
2470
|
});
|
|
2967
2471
|
}
|
|
2968
2472
|
if (head == "DISCON") rspDiscon();
|
|
@@ -2975,11 +2479,11 @@ var newTask = (worker) => {
|
|
|
2975
2479
|
};
|
|
2976
2480
|
var checkUpdate = (min = 10) => {
|
|
2977
2481
|
return setInterval(() => {
|
|
2978
|
-
|
|
2482
|
+
cfg.hub.TASK?.postMessage({
|
|
2979
2483
|
head: "LATEST",
|
|
2980
2484
|
data: {
|
|
2981
|
-
app:
|
|
2982
|
-
uid:
|
|
2485
|
+
app: cfg.app.NAME,
|
|
2486
|
+
uid: cfg.app.UUID
|
|
2983
2487
|
}
|
|
2984
2488
|
});
|
|
2985
2489
|
}, 1e3 * 60 * min);
|
|
@@ -2987,30 +2491,30 @@ var checkUpdate = (min = 10) => {
|
|
|
2987
2491
|
var rspBrdMsg = (brd) => {
|
|
2988
2492
|
if (brd.cmd == "LOGS") console.log(brd.msg);
|
|
2989
2493
|
if (brd.cmd == "TIME") setTime(brd.msg);
|
|
2990
|
-
if (brd.cmd == "RESULT" && brd.to ==
|
|
2494
|
+
if (brd.cmd == "RESULT" && brd.to == cfg.hub.UUID) {
|
|
2991
2495
|
console.log(brd.cmd, "From:", brd.from);
|
|
2992
2496
|
console.log(brd.msg);
|
|
2993
2497
|
}
|
|
2994
|
-
if (brd.cmd == "CONRST" && (brd.to ==
|
|
2498
|
+
if (brd.cmd == "CONRST" && (brd.to == cfg.hub.UUID || brd.to == "@all")) {
|
|
2995
2499
|
sessionStorage.clear();
|
|
2996
2500
|
window.location.reload();
|
|
2997
2501
|
}
|
|
2998
|
-
if (brd.cmd == "LOGOUT" && (brd.to ==
|
|
2502
|
+
if (brd.cmd == "LOGOUT" && (brd.to == cfg.hub.UUID || brd.to == "@all")) {
|
|
2999
2503
|
localStorage.clear();
|
|
3000
2504
|
sessionStorage.clear();
|
|
3001
2505
|
window.location.reload();
|
|
3002
2506
|
}
|
|
3003
|
-
if (brd.cmd == "NOTIFY" && (brd.to ==
|
|
2507
|
+
if (brd.cmd == "NOTIFY" && (brd.to == cfg.hub.UUID || brd.to == "@all")) {
|
|
3004
2508
|
brdNotify(brd.msg);
|
|
3005
2509
|
}
|
|
3006
2510
|
if (brd.cmd == "") console.log(brd.msg);
|
|
3007
2511
|
};
|
|
3008
2512
|
var rspAccept = (data) => {
|
|
3009
|
-
|
|
3010
|
-
console.log("hub-uuid:",
|
|
2513
|
+
cfg.hub.UUID = data.uuid ? data.uuid : "";
|
|
2514
|
+
console.log("hub-uuid:", cfg.hub.UUID);
|
|
3011
2515
|
const boxTime = document.querySelector("#topbar #box-time");
|
|
3012
2516
|
if (boxTime) boxTime.classList.remove("offline");
|
|
3013
|
-
|
|
2517
|
+
toast("\u0E40\u0E0A\u0E37\u0E48\u0E2D\u0E21\u0E15\u0E48\u0E2D Server \u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08.!", { type: "success" });
|
|
3014
2518
|
};
|
|
3015
2519
|
var rspDiscon = () => {
|
|
3016
2520
|
const boxTime = document.querySelector("#topbar #box-time");
|
|
@@ -3021,23 +2525,23 @@ var rspDiscon = () => {
|
|
|
3021
2525
|
if (svTime) svTime.innerText = "server";
|
|
3022
2526
|
if (svDate) svDate.innerText = "OFFLINE";
|
|
3023
2527
|
}
|
|
3024
|
-
|
|
2528
|
+
toast("\u0E02\u0E32\u0E14\u0E01\u0E32\u0E23\u0E40\u0E0A\u0E37\u0E48\u0E2D\u0E21\u0E15\u0E48\u0E2D Server.!", { type: "failure" });
|
|
3025
2529
|
};
|
|
3026
2530
|
var rspLatest = (data) => {
|
|
3027
|
-
if (
|
|
2531
|
+
if (cfg.app.UUID == data.appuuid && cfg.app.NAME == data.appname) {
|
|
3028
2532
|
const path = window.location.pathname;
|
|
3029
|
-
if (path != "/changelog" &&
|
|
2533
|
+
if (path != "/changelog" && cfg.app.RELEASE != data.release) {
|
|
3030
2534
|
window.location.replace("/changelog");
|
|
3031
2535
|
}
|
|
3032
2536
|
}
|
|
3033
2537
|
};
|
|
3034
2538
|
var setTime = (data) => {
|
|
3035
2539
|
if (typeof data.unix != "number") return;
|
|
3036
|
-
|
|
2540
|
+
cfg.UNIX_TIME = Number(data.unix);
|
|
3037
2541
|
const svTime = document.querySelector("#topbar #box-time #sv-time");
|
|
3038
2542
|
const svDate = document.querySelector("#topbar #box-time #sv-date");
|
|
3039
2543
|
if (svTime && svDate) {
|
|
3040
|
-
const [date, time] = timeToStr(
|
|
2544
|
+
const [date, time] = timeToStr(cfg.UNIX_TIME).split(" ");
|
|
3041
2545
|
svTime.innerText = time;
|
|
3042
2546
|
svDate.innerText = thaiDate(date, 11);
|
|
3043
2547
|
}
|
|
@@ -3055,8 +2559,8 @@ var brdNotify = (data) => {
|
|
|
3055
2559
|
};
|
|
3056
2560
|
export {
|
|
3057
2561
|
api_exports as apiHub,
|
|
2562
|
+
cfg,
|
|
3058
2563
|
docs_exports as docs,
|
|
3059
|
-
gbvar,
|
|
3060
2564
|
info,
|
|
3061
2565
|
init,
|
|
3062
2566
|
lib_exports as lib,
|