1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
3 | typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
4 | (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.htwoo = global.htwoo || {}, global.htwoo.dialog = {})));
|
5 | }(this, (function (exports) { 'use strict';
|
6 |
|
7 | let showDialog, closeDialog;
|
8 |
|
9 | const evtShowDialog = (event) => {
|
10 |
|
11 | let curElement = event.target;
|
12 |
|
13 | let modalDialog = curElement.parentElement.querySelector('.hoo-mdldialog-outer');
|
14 | modalDialog.classList.remove('is-hidden');
|
15 | modalDialog.classList.add('is-visible');
|
16 |
|
17 | };
|
18 |
|
19 | const evtHideDialog = (event) => {
|
20 |
|
21 | let curElement = event.target;
|
22 |
|
23 | let modalDialog = curElement.closest('.hoo-mdldialog-outer');
|
24 |
|
25 | modalDialog.classList.remove('is-visible');
|
26 | modalDialog.classList.add('is-hidden');
|
27 |
|
28 | };
|
29 |
|
30 | const registerDialog = () => {
|
31 |
|
32 | showDialog = document.querySelectorAll('.show-dialog');
|
33 | closeDialog = document.querySelectorAll('.hoo-dlgheader-closer');
|
34 |
|
35 | if (showDialog) {
|
36 |
|
37 | showDialog.forEach(item => {
|
38 | item.addEventListener('click', evtShowDialog);
|
39 | });
|
40 |
|
41 | }
|
42 |
|
43 | if (closeDialog) {
|
44 |
|
45 | closeDialog.forEach(item => {
|
46 | item.addEventListener('click', evtHideDialog);
|
47 | });
|
48 | }
|
49 |
|
50 | };
|
51 |
|
52 | exports.registerDialog = registerDialog;
|
53 |
|
54 | Object.defineProperty(exports, '__esModule', { value: true });
|
55 |
|
56 | })));
|