PluginProbe
Elementor Website Builder – more than just a page builder / 3.24.7
Elementor Website Builder – more than just a page builder v3.24.7
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / assets / js / wc-product-editor.js

wc-product-editor.js in Elementor Website Builder – more than just a page builder 3.24.7, at assets/js/wc-product-editor.js

81 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /*! elementor - v3.24.0 - 15-10-2024 */
2 /******/ (() => { // webpackBootstrap
3 /******/ "use strict";
4 var __webpack_exports__ = {};
5 /*!***************************************************!*\
6 !*** ../assets/dev/js/admin/wc-product-editor.js ***!
7 \***************************************************/
8
9
10 function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
11 function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12 function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
13 (function () {
14 var WcProductEditor = {
15 init: function init() {
16 this.getDefaultSettings();
17 this.wcNewProductEditorSwitchButton();
18 },
19 getDefaultSettings: function getDefaultSettings() {
20 this.selectors = {
21 wcProductHeaderInner: '.woocommerce-product-header__inner',
22 buttonTemplate: '#elementor-woocommerce-new-editor-button',
23 wcLoader: '.woocommerce-product-header[role="region"]',
24 wcEditButton: '.woocommerce-product-header__inner #elementor-editor-button',
25 body: 'body'
26 };
27 },
28 wcNewProductEditorSwitchButton: function wcNewProductEditorSwitchButton() {
29 var body = document.querySelector(this.selectors.body),
30 that = this;
31 if (!body) {
32 return;
33 }
34 var observer = new MutationObserver(function (mutationsList) {
35 var _iterator = _createForOfIteratorHelper(mutationsList),
36 _step;
37 try {
38 for (_iterator.s(); !(_step = _iterator.n()).done;) {
39 var mutation = _step.value;
40 if ('childList' === mutation.type) {
41 if (mutation.addedNodes.length > 0) {
42 if (that.isWcProductEditorLoading() && !that.isElementorButtonInjected()) {
43 that.injectElementorButton();
44 observer.disconnect();
45 }
46 }
47 }
48 }
49 } catch (err) {
50 _iterator.e(err);
51 } finally {
52 _iterator.f();
53 }
54 });
55 observer.observe(body, {
56 childList: true,
57 subtree: true
58 });
59 },
60 injectElementorButton: function injectElementorButton() {
61 var wcProductHeaderInner = document.querySelector(this.selectors.wcProductHeaderInner);
62 if (wcProductHeaderInner) {
63 var buttonTemplate = document.querySelector(this.selectors.buttonTemplate),
64 tempDiv = document.createElement('div');
65 tempDiv.innerHTML = buttonTemplate.innerHTML;
66 var button = tempDiv.firstElementChild;
67 wcProductHeaderInner.firstChild.append(button);
68 }
69 },
70 isWcProductEditorLoading: function isWcProductEditorLoading() {
71 return !!document.querySelector(this.selectors.wcLoader);
72 },
73 isElementorButtonInjected: function isElementorButtonInjected() {
74 return !!document.querySelector(this.selectors.wcEditButton);
75 }
76 };
77 WcProductEditor.init();
78 })();
79 /******/ })()
80 ;
81 //# sourceMappingURL=wc-product-editor.js.map