@xwadex/fesd 0.0.67 → 0.0.69
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/dist/fesd-bundle.css +1 -9
- package/dist/fesd-bundle.js +480 -516
- package/dist/fesd-bundle.js.map +1 -1
- package/dist/image-preview-bundle.js +1923 -2025
- package/dist/image-preview-bundle.js.map +1 -1
- package/dist/tools-bundle.js +277 -316
- package/dist/tools-bundle.js.map +1 -1
- package/dist/vendor-bundle.js +1960 -2122
- package/dist/vendor-bundle.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var si = (n, i, t) => (zs(n, typeof i != "symbol" ? i + "" : i, t), t), Bs = (n, i, t) => {
|
|
4
|
-
if (!i.has(n))
|
|
5
|
-
throw TypeError("Cannot " + t);
|
|
6
|
-
};
|
|
7
|
-
var p = (n, i, t) => {
|
|
8
|
-
if (i.has(n))
|
|
9
|
-
throw TypeError("Cannot add the same private member more than once");
|
|
10
|
-
i instanceof WeakSet ? i.add(n) : i.set(n, t);
|
|
11
|
-
};
|
|
12
|
-
var d = (n, i, t) => (Bs(n, i, "access private method"), t);
|
|
13
|
-
import f from "jquery";
|
|
14
|
-
import { OverlayScrollbars as Ve } from "overlayscrollbars";
|
|
1
|
+
import m from "jquery";
|
|
2
|
+
import { OverlayScrollbars as tt } from "overlayscrollbars";
|
|
15
3
|
import "./vendor-bundle.js";
|
|
16
4
|
import "validator";
|
|
17
5
|
import "flatpickr";
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
const
|
|
6
|
+
import ht from "vanilla-lazyload";
|
|
7
|
+
import { unlock as Ct, lock as Ht } from "tua-body-scroll-lock";
|
|
8
|
+
const Z = {
|
|
21
9
|
SETTINGS: {
|
|
22
10
|
videoId: null,
|
|
23
11
|
videoType: null,
|
|
@@ -78,14 +66,14 @@ const He = {
|
|
|
78
66
|
TEMPLATE() {
|
|
79
67
|
return '<div class="player-container"><div class="player-wrapper"></div></div>';
|
|
80
68
|
}
|
|
81
|
-
},
|
|
69
|
+
}, It = {
|
|
82
70
|
SETTINGS: {
|
|
83
71
|
success: null,
|
|
84
72
|
text: null,
|
|
85
73
|
className: null,
|
|
86
74
|
duration: 1500
|
|
87
75
|
}
|
|
88
|
-
},
|
|
76
|
+
}, P = {
|
|
89
77
|
SETTINGS: {
|
|
90
78
|
target: null,
|
|
91
79
|
route: null,
|
|
@@ -107,16 +95,16 @@ const He = {
|
|
|
107
95
|
destroy: null,
|
|
108
96
|
update: null
|
|
109
97
|
},
|
|
110
|
-
TEMPLATE(
|
|
98
|
+
TEMPLATE(s) {
|
|
111
99
|
return `
|
|
112
100
|
<div class="modal-scroller">
|
|
113
|
-
<div class="modal-wrapper" ${
|
|
101
|
+
<div class="modal-wrapper" ${s === "destroy" ? "data-modal-destroy" : "data-modal-close"}>
|
|
114
102
|
<div class="modal-content" stop-propagation>
|
|
115
103
|
</div>
|
|
116
104
|
</div>
|
|
117
105
|
`;
|
|
118
106
|
}
|
|
119
|
-
},
|
|
107
|
+
}, $ = {
|
|
120
108
|
SETTINGS: {
|
|
121
109
|
direction: "left",
|
|
122
110
|
// 方向 - top || right || bottom || left
|
|
@@ -135,7 +123,7 @@ const He = {
|
|
|
135
123
|
gap: 30
|
|
136
124
|
// 跑馬燈內容之間的距離 - Number
|
|
137
125
|
}
|
|
138
|
-
},
|
|
126
|
+
}, et = {
|
|
139
127
|
SETTINGS: {
|
|
140
128
|
scrollbar: {
|
|
141
129
|
"scrollbar-track-color": "transparent",
|
|
@@ -144,26 +132,26 @@ const He = {
|
|
|
144
132
|
"scrollbar-radius": "10px"
|
|
145
133
|
}
|
|
146
134
|
},
|
|
147
|
-
TEMPLATE(
|
|
135
|
+
TEMPLATE(s, t, e, i) {
|
|
148
136
|
const o = `
|
|
149
|
-
<i class="${
|
|
137
|
+
<i class="${i || "dropdown-icon"}"></i>
|
|
150
138
|
`, a = `
|
|
151
139
|
<div class="filter-bar">
|
|
152
|
-
<input class="filter-input" type="text" placeholder="${
|
|
140
|
+
<input class="filter-input" type="text" placeholder="${t}" disabled>
|
|
153
141
|
</div>
|
|
154
142
|
`, r = `<div class="select-wrapper">
|
|
155
143
|
<div class="select-display"></div>
|
|
156
144
|
${o}
|
|
157
145
|
<div class="dropdown">
|
|
158
|
-
${
|
|
146
|
+
${s ? a : ""}
|
|
159
147
|
<div class="dropdown-scroller">
|
|
160
148
|
<ul class="dropdown-list"></ul>
|
|
161
149
|
</div>
|
|
162
150
|
</div>
|
|
163
151
|
</div>`;
|
|
164
|
-
return
|
|
152
|
+
return e || r;
|
|
165
153
|
}
|
|
166
|
-
},
|
|
154
|
+
}, qt = {
|
|
167
155
|
SETTINGS: {
|
|
168
156
|
basic_rwd: 900,
|
|
169
157
|
markdownLink: !1,
|
|
@@ -172,7 +160,7 @@ const He = {
|
|
|
172
160
|
navigation: !1,
|
|
173
161
|
scrollStep: !1
|
|
174
162
|
}
|
|
175
|
-
},
|
|
163
|
+
}, mt = {
|
|
176
164
|
SETTINGS: {
|
|
177
165
|
scroller: window,
|
|
178
166
|
class: "aost-show",
|
|
@@ -195,7 +183,7 @@ const He = {
|
|
|
195
183
|
enter: null,
|
|
196
184
|
leave: null
|
|
197
185
|
}
|
|
198
|
-
},
|
|
186
|
+
}, F = {
|
|
199
187
|
SETTINGS: {
|
|
200
188
|
target: null,
|
|
201
189
|
container: null,
|
|
@@ -213,7 +201,7 @@ const He = {
|
|
|
213
201
|
beforeScroll: null,
|
|
214
202
|
afterScroll: null
|
|
215
203
|
}
|
|
216
|
-
},
|
|
204
|
+
}, x = {
|
|
217
205
|
SETTINGS: {
|
|
218
206
|
type: "drag",
|
|
219
207
|
drag: {
|
|
@@ -240,22 +228,22 @@ const He = {
|
|
|
240
228
|
</ul>
|
|
241
229
|
</div>`;
|
|
242
230
|
},
|
|
243
|
-
collapse(
|
|
231
|
+
collapse(s) {
|
|
244
232
|
return `<div class="drag-container">
|
|
245
233
|
<ul class="wrapper">
|
|
246
234
|
</ul>
|
|
247
|
-
<div class="collapse-placeholder">${
|
|
235
|
+
<div class="collapse-placeholder">${s.placeholder}</div>
|
|
248
236
|
</div>
|
|
249
237
|
<div class="collapse-container">
|
|
250
238
|
<ul class="wrapper">
|
|
251
239
|
</ul>
|
|
252
240
|
</div>`;
|
|
253
241
|
},
|
|
254
|
-
dropdown(
|
|
255
|
-
return `<dropdown-el${
|
|
242
|
+
dropdown(s) {
|
|
243
|
+
return `<dropdown-el${s.placeholder ? ` d4-placeholder="${s.placeholder}"` : ""}${s.value ? ` d4-value="${s.value}"` : ""}></dropdown-el>`;
|
|
256
244
|
}
|
|
257
245
|
}
|
|
258
|
-
},
|
|
246
|
+
}, gt = {
|
|
259
247
|
SETTINGS: {
|
|
260
248
|
// 樣式 normal / process
|
|
261
249
|
type: "normal",
|
|
@@ -275,7 +263,7 @@ const He = {
|
|
|
275
263
|
// 步驟狀態綁定
|
|
276
264
|
stepOutput: ".step-show"
|
|
277
265
|
}
|
|
278
|
-
},
|
|
266
|
+
}, ft = {
|
|
279
267
|
SETTINGS: {
|
|
280
268
|
collapseClass: "collapse",
|
|
281
269
|
block: "[collapse-block]",
|
|
@@ -308,7 +296,7 @@ const He = {
|
|
|
308
296
|
update: null,
|
|
309
297
|
afterUpdate: null
|
|
310
298
|
}
|
|
311
|
-
},
|
|
299
|
+
}, vt = {
|
|
312
300
|
SETTINGS: {
|
|
313
301
|
// 是否要加 hover 效果?
|
|
314
302
|
hover: !0,
|
|
@@ -323,198 +311,242 @@ const He = {
|
|
|
323
311
|
// hover 毫秒 ?
|
|
324
312
|
speed: 600
|
|
325
313
|
}
|
|
326
|
-
},
|
|
314
|
+
}, _e = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
327
315
|
__proto__: null,
|
|
328
|
-
anchor4:
|
|
329
|
-
aost4:
|
|
330
|
-
article4:
|
|
331
|
-
collapse4:
|
|
332
|
-
dropdown4:
|
|
333
|
-
marquee4:
|
|
334
|
-
modal4:
|
|
335
|
-
multipurpose4:
|
|
336
|
-
ripple4:
|
|
337
|
-
share4:
|
|
338
|
-
tab4:
|
|
339
|
-
video4:
|
|
340
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
341
|
-
before: "beforebegin",
|
|
316
|
+
anchor4: F,
|
|
317
|
+
aost4: mt,
|
|
318
|
+
article4: qt,
|
|
319
|
+
collapse4: ft,
|
|
320
|
+
dropdown4: et,
|
|
321
|
+
marquee4: $,
|
|
322
|
+
modal4: P,
|
|
323
|
+
multipurpose4: x,
|
|
324
|
+
ripple4: vt,
|
|
325
|
+
share4: It,
|
|
326
|
+
tab4: gt,
|
|
327
|
+
video4: Z
|
|
328
|
+
}, Symbol.toStringTag, { value: "Module" })), E = {
|
|
342
329
|
after: "afterend",
|
|
343
330
|
append: "beforeend",
|
|
344
331
|
prepend: "afterbegin"
|
|
345
|
-
},
|
|
346
|
-
const
|
|
347
|
-
return
|
|
348
|
-
},
|
|
332
|
+
}, R = (s) => typeof s == "string" && s !== "", Q = (s) => s instanceof HTMLElement, X = (s) => s instanceof NodeList, T = (s) => A(s) !== null, j = (s) => typeof s == "function", A = (s) => Q(s) ? s : document.querySelector(s), S = (s) => X(s) ? s : document.querySelectorAll(s), Mt = () => Math.random().toString(36).substr(2, 9), Ot = (s) => {
|
|
333
|
+
const t = document.createElement("div");
|
|
334
|
+
return t.innerHTML = s, t.childNodes;
|
|
335
|
+
}, Pt = (s) => {
|
|
349
336
|
try {
|
|
350
|
-
JSON.parse(
|
|
337
|
+
JSON.parse(s);
|
|
351
338
|
} catch {
|
|
352
|
-
return
|
|
353
|
-
}
|
|
354
|
-
return JSON.parse(
|
|
355
|
-
},
|
|
356
|
-
console.warn(`[${
|
|
357
|
-
},
|
|
358
|
-
console.error(`[${
|
|
359
|
-
},
|
|
360
|
-
on(
|
|
361
|
-
if (!
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
t[e] || (t[e] = []), t[e].push(i);
|
|
339
|
+
return s;
|
|
340
|
+
}
|
|
341
|
+
return JSON.parse(s);
|
|
342
|
+
}, w = (s, t) => {
|
|
343
|
+
console.warn(`[${s} warn]: ${t}`);
|
|
344
|
+
}, nt = (s, t) => {
|
|
345
|
+
console.error(`[${s} error]: ${t}`);
|
|
346
|
+
}, N = {
|
|
347
|
+
on(s, t) {
|
|
348
|
+
if (!j(t)) return this;
|
|
349
|
+
const { __events__: e } = this;
|
|
350
|
+
return s.split(" ").forEach((i) => {
|
|
351
|
+
e[i] || (e[i] = []), e[i].push(t);
|
|
366
352
|
}), this;
|
|
367
353
|
},
|
|
368
|
-
off(
|
|
369
|
-
const { __events__:
|
|
370
|
-
return
|
|
371
|
-
typeof
|
|
372
|
-
|
|
354
|
+
off(s, t) {
|
|
355
|
+
const { __events__: e } = this;
|
|
356
|
+
return s.split(" ").forEach((i) => {
|
|
357
|
+
typeof t > "u" ? e[i] = [] : e[i] && e[i].forEach((n, o) => {
|
|
358
|
+
n === t && e[i].splice(o, 1);
|
|
373
359
|
});
|
|
374
360
|
}), this;
|
|
375
361
|
},
|
|
376
|
-
once(
|
|
377
|
-
if (!
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
this.off(n, t), i.apply(this, e);
|
|
362
|
+
once(s, t) {
|
|
363
|
+
if (!j(t)) return this;
|
|
364
|
+
const e = (...i) => {
|
|
365
|
+
this.off(s, e), t.apply(this, i);
|
|
381
366
|
};
|
|
382
|
-
return this.on(
|
|
367
|
+
return this.on(s, e);
|
|
383
368
|
},
|
|
384
|
-
emit(...
|
|
385
|
-
const { __events__:
|
|
386
|
-
return
|
|
387
|
-
|
|
369
|
+
emit(...s) {
|
|
370
|
+
const { __events__: t } = this, e = s[0], i = s.slice(1, s.length);
|
|
371
|
+
return t[e] ? (t[e].forEach((n) => {
|
|
372
|
+
j(n) && n.apply(this, i);
|
|
388
373
|
}), this) : this;
|
|
389
374
|
}
|
|
390
|
-
},
|
|
391
|
-
easeInOutCirc(
|
|
392
|
-
return (
|
|
375
|
+
}, Nt = {
|
|
376
|
+
easeInOutCirc(s, t, e, i) {
|
|
377
|
+
return (s /= i / 2) < 1 ? -e / 2 * (Math.sqrt(1 - s * s) - 1) + t : e / 2 * (Math.sqrt(1 - (s -= 2) * s) + 1) + t;
|
|
393
378
|
},
|
|
394
|
-
easeInQuart(
|
|
395
|
-
return
|
|
379
|
+
easeInQuart(s, t, e, i) {
|
|
380
|
+
return e * (s /= i) * s * s * s + t;
|
|
396
381
|
},
|
|
397
|
-
easeOutQuart(
|
|
398
|
-
return -
|
|
382
|
+
easeOutQuart(s, t, e, i) {
|
|
383
|
+
return -e * ((s = s / i - 1) * s * s * s - 1) + t;
|
|
399
384
|
}
|
|
400
|
-
},
|
|
401
|
-
const { target:
|
|
385
|
+
}, K = (s, t) => {
|
|
386
|
+
const { target: e, container: i, spacer: n, speed: o, gap: a, easing: r, direction: l } = s, c = l === "horizontal", d = c ? "scrollLeft" : "scrollTop", u = c ? "left" : "top", h = c ? "width" : "height", p = T(i) ? A(i) : document.scrollingElement, g = p[d], b = T(e) ? A(e).getBoundingClientRect()[u] : 0 - g, f = T(n) ? A(n).getBoundingClientRect()[h] : 0, v = b - a - f, H = 15;
|
|
402
387
|
let y = 0;
|
|
403
|
-
if (
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
i && i.emit(x, F), !i && n.on && G(n.on[x]) && n.on[x](F);
|
|
388
|
+
if (v === 0) return;
|
|
389
|
+
const z = (q) => {
|
|
390
|
+
const M = A(e);
|
|
391
|
+
t && t.emit(q, M), !t && s.on && j(s.on[q]) && s.on[q](M);
|
|
408
392
|
};
|
|
409
|
-
|
|
410
|
-
const
|
|
411
|
-
y +=
|
|
412
|
-
const
|
|
413
|
-
|
|
393
|
+
z("beforeScroll");
|
|
394
|
+
const I = () => {
|
|
395
|
+
y += H;
|
|
396
|
+
const q = Nt[r](y, g, v, o);
|
|
397
|
+
p[d] = q, y < o && requestAnimationFrame(I), y >= o && z("afterScroll");
|
|
414
398
|
};
|
|
415
|
-
requestAnimationFrame(
|
|
399
|
+
requestAnimationFrame(I);
|
|
416
400
|
};
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
constructor(i, t = {}) {
|
|
420
|
-
p(this, tt);
|
|
421
|
-
p(this, St);
|
|
422
|
-
p(this, Lt);
|
|
401
|
+
class bt {
|
|
402
|
+
constructor(t, e = {}) {
|
|
423
403
|
this.__storage__ = {
|
|
424
|
-
el:
|
|
425
|
-
options:
|
|
426
|
-
}, this.active = "data-anchor-active",
|
|
404
|
+
el: t,
|
|
405
|
+
options: e
|
|
406
|
+
}, this.active = "data-anchor-active", this.#t();
|
|
407
|
+
}
|
|
408
|
+
#t() {
|
|
409
|
+
const { el: t, options: e } = this.__storage__;
|
|
410
|
+
if (!R(t) || !T(t)) return;
|
|
411
|
+
const { SETTINGS: i, EVENTS: n } = F;
|
|
412
|
+
if (this.elements = e.state == "not active" ? S(t + `:not([${this.active}])`) : S(t), this.elements = S(t), this.options = Object.assign({}, i, e), this.__events__ = Object.assign({}, n), this.options.on)
|
|
413
|
+
for (const [o, a] of Object.entries(this.options.on))
|
|
414
|
+
this.__events__[o] = [a];
|
|
415
|
+
this.#s();
|
|
416
|
+
}
|
|
417
|
+
#s() {
|
|
418
|
+
const { elements: t, options: e } = this;
|
|
419
|
+
t.forEach((i) => {
|
|
420
|
+
i.anchor = {}, i.anchor.instance = this, i.anchor.eventHandler = this.#e, i.anchor.defaultOptions = e, i.anchor.methods = {}, i.anchor.methods.destroy = this.destroy, i.anchor.methods.update = this.update, i.addEventListener("click", i.anchor.eventHandler), i.setAttribute(this.active, "");
|
|
421
|
+
}), this.emit("afterInit");
|
|
422
|
+
}
|
|
423
|
+
#e() {
|
|
424
|
+
const { defaultOptions: t, eventHandler: e, instance: i } = this.anchor, n = {
|
|
425
|
+
target: this.getAttribute("data-anchor-target") || t.target,
|
|
426
|
+
container: this.getAttribute("data-anchor-container") || t.container,
|
|
427
|
+
spacer: this.getAttribute("data-anchor-spacer") || t.spacer,
|
|
428
|
+
gap: parseInt(this.getAttribute("data-anchor-gap") || t.gap),
|
|
429
|
+
speed: parseInt(this.getAttribute("data-anchor-speed")) || t.speed,
|
|
430
|
+
delay: parseInt(this.getAttribute("data-anchor-delay")) || t.delay,
|
|
431
|
+
easing: this.getAttribute("data-anchor-easing") || t.easing,
|
|
432
|
+
direction: this.getAttribute("data-anchor-direction") || t.direction
|
|
433
|
+
};
|
|
434
|
+
this.removeEventListener("click", e), setTimeout(() => {
|
|
435
|
+
this.addEventListener("click", e);
|
|
436
|
+
}, n.speed), setTimeout(() => {
|
|
437
|
+
K(n, i);
|
|
438
|
+
}, n.delay);
|
|
427
439
|
}
|
|
428
440
|
destroy() {
|
|
429
|
-
const { elements:
|
|
430
|
-
return this.emit("beforeDestroy"),
|
|
431
|
-
|
|
441
|
+
const { elements: t } = this;
|
|
442
|
+
return this.emit("beforeDestroy"), t.forEach((e) => {
|
|
443
|
+
e.anchor && (e.removeEventListener("click", e.anchor.eventHandler), delete e.anchor);
|
|
432
444
|
}), this;
|
|
433
445
|
}
|
|
434
446
|
update() {
|
|
435
|
-
|
|
436
|
-
return d(i = this.destroy(), tt, qe).call(i), this.emit("afterUpdate"), this;
|
|
447
|
+
return this.destroy().#t(), this.emit("afterUpdate"), this;
|
|
437
448
|
}
|
|
438
|
-
static run(
|
|
439
|
-
const { SETTINGS:
|
|
449
|
+
static run(t) {
|
|
450
|
+
const { SETTINGS: e } = F, i = Object.assign({}, e, t);
|
|
440
451
|
setTimeout(() => {
|
|
441
|
-
|
|
442
|
-
},
|
|
452
|
+
K(i);
|
|
453
|
+
}, i.delay);
|
|
443
454
|
}
|
|
444
|
-
static url(
|
|
445
|
-
const { SETTINGS:
|
|
446
|
-
if (!a)
|
|
447
|
-
|
|
448
|
-
const r = Object.assign({}, t, i, { target: a });
|
|
455
|
+
static url(t) {
|
|
456
|
+
const { SETTINGS: e } = F, { hashName: i } = t, n = window.location.search || window.location.hash, { searchParams: o } = new URL(window.location), a = document.querySelector(`[data-anchor-id="${i ? o.get(i) : n.split("?").pop()}"]`);
|
|
457
|
+
if (!a) return;
|
|
458
|
+
const r = Object.assign({}, e, t, { target: a });
|
|
449
459
|
setTimeout(() => {
|
|
450
|
-
|
|
460
|
+
K(r);
|
|
451
461
|
}, r.delay);
|
|
452
462
|
}
|
|
453
463
|
}
|
|
454
|
-
|
|
455
|
-
const { el: i, options: t } = this.__storage__;
|
|
456
|
-
if (!ft(i) || !A(i))
|
|
457
|
-
return;
|
|
458
|
-
const { SETTINGS: e, EVENTS: s } = wt;
|
|
459
|
-
if (this.elements = t.state == "not active" ? D(i + `:not([${this.active}])`) : D(i), this.elements = D(i), this.options = Object.assign({}, e, t), this.__events__ = Object.assign({}, s), this.options.on)
|
|
460
|
-
for (const [o, a] of Object.entries(this.options.on))
|
|
461
|
-
this.__events__[o] = [a];
|
|
462
|
-
d(this, St, yi).call(this);
|
|
463
|
-
}, St = new WeakSet(), yi = function() {
|
|
464
|
-
const { elements: i, options: t } = this;
|
|
465
|
-
i.forEach((e) => {
|
|
466
|
-
e.anchor = {}, e.anchor.instance = this, e.anchor.eventHandler = d(this, Lt, wi), e.anchor.defaultOptions = t, e.anchor.methods = {}, e.anchor.methods.destroy = this.destroy, e.anchor.methods.update = this.update, e.addEventListener("click", e.anchor.eventHandler), e.setAttribute(this.active, "");
|
|
467
|
-
}), this.emit("afterInit");
|
|
468
|
-
}, Lt = new WeakSet(), wi = function() {
|
|
469
|
-
const { defaultOptions: i, eventHandler: t, instance: e } = this.anchor, s = {
|
|
470
|
-
target: this.getAttribute("data-anchor-target") || i.target,
|
|
471
|
-
container: this.getAttribute("data-anchor-container") || i.container,
|
|
472
|
-
spacer: this.getAttribute("data-anchor-spacer") || i.spacer,
|
|
473
|
-
gap: parseInt(this.getAttribute("data-anchor-gap") || i.gap),
|
|
474
|
-
speed: parseInt(this.getAttribute("data-anchor-speed")) || i.speed,
|
|
475
|
-
delay: parseInt(this.getAttribute("data-anchor-delay")) || i.delay,
|
|
476
|
-
easing: this.getAttribute("data-anchor-easing") || i.easing,
|
|
477
|
-
direction: this.getAttribute("data-anchor-direction") || i.direction
|
|
478
|
-
};
|
|
479
|
-
this.removeEventListener("click", t), setTimeout(() => {
|
|
480
|
-
this.addEventListener("click", t);
|
|
481
|
-
}, s.speed), setTimeout(() => {
|
|
482
|
-
Me(s, e);
|
|
483
|
-
}, s.delay);
|
|
484
|
-
};
|
|
485
|
-
Object.assign(bi.prototype, z);
|
|
464
|
+
Object.assign(bt.prototype, N);
|
|
486
465
|
window.MODALS || (window.MODALS = {});
|
|
487
|
-
const { MODALS:
|
|
488
|
-
const { TEMPLATE:
|
|
489
|
-
|
|
490
|
-
const
|
|
491
|
-
return [...
|
|
492
|
-
|
|
493
|
-
}),
|
|
466
|
+
const { MODALS: O } = window, jt = (s) => {
|
|
467
|
+
const { TEMPLATE: t } = P, { childDom: e } = s, i = document.createElement("div");
|
|
468
|
+
i.innerHTML = t(s.getAttribute("data-modal-template-setting"));
|
|
469
|
+
const n = i.querySelector(".modal-content");
|
|
470
|
+
return [...e].forEach((o) => {
|
|
471
|
+
n.append(o);
|
|
472
|
+
}), i.children[0];
|
|
494
473
|
};
|
|
495
|
-
|
|
496
|
-
class Ti extends HTMLElement {
|
|
474
|
+
class yt extends HTMLElement {
|
|
497
475
|
constructor() {
|
|
498
|
-
super();
|
|
499
|
-
p(this, _t);
|
|
500
|
-
p(this, Dt);
|
|
501
|
-
p(this, xt);
|
|
502
|
-
p(this, kt);
|
|
503
|
-
p(this, $t);
|
|
504
|
-
this.initialize = !1;
|
|
476
|
+
super(), this.initialize = !1;
|
|
505
477
|
}
|
|
506
478
|
static get observedAttributes() {
|
|
507
479
|
return [":state"];
|
|
508
480
|
}
|
|
509
|
-
attributeChangedCallback(t, e,
|
|
510
|
-
|
|
511
|
-
case ":state":
|
|
512
|
-
d(this, $t, _i).call(this, s);
|
|
513
|
-
break;
|
|
514
|
-
}
|
|
481
|
+
attributeChangedCallback(t, e, i) {
|
|
482
|
+
t === ":state" && this.#n(i);
|
|
515
483
|
}
|
|
516
484
|
connectedCallback() {
|
|
517
|
-
this.initialize || (this.initialize = !0,
|
|
485
|
+
this.initialize || (this.initialize = !0, this.#t());
|
|
486
|
+
}
|
|
487
|
+
#t() {
|
|
488
|
+
const { ATTRS: t } = P;
|
|
489
|
+
this.__events__ = {}, this.getAttribute(":state") || this.setAttribute(":state", "close");
|
|
490
|
+
const e = this.getAttribute(t.id) || Mt();
|
|
491
|
+
this.getAttribute(t.id) || (w(`modern-modal needs a ${t.id} attribute with a unique id.`), this.setAttribute(t.id, e)), O[e] && w(`the ${t.id} "${e}" is already be used.`), O[e] = this, this.#s();
|
|
492
|
+
}
|
|
493
|
+
#s() {
|
|
494
|
+
this.childDom = this.childNodes, this.template = jt(this), this.innerHTML = "", this.append(this.template), this.#e();
|
|
495
|
+
}
|
|
496
|
+
#e() {
|
|
497
|
+
const t = this.querySelector(".modal-scroller");
|
|
498
|
+
this.__scroller__ = tt(t, {
|
|
499
|
+
overflowBehavior: {
|
|
500
|
+
x: "hidden"
|
|
501
|
+
},
|
|
502
|
+
autoUpdate: !0
|
|
503
|
+
}), window.modalScroll = this.__scroller__, this.#i();
|
|
504
|
+
}
|
|
505
|
+
#i() {
|
|
506
|
+
const t = this, { ATTRS: e } = P, { close: i, destroy: n } = e;
|
|
507
|
+
t.querySelectorAll(`[${i}]`)?.forEach((o) => {
|
|
508
|
+
o.addEventListener("click", function() {
|
|
509
|
+
const a = this.getAttribute(i);
|
|
510
|
+
(a && O[a] ? O[a] : t).close();
|
|
511
|
+
});
|
|
512
|
+
}), t.querySelectorAll(`[${n}]`)?.forEach((o) => {
|
|
513
|
+
o.addEventListener("click", function() {
|
|
514
|
+
const a = this.getAttribute(n);
|
|
515
|
+
(a && O[a] ? O[a] : t).destroy();
|
|
516
|
+
});
|
|
517
|
+
}), t.querySelector("[stop-propagation]")?.addEventListener("click", function(o) {
|
|
518
|
+
o.stopPropagation();
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
#n(t) {
|
|
522
|
+
const { __scroller__: e } = this;
|
|
523
|
+
if (t === "open") {
|
|
524
|
+
if (this.style.display = "block", e) {
|
|
525
|
+
const { viewport: i } = e.elements();
|
|
526
|
+
i.scrollTo({
|
|
527
|
+
top: 0
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
setTimeout(() => {
|
|
531
|
+
this.classList.add("show"), this.emit("open");
|
|
532
|
+
}, 100);
|
|
533
|
+
}
|
|
534
|
+
if (t === "close") {
|
|
535
|
+
if (!this.classList.contains("show")) return;
|
|
536
|
+
this.classList.remove("show");
|
|
537
|
+
const i = () => {
|
|
538
|
+
this.style.removeProperty("display"), this.emit("close"), this.removeEventListener("transitionend", i);
|
|
539
|
+
};
|
|
540
|
+
this.addEventListener("transitionend", i);
|
|
541
|
+
}
|
|
542
|
+
if (t === "destroy") {
|
|
543
|
+
this.classList.remove("show");
|
|
544
|
+
const i = () => {
|
|
545
|
+
const { ATTRS: n } = P, o = this.getAttribute(n.id);
|
|
546
|
+
this.style.removeProperty("display"), this.emit("close"), this.remove(), this.emit("destroy"), O[o] && delete O[o];
|
|
547
|
+
};
|
|
548
|
+
this.addEventListener("transitionend", i);
|
|
549
|
+
}
|
|
518
550
|
}
|
|
519
551
|
open() {
|
|
520
552
|
return this.setAttribute(":state", "open"), this;
|
|
@@ -526,86 +558,23 @@ class Ti extends HTMLElement {
|
|
|
526
558
|
return this.setAttribute(":state", "destroy"), this;
|
|
527
559
|
}
|
|
528
560
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
},
|
|
535
|
-
|
|
536
|
-
},
|
|
537
|
-
const
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
},
|
|
542
|
-
autoUpdate: !0
|
|
543
|
-
}), window.modalScroll = this.__scroller__, d(this, kt, Li).call(this);
|
|
544
|
-
}, kt = new WeakSet(), Li = function() {
|
|
545
|
-
var a, r, l;
|
|
546
|
-
const t = this, { ATTRS: e } = j, { close: s, destroy: o } = e;
|
|
547
|
-
(a = t.querySelectorAll(`[${s}]`)) == null || a.forEach((c) => {
|
|
548
|
-
c.addEventListener("click", function() {
|
|
549
|
-
const u = this.getAttribute(s);
|
|
550
|
-
(u && P[u] ? P[u] : t).close();
|
|
551
|
-
});
|
|
552
|
-
}), (r = t.querySelectorAll(`[${o}]`)) == null || r.forEach((c) => {
|
|
553
|
-
c.addEventListener("click", function() {
|
|
554
|
-
const u = this.getAttribute(o);
|
|
555
|
-
(u && P[u] ? P[u] : t).destroy();
|
|
556
|
-
});
|
|
557
|
-
}), (l = t.querySelector("[stop-propagation]")) == null || l.addEventListener("click", function(c) {
|
|
558
|
-
c.stopPropagation();
|
|
559
|
-
});
|
|
560
|
-
}, $t = new WeakSet(), _i = function(t) {
|
|
561
|
-
const { __scroller__: e } = this;
|
|
562
|
-
if (t === "open") {
|
|
563
|
-
if (this.style.display = "block", e) {
|
|
564
|
-
const { viewport: s } = e.elements();
|
|
565
|
-
s.scrollTo({
|
|
566
|
-
top: 0
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
setTimeout(() => {
|
|
570
|
-
this.classList.add("show"), this.emit("open");
|
|
571
|
-
}, 100);
|
|
572
|
-
}
|
|
573
|
-
if (t === "close") {
|
|
574
|
-
if (!this.classList.contains("show"))
|
|
575
|
-
return;
|
|
576
|
-
this.classList.remove("show");
|
|
577
|
-
const s = () => {
|
|
578
|
-
this.style.removeProperty("display"), this.emit("close"), this.removeEventListener("transitionend", s);
|
|
579
|
-
};
|
|
580
|
-
this.addEventListener("transitionend", s);
|
|
581
|
-
}
|
|
582
|
-
if (t === "destroy") {
|
|
583
|
-
this.classList.remove("show");
|
|
584
|
-
const s = () => {
|
|
585
|
-
const { ATTRS: o } = j, a = this.getAttribute(o.id);
|
|
586
|
-
this.style.removeProperty("display"), this.emit("close"), this.remove(), this.emit("destroy"), P[a] && delete P[a];
|
|
587
|
-
};
|
|
588
|
-
this.addEventListener("transitionend", s);
|
|
589
|
-
}
|
|
590
|
-
};
|
|
591
|
-
Object.assign(Ti.prototype, z);
|
|
592
|
-
const { MODALS: ei } = window, bt = {}, Di = (n, i, ...t) => {
|
|
593
|
-
if (!i)
|
|
594
|
-
return;
|
|
595
|
-
const e = n[i];
|
|
596
|
-
e && G(e) && e.apply(n, t);
|
|
597
|
-
}, xi = (n, ...i) => {
|
|
598
|
-
n && G(n) && n.apply(V, i);
|
|
599
|
-
}, oi = (n, i) => {
|
|
600
|
-
const { target: t } = n, e = ei[t] || _(n.target);
|
|
601
|
-
e && ki(n, i), e || Qs(n, i);
|
|
602
|
-
}, ki = (n, i) => {
|
|
603
|
-
const { target: t, action: e, on: s, e: o } = n, a = ei[t] || _(n.target);
|
|
561
|
+
Object.assign(yt.prototype, N);
|
|
562
|
+
const { MODALS: it } = window, U = {}, wt = (s, t, ...e) => {
|
|
563
|
+
if (!t) return;
|
|
564
|
+
const i = s[t];
|
|
565
|
+
i && j(i) && i.apply(s, e);
|
|
566
|
+
}, Tt = (s, ...t) => {
|
|
567
|
+
s && j(s) && s.apply(C, t);
|
|
568
|
+
}, ot = (s, t) => {
|
|
569
|
+
const { target: e } = s, i = it[e] || A(s.target);
|
|
570
|
+
i && Et(s, t), i || zt(s, t);
|
|
571
|
+
}, Et = (s, t) => {
|
|
572
|
+
const { target: e, action: i, on: n, e: o } = s, a = it[e] || A(s.target);
|
|
604
573
|
switch (["open", "close", "destroy"].forEach((l) => {
|
|
605
574
|
a.once(l, () => {
|
|
606
|
-
|
|
575
|
+
t && (t.emit(l, a, o), wt(t, n[l], a, o)), t || Tt(n[l], a);
|
|
607
576
|
});
|
|
608
|
-
}),
|
|
577
|
+
}), i) {
|
|
609
578
|
case "open":
|
|
610
579
|
a.open();
|
|
611
580
|
break;
|
|
@@ -620,183 +589,234 @@ const { MODALS: ei } = window, bt = {}, Di = (n, i, ...t) => {
|
|
|
620
589
|
l === "close" && a.open(), l === "open" && a.close();
|
|
621
590
|
break;
|
|
622
591
|
}
|
|
623
|
-
},
|
|
624
|
-
const { target:
|
|
625
|
-
if (!
|
|
626
|
-
return E("modal4", "cannot find target or data-modal-route is not defined");
|
|
592
|
+
}, zt = async (s, t) => {
|
|
593
|
+
const { target: e, route: i, container: n, on: o, e: a } = s;
|
|
594
|
+
if (!i) return w("modal4", "cannot find target or data-modal-route is not defined");
|
|
627
595
|
const r = (l, ...c) => {
|
|
628
|
-
|
|
596
|
+
t && (t.emit(l, ...c), wt(t, o[l], ...c)), t || Tt(o[l], ...c);
|
|
629
597
|
};
|
|
630
|
-
|
|
631
|
-
const c =
|
|
632
|
-
[...c].forEach((
|
|
633
|
-
|
|
598
|
+
U[e] || (U[e] = !0, fetch(i).then((l) => (r("success", a), l.text())).then((l) => {
|
|
599
|
+
const c = Ot(l), d = A(n) || A(P.SETTINGS.container);
|
|
600
|
+
[...c].forEach((h) => {
|
|
601
|
+
d.append(h);
|
|
634
602
|
});
|
|
635
|
-
const
|
|
636
|
-
r("complete",
|
|
603
|
+
const u = it[e] || A(s.target);
|
|
604
|
+
r("complete", u), Et(s, t), delete U[e];
|
|
637
605
|
}).catch((l) => {
|
|
638
|
-
r("error", l), delete
|
|
606
|
+
r("error", l), delete U[e];
|
|
639
607
|
}));
|
|
640
608
|
};
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
constructor(i, t = {}) {
|
|
644
|
-
p(this, et);
|
|
645
|
-
p(this, Ct);
|
|
646
|
-
p(this, Ht);
|
|
609
|
+
class C {
|
|
610
|
+
constructor(t, e = {}) {
|
|
647
611
|
this.__storage__ = {
|
|
648
|
-
el:
|
|
649
|
-
options:
|
|
650
|
-
}, this.active = "data-modal-active",
|
|
612
|
+
el: t,
|
|
613
|
+
options: e
|
|
614
|
+
}, this.active = "data-modal-active", this.#t();
|
|
615
|
+
}
|
|
616
|
+
#t() {
|
|
617
|
+
const { el: t, options: e } = this.__storage__;
|
|
618
|
+
if (!R(t) || !T(t)) return;
|
|
619
|
+
const { SETTINGS: i, EVENTS: n } = P;
|
|
620
|
+
if (this.elements = e.state == "not active" ? S(t + `:not([${this.active}])`) : S(t), this.options = Object.assign({}, i, e), this.__events__ = Object.assign({}, n), this.options.on)
|
|
621
|
+
for (const [o, a] of Object.entries(this.options.on))
|
|
622
|
+
this.__events__[o] = [a];
|
|
623
|
+
this.#s();
|
|
624
|
+
}
|
|
625
|
+
#s() {
|
|
626
|
+
const { elements: t, options: e } = this;
|
|
627
|
+
t.forEach((i) => {
|
|
628
|
+
i.modal = {}, i.modal.instance = this, i.modal.eventHandler = this.#e, i.modal.defaultOptions = e, i.modal.methods = {}, i.modal.methods.destroy = this.destroy, i.modal.methods.update = this.update, i.addEventListener("click", i.modal.eventHandler), i.setAttribute(this.active, "");
|
|
629
|
+
}), this.emit("init");
|
|
630
|
+
}
|
|
631
|
+
#e(t) {
|
|
632
|
+
const { defaultOptions: e, eventHandler: i, instance: n } = this.modal, o = Pt(this.getAttribute("data-modal-on"));
|
|
633
|
+
o && typeof o != "object" && w("modal4", "data-modal-on must be a json string.");
|
|
634
|
+
const a = {
|
|
635
|
+
target: this.getAttribute("data-modal-target") || e.target,
|
|
636
|
+
action: this.getAttribute("data-modal-action") || e.action,
|
|
637
|
+
route: this.getAttribute("data-modal-route") || e.route,
|
|
638
|
+
container: this.getAttribute("data-modal-container") || e.container,
|
|
639
|
+
on: o && typeof o == "object" ? o : {},
|
|
640
|
+
e: t
|
|
641
|
+
};
|
|
642
|
+
this.removeEventListener("click", i), setTimeout(() => {
|
|
643
|
+
this.addEventListener("click", i);
|
|
644
|
+
}, 200), ot(a, n);
|
|
651
645
|
}
|
|
652
646
|
destroy() {
|
|
653
|
-
const { elements:
|
|
654
|
-
return
|
|
655
|
-
|
|
647
|
+
const { elements: t } = this;
|
|
648
|
+
return t.forEach((e) => {
|
|
649
|
+
e.modal && (e.removeEventListener("click", e.modal.eventHandler), delete e.modal);
|
|
656
650
|
}), this;
|
|
657
651
|
}
|
|
658
652
|
update() {
|
|
659
|
-
|
|
660
|
-
return d(i = this.destroy(), et, Oe).call(i), this.emit("update"), this;
|
|
653
|
+
return this.destroy().#t(), this.emit("update"), this;
|
|
661
654
|
}
|
|
662
655
|
/** static method 'open' */
|
|
663
|
-
static open(
|
|
664
|
-
const { SETTINGS:
|
|
665
|
-
|
|
656
|
+
static open(t) {
|
|
657
|
+
const { SETTINGS: e } = P, i = Object.assign({}, e, { on: {} }, t);
|
|
658
|
+
ot(i);
|
|
666
659
|
}
|
|
667
660
|
/** static method 'defineMethods' */
|
|
668
|
-
static defineMethods(
|
|
669
|
-
|
|
670
|
-
const
|
|
671
|
-
for (const [
|
|
672
|
-
|
|
673
|
-
Object.assign(
|
|
661
|
+
static defineMethods(t) {
|
|
662
|
+
C.prototype.__methods__ || (C.prototype.__methods__ = {});
|
|
663
|
+
const e = C.prototype.__methods__;
|
|
664
|
+
for (const [i, n] of Object.entries(t))
|
|
665
|
+
j(n) && (e[i] = n);
|
|
666
|
+
Object.assign(C.prototype, C.prototype.__methods__);
|
|
674
667
|
}
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
this.__events__[o] = [a];
|
|
684
|
-
d(this, Ct, $i).call(this);
|
|
685
|
-
}, Ct = new WeakSet(), $i = function() {
|
|
686
|
-
const { elements: i, options: t } = this;
|
|
687
|
-
i.forEach((e) => {
|
|
688
|
-
e.modal = {}, e.modal.instance = this, e.modal.eventHandler = d(this, Ht, Ci), e.modal.defaultOptions = t, e.modal.methods = {}, e.modal.methods.destroy = this.destroy, e.modal.methods.update = this.update, e.addEventListener("click", e.modal.eventHandler), e.setAttribute(this.active, "");
|
|
689
|
-
}), this.emit("init");
|
|
690
|
-
}, Ht = new WeakSet(), Ci = function(i) {
|
|
691
|
-
const { defaultOptions: t, eventHandler: e, instance: s } = this.modal, o = Fs(this.getAttribute("data-modal-on"));
|
|
692
|
-
o && typeof o != "object" && E("modal4", "data-modal-on must be a json string.");
|
|
693
|
-
const a = {
|
|
694
|
-
target: this.getAttribute("data-modal-target") || t.target,
|
|
695
|
-
action: this.getAttribute("data-modal-action") || t.action,
|
|
696
|
-
route: this.getAttribute("data-modal-route") || t.route,
|
|
697
|
-
container: this.getAttribute("data-modal-container") || t.container,
|
|
698
|
-
on: o && typeof o == "object" ? o : {},
|
|
699
|
-
e: i
|
|
700
|
-
};
|
|
701
|
-
this.removeEventListener("click", e), setTimeout(() => {
|
|
702
|
-
this.addEventListener("click", e);
|
|
703
|
-
}, 200), oi(a, s);
|
|
704
|
-
};
|
|
705
|
-
let V = B;
|
|
706
|
-
Object.assign(V.prototype, z);
|
|
707
|
-
customElements.define("modern-modal", Ti);
|
|
708
|
-
const Ks = (n, i) => {
|
|
709
|
-
const t = n === window ? n.innerHeight : n.getBoundingClientRect().height, e = n === window ? 0 : n.getBoundingClientRect().top;
|
|
710
|
-
i.forEach((s) => {
|
|
711
|
-
const { class: o, delay: a, start: r, end: l, repeat: c, instance: u } = s.aost, { top: h, bottom: g } = s.getBoundingClientRect(), m = t * (r / 100), v = t * (l / 100);
|
|
712
|
-
if (h - e <= m && g - e >= v && s.offsetParent)
|
|
668
|
+
}
|
|
669
|
+
Object.assign(C.prototype, N);
|
|
670
|
+
customElements.define("modern-modal", yt);
|
|
671
|
+
const Bt = (s, t) => {
|
|
672
|
+
const e = s === window ? s.innerHeight : s.getBoundingClientRect().height, i = s === window ? 0 : s.getBoundingClientRect().top;
|
|
673
|
+
t.forEach((n) => {
|
|
674
|
+
const { class: o, delay: a, start: r, end: l, repeat: c, instance: d } = n.aost, { top: u, bottom: h } = n.getBoundingClientRect(), p = e * (r / 100), g = e * (l / 100);
|
|
675
|
+
if (u - i <= p && h - i >= g && n.offsetParent)
|
|
713
676
|
setTimeout(() => {
|
|
714
|
-
|
|
677
|
+
n.classList.add(o);
|
|
715
678
|
}, a);
|
|
716
679
|
else {
|
|
717
|
-
const
|
|
680
|
+
const f = n.classList.contains(o) && c === "down" && u - i >= p || c === "up" && h - i <= g || c === !0;
|
|
718
681
|
setTimeout(() => {
|
|
719
|
-
|
|
682
|
+
f && n.classList.remove(o);
|
|
720
683
|
}, a);
|
|
721
684
|
}
|
|
722
685
|
});
|
|
723
|
-
},
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
constructor(i, t = {}) {
|
|
727
|
-
p(this, it);
|
|
728
|
-
p(this, It);
|
|
686
|
+
}, Wt = (s, t) => s === "up" || s === "down" ? s : s !== null ? s === "true" ? !0 : s === "false" ? !1 : t.repeat : t.repeat;
|
|
687
|
+
class At {
|
|
688
|
+
constructor(t, e = {}) {
|
|
729
689
|
this.__storage__ = {
|
|
730
|
-
el:
|
|
731
|
-
options:
|
|
732
|
-
}, this.active = "data-aost-active",
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
const {
|
|
736
|
-
if (!t)
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
690
|
+
el: t,
|
|
691
|
+
options: e
|
|
692
|
+
}, this.active = "data-aost-active", this.#t();
|
|
693
|
+
}
|
|
694
|
+
#t() {
|
|
695
|
+
const { el: t, options: e } = this.__storage__;
|
|
696
|
+
if (!R(t) || !T(t)) return;
|
|
697
|
+
const { SETTINGS: i, EVENTS: n } = mt;
|
|
698
|
+
if (this.elements = e.state == "not active" ? S(t + `:not([${this.active}])`) : S(t), this.options = Object.assign({}, i, e), this.__events__ = Object.assign({}, n), this.options.on)
|
|
699
|
+
for (const [o, a] of Object.entries(this.options.on))
|
|
700
|
+
this.__events__[o] = [a];
|
|
701
|
+
this.#s();
|
|
702
|
+
}
|
|
703
|
+
#s() {
|
|
704
|
+
const { elements: t, options: e } = this, { scroller: i } = e, n = i === window || !T(i) ? window : A(i);
|
|
705
|
+
this.eventHandler = () => {
|
|
706
|
+
Bt(n, t);
|
|
707
|
+
}, t.forEach((a) => {
|
|
708
|
+
a.aost = {}, a.aost.class = a.getAttribute("data-aost-class") || e.class, a.aost.delay = parseInt(a.getAttribute("data-aost-delay")) || e.delay, a.aost.start = parseInt(a.getAttribute("data-aost-start")) || e.start, a.aost.end = parseInt(a.getAttribute("data-aost-end")) || e.end, a.aost.repeat = Wt(a.getAttribute("data-aost-repeat"), e), a.aost.methods = {}, a.aost.methods.destroy = this.destroy, a.aost.methods.update = this.update, a.aost.instance = this, a.setAttribute(this.active, "");
|
|
709
|
+
});
|
|
710
|
+
const { eventHandler: o } = this;
|
|
711
|
+
o(), n.aost = {}, n.aost.eventHandler = o, n.addEventListener("scroll", n.aost.eventHandler, !1);
|
|
712
|
+
}
|
|
713
|
+
destroy(t) {
|
|
714
|
+
const { elements: e, options: i } = this;
|
|
715
|
+
if (!e) return this;
|
|
716
|
+
const { scroller: n } = i, o = n === window || !T(n) ? window : A(n);
|
|
717
|
+
return o.aost && (o.removeEventListener("scroll", o.aost.eventHandler), delete o.aost), e.forEach((a) => {
|
|
718
|
+
if (!a.aost) return;
|
|
742
719
|
const { class: r } = a.aost;
|
|
743
|
-
|
|
720
|
+
t && a.classList.remove(r), delete a.aost;
|
|
744
721
|
}), this;
|
|
745
722
|
}
|
|
746
|
-
update(
|
|
747
|
-
|
|
748
|
-
d(t = this.destroy(i), it, Pe).call(t);
|
|
723
|
+
update(t) {
|
|
724
|
+
this.destroy(t).#t();
|
|
749
725
|
}
|
|
750
726
|
}
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
d(this, It, Ii).call(this);
|
|
760
|
-
}, It = new WeakSet(), Ii = function() {
|
|
761
|
-
const { elements: i, options: t } = this, { scroller: e } = t, s = e === window || !A(e) ? window : _(e);
|
|
762
|
-
this.eventHandler = () => {
|
|
763
|
-
Ks(s, i);
|
|
764
|
-
}, i.forEach((a) => {
|
|
765
|
-
a.aost = {}, a.aost.class = a.getAttribute("data-aost-class") || t.class, a.aost.delay = parseInt(a.getAttribute("data-aost-delay")) || t.delay, a.aost.start = parseInt(a.getAttribute("data-aost-start")) || t.start, a.aost.end = parseInt(a.getAttribute("data-aost-end")) || t.end, a.aost.repeat = Vs(a.getAttribute("data-aost-repeat"), t), a.aost.methods = {}, a.aost.methods.destroy = this.destroy, a.aost.methods.update = this.update, a.aost.instance = this, a.setAttribute(this.active, "");
|
|
766
|
-
});
|
|
767
|
-
const { eventHandler: o } = this;
|
|
768
|
-
o(), s.aost = {}, s.aost.eventHandler = o, s.addEventListener("scroll", s.aost.eventHandler, !1);
|
|
769
|
-
};
|
|
770
|
-
Object.assign(Hi.prototype, z);
|
|
771
|
-
const tn = (n) => {
|
|
772
|
-
const { TEMPLATE: i } = He, { childDom: t } = n, e = document.createElement("div");
|
|
773
|
-
e.innerHTML = i();
|
|
774
|
-
const s = e.querySelector(".player-wrapper");
|
|
775
|
-
return [...t].forEach((o) => {
|
|
776
|
-
s.append(o);
|
|
777
|
-
}), e.children[0];
|
|
727
|
+
Object.assign(At.prototype, N);
|
|
728
|
+
const Gt = (s) => {
|
|
729
|
+
const { TEMPLATE: t } = Z, { childDom: e } = s, i = document.createElement("div");
|
|
730
|
+
i.innerHTML = t();
|
|
731
|
+
const n = i.querySelector(".player-wrapper");
|
|
732
|
+
return [...e].forEach((o) => {
|
|
733
|
+
n.append(o);
|
|
734
|
+
}), i.children[0];
|
|
778
735
|
};
|
|
779
|
-
|
|
780
|
-
class en extends HTMLElement {
|
|
736
|
+
class Rt extends HTMLElement {
|
|
781
737
|
constructor() {
|
|
782
|
-
super();
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
738
|
+
super(), this.#t();
|
|
739
|
+
}
|
|
740
|
+
#t() {
|
|
741
|
+
if (!this.getAttribute("video-id")) {
|
|
742
|
+
w("videoPlayer", "video-render needs a ['video-id'] attribute to creat player.");
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
this.videoId = this.getAttribute("video-id"), this.videoType = this.getAttribute("video-type"), this.videoMode = this.getAttribute("video-mode"), this.autoplay = this.getAttribute("video-autoplay"), this.startTime = this.getAttribute("video-starttime"), this.videoInboxImg = this.getAttribute("video-inbox-img"), this.#s();
|
|
746
|
+
}
|
|
747
|
+
#s() {
|
|
748
|
+
this.childDom = this.childNodes, this.template = Gt(this), this.innerHTML = "", this.append(this.template), this.#e();
|
|
749
|
+
}
|
|
750
|
+
#e() {
|
|
751
|
+
const { videoType: t, videoMode: e } = this, { COOKIEDISAGREELAYOUT: i } = Z;
|
|
752
|
+
let n = "";
|
|
753
|
+
function o(a) {
|
|
754
|
+
m(a).addClass("cookie-disagree"), m(".cookie-disagree").append(i);
|
|
755
|
+
}
|
|
756
|
+
switch (t) {
|
|
757
|
+
case "youtubeAPI":
|
|
758
|
+
break;
|
|
759
|
+
case "youtube":
|
|
760
|
+
document.body.wd_youtube == !1 ? o("video-player") : n = this.#i();
|
|
761
|
+
break;
|
|
762
|
+
case "youkuAPI":
|
|
763
|
+
break;
|
|
764
|
+
case "youku":
|
|
765
|
+
document.body.wd_youku == !1 ? o("video-player") : n = this.#o();
|
|
766
|
+
break;
|
|
767
|
+
case "vimeo":
|
|
768
|
+
document.body.wd_vimeo == !1 ? o("video-player") : n = this.#n();
|
|
769
|
+
break;
|
|
770
|
+
case "bilibili":
|
|
771
|
+
document.body.wd_bilibili == !1 ? o("video-player") : n = this.#a();
|
|
772
|
+
break;
|
|
773
|
+
case "instagram":
|
|
774
|
+
document.body.wd_instagram == !1 ? o(".instagram-media") : n = this.#l();
|
|
775
|
+
break;
|
|
776
|
+
case "tiktok":
|
|
777
|
+
document.body.wd_tiktok == !1 ? o("video-player") : n = this.#c();
|
|
778
|
+
break;
|
|
779
|
+
case "videojs":
|
|
780
|
+
break;
|
|
781
|
+
case "video":
|
|
782
|
+
n = this.#d();
|
|
783
|
+
break;
|
|
784
|
+
}
|
|
785
|
+
this.querySelector(".player-wrapper").insertAdjacentHTML(E.prepend, n);
|
|
786
|
+
}
|
|
787
|
+
// youtube iframe
|
|
788
|
+
#i() {
|
|
789
|
+
const { videoId: t, autoplay: e, startTime: i } = this;
|
|
790
|
+
return `<iframe src="https://www.youtube.com/embed/${t}?rel=0&${e === "on" ? "autoplay=1" : ""}&start=${i}&mute=1&loop=1&enablejsapi=1" frameborder="0" allowfullscreen="0" volumn="0" allow="${e === "on" ? "autoplay;" : ""} encrypted-media; gyroscope; picture-in-picture;"></iframe>`;
|
|
791
|
+
}
|
|
792
|
+
// vimeo iframe
|
|
793
|
+
#n() {
|
|
794
|
+
const { videoId: t, autoplay: e, hash: i } = this;
|
|
795
|
+
return `<iframe src="https://player.vimeo.com/video/${t}?h=${i}&${e === "on" ? "autoplay=1" : ""}&loop=1&color=ffffff&title=0&byline=0&portrait=0" frameborder="0" allow="${e === "on" ? "autoplay;" : ""} fullscreen; picture-in-picture" allowfullscreen></iframe><script src="https://player.vimeo.com/api/player.js"><\/script>`;
|
|
796
|
+
}
|
|
797
|
+
// youku iframe
|
|
798
|
+
#o() {
|
|
799
|
+
const { videoId: t, autoplay: e } = this;
|
|
800
|
+
return `<iframe src="https://player.youku.com/embed/${t}?rel=0&${e === "on" ? "autoplay=true" : ""}" allow="${e === "on" ? "autoplay;" : ""} width="100%" height="100%" frameborder=0 "allowfullscreen"></iframe>`;
|
|
801
|
+
}
|
|
802
|
+
#a() {
|
|
803
|
+
const { videoId: t, autoplay: e } = this;
|
|
804
|
+
return `<iframe src="//player.bilibili.com/player.html?bvid=${t}&page=1&as_wide=1&high_quality=1&danmaku=0" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>`;
|
|
805
|
+
}
|
|
806
|
+
// 2025.02.11 新增 ig
|
|
807
|
+
#l() {
|
|
808
|
+
const { videoId: t, autoplay: e } = this;
|
|
809
|
+
return `<iframe class="instagram-media instagram-media-rendered" id="instagram-embed-0" src="https://www.instagram.com/p/${t}/embed/" width="num-w" height=" num-h" scrolling="auto" frameborder="0" data-instgrm-payload-id="instagram-media-payload-0"></iframe>`;
|
|
810
|
+
}
|
|
811
|
+
// 2025.02.11 新增 tiktok
|
|
812
|
+
#c() {
|
|
813
|
+
const { videoId: t, autoplay: e } = this;
|
|
814
|
+
return `<iframe name="__tt_embed__v79271677875424740" sandbox="allow-popups allow-popups-to-escape-sandbox allow-scripts allow-top-navigation allow-same-origin" src="https://www.tiktok.com/player/v1/${t}?&${e === "on" ? "autoplay=1" : ""}"></iframe>`;
|
|
815
|
+
}
|
|
816
|
+
// 2026.01.15 新增 video
|
|
817
|
+
#d() {
|
|
818
|
+
const { videoId: t, autoplay: e } = this;
|
|
819
|
+
return `<video src="${t}" ${e == "on" ? "autoplay" : ""} muted playsinline controls></video>`;
|
|
800
820
|
}
|
|
801
821
|
play() {
|
|
802
822
|
const { videoType: t } = this;
|
|
@@ -833,92 +853,25 @@ class en extends HTMLElement {
|
|
|
833
853
|
}
|
|
834
854
|
}
|
|
835
855
|
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
}, qt = new WeakSet(), qi = function() {
|
|
843
|
-
this.childDom = this.childNodes, this.template = tn(this), this.innerHTML = "", this.append(this.template), d(this, Ot, Oi).call(this);
|
|
844
|
-
}, Ot = new WeakSet(), Oi = function() {
|
|
845
|
-
const { videoType: t, videoMode: e } = this, { COOKIEDISAGREELAYOUT: s } = He;
|
|
846
|
-
let o = "";
|
|
847
|
-
function a(r) {
|
|
848
|
-
f(r).addClass("cookie-disagree"), f(".cookie-disagree").append(s);
|
|
849
|
-
}
|
|
850
|
-
switch (t) {
|
|
851
|
-
case "youtubeAPI":
|
|
852
|
-
break;
|
|
853
|
-
case "youtube":
|
|
854
|
-
document.body.wd_youtube == !1 ? a("video-player") : o = d(this, Pt, Pi).call(this);
|
|
855
|
-
break;
|
|
856
|
-
case "youkuAPI":
|
|
857
|
-
break;
|
|
858
|
-
case "youku":
|
|
859
|
-
document.body.wd_youku == !1 ? a("video-player") : o = d(this, jt, ji).call(this);
|
|
860
|
-
break;
|
|
861
|
-
case "vimeo":
|
|
862
|
-
document.body.wd_vimeo == !1 ? a("video-player") : o = d(this, Nt, Ni).call(this);
|
|
863
|
-
break;
|
|
864
|
-
case "bilibili":
|
|
865
|
-
document.body.wd_bilibili == !1 ? a("video-player") : o = d(this, zt, zi).call(this);
|
|
866
|
-
break;
|
|
867
|
-
case "instagram":
|
|
868
|
-
document.body.wd_instagram == !1 ? a(".instagram-media") : o = d(this, Bt, Bi).call(this);
|
|
869
|
-
break;
|
|
870
|
-
case "tiktok":
|
|
871
|
-
document.body.wd_tiktok == !1 ? a("video-player") : o = d(this, Wt, Wi).call(this);
|
|
872
|
-
break;
|
|
873
|
-
case "videojs":
|
|
874
|
-
break;
|
|
875
|
-
case "video":
|
|
876
|
-
o = d(this, Gt, Gi).call(this);
|
|
877
|
-
break;
|
|
878
|
-
}
|
|
879
|
-
this.querySelector(".player-wrapper").insertAdjacentHTML(S.prepend, o);
|
|
880
|
-
}, Pt = new WeakSet(), Pi = function() {
|
|
881
|
-
const { videoId: t, autoplay: e, startTime: s } = this;
|
|
882
|
-
return `<iframe src="https://www.youtube.com/embed/${t}?rel=0&${e === "on" ? "autoplay=1" : ""}&start=${s}&mute=1&loop=1&enablejsapi=1" frameborder="0" allowfullscreen="0" volumn="0" allow="${e === "on" ? "autoplay;" : ""} encrypted-media; gyroscope; picture-in-picture;"></iframe>`;
|
|
883
|
-
}, Nt = new WeakSet(), Ni = function() {
|
|
884
|
-
const { videoId: t, autoplay: e, hash: s } = this;
|
|
885
|
-
return `<iframe src="https://player.vimeo.com/video/${t}?h=${s}&${e === "on" ? "autoplay=1" : ""}&loop=1&color=ffffff&title=0&byline=0&portrait=0" frameborder="0" allow="${e === "on" ? "autoplay;" : ""} fullscreen; picture-in-picture" allowfullscreen></iframe><script src="https://player.vimeo.com/api/player.js"><\/script>`;
|
|
886
|
-
}, jt = new WeakSet(), ji = function() {
|
|
887
|
-
const { videoId: t, autoplay: e } = this;
|
|
888
|
-
return `<iframe src="https://player.youku.com/embed/${t}?rel=0&${e === "on" ? "autoplay=true" : ""}" allow="${e === "on" ? "autoplay;" : ""} width="100%" height="100%" frameborder=0 "allowfullscreen"></iframe>`;
|
|
889
|
-
}, zt = new WeakSet(), zi = function() {
|
|
890
|
-
const { videoId: t, autoplay: e } = this;
|
|
891
|
-
return `<iframe src="//player.bilibili.com/player.html?bvid=${t}&page=1&as_wide=1&high_quality=1&danmaku=0" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>`;
|
|
892
|
-
}, Bt = new WeakSet(), Bi = function() {
|
|
893
|
-
const { videoId: t, autoplay: e } = this;
|
|
894
|
-
return `<iframe class="instagram-media instagram-media-rendered" id="instagram-embed-0" src="https://www.instagram.com/p/${t}/embed/" width="num-w" height=" num-h" scrolling="auto" frameborder="0" data-instgrm-payload-id="instagram-media-payload-0"></iframe>`;
|
|
895
|
-
}, Wt = new WeakSet(), Wi = function() {
|
|
896
|
-
const { videoId: t, autoplay: e } = this;
|
|
897
|
-
return `<iframe name="__tt_embed__v79271677875424740" sandbox="allow-popups allow-popups-to-escape-sandbox allow-scripts allow-top-navigation allow-same-origin" src="https://www.tiktok.com/player/v1/${t}?&${e === "on" ? "autoplay=1" : ""}"></iframe>`;
|
|
898
|
-
}, Gt = new WeakSet(), Gi = function() {
|
|
899
|
-
const { videoId: t, autoplay: e } = this;
|
|
900
|
-
return `<video src="${t}" ${e == "on" ? "autoplay" : ""} muted playsinline controls></video>`;
|
|
901
|
-
};
|
|
902
|
-
let Q = 0;
|
|
903
|
-
function Ri(n) {
|
|
904
|
-
const i = [];
|
|
905
|
-
return (n || []).forEach((t) => {
|
|
906
|
-
t instanceof HTMLElement ? i.push(t) : typeof t == "string" && i.push(...document.querySelectorAll(t));
|
|
907
|
-
}), i;
|
|
856
|
+
let B = 0;
|
|
857
|
+
function St(s) {
|
|
858
|
+
const t = [];
|
|
859
|
+
return (s || []).forEach((e) => {
|
|
860
|
+
e instanceof HTMLElement ? t.push(e) : typeof e == "string" && t.push(...document.querySelectorAll(e));
|
|
861
|
+
}), t;
|
|
908
862
|
}
|
|
909
|
-
function
|
|
910
|
-
const
|
|
911
|
-
|
|
863
|
+
function Lt(s) {
|
|
864
|
+
const t = St(s);
|
|
865
|
+
B += 1, B === 1 && document.documentElement.classList.add("scrollLock"), Ht(t);
|
|
912
866
|
}
|
|
913
|
-
function
|
|
914
|
-
|
|
915
|
-
const
|
|
916
|
-
|
|
867
|
+
function _t(s) {
|
|
868
|
+
B = Math.max(0, B - 1);
|
|
869
|
+
const t = St(s);
|
|
870
|
+
Ct(t), B === 0 && document.documentElement.classList.remove("scrollLock");
|
|
917
871
|
}
|
|
918
|
-
async function
|
|
919
|
-
if (
|
|
920
|
-
|
|
921
|
-
f("body").append(`
|
|
872
|
+
async function De(s = 0) {
|
|
873
|
+
if (m(".loading-wrapper").length) return;
|
|
874
|
+
m("body").append(`
|
|
922
875
|
<div class="loading-wrapper">
|
|
923
876
|
<div class="icon-box">
|
|
924
877
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid"><path d="M10 50A40 40 0 0 0 90 50A40 42 0 0 1 10 50" fill="#ffffff" stroke="none">
|
|
@@ -928,31 +881,31 @@ async function zn(n = 0) {
|
|
|
928
881
|
</svg>
|
|
929
882
|
</div>
|
|
930
883
|
</div>
|
|
931
|
-
`),
|
|
932
|
-
|
|
884
|
+
`), m(".loading-wrapper").delay(s).fadeIn(300).promise().done(function() {
|
|
885
|
+
Lt();
|
|
933
886
|
});
|
|
934
887
|
}
|
|
935
|
-
function
|
|
936
|
-
|
|
937
|
-
|
|
888
|
+
function $e() {
|
|
889
|
+
m(".loading-wrapper").fadeOut(300).promise().done(function() {
|
|
890
|
+
m(".loading-wrapper").remove(), _t();
|
|
938
891
|
});
|
|
939
892
|
}
|
|
940
|
-
function
|
|
941
|
-
new
|
|
893
|
+
function ke(s, t) {
|
|
894
|
+
new be(s, t);
|
|
942
895
|
}
|
|
943
|
-
function
|
|
944
|
-
const
|
|
945
|
-
} }),
|
|
946
|
-
|
|
896
|
+
function Xt() {
|
|
897
|
+
const s = document.querySelector("[data-aost]") && new At("[data-aost]"), t = document.querySelector("[data-anchor-target]") && new bt("[data-anchor-target]"), e = new ht({ callback_loaded: () => {
|
|
898
|
+
} }), i = new ue();
|
|
899
|
+
s?.update(), e.update(), i.reValidate(), t?.update();
|
|
947
900
|
}
|
|
948
|
-
function
|
|
901
|
+
function xe(s, t = () => {
|
|
949
902
|
}) {
|
|
950
|
-
|
|
951
|
-
typeof
|
|
952
|
-
}).siblings("[data-tab-content]").hide(),
|
|
903
|
+
m(`[data-tab-content=${s}]`).fadeIn(function() {
|
|
904
|
+
typeof t == "function" && t();
|
|
905
|
+
}).siblings("[data-tab-content]").hide(), Xt();
|
|
953
906
|
}
|
|
954
|
-
function
|
|
955
|
-
|
|
907
|
+
function Ce() {
|
|
908
|
+
tt(
|
|
956
909
|
{
|
|
957
910
|
target: document.body,
|
|
958
911
|
cancel: {
|
|
@@ -976,399 +929,394 @@ function Rn() {
|
|
|
976
929
|
}
|
|
977
930
|
);
|
|
978
931
|
}
|
|
979
|
-
function
|
|
980
|
-
window.onpageshow = function(
|
|
981
|
-
|
|
932
|
+
function He() {
|
|
933
|
+
window.onpageshow = function(s) {
|
|
934
|
+
s.persisted && window.location.reload();
|
|
982
935
|
};
|
|
983
936
|
}
|
|
984
|
-
function
|
|
985
|
-
const
|
|
937
|
+
function Ie() {
|
|
938
|
+
const s = navigator.userAgent;
|
|
986
939
|
return {
|
|
987
|
-
BigSurUP: /Mac OS X 10.15/.test(
|
|
940
|
+
BigSurUP: /Mac OS X 10.15/.test(s) || /Mac OS X 10_15_7/.test(s) || /Mac OS X 10_15_8/.test(s) || /Mac OS X 10_15_9/.test(s) || /Mac OS X 11_/.test(s) || /Mac OS X 12_/.test(s)
|
|
988
941
|
};
|
|
989
942
|
}
|
|
990
|
-
function
|
|
991
|
-
|
|
992
|
-
|
|
943
|
+
function qe(s, t) {
|
|
944
|
+
m(s).on("click", function() {
|
|
945
|
+
m(this).toggleClass(t);
|
|
993
946
|
});
|
|
994
947
|
}
|
|
995
|
-
function
|
|
996
|
-
|
|
997
|
-
|
|
948
|
+
function Me(s, t) {
|
|
949
|
+
m(s).on("click", function() {
|
|
950
|
+
m(s).not(this).removeClass(t), m(this).addClass(t);
|
|
998
951
|
});
|
|
999
952
|
}
|
|
1000
|
-
const
|
|
1001
|
-
let
|
|
953
|
+
const Oe = (s) => new Promise((t) => {
|
|
954
|
+
let e = setTimeout(() => (clearTimeout(e), t()), s);
|
|
1002
955
|
});
|
|
1003
|
-
function
|
|
1004
|
-
let
|
|
1005
|
-
return function(...
|
|
1006
|
-
let
|
|
1007
|
-
clearTimeout(
|
|
1008
|
-
|
|
1009
|
-
},
|
|
956
|
+
function Ut(s, t = 250) {
|
|
957
|
+
let e = null;
|
|
958
|
+
return function(...i) {
|
|
959
|
+
let n = this;
|
|
960
|
+
clearTimeout(e), e = setTimeout(() => {
|
|
961
|
+
s.apply(n, i);
|
|
962
|
+
}, t);
|
|
1010
963
|
};
|
|
1011
964
|
}
|
|
1012
|
-
function
|
|
1013
|
-
let
|
|
965
|
+
function Pe(s, t = 250) {
|
|
966
|
+
let e, i;
|
|
1014
967
|
return function() {
|
|
1015
|
-
const
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
},
|
|
968
|
+
const n = this, o = arguments, a = +/* @__PURE__ */ new Date();
|
|
969
|
+
e && a < e + t ? (clearTimeout(i), i = setTimeout(function() {
|
|
970
|
+
e = a, s.apply(n, o);
|
|
971
|
+
}, t)) : (e = a, s.apply(n, o));
|
|
1019
972
|
};
|
|
1020
973
|
}
|
|
1021
|
-
function
|
|
1022
|
-
window._g.interval = [],
|
|
1023
|
-
const
|
|
1024
|
-
let
|
|
1025
|
-
window._g.interval[
|
|
1026
|
-
var o =
|
|
1027
|
-
--r, a = r < 0 ? --a : a, a = a < 10 ? a = "0" + a : a, a == 0 && r == 0 && clearInterval(window._g.interval[
|
|
974
|
+
function Ne() {
|
|
975
|
+
window._g.interval = [], m(".countdown").each((t, e) => {
|
|
976
|
+
const i = Number(m(e).attr("data-seconds")) + 1;
|
|
977
|
+
let n = Math.floor(i / 60) + ":" + i % 60;
|
|
978
|
+
window._g.interval[t] = setInterval(function() {
|
|
979
|
+
var o = n.split(":"), a = parseInt(o[0], 10), r = parseInt(o[1], 10);
|
|
980
|
+
--r, a = r < 0 ? --a : a, a = a < 10 ? a = "0" + a : a, a == 0 && r == 0 && clearInterval(window._g.interval[t]), r = r < 0 ? 59 : r, r = r < 10 ? "0" + r : r, m(e).html(a + ":" + r), n = a + ":" + r;
|
|
1028
981
|
}, 1e3);
|
|
1029
982
|
});
|
|
1030
983
|
}
|
|
1031
|
-
function
|
|
1032
|
-
return new Promise((
|
|
1033
|
-
let
|
|
1034
|
-
clearTimeout(
|
|
1035
|
-
},
|
|
984
|
+
function je(s = 500) {
|
|
985
|
+
return new Promise((t, e) => {
|
|
986
|
+
let i = setTimeout(() => {
|
|
987
|
+
clearTimeout(i), t();
|
|
988
|
+
}, s);
|
|
1036
989
|
});
|
|
1037
990
|
}
|
|
1038
|
-
function
|
|
1039
|
-
const
|
|
1040
|
-
let
|
|
1041
|
-
document.documentElement.style.setProperty("--vh",
|
|
991
|
+
function ze() {
|
|
992
|
+
const s = function() {
|
|
993
|
+
let t = window.innerHeight * 0.01;
|
|
994
|
+
document.documentElement.style.setProperty("--vh", t + "px");
|
|
1042
995
|
};
|
|
1043
|
-
|
|
996
|
+
s(), window.addEventListener("resize", Ut(s));
|
|
1044
997
|
}
|
|
1045
|
-
function
|
|
1046
|
-
const o = this, r =
|
|
998
|
+
function Be(s, t, e, i, n) {
|
|
999
|
+
const o = this, r = m(s).html().split("<br>");
|
|
1047
1000
|
let l = "", c = 0;
|
|
1048
|
-
r.forEach((
|
|
1049
|
-
|
|
1050
|
-
|
|
1001
|
+
r.forEach((d, u) => {
|
|
1002
|
+
u !== 0 && (l += "<br>"), d.split("").forEach((p, g) => {
|
|
1003
|
+
t ? (g === 0 && (l += '<span class="letter-wrap" style="display: inline-block">'), p === " " ? l += '</span> <span class="letter-wrap" style="display: inline-block">' : (l += `<span class="letter"${n || e ? ` style="${n ? `transition: ${o.formatFloat(Math.random(), 2) * n}s;` : ""}${e ? e === "random" ? `transition-delay: ${o.formatFloat(Math.random(), 2)}s;` : `transition-delay: ${e + c * i}s;` : ""}"` : ""}>${p}</span>`, c++), g === d.length - 1 && (l += "</span>")) : p === " " ? l += " " : (l += `<span class="letter"${n || e ? ` style="${n ? `transition: ${o.formatFloat(Math.random(), 2) * n}s;` : ""}${e ? e === "random" ? `transition-delay: ${o.formatFloat(Math.random(), 2)}s;` : `transition-delay: ${e + c * i}s;` : ""}"` : ""}>${p}</span>`, c++);
|
|
1051
1004
|
});
|
|
1052
|
-
}),
|
|
1005
|
+
}), m(s).html(l);
|
|
1053
1006
|
}
|
|
1054
|
-
function
|
|
1055
|
-
const
|
|
1056
|
-
return Math.round(
|
|
1007
|
+
function We(s, t) {
|
|
1008
|
+
const e = Math.pow(10, t);
|
|
1009
|
+
return Math.round(s * e) / e;
|
|
1057
1010
|
}
|
|
1058
|
-
function
|
|
1059
|
-
let
|
|
1060
|
-
if (
|
|
1061
|
-
switch (
|
|
1011
|
+
function Ge(s) {
|
|
1012
|
+
let t = s.activeIndex, e = s.slides.length;
|
|
1013
|
+
if (s.params.loop)
|
|
1014
|
+
switch (s.activeIndex) {
|
|
1062
1015
|
case 0:
|
|
1063
|
-
|
|
1016
|
+
t = e - 3;
|
|
1064
1017
|
break;
|
|
1065
|
-
case
|
|
1066
|
-
|
|
1018
|
+
case e - 1:
|
|
1019
|
+
t = 0;
|
|
1067
1020
|
break;
|
|
1068
1021
|
default:
|
|
1069
|
-
--
|
|
1022
|
+
--t;
|
|
1070
1023
|
}
|
|
1071
|
-
return
|
|
1024
|
+
return t;
|
|
1072
1025
|
}
|
|
1073
|
-
function
|
|
1074
|
-
const
|
|
1075
|
-
(
|
|
1026
|
+
function Re(s, t) {
|
|
1027
|
+
const e = s.$el, i = s.params.grid.rows, n = t || s.params.slidesPerView * i;
|
|
1028
|
+
(s.loopedSlides ? s.slides.length - s.loopedSlides * 2 : s.slides.length) <= n ? (e.addClass("swiper-no-swiping"), m(s.params.navigation.nextEl).hide(), m(s.params.navigation.prevEl).hide(), m(s.params.pagination.el).hide(), s.params.autoplay.enabled = !1, s.autoplay.stop()) : (e.removeClass("swiper-no-swiping"), m(s.params.navigation.nextEl).show(), m(s.params.navigation.prevEl).show(), m(s.params.pagination.el).show(), s.params.autoplay.enabled && s.autoplay.start());
|
|
1076
1029
|
}
|
|
1077
|
-
function
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
detectShade(
|
|
1030
|
+
function Xe(s) {
|
|
1031
|
+
s.el.querySelectorAll("img.detect-shade").forEach((t) => {
|
|
1032
|
+
t.addEventListener("load", function() {
|
|
1033
|
+
detectShade(t);
|
|
1081
1034
|
});
|
|
1082
1035
|
});
|
|
1083
1036
|
}
|
|
1084
|
-
function
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1037
|
+
function Ue(s) {
|
|
1038
|
+
const t = s.el, e = m(t).find(".swiper-slide-active"), i = m(e).find("video").get(0), n = m(t).find(".swiper-slide video");
|
|
1039
|
+
s.autoplay.stop(), m(i).off("ended"), i ? (n.each((o, a) => {
|
|
1087
1040
|
a.currentTime = 0;
|
|
1088
|
-
}),
|
|
1089
|
-
|
|
1090
|
-
}),
|
|
1041
|
+
}), m(i).on("ended", function() {
|
|
1042
|
+
s.slideNext();
|
|
1043
|
+
}), i.play()) : s.params.autoplay.enabled && s.autoplay.start();
|
|
1091
1044
|
}
|
|
1092
|
-
function
|
|
1093
|
-
|
|
1094
|
-
const
|
|
1045
|
+
function Ye() {
|
|
1046
|
+
m(".number-grow").each(function(s, t) {
|
|
1047
|
+
const e = m(t), o = e.attr("data-num").replace(/(\d)(?=(?:\d{3})+$)/g, "$1,").split(""), a = () => {
|
|
1095
1048
|
let r = "";
|
|
1096
1049
|
for (var l = 0; l <= 9; l++)
|
|
1097
1050
|
r += String(l) + "<br>";
|
|
1098
1051
|
return r;
|
|
1099
1052
|
};
|
|
1100
|
-
|
|
1053
|
+
m(o).each(function(r, l) {
|
|
1101
1054
|
const c = () => l !== "," ? `<div class="num" data-final-num="${l}"><div><br>${a()}<br>${a()}</div></div>` : `<div class="comma">${l}</div>`;
|
|
1102
|
-
|
|
1055
|
+
e.append(c);
|
|
1103
1056
|
});
|
|
1104
1057
|
});
|
|
1105
1058
|
}
|
|
1106
|
-
function
|
|
1107
|
-
|
|
1108
|
-
const
|
|
1059
|
+
function Fe() {
|
|
1060
|
+
m(".letter-grow").each(function(s, t) {
|
|
1061
|
+
const e = m(t), n = e.attr("data-letter").split(""), o = () => {
|
|
1109
1062
|
let a = "";
|
|
1110
1063
|
for (let r = 65; r <= 90; r++)
|
|
1111
1064
|
a += String.fromCharCode(r) + "<br>";
|
|
1112
1065
|
return a;
|
|
1113
1066
|
};
|
|
1114
|
-
|
|
1067
|
+
m(n).each(function(a, r) {
|
|
1115
1068
|
const l = `<div class="letter" data-final-letter="${r}"><div><br>${o()}<br>${o()}</div></div>`;
|
|
1116
|
-
|
|
1069
|
+
e.append(l);
|
|
1117
1070
|
});
|
|
1118
1071
|
});
|
|
1119
1072
|
}
|
|
1120
|
-
function
|
|
1121
|
-
const
|
|
1122
|
-
let
|
|
1123
|
-
return
|
|
1073
|
+
function Je(s) {
|
|
1074
|
+
const t = getComputedStyle(s).transform;
|
|
1075
|
+
let e = t.match(/^matrix3d\((.+)\)$/);
|
|
1076
|
+
return e ? parseFloat(e[1].split(", ")[12]) : (e = t.match(/^matrix\((.+)\)$/), e ? parseFloat(e[1].split(", ")[4]) : 0);
|
|
1124
1077
|
}
|
|
1125
|
-
function
|
|
1126
|
-
const
|
|
1127
|
-
let
|
|
1128
|
-
return
|
|
1078
|
+
function Ze(s) {
|
|
1079
|
+
const t = getComputedStyle(s).transform;
|
|
1080
|
+
let e = t.match(/^matrix3d\((.+)\)$/);
|
|
1081
|
+
return e ? parseFloat(e[1].split(", ")[13]) : (e = t.match(/^matrix\((.+)\)$/), e ? parseFloat(e[1].split(", ")[5]) : 0);
|
|
1129
1082
|
}
|
|
1130
|
-
function
|
|
1131
|
-
const
|
|
1132
|
-
return
|
|
1083
|
+
function Qe(s) {
|
|
1084
|
+
const t = document.createElement("div");
|
|
1085
|
+
return t.innerHTML = s, t.childNodes[0];
|
|
1133
1086
|
}
|
|
1134
|
-
const
|
|
1135
|
-
|
|
1136
|
-
|
|
1087
|
+
const at = (s) => s.videoId !== "" || typeof s.videoId < "u", Yt = (s) => s.$selector.getAttribute("video4-active") === "on", Y = (s) => `<video-player video-id="${s.videoId}" video-type="${s.videoType}" video-startTime="${s.videoStartTime}" video-autoplay="${s.videoAutoplay}"></video-player>`, rt = (s) => (console.log(s.videoId, "params.videoId"), `<blockquote class="instagram-media" data-instgrm-captioned data-instgrm-permalink="${s.videoId}"></blockquote>`);
|
|
1088
|
+
class W {
|
|
1089
|
+
static globalOptions = {};
|
|
1137
1090
|
//*-* 給Article4用的 **//
|
|
1138
|
-
constructor(
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
p(this, nt);
|
|
1142
|
-
p(this, ot);
|
|
1143
|
-
p(this, Xt);
|
|
1144
|
-
p(this, at);
|
|
1145
|
-
p(this, Ut);
|
|
1146
|
-
if (!ft(i) && !Ie(i) && !vt(i)) {
|
|
1147
|
-
ni("video4", `找不到該物件 -> ${i}`);
|
|
1091
|
+
constructor(t, e = {}) {
|
|
1092
|
+
if (!R(t) && !Q(t) && !X(t)) {
|
|
1093
|
+
nt("video4", `找不到該物件 -> ${t}`);
|
|
1148
1094
|
return;
|
|
1149
1095
|
}
|
|
1150
1096
|
this.__storage__ = {
|
|
1151
|
-
el:
|
|
1152
|
-
options:
|
|
1153
|
-
}, this.active = "data-video-active",
|
|
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
|
-
a.
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1097
|
+
el: t,
|
|
1098
|
+
options: e
|
|
1099
|
+
}, this.active = "data-video-active", this.#t();
|
|
1100
|
+
}
|
|
1101
|
+
#t() {
|
|
1102
|
+
const { el: t, options: e } = this.__storage__, { SETTINGS: i, EVENTS: n, LAYOUT: o } = Z;
|
|
1103
|
+
if (e.isGlobal && (W.globalOptions = e), this.elements = e.state == "not active" ? S(t + `:not([${this.active}])`) : S(t), this.options = Object.assign(
|
|
1104
|
+
{},
|
|
1105
|
+
{ LAYOUT: o },
|
|
1106
|
+
// 原始 configs 的 LAYOUT
|
|
1107
|
+
i,
|
|
1108
|
+
// 原始 configs 的 SETTINGS
|
|
1109
|
+
W.globalOptions,
|
|
1110
|
+
// 全站 A 設定
|
|
1111
|
+
e
|
|
1112
|
+
// 個別傳入的設定 (優先級最高)
|
|
1113
|
+
), this.__events__ = Object.assign({}, n), this.options.on)
|
|
1114
|
+
for (const [a, r] of Object.entries(this.options.on))
|
|
1115
|
+
this.__events__[a] = [r];
|
|
1116
|
+
this.#s();
|
|
1117
|
+
}
|
|
1118
|
+
#s() {
|
|
1119
|
+
const { elements: t, options: e } = this;
|
|
1120
|
+
t.forEach((i) => {
|
|
1121
|
+
i.video = {}, i.video.instance = this, i.video.defaultOptions = e, i.video.params = this.#a(i), i.video.methods = {}, i.video.methods.update = this.update, i.setAttribute(this.active, ""), at(i.video.params) && !Yt(i.video.params) && (i.setAttribute("video4-active", "on"), this.#n(i)), at(i.video.params) || nt("video4", "無法取得影片 ID");
|
|
1122
|
+
}), this.emit("init");
|
|
1123
|
+
}
|
|
1124
|
+
#e(t) {
|
|
1125
|
+
const { $selector: e, videoId: i, videoType: n, videoInboxImg: o, videoHighQualityPic: a } = t, r = e?.querySelector("img"), l = r?.getAttribute("src") || r?.getAttribute("data-src");
|
|
1126
|
+
return o ? Promise.resolve(o) : l ? Promise.resolve(l) : n == "youtube" ? a == "on" ? Promise.resolve(`https://img.youtube.com/vi/${i}/maxresdefault.jpg`) : Promise.resolve(`https://img.youtube.com/vi/${i}/0.jpg`) : n == "vimeo" ? Promise.resolve(`https://vumbnail.com/${i}_large.jpg`) : n == "tiktok" ? fetch(`https://www.tiktok.com/oembed?url=https://www.tiktok.com/@/video/${i}`, { method: "GET", redirect: "follow" }).then((c) => c.json()).then((c) => c.thumbnail_url).catch(function() {
|
|
1127
|
+
return "";
|
|
1128
|
+
}) : Promise.resolve("");
|
|
1129
|
+
}
|
|
1130
|
+
#i(t, e) {
|
|
1131
|
+
const { videoType: i, videoId: n } = e;
|
|
1132
|
+
if (!(t?.getAttribute("src") || t?.getAttribute("data-src"))) {
|
|
1133
|
+
if (i === "video") {
|
|
1134
|
+
const a = document.createElement("video");
|
|
1135
|
+
a.src = n, a.preload = "metadata", a.muted = !0, a.playsInline = !0, a.crossOrigin = "anonymous", a.onloadeddata = () => {
|
|
1136
|
+
a.currentTime = 0.5;
|
|
1137
|
+
}, a.onseeked = () => {
|
|
1138
|
+
const r = document.createElement("canvas");
|
|
1139
|
+
r.width = a.videoWidth, r.height = a.videoHeight, r.getContext("2d").drawImage(a, 0, 0), t.src = r.toDataURL("image/jpeg", 0.85);
|
|
1140
|
+
};
|
|
1141
|
+
return;
|
|
1142
|
+
}
|
|
1143
|
+
this.#e(e).then((a) => {
|
|
1144
|
+
a ? t.setAttribute("src", `${a}`) : w("video4", "僅 youtube & vimeo 提供,無圖片時放置預設封面畫面,其他影片平台請自行上傳封面照片");
|
|
1145
|
+
});
|
|
1197
1146
|
}
|
|
1198
|
-
d(this, nt, ze).call(this, t).then((a) => {
|
|
1199
|
-
a ? i.setAttribute("src", `${a}`) : E("video4", "僅 youtube & vimeo 提供,無圖片時放置預設封面畫面,其他影片平台請自行上傳封面照片");
|
|
1200
|
-
});
|
|
1201
1147
|
}
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1148
|
+
#n(t) {
|
|
1149
|
+
const { LAYOUT: e } = this.options, i = t.video.params, { $selector: n, videoLayoutNo: o, videoId: a, videoType: r, videoMode: l, videoButton: c, videoCover: d, videoHighQualityPic: u } = i;
|
|
1150
|
+
if (l === "onBox" || l === "inBox") {
|
|
1151
|
+
let h = null;
|
|
1152
|
+
if (d === "on") {
|
|
1153
|
+
t.classList.add("video4-cover"), n.querySelector("img") || (n.insertAdjacentHTML(E.prepend, '<picture><source srcset="" type="image/webp"><source srcset="" type="image/jpeg"><img src="" alt></picture>'), w("video4", "若啟用 [videoCover] 且選擇 onBox 模式必須於 video-target 內放置 img 結構,若無結構則自動加入圖片結構"));
|
|
1154
|
+
const p = n.querySelector("img"), g = p?.getAttribute("src") || p?.getAttribute("data-src"), b = e[o] ? e[o] : e[0] || "";
|
|
1155
|
+
if (b ? p.insertAdjacentHTML(E.after, b) : w("video4", `找不到對應的 LAYOUT 設定 (No: ${o}),且無預設樣式。`), !g)
|
|
1156
|
+
this.#i(p, i);
|
|
1157
|
+
else if (!g && r == "youtube")
|
|
1158
|
+
u == "on" ? p.setAttribute("src", `https://img.youtube.com/vi/${a}/maxresdefault.jpg `) : p.setAttribute("src", `https://img.youtube.com/vi/${a}/0.jpg`);
|
|
1159
|
+
else if (!g && r == "vimeo")
|
|
1160
|
+
p.setAttribute("src", `https://vumbnail.com/${a}_large.jpg`);
|
|
1161
|
+
else if (!g && r === "video") {
|
|
1162
|
+
const f = document.createElement("video");
|
|
1163
|
+
f.src = a, f.preload = "metadata", f.muted = !0, f.playsInline = !0, f.crossOrigin = "anonymous", f.onloadeddata = () => {
|
|
1164
|
+
f.currentTime = 0.5;
|
|
1165
|
+
}, f.onseeked = () => {
|
|
1166
|
+
const v = document.createElement("canvas");
|
|
1167
|
+
v.width = f.videoWidth, v.height = f.videoHeight, v.getContext("2d").drawImage(f, 0, 0), p.src = v.toDataURL("image/jpeg", 0.85);
|
|
1168
|
+
};
|
|
1169
|
+
} else !g && r == "tiktok" ? fetch(`https://www.tiktok.com/oembed?url=https://www.tiktok.com/@/video/${a}`, { method: "GET", redirect: "follow" }).then((f) => f.json()).then((f) => {
|
|
1170
|
+
const v = f.thumbnail_url;
|
|
1171
|
+
p.setAttribute("src", `${v}`);
|
|
1172
|
+
}).catch(function(f) {
|
|
1173
|
+
console.log("error");
|
|
1174
|
+
}) : w("video4", "僅 youtube & vimeo 提供,無圖片時放置預設封面畫面,其他影片平台請自行上傳封面照片");
|
|
1175
|
+
}
|
|
1176
|
+
c == "off" ? h = n : (h = n.querySelector(c) ?? n, n.querySelector(c) || w("video4", `找不到 videoButton 設定的 element -> '${c}' , 點擊物件轉移至 '${this.__storage__.el}'`)), h.video || (h.video = {}, h.video.params = i, h.video.instance = this), h.video.eventHandler = this.#o, h.addEventListener("click", h.video.eventHandler);
|
|
1177
|
+
} else if (l === "onPage") {
|
|
1178
|
+
let h = null;
|
|
1179
|
+
if (d == "on") {
|
|
1180
|
+
t.classList.add("video4-cover"), n.querySelector("img") || (n.insertAdjacentHTML(E.prepend, '<picture><source srcset="" type="image/webp"><source srcset="" type="image/jpeg"><img src="" alt></picture>'), w("video", "若啟用 [videoCover] 且選擇 onBox 模式必須於 video-target 內放置 img 結構"));
|
|
1181
|
+
const p = n.querySelector("img");
|
|
1182
|
+
p.insertAdjacentHTML(E.after, e[o]);
|
|
1183
|
+
const g = p?.getAttribute("src") || p?.getAttribute("data-src");
|
|
1184
|
+
g ? !g && r == "youtube" ? u == "on" ? p.setAttribute("src", `http://img.youtube.com/vi/${a}/maxresdefault.jpg `) : p.setAttribute("src", `https://img.youtube.com/vi/${a}/0.jpg`) : !g && r == "vimeo" ? p.setAttribute("src", `https://vumbnail.com/${a}_large.jpg`) : !g && r == "tiktok" ? fetch(`https://www.tiktok.com/oembed?url=https://www.tiktok.com/@/video/${a}`, { method: "GET", redirect: "follow" }).then((b) => b.json()).then((b) => {
|
|
1185
|
+
const f = b.thumbnail_url;
|
|
1186
|
+
p.setAttribute("src", `${f}`);
|
|
1227
1187
|
}).catch(function(b) {
|
|
1228
1188
|
console.log("error");
|
|
1229
|
-
}) :
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
i.classList.add("video4-cover"), s.querySelector("img") || (s.insertAdjacentHTML(S.prepend, '<picture><source srcset="" type="image/webp"><source srcset="" type="image/jpeg"><img src="" alt></picture>'), E("video", "若啟用 [videoCover] 且選擇 onBox 模式必須於 video-target 內放置 img 結構"));
|
|
1236
|
-
const m = s.querySelector("img");
|
|
1237
|
-
m.insertAdjacentHTML(S.after, t[o]);
|
|
1238
|
-
const v = (m == null ? void 0 : m.getAttribute("src")) || (m == null ? void 0 : m.getAttribute("data-src"));
|
|
1239
|
-
v ? !v && r == "youtube" ? h == "on" ? m.setAttribute("src", `http://img.youtube.com/vi/${a}/maxresdefault.jpg `) : m.setAttribute("src", `https://img.youtube.com/vi/${a}/0.jpg`) : !v && r == "vimeo" ? m.setAttribute("src", `https://vumbnail.com/${a}_large.jpg`) : !v && r == "tiktok" ? fetch(`https://www.tiktok.com/oembed?url=https://www.tiktok.com/@/video/${a}`, { method: "GET", redirect: "follow" }).then((w) => w.json()).then((w) => {
|
|
1240
|
-
const b = w.thumbnail_url;
|
|
1241
|
-
m.setAttribute("src", `${b}`);
|
|
1242
|
-
}).catch(function(w) {
|
|
1243
|
-
console.log("error");
|
|
1244
|
-
}) : v || E("video4", "僅 youtube & vimeo 提供,無圖片時放置預設封面畫面,其他影片平台請自行上傳封面照片") : d(this, ot, Be).call(this, m, e), c == "off" ? g = s : (g = s.querySelector(c) ?? s, s.querySelector(c) || E("video4", `找不到 videoButton 設定的 element -> '${c}', 點擊物件轉移至 '${this.__storage__.el}'`));
|
|
1245
|
-
} else {
|
|
1246
|
-
s.innerHTML = yt(e);
|
|
1247
|
-
return;
|
|
1189
|
+
}) : g || w("video4", "僅 youtube & vimeo 提供,無圖片時放置預設封面畫面,其他影片平台請自行上傳封面照片") : this.#i(p, i), c == "off" ? h = n : (h = n.querySelector(c) ?? n, n.querySelector(c) || w("video4", `找不到 videoButton 設定的 element -> '${c}', 點擊物件轉移至 '${this.__storage__.el}'`));
|
|
1190
|
+
} else {
|
|
1191
|
+
n.innerHTML = Y(i);
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
h.video || (h.video = {}, h.video.params = i), h.video.eventHandler = this.#o, h.addEventListener("click", h.video.eventHandler);
|
|
1248
1195
|
}
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
const F = y.querySelector(".video-content");
|
|
1295
|
-
d(O = e, nt, ze).call(O, t.params).then((J) => {
|
|
1296
|
-
x = `
|
|
1196
|
+
}
|
|
1197
|
+
#o(t) {
|
|
1198
|
+
const { video: e } = this, i = e.instance, {
|
|
1199
|
+
$selector: n,
|
|
1200
|
+
videoMode: o,
|
|
1201
|
+
videoTarget: a,
|
|
1202
|
+
videoKeep: r,
|
|
1203
|
+
videoId: l,
|
|
1204
|
+
videoTargetRoute: c,
|
|
1205
|
+
videoType: d,
|
|
1206
|
+
videoIgHtml: u,
|
|
1207
|
+
videoInboxImg: h,
|
|
1208
|
+
videoButton: p,
|
|
1209
|
+
videoLayoutNo: g,
|
|
1210
|
+
videoStartTime: b
|
|
1211
|
+
} = e.params, f = new ht({ callback_loaded: (H) => {
|
|
1212
|
+
} }), v = new URLSearchParams({
|
|
1213
|
+
video_mode: o,
|
|
1214
|
+
video_type: d,
|
|
1215
|
+
video_id: l
|
|
1216
|
+
});
|
|
1217
|
+
if (o == "onBox" || o == "inBox") {
|
|
1218
|
+
const H = {
|
|
1219
|
+
target: a,
|
|
1220
|
+
route: c + `?${v.toString()}`,
|
|
1221
|
+
on: {
|
|
1222
|
+
complete(y) {
|
|
1223
|
+
o == "onBox" && (d == "instagram" ? (y.setAttribute("video-typeStyle", `${d}`), window.instgrm?.Embeds ? (y.querySelector(".modal-content").insertAdjacentHTML("beforeend", rt(e.params)), window.instgrm.Embeds.process()) : console.log("window.instgrm is undefined")) : (y.querySelector(".modal-content").insertAdjacentHTML("beforeend", Y(e.params)), y.setAttribute("video-typeStyle", `${d}`))), o == "inBox" && (y.setAttribute("video-typeStyle", `${d}`), d == "instagram" && (window.instgrm?.Embeds ? (y.querySelector(".modal-content").insertAdjacentHTML("beforeend", rt(e.params)), window.instgrm.Embeds.process()) : console.log("window.instgrm is undefined")));
|
|
1224
|
+
},
|
|
1225
|
+
open(y) {
|
|
1226
|
+
const z = y.querySelectorAll("[data-overlayscrollbars-viewport]");
|
|
1227
|
+
if (f.update(), Lt([...z]), d == "instagram") {
|
|
1228
|
+
const I = document.querySelector("[video-template] .modal-content");
|
|
1229
|
+
new ResizeObserver((M) => {
|
|
1230
|
+
M[0].contentRect.height > 50 && I.classList.add("active");
|
|
1231
|
+
}).observe(I);
|
|
1232
|
+
}
|
|
1233
|
+
if (o == "inBox")
|
|
1234
|
+
if (d == "instagram")
|
|
1235
|
+
m(".video-content").remove();
|
|
1236
|
+
else {
|
|
1237
|
+
let I;
|
|
1238
|
+
const q = y.querySelector(".video-content");
|
|
1239
|
+
i.#e(e.params).then((M) => {
|
|
1240
|
+
I = `
|
|
1297
1241
|
<div
|
|
1298
1242
|
class="photo-box"
|
|
1299
1243
|
video-target
|
|
1300
1244
|
video-mode="onPage"
|
|
1301
|
-
video-type="${
|
|
1245
|
+
video-type="${d}"
|
|
1302
1246
|
video-id="${l}"
|
|
1303
|
-
video-button="${
|
|
1304
|
-
video-layout-no="${
|
|
1305
|
-
video-starttime="${
|
|
1247
|
+
video-button="${p}"
|
|
1248
|
+
video-layout-no="${g}"
|
|
1249
|
+
video-starttime="${b}"
|
|
1306
1250
|
>
|
|
1307
1251
|
<picture>
|
|
1308
1252
|
<source
|
|
1309
|
-
srcset="${
|
|
1253
|
+
srcset="${M || ""}"
|
|
1310
1254
|
type="image/webp"
|
|
1311
1255
|
/>
|
|
1312
1256
|
<source
|
|
1313
|
-
srcset="${
|
|
1257
|
+
srcset="${M || ""}"
|
|
1314
1258
|
type="image/jpeg"
|
|
1315
1259
|
/>
|
|
1316
|
-
<img src="${
|
|
1260
|
+
<img src="${M || ""}" alt="" />
|
|
1317
1261
|
</picture>
|
|
1318
|
-
</div>`,
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1262
|
+
</div>`, q.insertAdjacentHTML(E.prepend, I);
|
|
1263
|
+
const st = y.querySelectorAll("[video-target]");
|
|
1264
|
+
st.length > 0 && new W(st, {
|
|
1265
|
+
LAYOUT: e.params.LAYOUT,
|
|
1266
|
+
videoLayoutNo: e.params.videoLayoutNo
|
|
1267
|
+
});
|
|
1323
1268
|
});
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1269
|
+
}
|
|
1270
|
+
i?.emit("openModal");
|
|
1271
|
+
},
|
|
1272
|
+
close(y) {
|
|
1273
|
+
const z = y.querySelectorAll("[data-overlayscrollbars-viewport]");
|
|
1274
|
+
_t([...z]), i?.emit("closeModal");
|
|
1275
|
+
},
|
|
1276
|
+
destroy(y) {
|
|
1277
|
+
}
|
|
1333
1278
|
}
|
|
1279
|
+
};
|
|
1280
|
+
C.open(H);
|
|
1281
|
+
} else if (o == "onPage")
|
|
1282
|
+
if (e.params.videoAutoplay = "on", r == "off") {
|
|
1283
|
+
if (n.querySelector("video-player"))
|
|
1284
|
+
return;
|
|
1285
|
+
n.innerHTML = Y(e.params);
|
|
1286
|
+
return;
|
|
1287
|
+
} else {
|
|
1288
|
+
(n.querySelector(r) ?? n).insertAdjacentHTML("beforeend", Y(e.params));
|
|
1289
|
+
return;
|
|
1334
1290
|
}
|
|
1291
|
+
}
|
|
1292
|
+
#a(t) {
|
|
1293
|
+
const e = this.options;
|
|
1294
|
+
return {
|
|
1295
|
+
$selector: t,
|
|
1296
|
+
videoId: t.getAttribute("video-id"),
|
|
1297
|
+
videoType: t.getAttribute("video-type"),
|
|
1298
|
+
videoAutoplay: t.getAttribute("video-autoplay") || e.videoAutoplay,
|
|
1299
|
+
videoMode: t.getAttribute("video-mode") || e.videoMode,
|
|
1300
|
+
videoButton: t.getAttribute("video-button") || e.videoButton,
|
|
1301
|
+
videoKeep: t.getAttribute("video-keep") || e.videoKeep,
|
|
1302
|
+
videoCover: t.getAttribute("video-cover") || e.videoCover,
|
|
1303
|
+
videoLayoutNo: t.getAttribute("video-layout-no") || e.videoLayoutNo,
|
|
1304
|
+
videoTarget: t.getAttribute("video-target") || e.videoTarget,
|
|
1305
|
+
videoTargetRoute: t.getAttribute("video-target-route") || e.videoTargetRoute,
|
|
1306
|
+
videoStartTime: t.getAttribute("video-starttime") || e.videoStartTime,
|
|
1307
|
+
videoHighQualityPic: t.getAttribute("video-highquality") || e.videoHighQuality,
|
|
1308
|
+
videoIgHtml: t.getAttribute("video-ig") || e.videoIgHtml,
|
|
1309
|
+
videoInboxImg: t.getAttribute("video-inbox-img") || e.videoInboxImgHtml,
|
|
1310
|
+
LAYOUT: e.LAYOUT || []
|
|
1335
1311
|
};
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
(s.querySelector(r) ?? s).insertAdjacentHTML("beforeend", yt(t.params));
|
|
1345
|
-
return;
|
|
1346
|
-
}
|
|
1347
|
-
}, Ut = new WeakSet(), Ji = function(i) {
|
|
1348
|
-
const t = this.options;
|
|
1349
|
-
return {
|
|
1350
|
-
$selector: i,
|
|
1351
|
-
videoId: i.getAttribute("video-id"),
|
|
1352
|
-
videoType: i.getAttribute("video-type"),
|
|
1353
|
-
videoAutoplay: i.getAttribute("video-autoplay") || t.videoAutoplay,
|
|
1354
|
-
videoMode: i.getAttribute("video-mode") || t.videoMode,
|
|
1355
|
-
videoButton: i.getAttribute("video-button") || t.videoButton,
|
|
1356
|
-
videoKeep: i.getAttribute("video-keep") || t.videoKeep,
|
|
1357
|
-
videoCover: i.getAttribute("video-cover") || t.videoCover,
|
|
1358
|
-
videoLayoutNo: i.getAttribute("video-layout-no") || t.videoLayoutNo,
|
|
1359
|
-
videoTarget: i.getAttribute("video-target") || t.videoTarget,
|
|
1360
|
-
videoTargetRoute: i.getAttribute("video-target-route") || t.videoTargetRoute,
|
|
1361
|
-
videoStartTime: i.getAttribute("video-starttime") || t.videoStartTime,
|
|
1362
|
-
videoHighQualityPic: i.getAttribute("video-highquality") || t.videoHighQuality,
|
|
1363
|
-
videoIgHtml: i.getAttribute("video-ig") || t.videoIgHtml,
|
|
1364
|
-
videoInboxImg: i.getAttribute("video-inbox-img") || t.videoInboxImgHtml,
|
|
1365
|
-
LAYOUT: t.LAYOUT || []
|
|
1366
|
-
};
|
|
1367
|
-
}, si(X, "globalOptions", {});
|
|
1368
|
-
let Ne = X;
|
|
1369
|
-
Object.assign(Ne.prototype, z);
|
|
1370
|
-
customElements.define("video-player", en);
|
|
1371
|
-
const an = {
|
|
1312
|
+
}
|
|
1313
|
+
update() {
|
|
1314
|
+
this.#t();
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
Object.assign(W.prototype, N);
|
|
1318
|
+
customElements.define("video-player", Rt);
|
|
1319
|
+
const Ft = {
|
|
1372
1320
|
"zh-tw": {
|
|
1373
1321
|
臺北市: [
|
|
1374
1322
|
["中正區", "100"],
|
|
@@ -2198,213 +2146,370 @@ const an = {
|
|
|
2198
2146
|
]
|
|
2199
2147
|
}
|
|
2200
2148
|
};
|
|
2201
|
-
let
|
|
2202
|
-
const
|
|
2203
|
-
const { TEMPLATE:
|
|
2204
|
-
|
|
2205
|
-
|
|
2149
|
+
let G;
|
|
2150
|
+
const Jt = (s) => {
|
|
2151
|
+
const { TEMPLATE: t } = et, { childDom: e } = s.s, i = document.createElement("div"), n = s.classList.contains("filter"), o = s.getAttribute("filter-placeholder"), a = s.getAttribute("d4-icon"), r = s.getAttribute("custom-template");
|
|
2152
|
+
i.innerHTML = t(
|
|
2153
|
+
n,
|
|
2206
2154
|
o,
|
|
2207
2155
|
r,
|
|
2208
2156
|
a
|
|
2209
2157
|
);
|
|
2210
|
-
const l =
|
|
2211
|
-
return [...
|
|
2212
|
-
c.tagName === "LI" && (c.classList.contains("has-sublayer") ? [...c.querySelectorAll("li")].forEach((
|
|
2213
|
-
(!
|
|
2158
|
+
const l = i.querySelector(".dropdown-list");
|
|
2159
|
+
return [...e].forEach((c) => {
|
|
2160
|
+
c.tagName === "LI" && (c.classList.contains("has-sublayer") ? [...c.querySelectorAll("li")].forEach((u) => {
|
|
2161
|
+
(!u.hasAttribute("data-option") || u.getAttribute("data-option").trim() === "") && u.setAttribute("data-option", u.textContent.trim());
|
|
2214
2162
|
}) : (!c.hasAttribute("data-option") || c.getAttribute("data-option").trim() === "") && c.setAttribute("data-option", c.textContent.trim())), l.append(c);
|
|
2215
|
-
}),
|
|
2216
|
-
},
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
s || E("dropdown", `Can't not find control element(${e})`), s && s.classList.contains("disabled") && (s.classList.remove("disabled"), s.tagName === "DROPDOWN-EL" && s.s.activeLi && M(s, [...s.s.allLi].indexOf(s.s.activeLi)));
|
|
2163
|
+
}), i.children[0];
|
|
2164
|
+
}, Zt = (s) => {
|
|
2165
|
+
const t = s.getAttribute("control-elements")?.split(",");
|
|
2166
|
+
t && t.forEach((e) => {
|
|
2167
|
+
const i = document.querySelector(e);
|
|
2168
|
+
i || w("dropdown", `Can't not find control element(${e})`), i && i.classList.contains("disabled") && (i.classList.remove("disabled"), i.tagName === "DROPDOWN-EL" && i.s.activeLi && k(i, [...i.s.allLi].indexOf(i.s.activeLi)));
|
|
2222
2169
|
});
|
|
2223
|
-
},
|
|
2224
|
-
const
|
|
2225
|
-
if (
|
|
2226
|
-
switch (
|
|
2227
|
-
|
|
2228
|
-
}),
|
|
2170
|
+
}, k = (s, t) => {
|
|
2171
|
+
const e = s.getAttribute("d4-placeholder"), i = s.s.dropdownEl.querySelectorAll(".dropdown-list li");
|
|
2172
|
+
if (t < 0 || t.length === 0) {
|
|
2173
|
+
switch (i.forEach((n) => {
|
|
2174
|
+
n.classList.remove("active");
|
|
2175
|
+
}), s.s.activeLi = void 0, s.s.selectType) {
|
|
2229
2176
|
case "single":
|
|
2230
|
-
|
|
2177
|
+
s.s.value = {
|
|
2231
2178
|
index: -1,
|
|
2232
2179
|
id: void 0,
|
|
2233
2180
|
el: void 0
|
|
2234
2181
|
};
|
|
2235
2182
|
break;
|
|
2236
2183
|
case "multiple":
|
|
2237
|
-
|
|
2184
|
+
s.s.value = [];
|
|
2238
2185
|
break;
|
|
2239
2186
|
}
|
|
2240
|
-
|
|
2187
|
+
s.s.selectDisplayEl.textContent = e.trim(), s.setAttribute("d4-value", "");
|
|
2241
2188
|
} else {
|
|
2242
|
-
if (
|
|
2243
|
-
|
|
2189
|
+
if (s.classList.contains("disabled")) {
|
|
2190
|
+
s.s.selectDisplayEl.textContent = e.trim();
|
|
2244
2191
|
return;
|
|
2245
2192
|
}
|
|
2246
|
-
switch (
|
|
2193
|
+
switch (s.s.selectType) {
|
|
2247
2194
|
case "single":
|
|
2248
|
-
const
|
|
2249
|
-
|
|
2195
|
+
const n = i[t].textContent.trim();
|
|
2196
|
+
s.s.allLi.forEach((r) => {
|
|
2250
2197
|
r.classList.remove("active");
|
|
2251
|
-
}),
|
|
2252
|
-
index:
|
|
2253
|
-
id:
|
|
2254
|
-
el:
|
|
2198
|
+
}), i[t].classList.add("active"), s.s.selectDisplayEl.textContent = n, s.s.activeLi = i[t], s.s.value = {
|
|
2199
|
+
index: t,
|
|
2200
|
+
id: i[t].getAttribute("data-option"),
|
|
2201
|
+
el: i[t]
|
|
2255
2202
|
};
|
|
2256
2203
|
break;
|
|
2257
2204
|
case "multiple":
|
|
2258
|
-
Array.isArray(
|
|
2259
|
-
|
|
2205
|
+
Array.isArray(t) && s.s.allLi.forEach((r) => {
|
|
2206
|
+
t.indexOf([...s.s.allLi].indexOf(r)) >= 0 ? r.classList.add("active") : r.classList.remove("active");
|
|
2260
2207
|
});
|
|
2261
|
-
const o =
|
|
2262
|
-
o.length <= 0 ?
|
|
2263
|
-
const l = r.getAttribute("data-option"), c = r.textContent.trim(),
|
|
2264
|
-
|
|
2265
|
-
})),
|
|
2266
|
-
index: [...
|
|
2208
|
+
const o = s.s.dropdownEl.querySelectorAll(".dropdown-list li.active");
|
|
2209
|
+
o.length <= 0 ? s.s.selectDisplayEl.textContent = e.trim() : (s.s.selectDisplayEl.textContent = "", o.forEach((r) => {
|
|
2210
|
+
const l = r.getAttribute("data-option"), c = r.textContent.trim(), d = `<div class="option-btn" data-option="${l}"><div class="text">${c}</div><div class="remove-icon"></div></div>`;
|
|
2211
|
+
s.s.selectDisplayEl.insertAdjacentHTML(E.append, d);
|
|
2212
|
+
})), s.s.activeLi = o, s.s.value = [...o].map((r) => ({
|
|
2213
|
+
index: [...i].indexOf(r),
|
|
2267
2214
|
id: r.getAttribute("data-option"),
|
|
2268
2215
|
el: r
|
|
2269
2216
|
}));
|
|
2270
2217
|
const a = [...o].map((r) => r.getAttribute("data-option"));
|
|
2271
|
-
|
|
2218
|
+
s.setAttribute("d4-value", a.join());
|
|
2272
2219
|
break;
|
|
2273
2220
|
}
|
|
2274
2221
|
}
|
|
2275
|
-
},
|
|
2276
|
-
const
|
|
2277
|
-
|
|
2278
|
-
const
|
|
2279
|
-
|
|
2280
|
-
}),
|
|
2281
|
-
},
|
|
2282
|
-
const
|
|
2283
|
-
|
|
2222
|
+
}, Qt = (s) => {
|
|
2223
|
+
const t = s.s.cityLang;
|
|
2224
|
+
m("#newCityData").length > 0 ? m("#newCityData").val() !== "" && (G = JSON.parse(m("#newCityData").val())[0], console.log([0])) : G = Ft, s.classList.contains("city") && (s.s.dropdownEl.querySelector(".dropdown-list").innerHTML = "", Object.keys(G[t]).forEach((e) => {
|
|
2225
|
+
const i = document.createElement("li");
|
|
2226
|
+
i.textContent = e, i.setAttribute("data-option", e), s.s.dropdownEl.querySelector(".dropdown-list").append(i);
|
|
2227
|
+
}), s.s.allLi = s.s.dropdownEl.querySelectorAll(".dropdown-list li"));
|
|
2228
|
+
}, Kt = (s, t) => {
|
|
2229
|
+
const e = s.s.cityLang;
|
|
2230
|
+
G[e][t].forEach((i, n) => {
|
|
2284
2231
|
const o = document.createElement("li");
|
|
2285
|
-
o.textContent =
|
|
2232
|
+
o.textContent = i[0], o.setAttribute("data-option", i[0]), s.s.dropdownEl.querySelector(".dropdown-list").append(o);
|
|
2286
2233
|
});
|
|
2287
|
-
},
|
|
2288
|
-
|
|
2289
|
-
|
|
2234
|
+
}, V = () => {
|
|
2235
|
+
S('dropdown-el[d4-status="open"]').forEach((t) => {
|
|
2236
|
+
t.close();
|
|
2290
2237
|
});
|
|
2291
|
-
},
|
|
2292
|
-
const { SETTINGS:
|
|
2293
|
-
((
|
|
2294
|
-
Object.keys(
|
|
2295
|
-
|
|
2238
|
+
}, Vt = () => {
|
|
2239
|
+
const { SETTINGS: s } = et;
|
|
2240
|
+
((e, i) => {
|
|
2241
|
+
Object.keys(i).forEach((n) => {
|
|
2242
|
+
e.style.setProperty(`--${n}`, i[n]);
|
|
2296
2243
|
});
|
|
2297
|
-
})(document.documentElement,
|
|
2244
|
+
})(document.documentElement, s.scrollbar);
|
|
2298
2245
|
};
|
|
2299
|
-
|
|
2246
|
+
Vt();
|
|
2300
2247
|
document.addEventListener("click", function() {
|
|
2301
|
-
|
|
2248
|
+
V();
|
|
2302
2249
|
});
|
|
2303
|
-
|
|
2304
|
-
class Zi extends HTMLElement {
|
|
2250
|
+
class Dt extends HTMLElement {
|
|
2305
2251
|
constructor() {
|
|
2306
|
-
super();
|
|
2307
|
-
p(this, Yt);
|
|
2308
|
-
p(this, Ft);
|
|
2309
|
-
// -** 獨立 dropdown 出 body 更新
|
|
2310
|
-
p(this, rt);
|
|
2311
|
-
p(this, Jt);
|
|
2312
|
-
p(this, Zt);
|
|
2313
|
-
this.initialize = !1;
|
|
2252
|
+
super(), this.initialize = !1;
|
|
2314
2253
|
}
|
|
2315
2254
|
static get observedAttributes() {
|
|
2316
2255
|
return ["d4-status", "d4-placeholder", "d4-value"];
|
|
2317
2256
|
}
|
|
2318
|
-
attributeChangedCallback(t, e,
|
|
2319
|
-
const
|
|
2257
|
+
attributeChangedCallback(t, e, i) {
|
|
2258
|
+
const n = this;
|
|
2320
2259
|
switch (t) {
|
|
2321
2260
|
case "d4-status":
|
|
2322
|
-
if (e === null || e ===
|
|
2323
|
-
|
|
2324
|
-
(s === "open" || s === "close") && o.emit(s);
|
|
2261
|
+
if (e === null || e === i) return;
|
|
2262
|
+
(i === "open" || i === "close") && n.emit(i);
|
|
2325
2263
|
break;
|
|
2326
2264
|
case "d4-value":
|
|
2327
|
-
if (e === null || e ===
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
switch (o.hasAttribute("multiple") ? "multiple" : "single") {
|
|
2265
|
+
if (e === null || e === i) return;
|
|
2266
|
+
if (i !== "")
|
|
2267
|
+
switch (n.hasAttribute("multiple") ? "multiple" : "single") {
|
|
2331
2268
|
case "single":
|
|
2332
|
-
const
|
|
2333
|
-
|
|
2269
|
+
const a = n.s.dropdownEl.querySelector(`.dropdown-list li[data-option="${i}"]`);
|
|
2270
|
+
T(a) ? k(n, [...n.s.allLi].indexOf(a)) : k(n, -1);
|
|
2334
2271
|
break;
|
|
2335
2272
|
case "multiple":
|
|
2336
|
-
const
|
|
2337
|
-
|
|
2338
|
-
const
|
|
2339
|
-
|
|
2273
|
+
const r = [];
|
|
2274
|
+
n.s.dropdownEl.querySelector(".dropdown-list li").classList.remove("active"), i.split(",").forEach((c) => {
|
|
2275
|
+
const d = n.s.dropdownEl.querySelector(`.dropdown-list li[data-option="${c}"]`);
|
|
2276
|
+
T(d) && (d.classList.add("active"), r.push(d));
|
|
2340
2277
|
});
|
|
2341
|
-
const
|
|
2342
|
-
|
|
2278
|
+
const l = r.map((c) => [...n.s.allLi].indexOf(c));
|
|
2279
|
+
k(n, l);
|
|
2343
2280
|
break;
|
|
2344
2281
|
}
|
|
2345
2282
|
else
|
|
2346
|
-
|
|
2347
|
-
|
|
2283
|
+
k(n, -1);
|
|
2284
|
+
n.emit("change");
|
|
2348
2285
|
break;
|
|
2349
2286
|
case "d4-placeholder":
|
|
2350
|
-
if (e === null)
|
|
2351
|
-
|
|
2352
|
-
e !== s && o.s.value.index < 0 && M(o, o.s.value.index);
|
|
2287
|
+
if (e === null) return;
|
|
2288
|
+
e !== i && n.s.value.index < 0 && k(n, n.s.value.index);
|
|
2353
2289
|
break;
|
|
2354
2290
|
}
|
|
2355
2291
|
}
|
|
2356
2292
|
connectedCallback() {
|
|
2357
2293
|
const t = this;
|
|
2358
|
-
t.initialize || t.classList.contains("d4-initialize") || (t.initialize = !0,
|
|
2294
|
+
t.initialize || t.classList.contains("d4-initialize") || (t.initialize = !0, this.#t());
|
|
2359
2295
|
}
|
|
2360
2296
|
disconnectedCallback() {
|
|
2361
2297
|
this.s && this.s.dropdownEl && this.s.dropdownEl.parentNode === document.body && document.body.removeChild(this.s.dropdownEl);
|
|
2362
2298
|
}
|
|
2299
|
+
#t() {
|
|
2300
|
+
this.s = {}, this.__events__ = {}, this.hasAttribute("d4-status") || this.setAttribute("d4-status", "close"), this.hasAttribute("d4-value") || this.setAttribute("d4-value", ""), this.#s();
|
|
2301
|
+
}
|
|
2302
|
+
#s() {
|
|
2303
|
+
this.s.childDom = this.childNodes, this.s.template = Jt(this), this.innerHTML = "", this.append(this.s.template), this.s.dropdownEl = this.querySelector(".dropdown"), this.getAttribute("d4-portal") === "true" && (this.s.dropdownEl.setAttribute("data-d4-portal", ""), document.body.appendChild(this.s.dropdownEl)), this.#i();
|
|
2304
|
+
}
|
|
2305
|
+
// -** 獨立 dropdown 出 body 更新
|
|
2306
|
+
#e() {
|
|
2307
|
+
const t = this, e = t.getBoundingClientRect(), i = t.s.dropdownEl;
|
|
2308
|
+
i.style.position = "fixed", i.style.overflow = "hidden", i.style.left = `${e.left}px`, i.style.width = `${e.width}px`;
|
|
2309
|
+
const n = parseInt(i.style.height) || i.scrollHeight;
|
|
2310
|
+
window.innerHeight - e.bottom < n && e.top > n ? (i.style.top = "auto", i.style.bottom = `${window.innerHeight - e.top + 5}px`) : (i.style.top = `${e.bottom + 5}px`, i.style.bottom = "auto");
|
|
2311
|
+
}
|
|
2312
|
+
#i() {
|
|
2313
|
+
const t = this;
|
|
2314
|
+
t.s.allLi = t.s.dropdownEl.querySelectorAll(".dropdown-list li"), t.s.selectDisplayEl = t.querySelector(".select-display"), t.s.selectType = t.hasAttribute("multiple") ? "multiple" : "single", t.s.cityLang = t.hasAttribute("city-lang") ? t.getAttribute("city-lang") : "zh-tw", Qt(t), t.s.subDropdownTotalH = 0;
|
|
2315
|
+
const e = t.getAttribute("d4-value");
|
|
2316
|
+
switch (t.s.selectType) {
|
|
2317
|
+
case "single":
|
|
2318
|
+
let i;
|
|
2319
|
+
if (t.classList.contains("dist")) {
|
|
2320
|
+
const o = document.querySelector(`dropdown-el[dist-select="${t.id}"]`), a = o ? o.getAttribute("d4-value") !== "" : !1;
|
|
2321
|
+
if (o && a) {
|
|
2322
|
+
const r = o.getAttribute("d4-value");
|
|
2323
|
+
if (Kt(t, r), t.s.allLi = t.s.dropdownEl.querySelectorAll(".dropdown-list li"), t.classList.remove("disabled"), t.getAttribute("d4-value") !== "") {
|
|
2324
|
+
const l = e.split(",")[1];
|
|
2325
|
+
i = t.s.dropdownEl.querySelector(`.dropdown-list li[data-option="${l}"]`), t.setAttribute("d4-value", l);
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
} else
|
|
2329
|
+
i = t.querySelector(`.dropdown-list li[data-option="${e}"]`);
|
|
2330
|
+
T(i) ? (i.classList.add("active"), t.s.activeLi = i, t.s.value = {
|
|
2331
|
+
index: [...t.s.allLi].indexOf(i),
|
|
2332
|
+
id: e,
|
|
2333
|
+
el: i
|
|
2334
|
+
}) : (t.s.activeLi = void 0, t.s.value = {
|
|
2335
|
+
index: -1,
|
|
2336
|
+
id: void 0,
|
|
2337
|
+
el: void 0
|
|
2338
|
+
});
|
|
2339
|
+
break;
|
|
2340
|
+
case "multiple":
|
|
2341
|
+
const n = [];
|
|
2342
|
+
e.split(",").forEach((o) => {
|
|
2343
|
+
const a = t.s.dropdownEl.querySelector(`.dropdown-list li[data-option="${o}"]`);
|
|
2344
|
+
T(a) && n.push(a);
|
|
2345
|
+
}), n.length > 0 ? t.s.value = {
|
|
2346
|
+
index: n.map((o) => [...t.s.allLi].indexOf(o)),
|
|
2347
|
+
id: n.map((o) => o.getAttribute("data-option")),
|
|
2348
|
+
el: n.map((o) => o)
|
|
2349
|
+
} : t.s.value = {
|
|
2350
|
+
index: [],
|
|
2351
|
+
id: void 0,
|
|
2352
|
+
el: void 0
|
|
2353
|
+
};
|
|
2354
|
+
break;
|
|
2355
|
+
}
|
|
2356
|
+
k(t, t.s.value.index), t.#n(), t.classList.add("d4-initialize");
|
|
2357
|
+
}
|
|
2358
|
+
#n() {
|
|
2359
|
+
const t = this;
|
|
2360
|
+
t.__events__.dropdownToggle = () => {
|
|
2361
|
+
t.addEventListener("click", function(e) {
|
|
2362
|
+
switch (e.stopPropagation(), t.getAttribute("d4-status")) {
|
|
2363
|
+
case "open":
|
|
2364
|
+
t.close();
|
|
2365
|
+
break;
|
|
2366
|
+
case "close":
|
|
2367
|
+
t.open();
|
|
2368
|
+
break;
|
|
2369
|
+
}
|
|
2370
|
+
});
|
|
2371
|
+
}, t.__events__.transitionend = () => {
|
|
2372
|
+
function e(i) {
|
|
2373
|
+
if (i.target === this) {
|
|
2374
|
+
const n = t.getAttribute("d4-status"), o = t.classList.contains("filter");
|
|
2375
|
+
switch (n) {
|
|
2376
|
+
case "open":
|
|
2377
|
+
const a = t.s.dropdownEl.querySelector(".dropdown-scroller"), r = () => {
|
|
2378
|
+
if (t.__scroller__) {
|
|
2379
|
+
const { viewport: l } = t.__scroller__.elements();
|
|
2380
|
+
if (T(t.s.activeLi)) {
|
|
2381
|
+
const c = t.s.activeLi.clientHeight / 2, d = t.s.activeLi.offsetTop, u = d - a.clientHeight / 2 + c > 0 ? d - a.clientHeight / 2 + c : 0;
|
|
2382
|
+
l.scrollTo({
|
|
2383
|
+
top: u,
|
|
2384
|
+
behavior: "smooth"
|
|
2385
|
+
});
|
|
2386
|
+
} else
|
|
2387
|
+
l.scrollTo({
|
|
2388
|
+
top: 0,
|
|
2389
|
+
behavior: "smooth"
|
|
2390
|
+
});
|
|
2391
|
+
}
|
|
2392
|
+
};
|
|
2393
|
+
t.s.subDropdownTotalH > 0 && t.__scroller__ && t.__scroller__.update(!0), o && (t.s.dropdownEl.querySelector(".filter-bar input").disabled = !1, t.s.dropdownEl.querySelector(".filter-bar input").focus()), t.s.selectType === "single" && r();
|
|
2394
|
+
break;
|
|
2395
|
+
case "close":
|
|
2396
|
+
t.getAttribute("d4-portal") == "true" ? (t.__scroller__ && t.__scroller__.update(!0), t.s.dropdownEl.style.height = "", t.s.dropdownEl.style.zIndex = "", o && (t.s.dropdownEl.querySelector(".filter-bar input").disabled = !0), t.s.dropdownEl.parentNode === document.body && document.body.removeChild(t.s.dropdownEl)) : (t.__scroller__.update(!0), t.s.dropdownEl.removeAttribute("style"), o && (t.querySelector(".filter-bar input").disabled = !0));
|
|
2397
|
+
break;
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
t.s.dropdownEl.addEventListener("transitionend", e);
|
|
2402
|
+
}, t.__events__.bindScrollbar = (e = this) => {
|
|
2403
|
+
const i = e.s.dropdownEl.querySelector(".dropdown-scroller");
|
|
2404
|
+
e.__scroller__ = tt(i, {
|
|
2405
|
+
overflowBehavior: {
|
|
2406
|
+
x: "hidden"
|
|
2407
|
+
}
|
|
2408
|
+
});
|
|
2409
|
+
}, t.__events__.selectOption = (e = this) => {
|
|
2410
|
+
let i, n;
|
|
2411
|
+
const o = e.s.dropdownEl.querySelector(".dropdown-scroller"), a = e.classList.contains("city");
|
|
2412
|
+
e.s.allLi = e.s.dropdownEl.querySelectorAll(".dropdown-list li"), e.s.allLi.forEach((r) => {
|
|
2413
|
+
r.addEventListener("click", function(l) {
|
|
2414
|
+
const c = this, d = [...e.s.allLi].indexOf(c), u = parseInt(e.getAttribute("d4-default-height"));
|
|
2415
|
+
if (c.classList.contains("has-sublayer")) {
|
|
2416
|
+
l.stopPropagation();
|
|
2417
|
+
const h = c.querySelector(".sub-dropdown"), p = h.querySelector(".sub-dropdown-list"), g = parseInt(getComputedStyle(p).marginTop) + parseInt(getComputedStyle(p).marginBottom);
|
|
2418
|
+
h.style.cssText = `--height: ${p.offsetHeight + g}px`;
|
|
2419
|
+
const b = parseInt(h.style.cssText.replace("--height:", "").trim()), f = parseInt(getComputedStyle(o).maxHeight), v = () => {
|
|
2420
|
+
i = u + e.s.subDropdownTotalH, n = i > f ? f : i, e.getAttribute("d4-portal") == "true" ? e.s.dropdownEl.style.setProperty("--maxHeight", `${n}px`) : e.style.cssText = `--maxHeight: ${n}px;`, e.s.dropdownEl.style.height = `${n}px`;
|
|
2421
|
+
};
|
|
2422
|
+
c.classList.contains("open") ? (c.classList.remove("open"), e.s.subDropdownTotalH -= b, v()) : (c.classList.add("open"), e.s.subDropdownTotalH += b, v());
|
|
2423
|
+
const H = () => {
|
|
2424
|
+
e.__scroller__.update(!0), h.removeEventListener("transitionend", H);
|
|
2425
|
+
};
|
|
2426
|
+
h.addEventListener("transitionend", H);
|
|
2427
|
+
} else
|
|
2428
|
+
switch (Zt(e), e.s.selectType) {
|
|
2429
|
+
// 單選
|
|
2430
|
+
case "single":
|
|
2431
|
+
if (e.setAttribute("d4-value", c.getAttribute("data-option")), a) {
|
|
2432
|
+
const h = e.s.cityLang, p = r.textContent.trim(), g = document.getElementById(e.getAttribute("dist-select"));
|
|
2433
|
+
g && (g.s.dropdownEl.querySelector(".dropdown-list").textContent = "", k(g, -1), G[h][p].forEach((b, f) => {
|
|
2434
|
+
const v = document.createElement("li");
|
|
2435
|
+
v.textContent = b[0], v.setAttribute("data-option", b[0]), e.getAttribute("d4-portal") == "true" ? g.s.dropdownEl.querySelector(".dropdown-list").append(v) : g.querySelector(".dropdown-list").append(v);
|
|
2436
|
+
}), e.__events__.selectOption(g));
|
|
2437
|
+
}
|
|
2438
|
+
(e.getAttribute("d4-portal") == "true" || c.parentNode.closest("li")?.classList.contains("has-sublayer")) && (l.stopPropagation(), e.close());
|
|
2439
|
+
break;
|
|
2440
|
+
// 複選
|
|
2441
|
+
case "multiple":
|
|
2442
|
+
l.stopPropagation(), c.classList.toggle("active"), k(e, d);
|
|
2443
|
+
break;
|
|
2444
|
+
}
|
|
2445
|
+
});
|
|
2446
|
+
});
|
|
2447
|
+
}, t.__events__.filterHandler = () => {
|
|
2448
|
+
t.classList.contains("filter") && (t.s.dropdownEl.querySelector(".filter-bar").addEventListener("click", function(e) {
|
|
2449
|
+
e.stopPropagation();
|
|
2450
|
+
}), t.s.dropdownEl.querySelector(".filter-input").addEventListener("input", function() {
|
|
2451
|
+
const e = this.value.toUpperCase();
|
|
2452
|
+
t.s.allLi.forEach((i) => {
|
|
2453
|
+
i.textContent.toUpperCase().includes(e) ? i.removeAttribute("style") : i.style.display = "none";
|
|
2454
|
+
});
|
|
2455
|
+
}));
|
|
2456
|
+
}, t.__events__.removeTag = () => {
|
|
2457
|
+
t.s.selectType !== "single" && t.s.selectDisplayEl.addEventListener("click", function(e) {
|
|
2458
|
+
if (e.target.classList.contains("select-display")) return;
|
|
2459
|
+
if ((e.target.classList.contains("option-btn") ? e.target : e.target.parentElement).contains(e.target) && (e.stopPropagation(), e.target.classList.contains("remove-icon"))) {
|
|
2460
|
+
const o = e.target.parentElement.getAttribute("data-option");
|
|
2461
|
+
t.s.dropdownEl.querySelector(`.dropdown-list li[data-option="${o}"]`).classList.remove("active"), t.s.activeLi = t.s.dropdownEl.querySelectorAll(".dropdown-list li.active"), e.target.parentElement.remove();
|
|
2462
|
+
const a = [...t.s.activeLi];
|
|
2463
|
+
t.s.value = a.map((l) => ({
|
|
2464
|
+
index: [...t.s.allLi].indexOf(l),
|
|
2465
|
+
id: l.getAttribute("data-option"),
|
|
2466
|
+
el: l
|
|
2467
|
+
})), t.s.activeLi = a;
|
|
2468
|
+
const r = a.map((l) => l.getAttribute("data-option"));
|
|
2469
|
+
t.setAttribute("d4-value", r.join()), a.length <= 0 && (t.s.selectDisplayEl.textContent = t.getAttribute("d4-placeholder").trim());
|
|
2470
|
+
}
|
|
2471
|
+
});
|
|
2472
|
+
}, t.__events__.dropdownToggle(), t.getAttribute("d4-portal") != "true" && t.__events__.bindScrollbar(), t.__events__.selectOption(), t.__events__.filterHandler(), t.__events__.removeTag(), t.__events__.transitionend();
|
|
2473
|
+
}
|
|
2363
2474
|
open() {
|
|
2364
2475
|
const t = this;
|
|
2365
2476
|
let e;
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
else {
|
|
2369
|
-
const c = t.querySelector(".dropdown-scroller"), u = c.querySelector(".os-content"), h = parseInt(getComputedStyle(c).maxHeight) || 200;
|
|
2370
|
-
e = Math.min(u ? u.scrollHeight : c.clientHeight, h);
|
|
2371
|
-
}
|
|
2372
|
-
const s = t.classList.contains("filter"), o = () => {
|
|
2477
|
+
t.getAttribute("d4-portal") == "true" ? (V(), t.s.dropdownEl.parentNode !== document.body && document.body.appendChild(t.s.dropdownEl), t.__scroller__ || t.__events__.bindScrollbar(), this.#e(), t.s.dropdownEl.offsetHeight, e = t.s.dropdownEl.querySelector(".dropdown-scroller").clientHeight) : e = t.querySelector(".dropdown-scroller").clientHeight;
|
|
2478
|
+
const i = t.classList.contains("filter"), n = () => {
|
|
2373
2479
|
if (t.getAttribute("d4-portal") == "true") {
|
|
2374
|
-
if (
|
|
2480
|
+
if (i)
|
|
2375
2481
|
return t.s.dropdownEl.querySelector(".dropdown-scroller .filter-bar") ? e : t.s.dropdownEl.querySelector(".filter-bar").clientHeight + e;
|
|
2376
|
-
} else if (
|
|
2482
|
+
} else if (i)
|
|
2377
2483
|
return t.querySelector(".dropdown-scroller .filter-bar") ? e : t.querySelector(".filter-bar").clientHeight + e;
|
|
2378
2484
|
return e;
|
|
2379
2485
|
};
|
|
2380
2486
|
t.s.subDropdownTotalH = 0;
|
|
2381
|
-
const
|
|
2382
|
-
t.s.dropdownEl.querySelectorAll('.has-sublayer[data-open="true"]').forEach((
|
|
2383
|
-
const
|
|
2384
|
-
|
|
2487
|
+
const o = t.getAttribute("d4-portal") == "true" ? t.s.dropdownEl.querySelector(".dropdown-scroller") : t.querySelector(".dropdown-scroller"), a = parseInt(getComputedStyle(o).maxHeight);
|
|
2488
|
+
t.s.dropdownEl.querySelectorAll('.has-sublayer[data-open="true"]').forEach((l) => {
|
|
2489
|
+
const c = l.querySelector(".sub-dropdown"), d = c.querySelector(".sub-dropdown-list"), u = parseInt(getComputedStyle(d).marginTop) + parseInt(getComputedStyle(d).marginBottom);
|
|
2490
|
+
c.style.cssText = `--height: ${d.offsetHeight + u}px`, t.s.subDropdownTotalH += parseInt(c.style.cssText.replace("--height:", "").trim()), l.classList.add("open");
|
|
2385
2491
|
});
|
|
2386
|
-
const
|
|
2387
|
-
const
|
|
2388
|
-
return
|
|
2492
|
+
const r = () => {
|
|
2493
|
+
const l = n() + t.s.subDropdownTotalH;
|
|
2494
|
+
return l > a ? a : l;
|
|
2389
2495
|
};
|
|
2390
|
-
return t.getAttribute("d4-portal") !== "true" &&
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
height: ${l()}px;
|
|
2496
|
+
return t.getAttribute("d4-portal") !== "true" && V(), t.setAttribute("d4-status", "open"), t.setAttribute("d4-default-height", n()), t.getAttribute("d4-portal") == "true" ? (t.s.dropdownEl.style.setProperty("--maxHeight", `${r()}px`), t.s.dropdownEl.style.zIndex = "9999", this.#e(), t.s.dropdownEl.offsetHeight, t.s.dropdownEl.style.height = `${r()}px`, t.__events__._scrollUpdate = () => {
|
|
2497
|
+
const l = t.getBoundingClientRect();
|
|
2498
|
+
l.bottom < 0 || l.top > window.innerHeight ? t.close() : t.#e();
|
|
2499
|
+
}, window.addEventListener("scroll", t.__events__._scrollUpdate, { passive: !0, capture: !0 }), window.addEventListener("resize", t.__events__._scrollUpdate, { passive: !0 })) : (t.style.cssText = `--maxHeight: ${r()}px;`, t.s.dropdownEl.style.cssText = `
|
|
2500
|
+
height: ${r()}px;
|
|
2396
2501
|
z-index: 2;
|
|
2397
2502
|
`), this;
|
|
2398
2503
|
}
|
|
2399
2504
|
close() {
|
|
2400
|
-
const t = this, e = t.s.dropdownEl.querySelectorAll(".has-sublayer"),
|
|
2401
|
-
return t.setAttribute("d4-status", "close"), t.s.dropdownEl.style.height = "0px", t.getAttribute("d4-portal") == "true" && t.__events__._scrollUpdate && (window.removeEventListener("scroll", t.__events__._scrollUpdate, { capture: !0 }), window.removeEventListener("resize", t.__events__._scrollUpdate)), e.forEach((
|
|
2402
|
-
|
|
2403
|
-
}), t.getAttribute("d4-portal") == "true" ? t.s.dropdownEl.style.setProperty("--maxHeight", `${
|
|
2505
|
+
const t = this, e = t.s.dropdownEl.querySelectorAll(".has-sublayer"), i = parseInt(t.getAttribute("d4-default-height"));
|
|
2506
|
+
return t.setAttribute("d4-status", "close"), t.s.dropdownEl.style.height = "0px", t.getAttribute("d4-portal") == "true" && t.__events__._scrollUpdate && (window.removeEventListener("scroll", t.__events__._scrollUpdate, { capture: !0 }), window.removeEventListener("resize", t.__events__._scrollUpdate)), e.forEach((n) => {
|
|
2507
|
+
n.classList.remove("open");
|
|
2508
|
+
}), t.getAttribute("d4-portal") == "true" ? t.s.dropdownEl.style.setProperty("--maxHeight", `${i}px`) : t.style.cssText = `--maxHeight: ${i}px;`, t.s.subDropdownTotalH = 0, t.classList.contains("filter") && t.s.dropdownEl.querySelector(".filter-input") && (t.s.dropdownEl.querySelector(".filter-input").value = "", t.s.allLi.forEach((n) => n.removeAttribute("style"))), this;
|
|
2404
2509
|
}
|
|
2405
2510
|
scrollTo(t) {
|
|
2406
|
-
const e = this, { viewport:
|
|
2407
|
-
|
|
2511
|
+
const e = this, { viewport: i } = e.__scroller__.elements();
|
|
2512
|
+
i.scrollTo({
|
|
2408
2513
|
top: t,
|
|
2409
2514
|
behavior: "smooth"
|
|
2410
2515
|
});
|
|
@@ -2413,294 +2518,232 @@ class Zi extends HTMLElement {
|
|
|
2413
2518
|
this.__events__.selectOption();
|
|
2414
2519
|
}
|
|
2415
2520
|
}
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
window.innerHeight - e.bottom < o && e.top > o ? (s.style.top = "auto", s.style.bottom = `${window.innerHeight - e.top + 5}px`) : (s.style.top = `${e.bottom + 5}px`, s.style.bottom = "auto");
|
|
2425
|
-
}, Jt = new WeakSet(), Vi = function() {
|
|
2426
|
-
var s;
|
|
2427
|
-
const t = this;
|
|
2428
|
-
t.s.allLi = t.s.dropdownEl.querySelectorAll(".dropdown-list li"), t.s.selectDisplayEl = t.querySelector(".select-display"), t.s.selectType = t.hasAttribute("multiple") ? "multiple" : "single", t.s.cityLang = t.hasAttribute("city-lang") ? t.getAttribute("city-lang") : "zh-tw", cn(t), t.s.subDropdownTotalH = 0;
|
|
2429
|
-
const e = t.getAttribute("d4-value");
|
|
2430
|
-
switch (t.s.selectType) {
|
|
2431
|
-
case "single":
|
|
2432
|
-
let o;
|
|
2433
|
-
if (t.classList.contains("dist")) {
|
|
2434
|
-
const r = document.querySelector(`dropdown-el[dist-select="${t.id}"]`), l = r ? r.getAttribute("d4-value") !== "" : !1;
|
|
2435
|
-
if (r && l) {
|
|
2436
|
-
const c = r.getAttribute("d4-value");
|
|
2437
|
-
if (dn(t, c), t.s.allLi = t.s.dropdownEl.querySelectorAll(".dropdown-list li"), t.classList.remove("disabled"), t.getAttribute("d4-value") !== "") {
|
|
2438
|
-
const u = e.split(",")[1];
|
|
2439
|
-
o = t.s.dropdownEl.querySelector(`.dropdown-list li[data-option="${u}"]`), t.setAttribute("d4-value", u);
|
|
2440
|
-
}
|
|
2441
|
-
}
|
|
2442
|
-
} else
|
|
2443
|
-
o = t.querySelector(`.dropdown-list li[data-option="${e}"]`);
|
|
2444
|
-
A(o) ? (o.classList.add("active"), t.s.activeLi = o, t.s.value = {
|
|
2445
|
-
index: [...t.s.allLi].indexOf(o),
|
|
2446
|
-
id: e,
|
|
2447
|
-
el: o
|
|
2448
|
-
}) : (t.s.activeLi = void 0, t.s.value = {
|
|
2449
|
-
index: -1,
|
|
2450
|
-
id: void 0,
|
|
2451
|
-
el: void 0
|
|
2452
|
-
});
|
|
2453
|
-
break;
|
|
2454
|
-
case "multiple":
|
|
2455
|
-
const a = [];
|
|
2456
|
-
e.split(",").forEach((r) => {
|
|
2457
|
-
const l = t.s.dropdownEl.querySelector(`.dropdown-list li[data-option="${r}"]`);
|
|
2458
|
-
A(l) && a.push(l);
|
|
2459
|
-
}), a.length > 0 ? t.s.value = {
|
|
2460
|
-
index: a.map((r) => [...t.s.allLi].indexOf(r)),
|
|
2461
|
-
id: a.map((r) => r.getAttribute("data-option")),
|
|
2462
|
-
el: a.map((r) => r)
|
|
2463
|
-
} : t.s.value = {
|
|
2464
|
-
index: [],
|
|
2465
|
-
id: void 0,
|
|
2466
|
-
el: void 0
|
|
2467
|
-
};
|
|
2468
|
-
break;
|
|
2469
|
-
}
|
|
2470
|
-
M(t, t.s.value.index), d(s = t, Zt, ts).call(s), t.classList.add("d4-initialize");
|
|
2471
|
-
}, Zt = new WeakSet(), ts = function() {
|
|
2472
|
-
const t = this;
|
|
2473
|
-
t.__events__.dropdownToggle = () => {
|
|
2474
|
-
t.addEventListener("click", function(e) {
|
|
2475
|
-
switch (e.stopPropagation(), t.getAttribute("d4-status")) {
|
|
2476
|
-
case "open":
|
|
2477
|
-
t.close();
|
|
2478
|
-
break;
|
|
2479
|
-
case "close":
|
|
2480
|
-
t.open();
|
|
2481
|
-
break;
|
|
2482
|
-
}
|
|
2483
|
-
});
|
|
2484
|
-
}, t.__events__.transitionend = () => {
|
|
2485
|
-
function e(s) {
|
|
2486
|
-
if (s.target === this) {
|
|
2487
|
-
const o = t.getAttribute("d4-status"), a = t.classList.contains("filter");
|
|
2488
|
-
switch (o) {
|
|
2489
|
-
case "open":
|
|
2490
|
-
const r = t.s.dropdownEl.querySelector(".dropdown-scroller"), l = () => {
|
|
2491
|
-
if (t.__scroller__) {
|
|
2492
|
-
const { viewport: c } = t.__scroller__.elements();
|
|
2493
|
-
if (A(t.s.activeLi)) {
|
|
2494
|
-
const u = t.s.activeLi.clientHeight / 2, h = t.s.activeLi.offsetTop, g = h - r.clientHeight / 2 + u > 0 ? h - r.clientHeight / 2 + u : 0;
|
|
2495
|
-
c.scrollTo({
|
|
2496
|
-
top: g,
|
|
2497
|
-
behavior: "smooth"
|
|
2498
|
-
});
|
|
2499
|
-
} else
|
|
2500
|
-
c.scrollTo({
|
|
2501
|
-
top: 0,
|
|
2502
|
-
behavior: "smooth"
|
|
2503
|
-
});
|
|
2504
|
-
}
|
|
2505
|
-
};
|
|
2506
|
-
t.s.subDropdownTotalH > 0 && t.__scroller__ && t.__scroller__.update(!0), a && (t.s.dropdownEl.querySelector(".filter-bar input").disabled = !1, t.s.dropdownEl.querySelector(".filter-bar input").focus()), t.s.selectType === "single" && l();
|
|
2507
|
-
break;
|
|
2508
|
-
case "close":
|
|
2509
|
-
t.getAttribute("d4-portal") == "true" ? (t.__scroller__ && t.__scroller__.update(!0), t.s.dropdownEl.style.height = "", t.s.dropdownEl.style.zIndex = "", a && (t.s.dropdownEl.querySelector(".filter-bar input").disabled = !0), t.s.dropdownEl.parentNode === document.body && document.body.removeChild(t.s.dropdownEl)) : (t.__scroller__.update(!0), t.s.dropdownEl.removeAttribute("style"), a && (t.querySelector(".filter-bar input").disabled = !0));
|
|
2510
|
-
break;
|
|
2511
|
-
}
|
|
2512
|
-
}
|
|
2521
|
+
Object.assign(Dt.prototype, N);
|
|
2522
|
+
customElements.define("dropdown-el", Dt);
|
|
2523
|
+
function J(s) {
|
|
2524
|
+
const t = {};
|
|
2525
|
+
return [...s.attributes].forEach((e) => {
|
|
2526
|
+
if (e.name.includes("duration-")) {
|
|
2527
|
+
const i = e.name.replace("duration-", ""), n = e.nodeValue;
|
|
2528
|
+
t[i] = Number(n);
|
|
2513
2529
|
}
|
|
2514
|
-
|
|
2515
|
-
}, t.__events__.bindScrollbar = (e = this) => {
|
|
2516
|
-
const s = e.s.dropdownEl.querySelector(".dropdown-scroller");
|
|
2517
|
-
e.__scroller__ = Ve(s, {
|
|
2518
|
-
overflowBehavior: {
|
|
2519
|
-
x: "hidden"
|
|
2520
|
-
}
|
|
2521
|
-
});
|
|
2522
|
-
}, t.__events__.selectOption = (e = this) => {
|
|
2523
|
-
let s, o;
|
|
2524
|
-
const a = e.s.dropdownEl.querySelector(".dropdown-scroller"), r = e.classList.contains("city");
|
|
2525
|
-
e.s.allLi = e.s.dropdownEl.querySelectorAll(".dropdown-list li"), e.s.allLi.forEach((l) => {
|
|
2526
|
-
l.addEventListener("click", function(c) {
|
|
2527
|
-
var m;
|
|
2528
|
-
const u = this, h = [...e.s.allLi].indexOf(u), g = parseInt(e.getAttribute("d4-default-height"));
|
|
2529
|
-
if (u.classList.contains("has-sublayer")) {
|
|
2530
|
-
c.stopPropagation();
|
|
2531
|
-
const v = u.querySelector(".sub-dropdown"), w = v.querySelector(".sub-dropdown-list"), b = parseInt(getComputedStyle(w).marginTop) + parseInt(getComputedStyle(w).marginBottom);
|
|
2532
|
-
v.style.cssText = `--height: ${w.offsetHeight + b}px`;
|
|
2533
|
-
const T = parseInt(v.style.cssText.replace("--height:", "").trim()), C = parseInt(getComputedStyle(a).maxHeight), y = () => {
|
|
2534
|
-
s = g + e.s.subDropdownTotalH, o = s > C ? C : s, e.getAttribute("d4-portal") == "true" ? e.s.dropdownEl.style.setProperty("--maxHeight", `${o}px`) : e.style.cssText = `--maxHeight: ${o}px;`, e.s.dropdownEl.style.height = `${o}px`;
|
|
2535
|
-
};
|
|
2536
|
-
u.classList.contains("open") ? (u.classList.remove("open"), e.s.subDropdownTotalH -= T, y()) : (u.classList.add("open"), e.s.subDropdownTotalH += T, y());
|
|
2537
|
-
const L = () => {
|
|
2538
|
-
e.__scroller__.update(!0), v.removeEventListener("transitionend", L);
|
|
2539
|
-
};
|
|
2540
|
-
v.addEventListener("transitionend", L);
|
|
2541
|
-
} else
|
|
2542
|
-
switch (ln(e), e.s.selectType) {
|
|
2543
|
-
case "single":
|
|
2544
|
-
if (e.setAttribute("d4-value", u.getAttribute("data-option")), r) {
|
|
2545
|
-
const v = e.s.cityLang, w = l.textContent.trim(), b = document.getElementById(e.getAttribute("dist-select"));
|
|
2546
|
-
b && (b.s.dropdownEl.querySelector(".dropdown-list").textContent = "", M(b, -1), K[v][w].forEach((T, C) => {
|
|
2547
|
-
const y = document.createElement("li");
|
|
2548
|
-
y.textContent = T[0], y.setAttribute("data-option", T[0]), e.getAttribute("d4-portal") == "true" ? b.s.dropdownEl.querySelector(".dropdown-list").append(y) : b.querySelector(".dropdown-list").append(y);
|
|
2549
|
-
}), e.__events__.selectOption(b));
|
|
2550
|
-
}
|
|
2551
|
-
(e.getAttribute("d4-portal") == "true" || (m = u.parentNode.closest("li")) != null && m.classList.contains("has-sublayer")) && (c.stopPropagation(), e.close());
|
|
2552
|
-
break;
|
|
2553
|
-
case "multiple":
|
|
2554
|
-
c.stopPropagation(), u.classList.toggle("active"), M(e, h);
|
|
2555
|
-
break;
|
|
2556
|
-
}
|
|
2557
|
-
});
|
|
2558
|
-
});
|
|
2559
|
-
}, t.__events__.filterHandler = () => {
|
|
2560
|
-
t.classList.contains("filter") && (t.s.dropdownEl.querySelector(".filter-bar").addEventListener("click", function(e) {
|
|
2561
|
-
e.stopPropagation();
|
|
2562
|
-
}), t.s.dropdownEl.querySelector(".filter-input").addEventListener("input", function() {
|
|
2563
|
-
const e = this.value.toUpperCase();
|
|
2564
|
-
t.s.allLi.forEach((s) => {
|
|
2565
|
-
s.textContent.toUpperCase().includes(e) ? s.removeAttribute("style") : s.style.display = "none";
|
|
2566
|
-
});
|
|
2567
|
-
}));
|
|
2568
|
-
}, t.__events__.removeTag = () => {
|
|
2569
|
-
t.s.selectType !== "single" && t.s.selectDisplayEl.addEventListener("click", function(e) {
|
|
2570
|
-
if (e.target.classList.contains("select-display"))
|
|
2571
|
-
return;
|
|
2572
|
-
if ((e.target.classList.contains("option-btn") ? e.target : e.target.parentElement).contains(e.target) && (e.stopPropagation(), e.target.classList.contains("remove-icon"))) {
|
|
2573
|
-
const a = e.target.parentElement.getAttribute("data-option");
|
|
2574
|
-
t.s.dropdownEl.querySelector(`.dropdown-list li[data-option="${a}"]`).classList.remove("active"), t.s.activeLi = t.s.dropdownEl.querySelectorAll(".dropdown-list li.active"), e.target.parentElement.remove();
|
|
2575
|
-
const r = [...t.s.activeLi];
|
|
2576
|
-
t.s.value = r.map((c) => ({
|
|
2577
|
-
index: [...t.s.allLi].indexOf(c),
|
|
2578
|
-
id: c.getAttribute("data-option"),
|
|
2579
|
-
el: c
|
|
2580
|
-
})), t.s.activeLi = r;
|
|
2581
|
-
const l = r.map((c) => c.getAttribute("data-option"));
|
|
2582
|
-
t.setAttribute("d4-value", l.join()), r.length <= 0 && (t.s.selectDisplayEl.textContent = t.getAttribute("d4-placeholder").trim());
|
|
2583
|
-
}
|
|
2584
|
-
});
|
|
2585
|
-
}, t.__events__.dropdownToggle(), t.getAttribute("d4-portal") != "true" && t.__events__.bindScrollbar(), t.__events__.selectOption(), t.__events__.filterHandler(), t.__events__.removeTag(), t.__events__.transitionend();
|
|
2586
|
-
};
|
|
2587
|
-
Object.assign(Zi.prototype, z);
|
|
2588
|
-
customElements.define("dropdown-el", Zi);
|
|
2589
|
-
function Tt(n) {
|
|
2590
|
-
const i = {};
|
|
2591
|
-
return [...n.attributes].forEach((t) => {
|
|
2592
|
-
if (t.name.includes("duration-")) {
|
|
2593
|
-
const e = t.name.replace("duration-", ""), s = t.nodeValue;
|
|
2594
|
-
i[e] = Number(s);
|
|
2595
|
-
}
|
|
2596
|
-
}), Object.keys(i).length === 0 ? null : i;
|
|
2530
|
+
}), Object.keys(t).length === 0 ? null : t;
|
|
2597
2531
|
}
|
|
2598
|
-
function
|
|
2599
|
-
if (
|
|
2600
|
-
let
|
|
2601
|
-
const
|
|
2602
|
-
value:
|
|
2603
|
-
point:
|
|
2532
|
+
function lt(s) {
|
|
2533
|
+
if (J(s)) {
|
|
2534
|
+
let t;
|
|
2535
|
+
const e = Object.keys(J(s)).map((i) => ({
|
|
2536
|
+
value: i,
|
|
2537
|
+
point: i
|
|
2604
2538
|
}));
|
|
2605
|
-
|
|
2606
|
-
for (let
|
|
2607
|
-
const { point:
|
|
2608
|
-
window.matchMedia(`(max-width: ${o}px)`).matches && (
|
|
2539
|
+
e.sort((i, n) => parseInt(n.value, 10) - parseInt(i.value, 10));
|
|
2540
|
+
for (let i = 0; i < e.length; i += 1) {
|
|
2541
|
+
const { point: n, value: o } = e[i];
|
|
2542
|
+
window.matchMedia(`(max-width: ${o}px)`).matches && (t = n);
|
|
2609
2543
|
}
|
|
2610
|
-
return
|
|
2544
|
+
return t ? Number(J(s)[t]) : s.s.options.duration;
|
|
2611
2545
|
} else
|
|
2612
|
-
return
|
|
2546
|
+
return s.s.options.duration;
|
|
2613
2547
|
}
|
|
2614
|
-
function
|
|
2615
|
-
const { behavior:
|
|
2616
|
-
o.className = "animate-container", a.className = "animate-item", [...
|
|
2548
|
+
function te(s) {
|
|
2549
|
+
const { behavior: t, continual: e, gap: i } = s.s.options, n = s.childNodes, o = document.createElement("div"), a = document.createElement("div");
|
|
2550
|
+
o.className = "animate-container", a.className = "animate-item", [...n].forEach((l) => {
|
|
2617
2551
|
a.append(l);
|
|
2618
2552
|
});
|
|
2619
2553
|
function r() {
|
|
2620
2554
|
const l = a.cloneNode(!0);
|
|
2621
|
-
return l.classList.add("clone"),
|
|
2555
|
+
return l.classList.add("clone"), s.s.cloneAnimation = null, s.s.cloneAnimateEl = l, l;
|
|
2622
2556
|
}
|
|
2623
|
-
|
|
2557
|
+
s.s.animation = null, s.s.animateEl = a, s.textContent = "", o.append(a), s.append(o), a.clientWidth * 2 + i >= s.clientWidth ? t === "normal" && e && o.append(r()) : s.s.options.continual = !1;
|
|
2624
2558
|
}
|
|
2625
|
-
function
|
|
2626
|
-
const { behavior:
|
|
2627
|
-
let
|
|
2628
|
-
switch (
|
|
2559
|
+
function D(s) {
|
|
2560
|
+
const { behavior: t, direction: e, continual: i } = s.s.options;
|
|
2561
|
+
let n = {};
|
|
2562
|
+
switch (t) {
|
|
2629
2563
|
case "normal":
|
|
2630
2564
|
let o, a;
|
|
2631
|
-
switch (
|
|
2565
|
+
switch (e) {
|
|
2632
2566
|
case "top":
|
|
2633
|
-
o =
|
|
2567
|
+
o = i ? "translate3d(0,100%,0)" : `translate3d(0,${s.clientHeight}px,0)`, a = "translate3d(0,-100%,0)", n.animate1 = [{ transform: o }, { transform: a }], i && (n.animate2 = [{ transform: "translate3d(0,0,0)" }, { transform: "translate3d(0,-200%,0)" }]);
|
|
2634
2568
|
break;
|
|
2635
2569
|
case "right":
|
|
2636
|
-
o =
|
|
2570
|
+
o = i ? "translate3d(0,0,0)" : "translate3d(-100%,0,0)", a = i ? "translate3d(200%,0,0)" : `translate3d(${s.clientWidth}px,0,0)`, n.animate1 = [{ transform: o }, { transform: a }], i && (n.animate2 = [{ transform: "translate3d(-100%,0,0)" }, { transform: "translate3d(100%,0,0)" }]);
|
|
2637
2571
|
break;
|
|
2638
2572
|
case "bottom":
|
|
2639
|
-
o = "translate3d(0,-100%,0)", a =
|
|
2573
|
+
o = "translate3d(0,-100%,0)", a = i ? "translate3d(0,100%,0)" : `translate3d(0,${s.clientHeight}px,0)`, n.animate1 = [{ transform: o }, { transform: a }], i && (n.animate2 = [{ transform: "translate3d(0,-200%,0)" }, { transform: "translate3d(0,0,0)" }]);
|
|
2640
2574
|
break;
|
|
2641
2575
|
case "left":
|
|
2642
|
-
o =
|
|
2576
|
+
o = i ? "translate3d(100%,0,0)" : `translate3d(${s.clientWidth}px,0,0)`, a = "translate3d(-100%,0,0)", n.animate1 = [{ transform: o }, { transform: a }], i && (n.animate2 = [{ transform: "translate3d(0,0,0)" }, { transform: "translate3d(-200%,0,0)" }]);
|
|
2643
2577
|
break;
|
|
2644
2578
|
}
|
|
2645
2579
|
break;
|
|
2580
|
+
// 來回模式
|
|
2646
2581
|
case "alternate":
|
|
2647
|
-
switch (
|
|
2582
|
+
switch (e) {
|
|
2648
2583
|
case "top":
|
|
2649
|
-
|
|
2584
|
+
n.animate1 = [{ transform: `translate3d(0,calc(${s.clientHeight}px - 100%),0)` }, { transform: "translate3d(0,0,0)" }, { transform: `translate3d(0,calc(${s.clientHeight}px - 100%),0)` }];
|
|
2650
2585
|
break;
|
|
2651
2586
|
case "right":
|
|
2652
|
-
|
|
2587
|
+
n.animate1 = [{ transform: "translate3d(0,0,0)" }, { transform: `translate3d(calc(-100% + ${s.clientWidth}px),0,0)` }, { transform: "translate3d(0,0,0)" }];
|
|
2653
2588
|
break;
|
|
2654
2589
|
case "bottom":
|
|
2655
|
-
|
|
2590
|
+
n.animate1 = [{ transform: "translate3d(0,0,0)" }, { transform: `translate3d(0,calc(${s.clientHeight}px - 100%),0)` }, { transform: "translate3d(0,0,0)" }];
|
|
2656
2591
|
break;
|
|
2657
2592
|
case "left":
|
|
2658
|
-
|
|
2593
|
+
n.animate1 = [{ transform: `translate3d(calc(-100% + ${s.clientWidth}px),0,0)` }, { transform: "translate3d(0,0,0)" }, { transform: `translate3d(calc(-100% + ${s.clientWidth}px),0,0)` }];
|
|
2659
2594
|
break;
|
|
2660
2595
|
}
|
|
2661
2596
|
break;
|
|
2662
2597
|
case "endStop":
|
|
2663
|
-
switch (
|
|
2598
|
+
switch (e) {
|
|
2664
2599
|
case "top":
|
|
2665
|
-
|
|
2600
|
+
n.animate1 = [{ transform: `translate3d(0,${s.clientHeight}px,0)` }, { transform: "translate3d(0,0,0)" }];
|
|
2666
2601
|
break;
|
|
2667
2602
|
case "right":
|
|
2668
|
-
|
|
2603
|
+
n.animate1 = [{ transform: "translate3d(-100%,0,0)" }, { transform: "translate3d(0,0,0)" }];
|
|
2669
2604
|
break;
|
|
2670
2605
|
case "bottom":
|
|
2671
|
-
|
|
2606
|
+
n.animate1 = [{ transform: "translate3d(0,-100%,0)" }, { transform: `translate3d(0,calc(${s.clientHeight}px - 100%),0)` }];
|
|
2672
2607
|
break;
|
|
2673
2608
|
case "left":
|
|
2674
|
-
|
|
2609
|
+
n.animate1 = [{ transform: `translate3d(${s.clientWidth}px,0,0)` }, { transform: `translate3d(calc(${s.clientWidth}px - 100%),0,0)` }];
|
|
2675
2610
|
break;
|
|
2676
2611
|
}
|
|
2677
2612
|
break;
|
|
2678
2613
|
}
|
|
2679
|
-
return
|
|
2614
|
+
return n;
|
|
2680
2615
|
}
|
|
2681
|
-
function
|
|
2682
|
-
let
|
|
2683
|
-
return function(
|
|
2684
|
-
|
|
2616
|
+
function ee(s) {
|
|
2617
|
+
let t;
|
|
2618
|
+
return function(e) {
|
|
2619
|
+
t && clearTimeout(t), t = setTimeout(s, 200, e);
|
|
2685
2620
|
};
|
|
2686
2621
|
}
|
|
2687
|
-
|
|
2688
|
-
class mn extends HTMLElement {
|
|
2622
|
+
class ie extends HTMLElement {
|
|
2689
2623
|
constructor() {
|
|
2690
|
-
super();
|
|
2691
|
-
p(this, Qt);
|
|
2692
|
-
p(this, Kt);
|
|
2693
|
-
p(this, Vt);
|
|
2694
|
-
p(this, te);
|
|
2695
|
-
this.initialize = !1;
|
|
2624
|
+
super(), this.initialize = !1;
|
|
2696
2625
|
}
|
|
2697
2626
|
static get observedAttributes() {
|
|
2698
2627
|
return [];
|
|
2699
2628
|
}
|
|
2700
|
-
attributeChangedCallback(t, e,
|
|
2629
|
+
attributeChangedCallback(t, e, i) {
|
|
2701
2630
|
}
|
|
2702
2631
|
connectedCallback() {
|
|
2703
|
-
this.initialize || (this.initialize = !0,
|
|
2632
|
+
this.initialize || (this.initialize = !0, this.#t());
|
|
2633
|
+
}
|
|
2634
|
+
#t() {
|
|
2635
|
+
const t = {
|
|
2636
|
+
direction: this.getAttribute("direction") || $.SETTINGS.direction,
|
|
2637
|
+
// up / down / left / right
|
|
2638
|
+
behavior: this.getAttribute("behavior") || $.SETTINGS.behavior,
|
|
2639
|
+
// normal / alternate / endStop
|
|
2640
|
+
duration: Number(this.getAttribute("duration")) || $.SETTINGS.duration,
|
|
2641
|
+
// ms
|
|
2642
|
+
durationBreakpoints: J(this) || $.SETTINGS.durationBreakpoints,
|
|
2643
|
+
autoplay: this.getAttribute("autoplay") || $.SETTINGS.autoplay,
|
|
2644
|
+
// normal / alternate / endStop
|
|
2645
|
+
pauseOnMouseenter: this.getAttribute("pauseOnMouseEnter") ? this.getAttribute("pauseOnMouseEnter") === "true" : $.SETTINGS.pauseOnMouseenter,
|
|
2646
|
+
// true / false
|
|
2647
|
+
continual: this.getAttribute("continual") ? this.getAttribute("continual") === "true" : $.SETTINGS.continual,
|
|
2648
|
+
// true / false
|
|
2649
|
+
gap: Number(this.getAttribute("gap")) || $.SETTINGS.gap
|
|
2650
|
+
};
|
|
2651
|
+
this.s = {}, this.s.options = t, this.s.nowDuration = lt(this), te(this), this.#s();
|
|
2652
|
+
}
|
|
2653
|
+
#s() {
|
|
2654
|
+
const { direction: t, continual: e, gap: i } = this.s.options;
|
|
2655
|
+
switch (t) {
|
|
2656
|
+
case "left":
|
|
2657
|
+
case "right":
|
|
2658
|
+
this.style.cssText = `--continual-gap: ${i}px;`;
|
|
2659
|
+
break;
|
|
2660
|
+
case "top":
|
|
2661
|
+
case "bottom":
|
|
2662
|
+
e ? this.style.cssText = `height: ${this.s.animateEl.clientHeight}px;--continual-gap: ${i}px;` : this.style.cssText = `min-height: ${this.s.animateEl.clientHeight}px;--continual-gap: ${i}px;`;
|
|
2663
|
+
break;
|
|
2664
|
+
}
|
|
2665
|
+
this.#e(), this.#i(), e && this.classList.add("continual"), this.classList.add("m4-initialize");
|
|
2666
|
+
}
|
|
2667
|
+
#e() {
|
|
2668
|
+
const t = this, { direction: e, behavior: i, duration: n, autoplay: o, pauseOnMouseenter: a, continual: r } = t.s.options;
|
|
2669
|
+
let l;
|
|
2670
|
+
function c() {
|
|
2671
|
+
switch (i) {
|
|
2672
|
+
case "normal":
|
|
2673
|
+
t.s.animateEl.style.transform = `${D(t).animate1[0].transform}`, t.s.animation = t.s.animateEl.animate(D(t).animate1, {
|
|
2674
|
+
duration: t.s.nowDuration,
|
|
2675
|
+
iterations: 1 / 0
|
|
2676
|
+
}), r && (t.s.cloneAnimateEl.style.transform = `${D(t).animate2[0].transform}`, t.s.cloneAnimation = t.s.cloneAnimateEl.animate(D(t).animate2, {
|
|
2677
|
+
duration: t.s.nowDuration,
|
|
2678
|
+
delay: -t.s.nowDuration / 2,
|
|
2679
|
+
iterations: 1 / 0
|
|
2680
|
+
}));
|
|
2681
|
+
break;
|
|
2682
|
+
case "alternate":
|
|
2683
|
+
let h = function() {
|
|
2684
|
+
let p = [];
|
|
2685
|
+
switch (e) {
|
|
2686
|
+
case "top":
|
|
2687
|
+
d = Math.abs(t.s.animateEl.scrollHeight - t.clientHeight), u = parseInt(t.s.nowDuration / (d * 2)) * t.s.animateEl.scrollHeight, p = [{ transform: `translate3d(0,${t.clientHeight}px,0)` }, { transform: `translate3d(0,calc(${t.clientHeight}px - 100%),0)` }];
|
|
2688
|
+
break;
|
|
2689
|
+
case "right":
|
|
2690
|
+
d = Math.abs(t.s.animateEl.scrollWidth - t.clientWidth), u = parseInt(t.s.nowDuration / (d * 2)) * t.s.animateEl.scrollWidth, p = [{ transform: "translate3d(-100%,0,0)" }, { transform: "translate3d(0,0,0)" }];
|
|
2691
|
+
break;
|
|
2692
|
+
case "bottom":
|
|
2693
|
+
d = Math.abs(t.s.animateEl.scrollHeight - t.clientHeight), u = parseInt(n / (d * 2)) * t.s.animateEl.scrollHeight, p = [{ transform: "translate3d(0,-100%,0)" }, { transform: "translate3d(0,0,0)" }];
|
|
2694
|
+
break;
|
|
2695
|
+
case "left":
|
|
2696
|
+
d = Math.abs(t.s.animateEl.scrollWidth - t.clientWidth), u = parseInt(n / (d * 2)) * t.s.animateEl.scrollWidth, p = [{ transform: `translate3d(${t.clientWidth}px,0,0)` }, { transform: `translate3d(calc(-100% + ${t.clientWidth}px),0,0)` }];
|
|
2697
|
+
break;
|
|
2698
|
+
}
|
|
2699
|
+
return p;
|
|
2700
|
+
}, d, u;
|
|
2701
|
+
(t.clientHeight > t.s.animateEl.scrollHeight || e === "left" || e === "right") && (t.s.animateEl.style.transform = `${h()[0].transform}`, t.s.animateEl.animate(h(), {
|
|
2702
|
+
duration: u,
|
|
2703
|
+
fill: "forwards"
|
|
2704
|
+
}).finished.then(() => {
|
|
2705
|
+
t.s.animation = t.s.animateEl.animate(D(t).animate1, {
|
|
2706
|
+
duration: t.s.nowDuration,
|
|
2707
|
+
iterations: 1 / 0
|
|
2708
|
+
});
|
|
2709
|
+
})), t.s.animation && t.s.animation.ready.then(() => {
|
|
2710
|
+
t.s.animateEl.classList.add("ready");
|
|
2711
|
+
});
|
|
2712
|
+
break;
|
|
2713
|
+
case "endStop":
|
|
2714
|
+
t.s.animateEl.style.transform = `${D(t).animate1[0].transform}`, t.s.animation = t.s.animateEl.animate(D(t).animate1, {
|
|
2715
|
+
duration: t.s.nowDuration,
|
|
2716
|
+
fill: "forwards"
|
|
2717
|
+
});
|
|
2718
|
+
break;
|
|
2719
|
+
}
|
|
2720
|
+
t.s.animateEl.classList.add("start"), o === !1 && (t.s.animateEl.classList.remove("start"), t.s.animation.cancel());
|
|
2721
|
+
}
|
|
2722
|
+
clearTimeout(l), l = setTimeout(
|
|
2723
|
+
() => {
|
|
2724
|
+
c();
|
|
2725
|
+
},
|
|
2726
|
+
o || 0
|
|
2727
|
+
), t.addEventListener("mouseenter", function() {
|
|
2728
|
+
t.s.animation && a && t.s.animation.playState === "running" && t.pause();
|
|
2729
|
+
}), t.addEventListener("mouseleave", function() {
|
|
2730
|
+
t.s.animation && a && t.s.animation.playState === "paused" && t.play();
|
|
2731
|
+
});
|
|
2732
|
+
}
|
|
2733
|
+
#i() {
|
|
2734
|
+
const t = this;
|
|
2735
|
+
function e() {
|
|
2736
|
+
const i = t.s.animation.startTime, n = t.s.cloneAnimation ? t.s.cloneAnimation.startTime : null;
|
|
2737
|
+
t.s.nowDuration = lt(t), t.s.animation.cancel(), t.s.cloneAnimation && t.s.cloneAnimation.cancel(), t.s.animation = t.s.animateEl.animate(D(t).animate1, {
|
|
2738
|
+
duration: t.s.nowDuration,
|
|
2739
|
+
iterations: 1 / 0
|
|
2740
|
+
}), t.s.animation.startTime = i, t.s.cloneAnimation && (t.s.cloneAnimation = t.s.cloneAnimateEl.animate(D(t).animate2, {
|
|
2741
|
+
duration: t.s.nowDuration,
|
|
2742
|
+
delay: -t.s.nowDuration / 2,
|
|
2743
|
+
iterations: 1 / 0
|
|
2744
|
+
}), t.s.cloneAnimation.startTime = n);
|
|
2745
|
+
}
|
|
2746
|
+
window.addEventListener("resize", ee(e));
|
|
2704
2747
|
}
|
|
2705
2748
|
play() {
|
|
2706
2749
|
this.s.animation.play(), this.s.animateEl.classList.add("start"), this.s.options.continual && (this.s.cloneAnimation.play(), this.s.cloneAnimateEl.classList.add("start"));
|
|
@@ -2709,191 +2752,47 @@ class mn extends HTMLElement {
|
|
|
2709
2752
|
this.s.animation.pause(), this.s.options.continual && this.s.cloneAnimation.pause();
|
|
2710
2753
|
}
|
|
2711
2754
|
}
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
// normal / alternate / endStop
|
|
2718
|
-
duration: Number(this.getAttribute("duration")) || I.SETTINGS.duration,
|
|
2719
|
-
// ms
|
|
2720
|
-
durationBreakpoints: Tt(this) || I.SETTINGS.durationBreakpoints,
|
|
2721
|
-
autoplay: this.getAttribute("autoplay") || I.SETTINGS.autoplay,
|
|
2722
|
-
// normal / alternate / endStop
|
|
2723
|
-
pauseOnMouseenter: this.getAttribute("pauseOnMouseEnter") ? this.getAttribute("pauseOnMouseEnter") === "true" : I.SETTINGS.pauseOnMouseenter,
|
|
2724
|
-
// true / false
|
|
2725
|
-
continual: this.getAttribute("continual") ? this.getAttribute("continual") === "true" : I.SETTINGS.continual,
|
|
2726
|
-
// true / false
|
|
2727
|
-
gap: Number(this.getAttribute("gap")) || I.SETTINGS.gap
|
|
2755
|
+
customElements.define("marquee-el", ie);
|
|
2756
|
+
const ct = function(s, t) {
|
|
2757
|
+
let e;
|
|
2758
|
+
return function(i) {
|
|
2759
|
+
e && clearTimeout(e), e = setTimeout(s, 200, i);
|
|
2728
2760
|
};
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
case "left":
|
|
2734
|
-
case "right":
|
|
2735
|
-
this.style.cssText = `--continual-gap: ${s}px;`;
|
|
2736
|
-
break;
|
|
2737
|
-
case "top":
|
|
2738
|
-
case "bottom":
|
|
2739
|
-
e ? this.style.cssText = `height: ${this.s.animateEl.clientHeight}px;--continual-gap: ${s}px;` : this.style.cssText = `min-height: ${this.s.animateEl.clientHeight}px;--continual-gap: ${s}px;`;
|
|
2740
|
-
break;
|
|
2741
|
-
}
|
|
2742
|
-
d(this, Vt, ss).call(this), d(this, te, ns).call(this), e && this.classList.add("continual"), this.classList.add("m4-initialize");
|
|
2743
|
-
}, Vt = new WeakSet(), ss = function() {
|
|
2744
|
-
const t = this, { direction: e, behavior: s, duration: o, autoplay: a, pauseOnMouseenter: r, continual: l } = t.s.options;
|
|
2745
|
-
let c;
|
|
2746
|
-
function u() {
|
|
2747
|
-
switch (s) {
|
|
2748
|
-
case "normal":
|
|
2749
|
-
t.s.animateEl.style.transform = `${H(t).animate1[0].transform}`, t.s.animation = t.s.animateEl.animate(H(t).animate1, {
|
|
2750
|
-
duration: t.s.nowDuration,
|
|
2751
|
-
iterations: 1 / 0
|
|
2752
|
-
}), l && (t.s.cloneAnimateEl.style.transform = `${H(t).animate2[0].transform}`, t.s.cloneAnimation = t.s.cloneAnimateEl.animate(H(t).animate2, {
|
|
2753
|
-
duration: t.s.nowDuration,
|
|
2754
|
-
delay: -t.s.nowDuration / 2,
|
|
2755
|
-
iterations: 1 / 0
|
|
2756
|
-
}));
|
|
2757
|
-
break;
|
|
2758
|
-
case "alternate":
|
|
2759
|
-
let m = function() {
|
|
2760
|
-
let v = [];
|
|
2761
|
-
switch (e) {
|
|
2762
|
-
case "top":
|
|
2763
|
-
h = Math.abs(t.s.animateEl.scrollHeight - t.clientHeight), g = parseInt(t.s.nowDuration / (h * 2)) * t.s.animateEl.scrollHeight, v = [{ transform: `translate3d(0,${t.clientHeight}px,0)` }, { transform: `translate3d(0,calc(${t.clientHeight}px - 100%),0)` }];
|
|
2764
|
-
break;
|
|
2765
|
-
case "right":
|
|
2766
|
-
h = Math.abs(t.s.animateEl.scrollWidth - t.clientWidth), g = parseInt(t.s.nowDuration / (h * 2)) * t.s.animateEl.scrollWidth, v = [{ transform: "translate3d(-100%,0,0)" }, { transform: "translate3d(0,0,0)" }];
|
|
2767
|
-
break;
|
|
2768
|
-
case "bottom":
|
|
2769
|
-
h = Math.abs(t.s.animateEl.scrollHeight - t.clientHeight), g = parseInt(o / (h * 2)) * t.s.animateEl.scrollHeight, v = [{ transform: "translate3d(0,-100%,0)" }, { transform: "translate3d(0,0,0)" }];
|
|
2770
|
-
break;
|
|
2771
|
-
case "left":
|
|
2772
|
-
h = Math.abs(t.s.animateEl.scrollWidth - t.clientWidth), g = parseInt(o / (h * 2)) * t.s.animateEl.scrollWidth, v = [{ transform: `translate3d(${t.clientWidth}px,0,0)` }, { transform: `translate3d(calc(-100% + ${t.clientWidth}px),0,0)` }];
|
|
2773
|
-
break;
|
|
2774
|
-
}
|
|
2775
|
-
return v;
|
|
2776
|
-
}, h, g;
|
|
2777
|
-
(t.clientHeight > t.s.animateEl.scrollHeight || e === "left" || e === "right") && (t.s.animateEl.style.transform = `${m()[0].transform}`, t.s.animateEl.animate(m(), {
|
|
2778
|
-
duration: g,
|
|
2779
|
-
fill: "forwards"
|
|
2780
|
-
}).finished.then(() => {
|
|
2781
|
-
t.s.animation = t.s.animateEl.animate(H(t).animate1, {
|
|
2782
|
-
duration: t.s.nowDuration,
|
|
2783
|
-
iterations: 1 / 0
|
|
2784
|
-
});
|
|
2785
|
-
})), t.s.animation && t.s.animation.ready.then(() => {
|
|
2786
|
-
t.s.animateEl.classList.add("ready");
|
|
2787
|
-
});
|
|
2788
|
-
break;
|
|
2789
|
-
case "endStop":
|
|
2790
|
-
t.s.animateEl.style.transform = `${H(t).animate1[0].transform}`, t.s.animation = t.s.animateEl.animate(H(t).animate1, {
|
|
2791
|
-
duration: t.s.nowDuration,
|
|
2792
|
-
fill: "forwards"
|
|
2793
|
-
});
|
|
2794
|
-
break;
|
|
2795
|
-
}
|
|
2796
|
-
t.s.animateEl.classList.add("start"), a === !1 && (t.s.animateEl.classList.remove("start"), t.s.animation.cancel());
|
|
2797
|
-
}
|
|
2798
|
-
clearTimeout(c), c = setTimeout(
|
|
2799
|
-
() => {
|
|
2800
|
-
u();
|
|
2801
|
-
},
|
|
2802
|
-
a || 0
|
|
2803
|
-
), t.addEventListener("mouseenter", function() {
|
|
2804
|
-
t.s.animation && r && t.s.animation.playState === "running" && t.pause();
|
|
2805
|
-
}), t.addEventListener("mouseleave", function() {
|
|
2806
|
-
t.s.animation && r && t.s.animation.playState === "paused" && t.play();
|
|
2807
|
-
});
|
|
2808
|
-
}, te = new WeakSet(), ns = function() {
|
|
2809
|
-
const t = this;
|
|
2810
|
-
function e() {
|
|
2811
|
-
const s = t.s.animation.startTime, o = t.s.cloneAnimation ? t.s.cloneAnimation.startTime : null;
|
|
2812
|
-
t.s.nowDuration = li(t), t.s.animation.cancel(), t.s.cloneAnimation && t.s.cloneAnimation.cancel(), t.s.animation = t.s.animateEl.animate(H(t).animate1, {
|
|
2813
|
-
duration: t.s.nowDuration,
|
|
2814
|
-
iterations: 1 / 0
|
|
2815
|
-
}), t.s.animation.startTime = s, t.s.cloneAnimation && (t.s.cloneAnimation = t.s.cloneAnimateEl.animate(H(t).animate2, {
|
|
2816
|
-
duration: t.s.nowDuration,
|
|
2817
|
-
delay: -t.s.nowDuration / 2,
|
|
2818
|
-
iterations: 1 / 0
|
|
2819
|
-
}), t.s.cloneAnimation.startTime = o);
|
|
2820
|
-
}
|
|
2821
|
-
window.addEventListener("resize", hn(e));
|
|
2822
|
-
};
|
|
2823
|
-
customElements.define("marquee-el", mn);
|
|
2824
|
-
const ci = function(n, i) {
|
|
2825
|
-
let t;
|
|
2826
|
-
return function(e) {
|
|
2827
|
-
t && clearTimeout(t), t = setTimeout(n, 200, e);
|
|
2828
|
-
};
|
|
2829
|
-
}, k = (n, i) => {
|
|
2830
|
-
if (vt(n)) {
|
|
2831
|
-
n.forEach((t) => {
|
|
2832
|
-
t.classList.add(i);
|
|
2761
|
+
}, L = (s, t) => {
|
|
2762
|
+
if (X(s)) {
|
|
2763
|
+
s.forEach((e) => {
|
|
2764
|
+
e.classList.add(t);
|
|
2833
2765
|
});
|
|
2834
2766
|
return;
|
|
2835
2767
|
}
|
|
2836
|
-
|
|
2837
|
-
},
|
|
2838
|
-
if (
|
|
2839
|
-
|
|
2840
|
-
|
|
2768
|
+
s.classList.add(t);
|
|
2769
|
+
}, _ = (s, t) => {
|
|
2770
|
+
if (X(s)) {
|
|
2771
|
+
s.forEach((e) => {
|
|
2772
|
+
e.classList.remove(t);
|
|
2841
2773
|
});
|
|
2842
2774
|
return;
|
|
2843
2775
|
}
|
|
2844
|
-
|
|
2776
|
+
s.classList.remove(t);
|
|
2845
2777
|
};
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
// 初始化
|
|
2850
|
-
p(this, ee);
|
|
2851
|
-
// 左右箭頭事件綁定
|
|
2852
|
-
p(this, ie);
|
|
2853
|
-
// 左右拖拉事件綁定
|
|
2854
|
-
p(this, se);
|
|
2855
|
-
// 卷軸位置判斷
|
|
2856
|
-
p(this, lt);
|
|
2857
|
-
// 隱藏按鈕判斷
|
|
2858
|
-
p(this, U);
|
|
2859
|
-
// 選項事件綁定
|
|
2860
|
-
p(this, ne);
|
|
2861
|
-
this.$element = i, this.option = i.s.option.drag, this._didInitialScroll = !1, d(this, ee, os).call(this);
|
|
2778
|
+
class dt {
|
|
2779
|
+
constructor(t) {
|
|
2780
|
+
this.$element = t, this.option = t.s.option.drag, this._didInitialScroll = !1, this.#t();
|
|
2862
2781
|
}
|
|
2863
|
-
//
|
|
2864
|
-
|
|
2865
|
-
const t = this
|
|
2866
|
-
if (!
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
});
|
|
2782
|
+
// 初始化
|
|
2783
|
+
#t() {
|
|
2784
|
+
const t = this;
|
|
2785
|
+
if (!t.$element) return;
|
|
2786
|
+
t.$container = t.$element.querySelector(".drag-container"), t.$wrapper = t.$container.querySelector(".wrapper");
|
|
2787
|
+
let e = !1;
|
|
2788
|
+
const i = () => {
|
|
2789
|
+
e || (requestAnimationFrame(() => {
|
|
2790
|
+
this.#i(), this.#n(), e = !1;
|
|
2791
|
+
}), e = !0);
|
|
2874
2792
|
};
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
}
|
|
2879
|
-
s();
|
|
2880
|
-
}
|
|
2881
|
-
}
|
|
2882
|
-
ee = new WeakSet(), os = function() {
|
|
2883
|
-
var s, o, a, r;
|
|
2884
|
-
const i = this;
|
|
2885
|
-
if (!i.$element)
|
|
2886
|
-
return;
|
|
2887
|
-
i.$container = i.$element.querySelector(".drag-container"), i.$wrapper = i.$container.querySelector(".wrapper");
|
|
2888
|
-
let t = !1;
|
|
2889
|
-
const e = () => {
|
|
2890
|
-
t || (requestAnimationFrame(() => {
|
|
2891
|
-
d(this, lt, Xe).call(this), d(this, U, Et).call(this), t = !1;
|
|
2892
|
-
}), t = !0);
|
|
2893
|
-
};
|
|
2894
|
-
i.$wrapper.removeEventListener("scroll", e), i.$wrapper.addEventListener("scroll", e), window.removeEventListener("resize", e), window.addEventListener("resize", e), (i.option.draggable || i.$element.s.type == "collapse") && d(s = i, se, rs).call(s), i.option.navigation && i.$element.s.type !== "collapse" && (i.$container.insertAdjacentHTML(
|
|
2895
|
-
S.prepend,
|
|
2896
|
-
`<div class="navigation">
|
|
2793
|
+
t.$wrapper.removeEventListener("scroll", i), t.$wrapper.addEventListener("scroll", i), window.removeEventListener("resize", i), window.addEventListener("resize", i), (t.option.draggable || t.$element.s.type == "collapse") && t.#e(), t.option.navigation && t.$element.s.type !== "collapse" && (t.$container.insertAdjacentHTML(
|
|
2794
|
+
E.prepend,
|
|
2795
|
+
`<div class="navigation">
|
|
2897
2796
|
<div class="button prev">
|
|
2898
2797
|
<div></div>
|
|
2899
2798
|
</div>
|
|
@@ -2901,661 +2800,661 @@ ee = new WeakSet(), os = function() {
|
|
|
2901
2800
|
<div></div>
|
|
2902
2801
|
</div>
|
|
2903
2802
|
</div>`
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
});
|
|
2907
|
-
}, ie = new WeakSet(), as = function() {
|
|
2908
|
-
const i = this, { $wrapper: t, $button: e } = i, s = function() {
|
|
2909
|
-
const o = this.classList.contains("next"), a = parseInt(t.getBoundingClientRect().width * 0.7);
|
|
2910
|
-
t.scrollTo({
|
|
2911
|
-
left: o ? t.scrollLeft + a : t.scrollLeft - a,
|
|
2912
|
-
behavior: "smooth"
|
|
2913
|
-
}), setTimeout(() => {
|
|
2914
|
-
var r;
|
|
2915
|
-
d(r = i, U, Et).call(r);
|
|
2916
|
-
}, 100);
|
|
2917
|
-
};
|
|
2918
|
-
e.forEach((o) => {
|
|
2919
|
-
o.removeEventListener("click", s), o.addEventListener("click", s);
|
|
2920
|
-
});
|
|
2921
|
-
}, se = new WeakSet(), rs = function() {
|
|
2922
|
-
const { $wrapper: i } = this;
|
|
2923
|
-
let t = !1, e = !1, s = 0, o = 0;
|
|
2924
|
-
const a = function(h) {
|
|
2925
|
-
h.preventDefault(), e = !1, t = !0, s = h.pageX - i.offsetLeft, o = i.scrollLeft;
|
|
2926
|
-
};
|
|
2927
|
-
i.removeEventListener("mousedown", a), i.addEventListener("mousedown", a);
|
|
2928
|
-
const r = function() {
|
|
2929
|
-
e = !1, t = !1;
|
|
2930
|
-
};
|
|
2931
|
-
i.removeEventListener("mouseleave", r), i.addEventListener("mouseleave", r);
|
|
2932
|
-
const l = function(h) {
|
|
2933
|
-
h.preventDefault(), t = !1;
|
|
2934
|
-
};
|
|
2935
|
-
i.removeEventListener("mouseup", l), i.addEventListener("mouseup", l);
|
|
2936
|
-
const c = function(h) {
|
|
2937
|
-
if (h.preventDefault(), e = !0, !t)
|
|
2938
|
-
return;
|
|
2939
|
-
const m = h.pageX - i.offsetLeft - s;
|
|
2940
|
-
i.scrollTo({
|
|
2941
|
-
left: o - m
|
|
2803
|
+
), t.$button = t.$container?.querySelectorAll(".button"), t.#s()), t.#o(), t.update(!0), requestAnimationFrame(() => {
|
|
2804
|
+
this.#i(), this.#n();
|
|
2942
2805
|
});
|
|
2943
|
-
};
|
|
2944
|
-
i.removeEventListener("mousemove", c), i.addEventListener("mousemove", c);
|
|
2945
|
-
const u = function(h) {
|
|
2946
|
-
e && (h.preventDefault(), h.stopPropagation());
|
|
2947
|
-
};
|
|
2948
|
-
i.querySelectorAll("a").forEach((h) => {
|
|
2949
|
-
h.removeEventListener("click", u), h.addEventListener("click", u);
|
|
2950
|
-
});
|
|
2951
|
-
}, lt = new WeakSet(), Xe = function() {
|
|
2952
|
-
const { $container: i, $wrapper: t } = this, e = t.scrollWidth - t.clientWidth, s = Math.round(t.scrollLeft);
|
|
2953
|
-
e <= 0 || (k(i, "scrollable"), s == 0 ? (k(t, "start"), $(t, "end")) : s + 1 >= e ? ($(t, "start"), k(t, "end")) : (k(t, "center"), $(t, "start"), $(t, "end")));
|
|
2954
|
-
}, U = new WeakSet(), Et = function() {
|
|
2955
|
-
const { $wrapper: i, $button: t, $element: e } = this;
|
|
2956
|
-
if (!t)
|
|
2957
|
-
return;
|
|
2958
|
-
const s = i.scrollWidth - i.clientWidth, o = i.scrollLeft;
|
|
2959
|
-
if (s <= 0) {
|
|
2960
|
-
k(t, "hide"), $(t, "active"), k(e, "noScrollable");
|
|
2961
|
-
return;
|
|
2962
2806
|
}
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2807
|
+
// 更新 active 位置
|
|
2808
|
+
update(t = !1) {
|
|
2809
|
+
const e = this.$element.querySelector(".wrapper"), i = e?.querySelector(".active");
|
|
2810
|
+
if (!i || !e) return;
|
|
2811
|
+
const n = () => {
|
|
2812
|
+
const o = e.getBoundingClientRect(), a = i.getBoundingClientRect(), r = o.left + o.width / 2, c = a.left + a.width / 2 - r, d = e.scrollLeft + c;
|
|
2813
|
+
e.scrollTo({
|
|
2814
|
+
left: d,
|
|
2815
|
+
behavior: "smooth"
|
|
2816
|
+
});
|
|
2817
|
+
};
|
|
2818
|
+
if (t && !this._didInitialScroll) {
|
|
2819
|
+
this._didInitialScroll = !0, setTimeout(n, 250);
|
|
2966
2820
|
return;
|
|
2967
2821
|
}
|
|
2968
|
-
|
|
2969
|
-
}
|
|
2970
|
-
|
|
2971
|
-
|
|
2822
|
+
n();
|
|
2823
|
+
}
|
|
2824
|
+
// 左右箭頭事件綁定
|
|
2825
|
+
#s() {
|
|
2826
|
+
const t = this, { $wrapper: e, $button: i } = t, n = function() {
|
|
2827
|
+
const o = this.classList.contains("next"), a = parseInt(e.getBoundingClientRect().width * 0.7);
|
|
2828
|
+
e.scrollTo({
|
|
2829
|
+
left: o ? e.scrollLeft + a : e.scrollLeft - a,
|
|
2830
|
+
behavior: "smooth"
|
|
2831
|
+
}), setTimeout(() => {
|
|
2832
|
+
t.#n();
|
|
2833
|
+
}, 100);
|
|
2834
|
+
};
|
|
2835
|
+
i.forEach((o) => {
|
|
2836
|
+
o.removeEventListener("click", n), o.addEventListener("click", n);
|
|
2837
|
+
});
|
|
2838
|
+
}
|
|
2839
|
+
// 左右拖拉事件綁定
|
|
2840
|
+
#e() {
|
|
2841
|
+
const { $wrapper: t } = this;
|
|
2842
|
+
let e = !1, i = !1, n = 0, o = 0;
|
|
2843
|
+
const a = function(u) {
|
|
2844
|
+
u.preventDefault(), i = !1, e = !0, n = u.pageX - t.offsetLeft, o = t.scrollLeft;
|
|
2845
|
+
};
|
|
2846
|
+
t.removeEventListener("mousedown", a), t.addEventListener("mousedown", a);
|
|
2847
|
+
const r = function() {
|
|
2848
|
+
i = !1, e = !1;
|
|
2849
|
+
};
|
|
2850
|
+
t.removeEventListener("mouseleave", r), t.addEventListener("mouseleave", r);
|
|
2851
|
+
const l = function(u) {
|
|
2852
|
+
u.preventDefault(), e = !1;
|
|
2853
|
+
};
|
|
2854
|
+
t.removeEventListener("mouseup", l), t.addEventListener("mouseup", l);
|
|
2855
|
+
const c = function(u) {
|
|
2856
|
+
if (u.preventDefault(), i = !0, !e) return;
|
|
2857
|
+
const p = u.pageX - t.offsetLeft - n;
|
|
2858
|
+
t.scrollTo({
|
|
2859
|
+
left: o - p
|
|
2860
|
+
});
|
|
2861
|
+
};
|
|
2862
|
+
t.removeEventListener("mousemove", c), t.addEventListener("mousemove", c);
|
|
2863
|
+
const d = function(u) {
|
|
2864
|
+
i && (u.preventDefault(), u.stopPropagation());
|
|
2865
|
+
};
|
|
2866
|
+
t.querySelectorAll("a").forEach((u) => {
|
|
2867
|
+
u.removeEventListener("click", d), u.addEventListener("click", d);
|
|
2868
|
+
});
|
|
2869
|
+
}
|
|
2870
|
+
// 卷軸位置判斷
|
|
2871
|
+
#i() {
|
|
2872
|
+
const { $container: t, $wrapper: e } = this, i = e.scrollWidth - e.clientWidth, n = Math.round(e.scrollLeft);
|
|
2873
|
+
i <= 0 || (L(t, "scrollable"), n == 0 ? (L(e, "start"), _(e, "end")) : n + 1 >= i ? (_(e, "start"), L(e, "end")) : (L(e, "center"), _(e, "start"), _(e, "end")));
|
|
2874
|
+
}
|
|
2875
|
+
// 隱藏按鈕判斷
|
|
2876
|
+
#n() {
|
|
2877
|
+
const { $wrapper: t, $button: e, $element: i } = this;
|
|
2878
|
+
if (!e) return;
|
|
2879
|
+
const n = t.scrollWidth - t.clientWidth, o = t.scrollLeft;
|
|
2880
|
+
if (n <= 0) {
|
|
2881
|
+
L(e, "hide"), _(e, "active"), L(i, "noScrollable");
|
|
2972
2882
|
return;
|
|
2973
2883
|
}
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2884
|
+
n > 0 && (L(e, "active"), _(i, "noScrollable")), o == 0 ? e.forEach((a) => {
|
|
2885
|
+
if (a.classList.contains("next")) {
|
|
2886
|
+
_(a, "hide");
|
|
2887
|
+
return;
|
|
2888
|
+
}
|
|
2889
|
+
L(a, "hide");
|
|
2890
|
+
}) : o + 1 >= n ? e.forEach((a) => {
|
|
2891
|
+
if (a.classList.contains("next")) {
|
|
2892
|
+
L(a, "hide");
|
|
2893
|
+
return;
|
|
2894
|
+
}
|
|
2895
|
+
_(a, "hide");
|
|
2896
|
+
}) : _(e, "hide");
|
|
2897
|
+
}
|
|
2898
|
+
// 選項事件綁定
|
|
2899
|
+
#o() {
|
|
2900
|
+
const { $element: t } = this, e = (n) => {
|
|
2901
|
+
if (this.option.selected) {
|
|
2902
|
+
const o = n.getAttribute("data-option").trim();
|
|
2903
|
+
t.setAttribute("m4-status", o);
|
|
2904
|
+
}
|
|
2905
|
+
};
|
|
2906
|
+
function i() {
|
|
2907
|
+
e(this);
|
|
2981
2908
|
}
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
}
|
|
2986
|
-
this.$container.querySelectorAll(".item").forEach((s) => {
|
|
2987
|
-
s.removeEventListener("click", e), s.addEventListener("click", e);
|
|
2988
|
-
});
|
|
2989
|
-
};
|
|
2990
|
-
var oe, cs, ae, ds, re, us, le, ps;
|
|
2991
|
-
class gn {
|
|
2992
|
-
constructor(i) {
|
|
2993
|
-
// 初始化
|
|
2994
|
-
p(this, oe);
|
|
2995
|
-
// 隱藏按鈕判斷
|
|
2996
|
-
p(this, ae);
|
|
2997
|
-
// 展開箭頭事件綁定
|
|
2998
|
-
p(this, re);
|
|
2999
|
-
// 選項事件綁定
|
|
3000
|
-
p(this, le);
|
|
3001
|
-
this.$element = i, this.option = i.s.option.collapse, d(this, oe, cs).call(this);
|
|
2909
|
+
this.$container.querySelectorAll(".item").forEach((n) => {
|
|
2910
|
+
n.removeEventListener("click", i), n.addEventListener("click", i);
|
|
2911
|
+
});
|
|
3002
2912
|
}
|
|
3003
2913
|
}
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
2914
|
+
class se {
|
|
2915
|
+
constructor(t) {
|
|
2916
|
+
this.$element = t, this.option = t.s.option.collapse, this.#t();
|
|
2917
|
+
}
|
|
2918
|
+
// 初始化
|
|
2919
|
+
#t() {
|
|
2920
|
+
this.$element && (this.$container = this.$element.querySelector(".collapse-container"), this.$wrapper = this.$container.querySelector(".wrapper"), this.#s() && this.#e(), this.#i());
|
|
2921
|
+
}
|
|
2922
|
+
// 隱藏按鈕判斷
|
|
2923
|
+
#s() {
|
|
2924
|
+
const t = this.$element.querySelector(".drag-container"), e = t.querySelector(".wrapper");
|
|
2925
|
+
return e.scrollWidth - e.clientWidth > 0 ? (t.insertAdjacentHTML(E.append, '<div class="open-collapse"></div>'), this.$button = t.querySelector(".open-collapse"), _(this.$element, "noScrollable"), !0) : (L(this.$element, "noScrollable"), !1);
|
|
2926
|
+
}
|
|
2927
|
+
// 展開箭頭事件綁定
|
|
2928
|
+
#e() {
|
|
2929
|
+
const { $element: t, $button: e } = this, i = function() {
|
|
2930
|
+
t.classList.contains("expand") ? t.classList.remove("expand") : t.classList.add("expand");
|
|
2931
|
+
};
|
|
2932
|
+
e.removeEventListener("click", i), e.addEventListener("click", i);
|
|
2933
|
+
}
|
|
2934
|
+
// 選項事件綁定
|
|
2935
|
+
#i() {
|
|
2936
|
+
const { $element: t } = this, e = (n, o) => {
|
|
2937
|
+
if (t?.classList.contains("expand") ? t?.classList.remove("expand") : t?.classList.add("expand"), this.option.selected) {
|
|
2938
|
+
const a = n.getAttribute("data-option").trim();
|
|
2939
|
+
t.setAttribute("m4-status", a);
|
|
2940
|
+
}
|
|
2941
|
+
};
|
|
2942
|
+
function i() {
|
|
2943
|
+
e(this);
|
|
3019
2944
|
}
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
2945
|
+
this.$container.querySelectorAll(".item").forEach((n) => {
|
|
2946
|
+
n.removeEventListener("click", i), n.addEventListener("click", i);
|
|
2947
|
+
});
|
|
3023
2948
|
}
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
});
|
|
3027
|
-
|
|
3028
|
-
const fn = (n) => {
|
|
3029
|
-
const { type: i, option: t, originalDomString: e } = n.s, s = document.createElement("div");
|
|
3030
|
-
return i == "drag" && (s.innerHTML = q.TEMPLATE[i]().trim(), s.querySelector(".drag-container .wrapper").insertAdjacentHTML(S.append, e)), i == "collapse" && (s.innerHTML = q.TEMPLATE[i](t == null ? void 0 : t.collapse).trim(), s.querySelector(".drag-container .wrapper").insertAdjacentHTML(S.append, e), s.querySelector(".collapse-container .wrapper").insertAdjacentHTML(S.append, e)), i == "dropdown" && (s.innerHTML = q.TEMPLATE[i](t == null ? void 0 : t.dropdown).trim(), s.querySelector("dropdown-el").insertAdjacentHTML(S.append, e)), s.children;
|
|
2949
|
+
}
|
|
2950
|
+
const ne = (s) => {
|
|
2951
|
+
const { type: t, option: e, originalDomString: i } = s.s, n = document.createElement("div");
|
|
2952
|
+
return t == "drag" && (n.innerHTML = x.TEMPLATE[t]().trim(), n.querySelector(".drag-container .wrapper").insertAdjacentHTML(E.append, i)), t == "collapse" && (n.innerHTML = x.TEMPLATE[t](e?.collapse).trim(), n.querySelector(".drag-container .wrapper").insertAdjacentHTML(E.append, i), n.querySelector(".collapse-container .wrapper").insertAdjacentHTML(E.append, i)), t == "dropdown" && (n.innerHTML = x.TEMPLATE[t](e?.dropdown).trim(), n.querySelector("dropdown-el").insertAdjacentHTML(E.append, i)), n.children;
|
|
3031
2953
|
};
|
|
3032
|
-
|
|
3033
|
-
class vn extends HTMLElement {
|
|
2954
|
+
class oe extends HTMLElement {
|
|
3034
2955
|
constructor() {
|
|
3035
|
-
super();
|
|
3036
|
-
p(this, ce);
|
|
3037
|
-
p(this, de);
|
|
3038
|
-
// 斷點設定
|
|
3039
|
-
p(this, ct);
|
|
3040
|
-
// 同步目前選中的項目
|
|
3041
|
-
p(this, dt);
|
|
3042
|
-
// 下拉選項事件綁定
|
|
3043
|
-
p(this, ue);
|
|
3044
|
-
// 關閉展開中的 collapse
|
|
3045
|
-
p(this, ut);
|
|
3046
|
-
// check type
|
|
3047
|
-
p(this, Y);
|
|
3048
|
-
this.initialize = !1, this.__events__ = {}, this.s = {}, this.s.originalDomString = this.innerHTML.trim().replace(/\n/g, ""), this.previousWidth = window.innerWidth;
|
|
2956
|
+
super(), this.initialize = !1, this.__events__ = {}, this.s = {}, this.s.originalDomString = this.innerHTML.trim().replace(/\n/g, ""), this.previousWidth = window.innerWidth;
|
|
3049
2957
|
}
|
|
3050
2958
|
static get observedAttributes() {
|
|
3051
2959
|
return ["m4-type", "m4-status"];
|
|
3052
2960
|
}
|
|
3053
|
-
attributeChangedCallback(t, e,
|
|
2961
|
+
attributeChangedCallback(t, e, i) {
|
|
3054
2962
|
switch (t) {
|
|
3055
2963
|
case "m4-type":
|
|
3056
|
-
if (e === null || e ===
|
|
3057
|
-
|
|
3058
|
-
this.s.type = s, d(this, Y, At).call(this);
|
|
2964
|
+
if (e === null || e === i) return;
|
|
2965
|
+
this.s.type = i, this.#a();
|
|
3059
2966
|
break;
|
|
3060
2967
|
case "m4-status":
|
|
3061
|
-
if (e ===
|
|
3062
|
-
|
|
3063
|
-
d(this, dt, Ye).call(this, s);
|
|
2968
|
+
if (e === i) return;
|
|
2969
|
+
this.#i(i);
|
|
3064
2970
|
break;
|
|
3065
2971
|
}
|
|
3066
2972
|
}
|
|
3067
2973
|
connectedCallback() {
|
|
3068
|
-
this.initialize || this.classList.contains("m4-init") || (this.initialize = !0,
|
|
2974
|
+
this.initialize || this.classList.contains("m4-init") || (this.initialize = !0, this.#t());
|
|
3069
2975
|
}
|
|
3070
2976
|
update() {
|
|
3071
|
-
|
|
2977
|
+
this.#o(), this.#e();
|
|
2978
|
+
}
|
|
2979
|
+
#t() {
|
|
2980
|
+
let t = {};
|
|
2981
|
+
this.hasAttribute("m4-value") || this.setAttribute("m4-value", ""), this.s.type = this.getAttribute("m4-type") ?? x.SETTINGS.type, this.hasAttribute("m4-option") && (t = this.getAttribute("m4-option") ? JSON.parse(this.getAttribute("m4-option")) : {}, this.removeAttribute("m4-option"));
|
|
2982
|
+
const e = (i) => {
|
|
2983
|
+
if (i.type === "resize") {
|
|
2984
|
+
if (window.innerWidth === this.previousWidth) return;
|
|
2985
|
+
this.previousWidth = window.innerWidth;
|
|
2986
|
+
}
|
|
2987
|
+
this.update();
|
|
2988
|
+
};
|
|
2989
|
+
window.removeEventListener("resize", ct(e)), window.addEventListener("resize", ct(e)), this.s.option = {}, this.s.option.drag = Object.assign({}, x.SETTINGS.drag, t?.drag), this.s.option.collapse = Object.assign({}, x.SETTINGS.collapse, t?.collapse), this.s.option.dropdown = Object.assign({}, x.SETTINGS.dropdown, t?.dropdown), this.s.option.breakpoint = Object.assign({}, x.SETTINGS.breakpoint, t?.breakpoint), this.#s();
|
|
3072
2990
|
}
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
let t = {};
|
|
3076
|
-
this.hasAttribute("m4-value") || this.setAttribute("m4-value", ""), this.s.type = this.getAttribute("m4-type") ?? q.SETTINGS.type, this.hasAttribute("m4-option") && (t = this.getAttribute("m4-option") ? JSON.parse(this.getAttribute("m4-option")) : {}, this.removeAttribute("m4-option"));
|
|
3077
|
-
const e = (s) => {
|
|
3078
|
-
if (s.type === "resize") {
|
|
3079
|
-
if (window.innerWidth === this.previousWidth)
|
|
3080
|
-
return;
|
|
3081
|
-
this.previousWidth = window.innerWidth;
|
|
3082
|
-
}
|
|
3083
|
-
this.update();
|
|
3084
|
-
};
|
|
3085
|
-
window.removeEventListener("resize", ci(e)), window.addEventListener("resize", ci(e)), this.s.option = {}, this.s.option.drag = Object.assign({}, q.SETTINGS.drag, t == null ? void 0 : t.drag), this.s.option.collapse = Object.assign({}, q.SETTINGS.collapse, t == null ? void 0 : t.collapse), this.s.option.dropdown = Object.assign({}, q.SETTINGS.dropdown, t == null ? void 0 : t.dropdown), this.s.option.breakpoint = Object.assign({}, q.SETTINGS.breakpoint, t == null ? void 0 : t.breakpoint), d(this, de, ms).call(this);
|
|
3086
|
-
}, de = new WeakSet(), ms = function() {
|
|
3087
|
-
this.classList.add("m4-init"), d(this, ct, Ue).call(this);
|
|
3088
|
-
}, ct = new WeakSet(), Ue = function() {
|
|
3089
|
-
const t = Object.keys(this.s.option.breakpoint);
|
|
3090
|
-
if (!t.length) {
|
|
3091
|
-
d(this, Y, At).call(this);
|
|
3092
|
-
return;
|
|
2991
|
+
#s() {
|
|
2992
|
+
this.classList.add("m4-init"), this.#e();
|
|
3093
2993
|
}
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
}
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
2994
|
+
// 斷點設定
|
|
2995
|
+
#e() {
|
|
2996
|
+
const t = Object.keys(this.s.option.breakpoint);
|
|
2997
|
+
if (!t.length) {
|
|
2998
|
+
this.#a();
|
|
2999
|
+
return;
|
|
3000
|
+
}
|
|
3001
|
+
t.map((e) => Number(e)).sort((e, i) => i - e).some((e) => (window.innerWidth >= e && (this.s.type = this.s.option.breakpoint[e]?.type, this.setAttribute("m4-type", this.s.type), this.s.option.drag = Object.assign({}, this.s.option.drag, this.s.option.breakpoint[e]?.drag), this.s.option.collapse = Object.assign({}, this.s.option.collapse, this.s.option.breakpoint[e]?.collapse), this.s.option.dropdown = Object.assign({}, this.s.option.dropdown, this.s.option.breakpoint[e]?.dropdown)), this.#a(), window.innerWidth >= e));
|
|
3002
|
+
}
|
|
3003
|
+
// 同步目前選中的項目
|
|
3004
|
+
#i(t = this.getAttribute("m4-status")) {
|
|
3005
|
+
const e = t ?? "", i = (o) => {
|
|
3006
|
+
this.querySelectorAll(o).forEach((a) => {
|
|
3007
|
+
const r = a.getAttribute("data-option")?.trim();
|
|
3008
|
+
a.classList.toggle("active", r === e);
|
|
3009
|
+
});
|
|
3010
|
+
};
|
|
3011
|
+
i(".drag-container .item"), i(".collapse-container .item");
|
|
3012
|
+
const n = this.querySelector("dropdown-el");
|
|
3013
|
+
n && n.getAttribute("d4-value") !== e && n.setAttribute("d4-value", e), this.drag?.update();
|
|
3014
|
+
}
|
|
3015
|
+
// 下拉選項事件綁定
|
|
3016
|
+
#n() {
|
|
3017
|
+
const t = this.querySelector("dropdown-el");
|
|
3018
|
+
!t || typeof t.on != "function" || (this.__events__.dropdownChange = () => {
|
|
3019
|
+
const e = t.getAttribute("d4-value")?.trim() ?? "";
|
|
3020
|
+
this.getAttribute("m4-status") !== e && this.setAttribute("m4-status", e);
|
|
3021
|
+
}, t.off?.("change", this.__events__.dropdownChange), t.on("change", this.__events__.dropdownChange));
|
|
3022
|
+
}
|
|
3023
|
+
// 關閉展開中的 collapse
|
|
3024
|
+
#o() {
|
|
3025
|
+
this.classList.remove("expand");
|
|
3026
|
+
}
|
|
3027
|
+
// check type
|
|
3028
|
+
#a() {
|
|
3029
|
+
const { type: t } = this.s;
|
|
3030
|
+
switch (this.#o(), this.innerHTML = "", [...ne(this)].forEach((e) => {
|
|
3031
|
+
this.append(e);
|
|
3032
|
+
}), this.#i(), t) {
|
|
3033
|
+
case "drag":
|
|
3034
|
+
this.drag = new dt(this);
|
|
3035
|
+
break;
|
|
3036
|
+
case "collapse":
|
|
3037
|
+
this.drag = new dt(this), this.collapse = new se(this);
|
|
3038
|
+
break;
|
|
3039
|
+
case "dropdown":
|
|
3040
|
+
this.#n();
|
|
3041
|
+
break;
|
|
3042
|
+
}
|
|
3134
3043
|
}
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
var pe, vs, he, bs, pt, Je, W, Z, me, ys, ge, ws, fe, Ts, ve, Es, be, As, ye, Ss, we, Ls, Te, _s, Ee, Ds, N, R, Ae, xs, Se, ks, Le, $s, _e, Cs;
|
|
3139
|
-
class fs extends HTMLElement {
|
|
3044
|
+
}
|
|
3045
|
+
customElements.define("multipurpose-nav", oe);
|
|
3046
|
+
class $t extends HTMLElement {
|
|
3140
3047
|
// 定義組件的初始狀態
|
|
3141
3048
|
constructor(t, e) {
|
|
3142
3049
|
super();
|
|
3143
|
-
p(this, pe);
|
|
3144
|
-
p(this, he);
|
|
3145
|
-
// 第一關 判斷數量以及id設定
|
|
3146
|
-
p(this, pt);
|
|
3147
|
-
// 第二關 id命名提醒
|
|
3148
|
-
p(this, W);
|
|
3149
|
-
p(this, me);
|
|
3150
|
-
p(this, ge);
|
|
3151
|
-
p(this, fe);
|
|
3152
|
-
// 執行函式
|
|
3153
|
-
// 移動至指定位置
|
|
3154
|
-
p(this, ve);
|
|
3155
|
-
// 移動
|
|
3156
|
-
p(this, be);
|
|
3157
|
-
// 步驟狀態
|
|
3158
|
-
p(this, ye);
|
|
3159
|
-
// next 按鈕狀態
|
|
3160
|
-
p(this, we);
|
|
3161
|
-
// prev 按鈕狀態
|
|
3162
|
-
p(this, Te);
|
|
3163
|
-
// 頁籤狀態
|
|
3164
|
-
p(this, Ee);
|
|
3165
|
-
// 第三關各種元件判斷 及 執行
|
|
3166
|
-
p(this, N);
|
|
3167
|
-
// 消失動畫
|
|
3168
|
-
p(this, Ae);
|
|
3169
|
-
// 出現動畫
|
|
3170
|
-
p(this, Se);
|
|
3171
|
-
// 狀態
|
|
3172
|
-
p(this, Le);
|
|
3173
|
-
// resize
|
|
3174
|
-
p(this, _e);
|
|
3175
3050
|
}
|
|
3176
3051
|
// 當組件的屬性被更改時會被呼叫
|
|
3177
3052
|
static get observedAttributes() {
|
|
3178
3053
|
return ["t4-active"];
|
|
3179
3054
|
}
|
|
3180
|
-
attributeChangedCallback(t, e,
|
|
3181
|
-
t === "t4-active" && e !==
|
|
3055
|
+
attributeChangedCallback(t, e, i) {
|
|
3056
|
+
t === "t4-active" && e !== i && this.#f(i);
|
|
3182
3057
|
}
|
|
3183
3058
|
connectedCallback() {
|
|
3184
|
-
this.classList.contains("t4-initialize") ||
|
|
3059
|
+
this.classList.contains("t4-initialize") || this.#t();
|
|
3060
|
+
}
|
|
3061
|
+
#t() {
|
|
3062
|
+
const t = this.getAttribute("t4-name"), { SETTINGS: e } = gt;
|
|
3063
|
+
document.querySelectorAll(`tab-el[t4-name=${t}]`).length > 1 && console.warn(t, "名字有重複喔!!!"), this.t = {
|
|
3064
|
+
tabs: [],
|
|
3065
|
+
name: t,
|
|
3066
|
+
tabPanels: [...this.children],
|
|
3067
|
+
activeTab: "",
|
|
3068
|
+
stepOutput: e.stepOutput,
|
|
3069
|
+
recordUrl: this.getAttribute("t4-url") || e.recordUrl,
|
|
3070
|
+
type: this.getAttribute("t4-type") || e.type,
|
|
3071
|
+
display: this.getAttribute("t4-display") || e.display,
|
|
3072
|
+
defaultPage: this.getAttribute("t4-defaultPage") || e.defaultPage,
|
|
3073
|
+
anchor: this.getAttribute("t4-anchor"),
|
|
3074
|
+
gap: this.getAttribute("t4-gap") || e.anchorGap,
|
|
3075
|
+
transition: {
|
|
3076
|
+
duration: this.getAttribute("t4-duration") || e.transition.duration,
|
|
3077
|
+
timing: this.getAttribute("t4-timing") || e.transition.timing,
|
|
3078
|
+
delay: this.getAttribute("t4-delay") || e.transition.delay
|
|
3079
|
+
},
|
|
3080
|
+
tabGroup: this.getAttribute("t4-group") || e.tabGroup
|
|
3081
|
+
}, this.__events__ = {}, this.t.tabs = this.#e(), this.t.step = document.querySelector(`[t4-control="${this.t.name}"]${this.t.stepOutput}`), this.#s();
|
|
3082
|
+
}
|
|
3083
|
+
#s() {
|
|
3084
|
+
if (this.t.activeTab = this.t.defaultPage, this.t.display === "swiper" && this.#n(), this.t.recordUrl) {
|
|
3085
|
+
const e = new URLSearchParams(document.location.search).get(this.t.name), i = document.querySelectorAll(`[t4-name="${this.t.name}"] .tab-panel[t4-id="${e}"]`);
|
|
3086
|
+
e && i.length === 1 ? this.t.activeTab = e : console.warn(`沒有${e}這頁喔!!`);
|
|
3087
|
+
}
|
|
3088
|
+
this.setActiveTab(this.t.activeTab), this.classList.add("t4-initialize"), this.#v();
|
|
3089
|
+
}
|
|
3090
|
+
// 第一關 判斷數量以及id設定
|
|
3091
|
+
#e() {
|
|
3092
|
+
const { t } = this, e = Array.from(document.querySelectorAll(`[t4-control="${t.name}"][t4-role="tab"]`));
|
|
3093
|
+
return t.type === "normal" && t.tabGroup === "true" && t.tabPanels.length !== e.length && console.warn("按鈕與內容數量不同喔", t.tabPanels.length, e.length), t.tabGroup === "true" ? t.tabPanels.forEach((i, n) => i.setAttribute("t4-id", n)) : t.tabPanels.forEach((i) => {
|
|
3094
|
+
i.getAttribute("t4-id") || console.warn(i, "請幫我設定id!!");
|
|
3095
|
+
}), e;
|
|
3096
|
+
}
|
|
3097
|
+
// 第二關 id命名提醒
|
|
3098
|
+
#i(t) {
|
|
3099
|
+
const { t: e } = this, i = e.tabPanels.filter((o) => o.getAttribute("t4-id") === t);
|
|
3100
|
+
i.length > 1 && console.warn("有兩個相同id設定", i);
|
|
3101
|
+
const n = i[0];
|
|
3102
|
+
return n ? e.tabPanels.indexOf(n) : (console.warn(`找不到t4-id為${t}的頁籤`), 0);
|
|
3103
|
+
}
|
|
3104
|
+
#n() {
|
|
3105
|
+
const t = document.createElement("div");
|
|
3106
|
+
t.classList.add("swiper-container");
|
|
3107
|
+
const e = document.createElement("div");
|
|
3108
|
+
e.classList.add("swiper-wrapper"), this.t.tabPanels.forEach((i) => {
|
|
3109
|
+
e.appendChild(i.cloneNode(!0));
|
|
3110
|
+
}), this.t.tabPanels = [...e.children], t.appendChild(e), this.innerHTML = "", this.appendChild(t), this.#o();
|
|
3111
|
+
}
|
|
3112
|
+
#o() {
|
|
3113
|
+
const t = this.querySelector(".swiper-container"), e = this.querySelector(".swiper-wrapper"), i = this.t.tabPanels;
|
|
3114
|
+
t.style.overflow = "hidden", e.style.display = "flex";
|
|
3115
|
+
const n = i.length * 100 + "%";
|
|
3116
|
+
e.style.width = n;
|
|
3117
|
+
}
|
|
3118
|
+
#a(t) {
|
|
3119
|
+
const { t: e } = this;
|
|
3120
|
+
if (e.recordUrl === "true") {
|
|
3121
|
+
const i = new URLSearchParams(document.location.search);
|
|
3122
|
+
i.set(e.name, t);
|
|
3123
|
+
const n = `${window.location.pathname}?${i.toString()}`;
|
|
3124
|
+
history.replaceState({ t4Id: t }, "", n);
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
// 執行函式
|
|
3128
|
+
// 移動至指定位置
|
|
3129
|
+
#l() {
|
|
3130
|
+
const t = parseInt(this.t.gap, 10), e = window.pageYOffset, n = this.getBoundingClientRect().top + e - t;
|
|
3131
|
+
this.#c(n);
|
|
3132
|
+
}
|
|
3133
|
+
// 移動
|
|
3134
|
+
#c(t) {
|
|
3135
|
+
window.scrollTo({
|
|
3136
|
+
top: t,
|
|
3137
|
+
behavior: "smooth"
|
|
3138
|
+
});
|
|
3139
|
+
}
|
|
3140
|
+
// 步驟狀態
|
|
3141
|
+
#d(t) {
|
|
3142
|
+
let e = parseInt(t, 10) + 1;
|
|
3143
|
+
this.t.step.textContent = `${e}`, this.t.step.setAttribute("now-page", e);
|
|
3144
|
+
}
|
|
3145
|
+
// next 按鈕狀態
|
|
3146
|
+
#u(t) {
|
|
3147
|
+
const e = document.querySelectorAll(`[t4-role="next"][t4-control="${this.t.name}"]`), i = this.t.tabPanels.length === 1, n = t === this.t.tabPanels.length - 1;
|
|
3148
|
+
e.forEach((o) => {
|
|
3149
|
+
i || n ? o.setAttribute("disabled", "") : o.removeAttribute("disabled");
|
|
3150
|
+
});
|
|
3151
|
+
}
|
|
3152
|
+
// prev 按鈕狀態
|
|
3153
|
+
#p(t) {
|
|
3154
|
+
const e = document.querySelectorAll(`[t4-role="prev"][t4-control="${this.t.name}"]`), i = this.t.tabPanels.length === 1, n = t === 0;
|
|
3155
|
+
e.forEach((o) => {
|
|
3156
|
+
i || n ? o.setAttribute("disabled", "") : o.removeAttribute("disabled");
|
|
3157
|
+
});
|
|
3158
|
+
}
|
|
3159
|
+
// 頁籤狀態
|
|
3160
|
+
#h(t, e) {
|
|
3161
|
+
this.t.tabGroup === "true" ? this.t.tabs.forEach((i, n) => {
|
|
3162
|
+
n == t ? i.setAttribute("aria-selected", !0) : i.setAttribute("aria-selected", !1);
|
|
3163
|
+
}) : this.t.tabs.forEach((i, n) => {
|
|
3164
|
+
i.getAttribute("t4-id") === e ? i.setAttribute("aria-selected", !0) : i.setAttribute("aria-selected", !1);
|
|
3165
|
+
});
|
|
3166
|
+
}
|
|
3167
|
+
// 第三關各種元件判斷 及 執行
|
|
3168
|
+
#r(t, e, i) {
|
|
3169
|
+
switch (t) {
|
|
3170
|
+
case "step":
|
|
3171
|
+
Q(this.t.step) && this.#d(e);
|
|
3172
|
+
break;
|
|
3173
|
+
case "eventAnchor":
|
|
3174
|
+
this.t.anchor && this.#l();
|
|
3175
|
+
break;
|
|
3176
|
+
case "tabState":
|
|
3177
|
+
this.t.type == "normal" && this.#h(e, i);
|
|
3178
|
+
break;
|
|
3179
|
+
case "btnState":
|
|
3180
|
+
this.#u(e), this.#p(e);
|
|
3181
|
+
break;
|
|
3182
|
+
case "tabUrl":
|
|
3183
|
+
this.t.recordUrl === "true" && this.#a(e);
|
|
3184
|
+
break;
|
|
3185
|
+
default:
|
|
3186
|
+
console.warn("請增加判斷,謝謝");
|
|
3187
|
+
break;
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3190
|
+
// 消失動畫
|
|
3191
|
+
#m(t) {
|
|
3192
|
+
const { t: e } = this, { duration: i, timing: n, delay: o } = this.t.transition, a = e.tabPanels[t];
|
|
3193
|
+
switch (a.classList.remove("show"), a.classList.add("hide"), e.display) {
|
|
3194
|
+
case "fade":
|
|
3195
|
+
a.style.cssText = "display: none; opacity: 0;";
|
|
3196
|
+
break;
|
|
3197
|
+
case "slide":
|
|
3198
|
+
a.style.cssText = "display: none; opacity: 0; max-height: unset;";
|
|
3199
|
+
break;
|
|
3200
|
+
case "swiper":
|
|
3201
|
+
break;
|
|
3202
|
+
default:
|
|
3203
|
+
a.style.display = "none";
|
|
3204
|
+
break;
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
// 出現動畫
|
|
3208
|
+
#g(t) {
|
|
3209
|
+
const { duration: e, timing: i, delay: n } = this.t.transition, o = this.t.tabPanels[t];
|
|
3210
|
+
let a;
|
|
3211
|
+
switch (o.classList.add("show"), o.classList.remove("hide"), o.style.transition = `opacity ${e}ms ${i} ${n}ms`, o.style.display = "block", this.t.display) {
|
|
3212
|
+
case "fade":
|
|
3213
|
+
o.style.opacity = "0", a = setTimeout(() => {
|
|
3214
|
+
clearTimeout(a), o.style.opacity = "1";
|
|
3215
|
+
}, 100);
|
|
3216
|
+
break;
|
|
3217
|
+
case "slide":
|
|
3218
|
+
console.warn(this.t.display, "抱歉,好像壞掉了...");
|
|
3219
|
+
const r = o.offsetHeight;
|
|
3220
|
+
o.style.opacity = "1", o.style.maxHeight = "0", a = setTimeout(() => {
|
|
3221
|
+
clearTimeout(a), o.style.maxHeight = r + "px";
|
|
3222
|
+
}, 100);
|
|
3223
|
+
break;
|
|
3224
|
+
case "swiper":
|
|
3225
|
+
o.style.opacity = "1";
|
|
3226
|
+
const l = this.querySelector(".swiper-wrapper"), c = this.t.tabPanels[0].offsetWidth, d = -t * c;
|
|
3227
|
+
l.style.transition = `transform ${e}ms ${i} ${n}ms`, l.style.transform = `translateX(${d}px)`;
|
|
3228
|
+
break;
|
|
3229
|
+
default:
|
|
3230
|
+
console.warn(this.t.display, "沒有這個效果請自己想辦法!!!!");
|
|
3231
|
+
break;
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
// 狀態
|
|
3235
|
+
#f(t) {
|
|
3236
|
+
const e = this.#i(t);
|
|
3237
|
+
this.#r("step", e), this.#r("btnState", e), this.#r("tabState", e, t), this.#r("tabUrl", t), this.emit("change");
|
|
3238
|
+
}
|
|
3239
|
+
// resize
|
|
3240
|
+
#v() {
|
|
3241
|
+
const t = this;
|
|
3242
|
+
window.addEventListener(
|
|
3243
|
+
"resize",
|
|
3244
|
+
ae(() => {
|
|
3245
|
+
t.update();
|
|
3246
|
+
}, 1e3)
|
|
3247
|
+
);
|
|
3185
3248
|
}
|
|
3186
3249
|
// ------------- 我是分隔線呦 -------------
|
|
3187
3250
|
// 頁籤切換
|
|
3188
3251
|
tabClick(t) {
|
|
3189
|
-
const { t: e } = this,
|
|
3190
|
-
this.setActiveTab(
|
|
3191
|
-
|
|
3252
|
+
const { t: e } = this, i = e.tabs.indexOf(t) % e.tabPanels.length, n = e.tabGroup === "true" ? String(i) : t.getAttribute("t4-id");
|
|
3253
|
+
this.setActiveTab(n), setTimeout(() => {
|
|
3254
|
+
this.#r("eventAnchor");
|
|
3192
3255
|
}, e.transition.duration);
|
|
3193
3256
|
}
|
|
3194
3257
|
// 外部呼叫方法 $0.setActiveTab(0)
|
|
3195
3258
|
setActiveTab(t) {
|
|
3196
|
-
const { t: e } = this,
|
|
3197
|
-
e.activeTab =
|
|
3198
|
-
const
|
|
3199
|
-
e.tabPanels.forEach((
|
|
3200
|
-
|
|
3259
|
+
const { t: e } = this, i = t === "" ? e.tabPanels[0].getAttribute("t4-id") : t;
|
|
3260
|
+
e.activeTab = i, this.setAttribute("t4-active", i);
|
|
3261
|
+
const n = this.#i(i);
|
|
3262
|
+
e.tabPanels.forEach((o, a) => {
|
|
3263
|
+
a === n ? this.#g(a) : this.#m(a);
|
|
3201
3264
|
});
|
|
3202
3265
|
}
|
|
3203
3266
|
// 外部呼叫方法 $0.goNext()
|
|
3204
3267
|
goNext() {
|
|
3205
|
-
const t =
|
|
3206
|
-
this.setActiveTab(
|
|
3268
|
+
const t = this.#i(this.t.activeTab), e = Math.min(this.t.tabPanels.length - 1, t + 1), i = this.t.tabPanels[e].getAttribute("t4-id");
|
|
3269
|
+
this.setActiveTab(i);
|
|
3207
3270
|
}
|
|
3208
3271
|
// 外部呼叫方法 $0.goPrev()
|
|
3209
3272
|
goPrev() {
|
|
3210
|
-
const t =
|
|
3211
|
-
this.setActiveTab(
|
|
3273
|
+
const t = this.#i(this.t.activeTab), e = Math.max(0, t - 1), i = this.t.tabPanels[e].getAttribute("t4-id");
|
|
3274
|
+
this.setActiveTab(i);
|
|
3212
3275
|
}
|
|
3213
3276
|
// 外部呼叫方法 $0.update()
|
|
3214
3277
|
update() {
|
|
3215
|
-
this.t.tabs =
|
|
3278
|
+
this.t.tabs = this.#e(), kt(), console.log("tab update!!!!");
|
|
3216
3279
|
}
|
|
3217
3280
|
}
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
name: t,
|
|
3223
|
-
tabPanels: [...this.children],
|
|
3224
|
-
activeTab: "",
|
|
3225
|
-
stepOutput: e.stepOutput,
|
|
3226
|
-
recordUrl: this.getAttribute("t4-url") || e.recordUrl,
|
|
3227
|
-
type: this.getAttribute("t4-type") || e.type,
|
|
3228
|
-
display: this.getAttribute("t4-display") || e.display,
|
|
3229
|
-
defaultPage: this.getAttribute("t4-defaultPage") || e.defaultPage,
|
|
3230
|
-
anchor: this.getAttribute("t4-anchor"),
|
|
3231
|
-
gap: this.getAttribute("t4-gap") || e.anchorGap,
|
|
3232
|
-
transition: {
|
|
3233
|
-
duration: this.getAttribute("t4-duration") || e.transition.duration,
|
|
3234
|
-
timing: this.getAttribute("t4-timing") || e.transition.timing,
|
|
3235
|
-
delay: this.getAttribute("t4-delay") || e.transition.delay
|
|
3236
|
-
},
|
|
3237
|
-
tabGroup: this.getAttribute("t4-group") || e.tabGroup
|
|
3238
|
-
}, this.__events__ = {}, this.t.tabs = d(this, pt, Je).call(this), this.t.step = document.querySelector(`[t4-control="${this.t.name}"]${this.t.stepOutput}`), d(this, he, bs).call(this);
|
|
3239
|
-
}, he = new WeakSet(), bs = function() {
|
|
3240
|
-
if (this.t.activeTab = this.t.defaultPage, this.t.display === "swiper" && d(this, me, ys).call(this), this.t.recordUrl) {
|
|
3241
|
-
const e = new URLSearchParams(document.location.search).get(this.t.name), s = document.querySelectorAll(`[t4-name="${this.t.name}"] .tab-panel[t4-id="${e}"]`);
|
|
3242
|
-
e && s.length === 1 ? this.t.activeTab = e : console.warn(`沒有${e}這頁喔!!`);
|
|
3243
|
-
}
|
|
3244
|
-
this.setActiveTab(this.t.activeTab), this.classList.add("t4-initialize"), d(this, _e, Cs).call(this);
|
|
3245
|
-
}, pt = new WeakSet(), Je = function() {
|
|
3246
|
-
const { t } = this, e = Array.from(document.querySelectorAll(`[t4-control="${t.name}"][t4-role="tab"]`));
|
|
3247
|
-
return t.type === "normal" && t.tabGroup === "true" && t.tabPanels.length !== e.length && console.warn("按鈕與內容數量不同喔", t.tabPanels.length, e.length), t.tabGroup === "true" ? t.tabPanels.forEach((s, o) => s.setAttribute("t4-id", o)) : t.tabPanels.forEach((s) => {
|
|
3248
|
-
s.getAttribute("t4-id") || console.warn(s, "請幫我設定id!!");
|
|
3249
|
-
}), e;
|
|
3250
|
-
}, W = new WeakSet(), Z = function(t) {
|
|
3251
|
-
const { t: e } = this, s = e.tabPanels.filter((a) => a.getAttribute("t4-id") === t);
|
|
3252
|
-
s.length > 1 && console.warn("有兩個相同id設定", s);
|
|
3253
|
-
const o = s[0];
|
|
3254
|
-
return o ? e.tabPanels.indexOf(o) : (console.warn(`找不到t4-id為${t}的頁籤`), 0);
|
|
3255
|
-
}, me = new WeakSet(), ys = function() {
|
|
3256
|
-
const t = document.createElement("div");
|
|
3257
|
-
t.classList.add("swiper-container");
|
|
3258
|
-
const e = document.createElement("div");
|
|
3259
|
-
e.classList.add("swiper-wrapper"), this.t.tabPanels.forEach((s) => {
|
|
3260
|
-
e.appendChild(s.cloneNode(!0));
|
|
3261
|
-
}), this.t.tabPanels = [...e.children], t.appendChild(e), this.innerHTML = "", this.appendChild(t), d(this, ge, ws).call(this);
|
|
3262
|
-
}, ge = new WeakSet(), ws = function() {
|
|
3263
|
-
const t = this.querySelector(".swiper-container"), e = this.querySelector(".swiper-wrapper"), s = this.t.tabPanels;
|
|
3264
|
-
t.style.overflow = "hidden", e.style.display = "flex";
|
|
3265
|
-
const o = s.length * 100 + "%";
|
|
3266
|
-
e.style.width = o;
|
|
3267
|
-
}, fe = new WeakSet(), Ts = function(t) {
|
|
3268
|
-
const { t: e } = this;
|
|
3269
|
-
if (e.recordUrl === "true") {
|
|
3270
|
-
const s = new URLSearchParams(document.location.search);
|
|
3271
|
-
s.set(e.name, t);
|
|
3272
|
-
const o = `${window.location.pathname}?${s.toString()}`;
|
|
3273
|
-
history.replaceState({ t4Id: t }, "", o);
|
|
3274
|
-
}
|
|
3275
|
-
}, ve = new WeakSet(), Es = function() {
|
|
3276
|
-
const t = parseInt(this.t.gap, 10), e = window.pageYOffset, o = this.getBoundingClientRect().top + e - t;
|
|
3277
|
-
d(this, be, As).call(this, o);
|
|
3278
|
-
}, be = new WeakSet(), As = function(t) {
|
|
3279
|
-
window.scrollTo({
|
|
3280
|
-
top: t,
|
|
3281
|
-
behavior: "smooth"
|
|
3282
|
-
});
|
|
3283
|
-
}, ye = new WeakSet(), Ss = function(t) {
|
|
3284
|
-
let e = parseInt(t, 10) + 1;
|
|
3285
|
-
this.t.step.textContent = `${e}`, this.t.step.setAttribute("now-page", e);
|
|
3286
|
-
}, we = new WeakSet(), Ls = function(t) {
|
|
3287
|
-
const e = document.querySelectorAll(`[t4-role="next"][t4-control="${this.t.name}"]`), s = this.t.tabPanels.length === 1, o = t === this.t.tabPanels.length - 1;
|
|
3288
|
-
e.forEach((a) => {
|
|
3289
|
-
s || o ? a.setAttribute("disabled", "") : a.removeAttribute("disabled");
|
|
3290
|
-
});
|
|
3291
|
-
}, Te = new WeakSet(), _s = function(t) {
|
|
3292
|
-
const e = document.querySelectorAll(`[t4-role="prev"][t4-control="${this.t.name}"]`), s = this.t.tabPanels.length === 1, o = t === 0;
|
|
3293
|
-
e.forEach((a) => {
|
|
3294
|
-
s || o ? a.setAttribute("disabled", "") : a.removeAttribute("disabled");
|
|
3295
|
-
});
|
|
3296
|
-
}, Ee = new WeakSet(), Ds = function(t, e) {
|
|
3297
|
-
this.t.tabGroup === "true" ? this.t.tabs.forEach((s, o) => {
|
|
3298
|
-
o == t ? s.setAttribute("aria-selected", !0) : s.setAttribute("aria-selected", !1);
|
|
3299
|
-
}) : this.t.tabs.forEach((s, o) => {
|
|
3300
|
-
s.getAttribute("t4-id") === e ? s.setAttribute("aria-selected", !0) : s.setAttribute("aria-selected", !1);
|
|
3301
|
-
});
|
|
3302
|
-
}, N = new WeakSet(), R = function(t, e, s) {
|
|
3303
|
-
switch (t) {
|
|
3304
|
-
case "step":
|
|
3305
|
-
Ie(this.t.step) && d(this, ye, Ss).call(this, e);
|
|
3306
|
-
break;
|
|
3307
|
-
case "eventAnchor":
|
|
3308
|
-
this.t.anchor && d(this, ve, Es).call(this);
|
|
3309
|
-
break;
|
|
3310
|
-
case "tabState":
|
|
3311
|
-
this.t.type == "normal" && d(this, Ee, Ds).call(this, e, s);
|
|
3312
|
-
break;
|
|
3313
|
-
case "btnState":
|
|
3314
|
-
d(this, we, Ls).call(this, e), d(this, Te, _s).call(this, e);
|
|
3315
|
-
break;
|
|
3316
|
-
case "tabUrl":
|
|
3317
|
-
this.t.recordUrl === "true" && d(this, fe, Ts).call(this, e);
|
|
3318
|
-
break;
|
|
3319
|
-
default:
|
|
3320
|
-
console.warn("請增加判斷,謝謝");
|
|
3321
|
-
break;
|
|
3322
|
-
}
|
|
3323
|
-
}, Ae = new WeakSet(), xs = function(t) {
|
|
3324
|
-
const { t: e } = this;
|
|
3325
|
-
this.t.transition;
|
|
3326
|
-
const s = e.tabPanels[t];
|
|
3327
|
-
switch (s.classList.remove("show"), s.classList.add("hide"), e.display) {
|
|
3328
|
-
case "fade":
|
|
3329
|
-
s.style.cssText = "display: none; opacity: 0;";
|
|
3330
|
-
break;
|
|
3331
|
-
case "slide":
|
|
3332
|
-
s.style.cssText = "display: none; opacity: 0; max-height: unset;";
|
|
3333
|
-
break;
|
|
3334
|
-
case "swiper":
|
|
3335
|
-
break;
|
|
3336
|
-
default:
|
|
3337
|
-
s.style.display = "none";
|
|
3338
|
-
break;
|
|
3339
|
-
}
|
|
3340
|
-
}, Se = new WeakSet(), ks = function(t) {
|
|
3341
|
-
const { duration: e, timing: s, delay: o } = this.t.transition, a = this.t.tabPanels[t];
|
|
3342
|
-
let r;
|
|
3343
|
-
switch (a.classList.add("show"), a.classList.remove("hide"), a.style.transition = `opacity ${e}ms ${s} ${o}ms`, a.style.display = "block", this.t.display) {
|
|
3344
|
-
case "fade":
|
|
3345
|
-
a.style.opacity = "0", r = setTimeout(() => {
|
|
3346
|
-
clearTimeout(r), a.style.opacity = "1";
|
|
3347
|
-
}, 100);
|
|
3348
|
-
break;
|
|
3349
|
-
case "slide":
|
|
3350
|
-
console.warn(this.t.display, "抱歉,好像壞掉了...");
|
|
3351
|
-
const l = a.offsetHeight;
|
|
3352
|
-
a.style.opacity = "1", a.style.maxHeight = "0", r = setTimeout(() => {
|
|
3353
|
-
clearTimeout(r), a.style.maxHeight = l + "px";
|
|
3354
|
-
}, 100);
|
|
3355
|
-
break;
|
|
3356
|
-
case "swiper":
|
|
3357
|
-
a.style.opacity = "1";
|
|
3358
|
-
const c = this.querySelector(".swiper-wrapper"), u = this.t.tabPanels[0].offsetWidth, h = -t * u;
|
|
3359
|
-
c.style.transition = `transform ${e}ms ${s} ${o}ms`, c.style.transform = `translateX(${h}px)`;
|
|
3360
|
-
break;
|
|
3361
|
-
default:
|
|
3362
|
-
console.warn(this.t.display, "沒有這個效果請自己想辦法!!!!");
|
|
3363
|
-
break;
|
|
3364
|
-
}
|
|
3365
|
-
}, Le = new WeakSet(), $s = function(t) {
|
|
3366
|
-
const e = d(this, W, Z).call(this, t);
|
|
3367
|
-
d(this, N, R).call(this, "step", e), d(this, N, R).call(this, "btnState", e), d(this, N, R).call(this, "tabState", e, t), d(this, N, R).call(this, "tabUrl", t), this.emit("change");
|
|
3368
|
-
}, _e = new WeakSet(), Cs = function() {
|
|
3369
|
-
const t = this;
|
|
3370
|
-
window.addEventListener(
|
|
3371
|
-
"resize",
|
|
3372
|
-
bn(() => {
|
|
3373
|
-
t.update();
|
|
3374
|
-
}, 1e3)
|
|
3375
|
-
);
|
|
3376
|
-
};
|
|
3377
|
-
function bn(n, i = 1e3) {
|
|
3378
|
-
let t;
|
|
3379
|
-
return function(e) {
|
|
3380
|
-
t && clearTimeout(t), t = setTimeout(n, i, e);
|
|
3281
|
+
function ae(s, t = 1e3) {
|
|
3282
|
+
let e;
|
|
3283
|
+
return function(i) {
|
|
3284
|
+
e && clearTimeout(e), e = setTimeout(s, t, i);
|
|
3381
3285
|
};
|
|
3382
3286
|
}
|
|
3383
|
-
function
|
|
3384
|
-
const
|
|
3385
|
-
document.addEventListener("click", function(
|
|
3386
|
-
let
|
|
3387
|
-
for (const
|
|
3388
|
-
if (
|
|
3389
|
-
|
|
3287
|
+
function kt() {
|
|
3288
|
+
const s = document.querySelectorAll("[t4-control]");
|
|
3289
|
+
document.addEventListener("click", function(t) {
|
|
3290
|
+
let e = !1;
|
|
3291
|
+
for (const i of s)
|
|
3292
|
+
if (i.contains(t.target) || t.target.closest("[t4-control]") === i) {
|
|
3293
|
+
e = !0;
|
|
3390
3294
|
break;
|
|
3391
3295
|
}
|
|
3392
|
-
if (
|
|
3393
|
-
const
|
|
3296
|
+
if (e) {
|
|
3297
|
+
const i = t.target.closest("[t4-control]"), n = i.getAttribute("t4-control"), o = document.querySelectorAll(`tab-el[t4-name="${n}"]`), a = i.getAttribute("t4-role");
|
|
3394
3298
|
o.forEach((r) => {
|
|
3395
3299
|
switch (a) {
|
|
3396
3300
|
case "tab":
|
|
3397
|
-
r.tabClick(
|
|
3301
|
+
r.tabClick(i);
|
|
3398
3302
|
break;
|
|
3399
3303
|
case "next":
|
|
3400
|
-
r.goNext(
|
|
3304
|
+
r.goNext(i);
|
|
3401
3305
|
break;
|
|
3402
3306
|
case "prev":
|
|
3403
|
-
r.goPrev(
|
|
3307
|
+
r.goPrev(i);
|
|
3404
3308
|
break;
|
|
3405
3309
|
default:
|
|
3406
|
-
console.warn("你是誰??",
|
|
3310
|
+
console.warn("你是誰??", i);
|
|
3407
3311
|
break;
|
|
3408
3312
|
}
|
|
3409
3313
|
});
|
|
3410
3314
|
}
|
|
3411
3315
|
});
|
|
3412
3316
|
}
|
|
3413
|
-
|
|
3414
|
-
Object.assign(
|
|
3415
|
-
customElements.define("tab-el",
|
|
3416
|
-
const
|
|
3417
|
-
const { defaultOptions:
|
|
3418
|
-
|
|
3419
|
-
},
|
|
3420
|
-
const { defaultOptions:
|
|
3421
|
-
|
|
3317
|
+
kt();
|
|
3318
|
+
Object.assign($t.prototype, N);
|
|
3319
|
+
customElements.define("tab-el", $t);
|
|
3320
|
+
const ut = (s) => {
|
|
3321
|
+
const { defaultOptions: t } = s.collapse, { collapseClass: e, target: i, transition: n } = t, o = s.querySelector(i);
|
|
3322
|
+
s.classList.add(e), o.style.height = 0, o.style["transition-property"] = n.property, o.style["transition-duration"] = n.duration, o.style["transition-timing-function"] = n.function, o.style["transition-delay"] = n.delay, o.style.overflow = "hidden";
|
|
3323
|
+
}, re = (s) => {
|
|
3324
|
+
const { defaultOptions: t } = s.collapse, { collapseClass: e, target: i, transition: n } = t, o = s.querySelector(i), a = o.children[0].offsetHeight;
|
|
3325
|
+
s.collapse.height = a, s.classList.remove(e), o.style.display = "block", o.style.height = `${a}px`, o.style["transition-property"] = n.property, o.style["transition-duration"] = n.duration, o.style["transition-timing-function"] = n.function, o.style["transition-delay"] = n.delay, o.style.overflow = "hidden";
|
|
3422
3326
|
};
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3327
|
+
class le {
|
|
3328
|
+
constructor(t, e = {}) {
|
|
3329
|
+
!R(t) && !Q(t) && !X(t) && !T(t) || (this.__storage__ = {
|
|
3330
|
+
el: t,
|
|
3331
|
+
options: e
|
|
3332
|
+
}, this.active = "data-collapse-active", this.#t());
|
|
3333
|
+
}
|
|
3334
|
+
#t() {
|
|
3335
|
+
const { el: t, options: e } = this.__storage__, { SETTINGS: i, EVENTS: n } = ft;
|
|
3336
|
+
if (this.elements = e.state == "not active" ? S(t + `:not([${this.active}])`) : S(t), this.options = Object.assign({}, i, e), this.__events__ = Object.assign({}, n), this.options.on)
|
|
3337
|
+
for (const [o, a] of Object.entries(this.options.on))
|
|
3338
|
+
this.__events__[o] = [a];
|
|
3339
|
+
this.#s();
|
|
3340
|
+
}
|
|
3341
|
+
#s() {
|
|
3342
|
+
const { elements: t, options: e } = this;
|
|
3343
|
+
t.forEach((i) => {
|
|
3344
|
+
i.collapse = {}, i.collapse.instance = this, i.collapse.defaultOptions = e, i.collapse.methods = {}, i.collapse.methods.update = this.update, i.setAttribute(this.active, ""), this.#e(i);
|
|
3345
|
+
}), this.emit("init");
|
|
3346
|
+
}
|
|
3347
|
+
#e(t) {
|
|
3348
|
+
const { options: e } = this, { collapseClass: i, block: n, target: o, defaultOpen: a, targetStopPropagation: r, defaultActiveMark: l } = e, c = t, d = c.querySelector(o);
|
|
3349
|
+
if (c.collapse.height = d.children[0].offsetHeight, a ? (d.style.height = `${d.children[0].offsetHeight}px`, c.classList.remove(i)) : !c.classList.contains(l) && !c.hasAttribute(l) ? (c.classList.add(i), d.style.height = "0px", d.style.overflow = "hidden") : (d.style.height = `${d.children[0].offsetHeight}px`, c.classList.remove(i)), c.removeEventListener("click", this.#i), c.addEventListener("click", this.#i), r) {
|
|
3350
|
+
const u = (h) => {
|
|
3351
|
+
h.stopPropagation();
|
|
3352
|
+
};
|
|
3353
|
+
d.removeEventListener("click", u), d.addEventListener("click", u);
|
|
3354
|
+
}
|
|
3355
|
+
}
|
|
3356
|
+
#i() {
|
|
3357
|
+
const { instance: t, defaultOptions: e } = this.collapse, { collapseClass: i, block: n, target: o, single: a } = e, r = this;
|
|
3358
|
+
r.classList.contains(i) ? (a && r.parentNode.querySelectorAll(`.${r.classList[0]}`).forEach((l) => {
|
|
3359
|
+
ut(l);
|
|
3360
|
+
}), re(r)) : ut(r), t.emit("afterCollapse");
|
|
3434
3361
|
}
|
|
3435
3362
|
update() {
|
|
3436
|
-
|
|
3363
|
+
this.#t();
|
|
3437
3364
|
}
|
|
3438
3365
|
}
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
d(this, De, Is).call(this);
|
|
3445
|
-
}, De = new WeakSet(), Is = function() {
|
|
3446
|
-
const { elements: i, options: t } = this;
|
|
3447
|
-
i.forEach((e) => {
|
|
3448
|
-
e.collapse = {}, e.collapse.instance = this, e.collapse.defaultOptions = t, e.collapse.methods = {}, e.collapse.methods.update = this.update, e.setAttribute(this.active, ""), d(this, xe, Ms).call(this, e);
|
|
3449
|
-
}), this.emit("init");
|
|
3450
|
-
}, xe = new WeakSet(), Ms = function(i) {
|
|
3451
|
-
const { options: t } = this, { collapseClass: e, block: s, target: o, defaultOpen: a, targetStopPropagation: r, defaultActiveMark: l } = t, c = i, u = c.querySelector(o);
|
|
3452
|
-
if (c.collapse.height = u.children[0].offsetHeight, a ? (u.style.height = `${u.children[0].offsetHeight}px`, c.classList.remove(e)) : !c.classList.contains(l) && !c.hasAttribute(l) ? (c.classList.add(e), u.style.height = "0px", u.style.overflow = "hidden") : (u.style.height = `${u.children[0].offsetHeight}px`, c.classList.remove(e)), c.removeEventListener("click", d(this, mt, Qe)), c.addEventListener("click", d(this, mt, Qe)), r) {
|
|
3453
|
-
const h = (g) => {
|
|
3454
|
-
g.stopPropagation();
|
|
3455
|
-
};
|
|
3456
|
-
u.removeEventListener("click", h), u.addEventListener("click", h);
|
|
3457
|
-
}
|
|
3458
|
-
}, mt = new WeakSet(), Qe = function() {
|
|
3459
|
-
const { instance: i, defaultOptions: t } = this.collapse, { collapseClass: e, block: s, target: o, single: a } = t, r = this;
|
|
3460
|
-
r.classList.contains(e) ? (a && r.parentNode.querySelectorAll(`.${r.classList[0]}`).forEach((l) => {
|
|
3461
|
-
ui(l);
|
|
3462
|
-
}), yn(r)) : ui(r), i.emit("afterCollapse");
|
|
3463
|
-
};
|
|
3464
|
-
Object.assign(wn.prototype, z);
|
|
3465
|
-
function Tn(n, i) {
|
|
3466
|
-
const t = i, { color: e, opacity: s, duration: o } = i.s.options;
|
|
3467
|
-
let a = document.createElement("span"), r = n.clientX - t.getBoundingClientRect().left, l = n.clientY - t.getBoundingClientRect().top;
|
|
3468
|
-
a.style.cssText = `background: ${e};left: ${r}px;top: ${l}px;opacity: ${s};animation-duration: ${o}ms`, a.classList.add("circle"), t.appendChild(a), setTimeout(function() {
|
|
3366
|
+
Object.assign(le.prototype, N);
|
|
3367
|
+
function ce(s, t) {
|
|
3368
|
+
const e = t, { color: i, opacity: n, duration: o } = t.s.options;
|
|
3369
|
+
let a = document.createElement("span"), r = s.clientX - e.getBoundingClientRect().left, l = s.clientY - e.getBoundingClientRect().top;
|
|
3370
|
+
a.style.cssText = `background: ${i};left: ${r}px;top: ${l}px;opacity: ${n};animation-duration: ${o}ms`, a.classList.add("circle"), e.appendChild(a), setTimeout(function() {
|
|
3469
3371
|
a.remove();
|
|
3470
3372
|
}, `${o}`);
|
|
3471
3373
|
}
|
|
3472
|
-
function
|
|
3473
|
-
document.querySelectorAll("ripple-btn").forEach((
|
|
3474
|
-
|
|
3374
|
+
function xt() {
|
|
3375
|
+
document.querySelectorAll("ripple-btn").forEach((s) => {
|
|
3376
|
+
s.querySelector(".hover-ball"), s.style.setProperty("--r", ""), s.classList.remove("entered");
|
|
3475
3377
|
});
|
|
3476
3378
|
}
|
|
3477
|
-
document.addEventListener("click",
|
|
3478
|
-
|
|
3479
|
-
class En extends HTMLElement {
|
|
3379
|
+
document.addEventListener("click", xt);
|
|
3380
|
+
class de extends HTMLElement {
|
|
3480
3381
|
constructor() {
|
|
3481
|
-
super();
|
|
3482
|
-
p(this, gt);
|
|
3483
|
-
p(this, ke);
|
|
3484
|
-
p(this, $e);
|
|
3485
|
-
p(this, Ce);
|
|
3486
|
-
this.initialize = !1;
|
|
3382
|
+
super(), this.initialize = !1;
|
|
3487
3383
|
}
|
|
3488
3384
|
connectedCallback() {
|
|
3489
3385
|
const t = this;
|
|
3490
|
-
t.initialize || t.classList.contains("r4-initialize") || (t.initialize = !0,
|
|
3386
|
+
t.initialize || t.classList.contains("r4-initialize") || (t.initialize = !0, this.#t());
|
|
3387
|
+
}
|
|
3388
|
+
#t() {
|
|
3389
|
+
const { SETTINGS: t } = vt;
|
|
3390
|
+
this.s = {};
|
|
3391
|
+
function e(n) {
|
|
3392
|
+
let o = !!n;
|
|
3393
|
+
return o = n === "true", o;
|
|
3394
|
+
}
|
|
3395
|
+
const i = {
|
|
3396
|
+
color: this.getAttribute("r4-color") || t.color,
|
|
3397
|
+
opacity: this.getAttribute("r4-opacity") || t.opacity,
|
|
3398
|
+
duration: Number(this.getAttribute("r4-duration")) || t.duration,
|
|
3399
|
+
speed: Number(this.getAttribute("r4-speed")) || t.speed,
|
|
3400
|
+
hover: this.getAttribute("r4-hover") ? e(this.getAttribute("r4-hover")) : t.hover,
|
|
3401
|
+
click: this.getAttribute("r4-hover-click") ? e(this.getAttribute("r4-hover-click")) : t.click
|
|
3402
|
+
};
|
|
3403
|
+
this.s.options = i, this.s.options.hover && this.classList.add("hover-btn"), this.#s();
|
|
3404
|
+
}
|
|
3405
|
+
#s() {
|
|
3406
|
+
this.#e(), this.#i(), this.classList.add("r4-initialize");
|
|
3407
|
+
}
|
|
3408
|
+
#e() {
|
|
3409
|
+
const t = this, e = document.createElement("i");
|
|
3410
|
+
e.classList.add("hover-ball"), e.style.transitionDuration = `${t.s.options.speed}ms`, t.appendChild(e);
|
|
3411
|
+
}
|
|
3412
|
+
#i() {
|
|
3413
|
+
const t = this.querySelector("i.hover-ball"), e = this;
|
|
3414
|
+
e.addEventListener("click", function(o) {
|
|
3415
|
+
o.stopPropagation(), e.s.options.click && ce(o, e);
|
|
3416
|
+
});
|
|
3417
|
+
let i = "ontouchstart" in document.documentElement ? "touchstart" : "mouseenter", n = "ontouchend" in document.documentElement ? "touchend" : "mouseleave";
|
|
3418
|
+
e.addEventListener(i, function(o) {
|
|
3419
|
+
if (i === "touchstart" && xt(), e.s.options.hover) {
|
|
3420
|
+
const a = Math.round(i === "mouseenter" ? o.clientX - e.getBoundingClientRect().left : o.changedTouches[0].clientX - e.getBoundingClientRect().x), r = Math.round(i === "mouseenter" ? o.clientY - e.getBoundingClientRect().top : o.changedTouches[0].clientY - e.getBoundingClientRect().y), { offsetWidth: l, offsetHeight: c } = e, d = Math.max(l, c);
|
|
3421
|
+
t.style.width = d * 2 + "px", t.style.height = d * 2 + "px", t.style.left = a + "px", t.style.top = r + "px", e.classList.add("entered");
|
|
3422
|
+
}
|
|
3423
|
+
}), e.addEventListener(n, function(o) {
|
|
3424
|
+
if (n !== "touchend" && e.s.options.hover) {
|
|
3425
|
+
const a = Math.round(n === "mouseleave" ? o.clientX - e.getBoundingClientRect().left : o.changedTouches[0].clientX - e.getBoundingClientRect().x), r = Math.round(n === "mouseleave" ? o.clientY - e.getBoundingClientRect().top : o.changedTouches[0].clientY - e.getBoundingClientRect().y);
|
|
3426
|
+
t.style.width = "1px", t.style.height = "1px", e.style.setProperty("--r", ""), t.style.left = a + "px", t.style.top = r + "px", e.classList.remove("entered");
|
|
3427
|
+
}
|
|
3428
|
+
});
|
|
3491
3429
|
}
|
|
3492
3430
|
update() {
|
|
3493
|
-
this.classList.remove("r4-initialize"), this.querySelector("i.hover-ball").remove(),
|
|
3431
|
+
this.classList.remove("r4-initialize"), this.querySelector("i.hover-ball").remove(), this.#t();
|
|
3494
3432
|
}
|
|
3495
3433
|
}
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
this.s = {};
|
|
3499
|
-
function e(o) {
|
|
3500
|
-
let a = !!o;
|
|
3501
|
-
return a = o === "true", a;
|
|
3502
|
-
}
|
|
3503
|
-
const s = {
|
|
3504
|
-
color: this.getAttribute("r4-color") || t.color,
|
|
3505
|
-
opacity: this.getAttribute("r4-opacity") || t.opacity,
|
|
3506
|
-
duration: Number(this.getAttribute("r4-duration")) || t.duration,
|
|
3507
|
-
speed: Number(this.getAttribute("r4-speed")) || t.speed,
|
|
3508
|
-
hover: this.getAttribute("r4-hover") ? e(this.getAttribute("r4-hover")) : t.hover,
|
|
3509
|
-
click: this.getAttribute("r4-hover-click") ? e(this.getAttribute("r4-hover-click")) : t.click
|
|
3510
|
-
};
|
|
3511
|
-
this.s.options = s, this.s.options.hover && this.classList.add("hover-btn"), d(this, ke, Os).call(this);
|
|
3512
|
-
}, ke = new WeakSet(), Os = function() {
|
|
3513
|
-
d(this, $e, Ps).call(this), d(this, Ce, Ns).call(this), this.classList.add("r4-initialize");
|
|
3514
|
-
}, $e = new WeakSet(), Ps = function() {
|
|
3515
|
-
const t = this, e = document.createElement("i");
|
|
3516
|
-
e.classList.add("hover-ball"), e.style.transitionDuration = `${t.s.options.speed}ms`, t.appendChild(e);
|
|
3517
|
-
}, Ce = new WeakSet(), Ns = function() {
|
|
3518
|
-
const t = this.querySelector("i.hover-ball"), e = this;
|
|
3519
|
-
e.addEventListener("click", function(a) {
|
|
3520
|
-
a.stopPropagation(), e.s.options.click && Tn(a, e);
|
|
3521
|
-
});
|
|
3522
|
-
let s = "ontouchstart" in document.documentElement ? "touchstart" : "mouseenter", o = "ontouchend" in document.documentElement ? "touchend" : "mouseleave";
|
|
3523
|
-
e.addEventListener(s, function(a) {
|
|
3524
|
-
if (s === "touchstart" && qs(), e.s.options.hover) {
|
|
3525
|
-
const r = Math.round(s === "mouseenter" ? a.clientX - e.getBoundingClientRect().left : a.changedTouches[0].clientX - e.getBoundingClientRect().x), l = Math.round(s === "mouseenter" ? a.clientY - e.getBoundingClientRect().top : a.changedTouches[0].clientY - e.getBoundingClientRect().y), { offsetWidth: c, offsetHeight: u } = e, h = Math.max(c, u);
|
|
3526
|
-
t.style.width = h * 2 + "px", t.style.height = h * 2 + "px", t.style.left = r + "px", t.style.top = l + "px", e.classList.add("entered");
|
|
3527
|
-
}
|
|
3528
|
-
}), e.addEventListener(o, function(a) {
|
|
3529
|
-
if (o !== "touchend" && e.s.options.hover) {
|
|
3530
|
-
const r = Math.round(o === "mouseleave" ? a.clientX - e.getBoundingClientRect().left : a.changedTouches[0].clientX - e.getBoundingClientRect().x), l = Math.round(o === "mouseleave" ? a.clientY - e.getBoundingClientRect().top : a.changedTouches[0].clientY - e.getBoundingClientRect().y);
|
|
3531
|
-
t.style.width = "1px", t.style.height = "1px", e.style.setProperty("--r", ""), t.style.left = r + "px", t.style.top = l + "px", e.classList.remove("entered");
|
|
3532
|
-
}
|
|
3533
|
-
});
|
|
3534
|
-
};
|
|
3535
|
-
customElements.define("ripple-btn", En);
|
|
3536
|
-
class An {
|
|
3434
|
+
customElements.define("ripple-btn", de);
|
|
3435
|
+
class ue {
|
|
3537
3436
|
constructor() {
|
|
3538
3437
|
this.init();
|
|
3539
3438
|
}
|
|
3540
3439
|
init() {
|
|
3541
|
-
const
|
|
3542
|
-
const r = document.createElement("div"), l = document.createElement("span"), c = document.createElement("span"),
|
|
3440
|
+
const t = document.querySelectorAll("*:not([video-id]) > img"), e = (o, a) => {
|
|
3441
|
+
const r = document.createElement("div"), l = document.createElement("span"), c = document.createElement("span"), d = Math.sqrt(o ** 2 + a ** 2), u = Math.asin(a / d) * 180 / Math.PI;
|
|
3543
3442
|
return r.className = "no-image", l.className = "slash1", l.style.cssText = `
|
|
3544
|
-
width: ${
|
|
3545
|
-
transform: rotate(${
|
|
3443
|
+
width: ${d}px;
|
|
3444
|
+
transform: rotate(${u}deg);
|
|
3546
3445
|
`, c.className = "slash2", c.style.cssText = `
|
|
3547
|
-
width: ${
|
|
3548
|
-
transform: rotate(${-
|
|
3446
|
+
width: ${d}px;
|
|
3447
|
+
transform: rotate(${-u}deg);
|
|
3549
3448
|
`, r.appendChild(l), r.appendChild(c), r;
|
|
3550
|
-
},
|
|
3551
|
-
for (let o = 0; o <
|
|
3552
|
-
|
|
3553
|
-
|
|
3449
|
+
}, i = document.querySelectorAll(".error-image");
|
|
3450
|
+
for (let o = 0; o < i.length; o++)
|
|
3451
|
+
i[o].remove();
|
|
3452
|
+
t.forEach((o) => {
|
|
3554
3453
|
let a;
|
|
3555
3454
|
const r = o.parentElement.clientWidth, l = o.parentElement.clientHeight;
|
|
3556
3455
|
if (o.classList.contains("lazy") || o.classList.contains("swiper-lazy") ? a = o.getAttribute("data-src") : a = o.getAttribute("src"), a === "") {
|
|
3557
|
-
const c = document.createElement("div"),
|
|
3558
|
-
c.className = "error-image",
|
|
3456
|
+
const c = document.createElement("div"), d = getComputedStyle(o.parentElement).position;
|
|
3457
|
+
c.className = "error-image", d === "static" && (o.parentElement.style.position = "relative"), o.parentElement.appendChild(c), c.style.cssText = `
|
|
3559
3458
|
position: absolute;
|
|
3560
3459
|
top: 50%;
|
|
3561
3460
|
left: 50%;
|
|
@@ -3563,118 +3462,117 @@ class An {
|
|
|
3563
3462
|
height: 100%;
|
|
3564
3463
|
transform: translate(-50%,-50%);
|
|
3565
3464
|
z-index: 1;
|
|
3566
|
-
`, c.appendChild(
|
|
3465
|
+
`, c.appendChild(e(r, l));
|
|
3567
3466
|
}
|
|
3568
3467
|
});
|
|
3569
|
-
function
|
|
3468
|
+
function n() {
|
|
3570
3469
|
const o = document.querySelectorAll(".no-image");
|
|
3571
3470
|
o.length <= 0 || o.forEach((a) => {
|
|
3572
|
-
const r = a.parentElement.clientWidth, l = a.parentElement.clientHeight, c = Math.sqrt(r ** 2 + l ** 2),
|
|
3471
|
+
const r = a.parentElement.clientWidth, l = a.parentElement.clientHeight, c = Math.sqrt(r ** 2 + l ** 2), d = Math.asin(l / c) * 180 / Math.PI;
|
|
3573
3472
|
a.querySelector(".slash1").style.cssText = `
|
|
3574
3473
|
width: ${c}px;
|
|
3575
|
-
transform: rotate(${
|
|
3474
|
+
transform: rotate(${d}deg);
|
|
3576
3475
|
`, a.querySelector(".slash2").style.cssText = `
|
|
3577
3476
|
width: ${c}px;
|
|
3578
|
-
transform: rotate(${-
|
|
3477
|
+
transform: rotate(${-d}deg);
|
|
3579
3478
|
`;
|
|
3580
3479
|
});
|
|
3581
3480
|
}
|
|
3582
|
-
window.addEventListener("resize",
|
|
3481
|
+
window.addEventListener("resize", n);
|
|
3583
3482
|
}
|
|
3584
3483
|
reValidate() {
|
|
3585
3484
|
this.init();
|
|
3586
3485
|
}
|
|
3587
3486
|
}
|
|
3588
|
-
function
|
|
3589
|
-
return
|
|
3590
|
-
Function(
|
|
3591
|
-
} :
|
|
3487
|
+
function pt(s, t) {
|
|
3488
|
+
return s ? function(e, i) {
|
|
3489
|
+
Function(s)(e, i);
|
|
3490
|
+
} : t;
|
|
3592
3491
|
}
|
|
3593
|
-
function
|
|
3594
|
-
const
|
|
3595
|
-
o.querySelector("img") && o.querySelector("img").remove(), o.appendChild(
|
|
3596
|
-
const a =
|
|
3597
|
-
if (
|
|
3598
|
-
const l =
|
|
3599
|
-
|
|
3600
|
-
function(
|
|
3601
|
-
const
|
|
3492
|
+
function pe(s, t, e, i) {
|
|
3493
|
+
const n = t.params, o = s.closest("[data-upload-item]").querySelector("[data-preview]");
|
|
3494
|
+
o.querySelector("img") && o.querySelector("img").remove(), o.appendChild(i.imgElement);
|
|
3495
|
+
const a = s.dataset.group, r = document.querySelector(t.el).dataset.index;
|
|
3496
|
+
if (n.compress) {
|
|
3497
|
+
const l = e.name.substring(e.name.lastIndexOf(".")).replace("."), c = e.name.replace(`.${l}`, "");
|
|
3498
|
+
i.originalCanvas.toBlob(
|
|
3499
|
+
function(d) {
|
|
3500
|
+
const u = new File([d], `${c}`, { type: e.type });
|
|
3602
3501
|
uploadImage[`${a}`][r] = {
|
|
3603
|
-
file:
|
|
3604
|
-
info:
|
|
3605
|
-
},
|
|
3502
|
+
file: u,
|
|
3503
|
+
info: i
|
|
3504
|
+
}, n.on.changeAfter && typeof n.on.changeAfter == "function" && n.on.changeAfter(s, i);
|
|
3606
3505
|
},
|
|
3607
|
-
|
|
3608
|
-
|
|
3506
|
+
e.type,
|
|
3507
|
+
n.compress
|
|
3609
3508
|
);
|
|
3610
3509
|
} else
|
|
3611
3510
|
uploadImage[`${a}`][r] = {
|
|
3612
|
-
file:
|
|
3613
|
-
info:
|
|
3614
|
-
},
|
|
3511
|
+
file: e,
|
|
3512
|
+
info: i
|
|
3513
|
+
}, n.on.changeAfter && typeof n.on.changeAfter == "function" && n.on.changeAfter(s, i);
|
|
3615
3514
|
}
|
|
3616
|
-
function
|
|
3617
|
-
const
|
|
3618
|
-
let
|
|
3619
|
-
switch (
|
|
3515
|
+
function he(s, t, e, i) {
|
|
3516
|
+
const n = document.createElement("canvas"), o = n.getContext("2d"), a = t.width, l = t.height / a * 100, c = i / e * 100;
|
|
3517
|
+
let d = 0, u = 0;
|
|
3518
|
+
switch (n.width = e, n.height = i, s.previewSize) {
|
|
3620
3519
|
case "contain":
|
|
3621
|
-
l < c ? (
|
|
3520
|
+
l < c ? (d = n.width, u = e * l / 100) : l > c ? (d = i / l * 100, u = n.height) : (d = n.width, u = n.height);
|
|
3622
3521
|
break;
|
|
3623
3522
|
case "cover":
|
|
3624
|
-
l < c ? (
|
|
3523
|
+
l < c ? (d = i / l * 100, u = n.height) : l > c ? (d = n.width, u = e * l / 100) : l === c && (d = n.width, u = n.height);
|
|
3625
3524
|
break;
|
|
3626
3525
|
}
|
|
3627
|
-
const
|
|
3628
|
-
return o.drawImage(
|
|
3526
|
+
const h = (n.width - d) * 0.5, p = (n.height - u) * 0.5;
|
|
3527
|
+
return o.drawImage(t, h, p, d, u), n;
|
|
3629
3528
|
}
|
|
3630
|
-
function
|
|
3631
|
-
return new Promise((
|
|
3632
|
-
if (
|
|
3633
|
-
const
|
|
3634
|
-
|
|
3529
|
+
function me(s, t) {
|
|
3530
|
+
return new Promise((e, i) => {
|
|
3531
|
+
if (t) {
|
|
3532
|
+
const n = new Image();
|
|
3533
|
+
n.src = t, n.classList.add(s.previewSize), n.onload = () => {
|
|
3635
3534
|
let o = {
|
|
3636
|
-
imgElement:
|
|
3637
|
-
originalCanvas:
|
|
3535
|
+
imgElement: n,
|
|
3536
|
+
originalCanvas: he(s, n, n.width, n.height),
|
|
3638
3537
|
info: {
|
|
3639
|
-
originalWidth:
|
|
3640
|
-
originalHeight:
|
|
3641
|
-
ratio:
|
|
3538
|
+
originalWidth: n.width,
|
|
3539
|
+
originalHeight: n.height,
|
|
3540
|
+
ratio: n.height / n.width * 100 + "%"
|
|
3642
3541
|
}
|
|
3643
3542
|
};
|
|
3644
|
-
|
|
3543
|
+
e(o);
|
|
3645
3544
|
};
|
|
3646
3545
|
} else
|
|
3647
|
-
|
|
3546
|
+
e();
|
|
3648
3547
|
});
|
|
3649
3548
|
}
|
|
3650
|
-
function
|
|
3651
|
-
const
|
|
3652
|
-
return Math.round(
|
|
3549
|
+
function ge(s, t) {
|
|
3550
|
+
const e = Math.pow(10, t);
|
|
3551
|
+
return Math.round(s * e) / e;
|
|
3653
3552
|
}
|
|
3654
|
-
function
|
|
3655
|
-
let
|
|
3656
|
-
return `${
|
|
3553
|
+
function fe(s, t) {
|
|
3554
|
+
let e = s.size / 1024 / 1024;
|
|
3555
|
+
return `${ge(e, 2)}` <= t;
|
|
3657
3556
|
}
|
|
3658
|
-
function
|
|
3659
|
-
if (
|
|
3660
|
-
|
|
3661
|
-
const e = n.target.files[0], s = i.closest("[data-upload-item]");
|
|
3557
|
+
function ve(s, t, e) {
|
|
3558
|
+
if (s.target.files.length <= 0) return;
|
|
3559
|
+
const i = s.target.files[0], n = t.closest("[data-upload-item]");
|
|
3662
3560
|
let o = new FileReader();
|
|
3663
3561
|
o.onload = (a) => {
|
|
3664
|
-
const r =
|
|
3665
|
-
if (
|
|
3666
|
-
|
|
3562
|
+
const r = i.type.split("/")[0] === "image" ? a.target.result : null;
|
|
3563
|
+
if (e.params.sizeLimit && !fe(i, e.params.sizeLimit)) {
|
|
3564
|
+
t.value = "", n.classList.add("over-limit"), e.params.on.overLimit && typeof e.params.on.overLimit == "function" && e.params.on.overLimit(t, e.params.sizeLimit);
|
|
3667
3565
|
return;
|
|
3668
3566
|
} else
|
|
3669
|
-
|
|
3670
|
-
|
|
3567
|
+
n.classList.remove("over-limit"), n.classList.add("uploaded"), me(e.params, r).then((l) => {
|
|
3568
|
+
pe(t, e, i, l);
|
|
3671
3569
|
});
|
|
3672
|
-
}, o.readAsDataURL(
|
|
3570
|
+
}, o.readAsDataURL(i);
|
|
3673
3571
|
}
|
|
3674
|
-
class
|
|
3675
|
-
constructor(
|
|
3676
|
-
const
|
|
3677
|
-
|
|
3572
|
+
class be {
|
|
3573
|
+
constructor(t, e) {
|
|
3574
|
+
const i = this;
|
|
3575
|
+
i.el = t, i.params = {
|
|
3678
3576
|
on: {
|
|
3679
3577
|
changeAfter: null,
|
|
3680
3578
|
overLimit: null
|
|
@@ -3687,79 +3585,79 @@ class $n {
|
|
|
3687
3585
|
//縮圖形式 (type: String 'contain' || 'cover')
|
|
3688
3586
|
compress: 0.8
|
|
3689
3587
|
//壓縮品質 (type: Number 0~1 || false)
|
|
3690
|
-
}, Object.assign(
|
|
3588
|
+
}, Object.assign(i.params, e), i.init();
|
|
3691
3589
|
}
|
|
3692
3590
|
init() {
|
|
3693
|
-
const
|
|
3694
|
-
|
|
3695
|
-
|
|
3591
|
+
const t = this, e = document.querySelectorAll(`${t.el}:not(.preview-active)`);
|
|
3592
|
+
e.length <= 0 || (window.uploadImage = {}, e.forEach((i, n) => {
|
|
3593
|
+
i.classList.add("preview-active");
|
|
3696
3594
|
const o = {
|
|
3697
|
-
group:
|
|
3698
|
-
sizeLimit: parseInt(
|
|
3699
|
-
previewSize:
|
|
3700
|
-
compress:
|
|
3595
|
+
group: i.dataset.group || t.params.group,
|
|
3596
|
+
sizeLimit: parseInt(i.dataset.limit) || t.params.sizeLimit,
|
|
3597
|
+
previewSize: i.dataset.previewSize || t.params.previewSize,
|
|
3598
|
+
compress: i.dataset.compress || t.params.compress,
|
|
3701
3599
|
on: {
|
|
3702
|
-
changeAfter:
|
|
3703
|
-
overLimit:
|
|
3600
|
+
changeAfter: pt(i.dataset.changeAfter, t.params.on.changeAfter),
|
|
3601
|
+
overLimit: pt(i.dataset.overLimit, t.params.on.overLimit)
|
|
3704
3602
|
}
|
|
3705
3603
|
};
|
|
3706
|
-
|
|
3707
|
-
|
|
3604
|
+
t.params = o, typeof uploadImage[`${o.group}`] > "u" && (uploadImage[`${o.group}`] = []), i.dataset.group || (i.dataset.group = o.group), i.dataset.index = document.querySelectorAll(`[data-group="${o.group}"]`).length - 1, i.addEventListener("change", function(a) {
|
|
3605
|
+
ve(a, i, t);
|
|
3708
3606
|
});
|
|
3709
3607
|
}));
|
|
3710
3608
|
}
|
|
3711
3609
|
}
|
|
3712
3610
|
export {
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3611
|
+
bt as A,
|
|
3612
|
+
T as B,
|
|
3613
|
+
le as C,
|
|
3614
|
+
Dt as D,
|
|
3615
|
+
X as E,
|
|
3616
|
+
R as F,
|
|
3617
|
+
Ue as G,
|
|
3618
|
+
Fe as H,
|
|
3619
|
+
be as I,
|
|
3620
|
+
$e as J,
|
|
3621
|
+
De as K,
|
|
3622
|
+
Ye as L,
|
|
3623
|
+
ie as M,
|
|
3624
|
+
Lt as N,
|
|
3625
|
+
_t as O,
|
|
3626
|
+
It as P,
|
|
3627
|
+
Oe as Q,
|
|
3628
|
+
de as R,
|
|
3629
|
+
Xe as S,
|
|
3630
|
+
$t as T,
|
|
3631
|
+
xe as U,
|
|
3632
|
+
Pe as V,
|
|
3633
|
+
W,
|
|
3634
|
+
Z as X,
|
|
3635
|
+
Be as Y,
|
|
3636
|
+
At as a,
|
|
3637
|
+
ue as b,
|
|
3638
|
+
C as c,
|
|
3639
|
+
oe as d,
|
|
3640
|
+
Xt as e,
|
|
3641
|
+
He as f,
|
|
3642
|
+
qt as g,
|
|
3643
|
+
Ce as h,
|
|
3644
|
+
Me as i,
|
|
3645
|
+
qe as j,
|
|
3646
|
+
_e as k,
|
|
3647
|
+
Ne as l,
|
|
3648
|
+
Mt as m,
|
|
3649
|
+
Ut as n,
|
|
3650
|
+
je as o,
|
|
3651
|
+
Ie as p,
|
|
3652
|
+
ze as q,
|
|
3653
|
+
We as r,
|
|
3654
|
+
S as s,
|
|
3655
|
+
Ge as t,
|
|
3656
|
+
Re as u,
|
|
3657
|
+
Je as v,
|
|
3658
|
+
Ze as w,
|
|
3659
|
+
Qe as x,
|
|
3660
|
+
ke as y,
|
|
3661
|
+
E as z
|
|
3764
3662
|
};
|
|
3765
3663
|
//# sourceMappingURL=image-preview-bundle.js.map
|