@total_onion/onion-modalcontroller 1.0.12 → 1.0.15
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/onion-modalcontroller.js +20 -45
- package/package.json +1 -1
package/onion-modalcontroller.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import lazyloaderV3 from "@total_onion/onion-loader/onion-loader";
|
|
2
|
-
|
|
3
1
|
export default class modalController {
|
|
4
2
|
constructor() {
|
|
5
3
|
let defaultGlobalSettings = {
|
|
@@ -70,50 +68,21 @@ export default class modalController {
|
|
|
70
68
|
if (!popupContent) {
|
|
71
69
|
return;
|
|
72
70
|
}
|
|
73
|
-
|
|
74
|
-
const modalPopupContent = document
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
|
|
72
|
+
const modalPopupContent = document.querySelector(
|
|
73
|
+
`[data-modalpopupcontent=${triggerName}]`
|
|
74
|
+
);
|
|
77
75
|
|
|
78
76
|
if (modalPopupContent) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
if (
|
|
78
|
+
!popupContent.querySelector(`[data-modalpopupcontent=${triggerName}]`)
|
|
79
|
+
) {
|
|
80
|
+
popupContent.appendChild(modalPopupContent);
|
|
81
|
+
}
|
|
83
82
|
modalPopupContent.classList.add("active");
|
|
84
|
-
const sections = popupContent.querySelectorAll(["data-assetkey"]);
|
|
85
|
-
sections.forEach((section) => {
|
|
86
|
-
section.classList.remove("loaded");
|
|
87
|
-
});
|
|
88
83
|
requestAnimationFrame(() => {
|
|
89
84
|
modalPopup.classList.add("open");
|
|
90
85
|
document.documentElement.classList.add("lock-position");
|
|
91
|
-
lazyloaderV3.options.assetArray = [
|
|
92
|
-
{ assetKey: "wysiwyg-text-content" },
|
|
93
|
-
{ assetKey: "modal-form-v3" },
|
|
94
|
-
{ assetKey: "video-content-v3" },
|
|
95
|
-
{ assetKey: "theme-switcher" },
|
|
96
|
-
{ assetKey: "sub-group-container-v3" },
|
|
97
|
-
{ assetKey: "standard-content-v3" },
|
|
98
|
-
{ assetKey: "spacer-v3" },
|
|
99
|
-
{ assetKey: "social-networks-v3" },
|
|
100
|
-
{ assetKey: "raw-html" },
|
|
101
|
-
{ assetKey: "product-info-v3" },
|
|
102
|
-
{ assetKey: "post-info-v3" },
|
|
103
|
-
{ assetKey: "market-selector-v3" },
|
|
104
|
-
{ assetKey: "lottie-content-v3" },
|
|
105
|
-
{ assetKey: "group-container-v3" },
|
|
106
|
-
{ assetKey: "gradient-layer-v3" },
|
|
107
|
-
{ assetKey: "form-selection-v3" },
|
|
108
|
-
{ assetKey: "divider-v3" },
|
|
109
|
-
{ assetKey: "cover-link-v3" },
|
|
110
|
-
{ assetKey: "carousel-multi-layout-v3" },
|
|
111
|
-
{ assetKey: "block-interactions-v3" },
|
|
112
|
-
{ assetKey: "betterreviews-display-v3" },
|
|
113
|
-
{ assetKey: "accordion-v3" },
|
|
114
|
-
{ assetKey: "accent-image-v3" },
|
|
115
|
-
];
|
|
116
|
-
lazyloaderV3.lazyloaderInit();
|
|
117
86
|
});
|
|
118
87
|
this.handleCloseButtonClicks();
|
|
119
88
|
} else {
|
|
@@ -126,11 +95,17 @@ export default class modalController {
|
|
|
126
95
|
const popupContent = modalPopup.querySelector(
|
|
127
96
|
".modal-controller-popup__content"
|
|
128
97
|
);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
98
|
+
|
|
99
|
+
if (popupContent) {
|
|
100
|
+
const activeContents = popupContent.querySelectorAll(
|
|
101
|
+
"[data-modalpopupcontent].active"
|
|
102
|
+
);
|
|
103
|
+
activeContents.forEach((activeContent) => {
|
|
104
|
+
setTimeout(() => {
|
|
105
|
+
activeContent.classList.remove("active");
|
|
106
|
+
}, 300);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
134
109
|
}
|
|
135
110
|
closePopupOnClickOutside(event, modalPopup) {
|
|
136
111
|
if (event.target === modalPopup) {
|