forked from smartcloudsol/gatey
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobserver.js
More file actions
30 lines (28 loc) · 1.49 KB
/
observer.js
File metadata and controls
30 lines (28 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(function () {
const mountAuthenticator = (el) => {
if (!el?.id || jQuery(el).data("rendered")) return;
jQuery(document).trigger("gatey-authenticator-block", el.id);
jQuery(el).data("rendered", "true");
};
const mountAccountAttribute = (el) => {
if (!el?.id || jQuery(el).data("rendered")) return;
jQuery(document).trigger("gatey-account-attribute-block", el.id);
jQuery(el).data("rendered", "true");
};
jQuery(() => jQuery('[gatey-authenticator]').each((_idx, n) => mountAuthenticator(n)));
jQuery(() => jQuery('[gatey-account-attribute]').each((_idx, n) => mountAccountAttribute(n)));
jQuery(window).on("elementor/frontend/init", function () {
if (elementorFrontend?.hooks) {
elementorFrontend.hooks.addAction("frontend/element_ready/shortcode.default", () => {
jQuery('[gatey-authenticator]').each((_idx, n) => mountAuthenticator(n));
jQuery('[gatey-account-attribute]').each((_idx, n) => mountAccountAttribute(n));
});
elementorFrontend.hooks.addAction("frontend/element_ready/gatey_authenticator.default", () => {
jQuery('[gatey-authenticator]').each((_idx, n) => mountAuthenticator(n));
});
elementorFrontend.hooks.addAction("frontend/element_ready/gatey_account_attribute.default", () => {
jQuery('[gatey-account-attribute]').each((_idx, n) => mountAccountAttribute(n));
});
}
});
})();