PluginProbe
Elementor Website Builder – more than just a page builder / 3.0.4
Elementor Website Builder – more than just a page builder v3.0.4
4.3.1 4.3.0 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 All 454 releases
← All changes | assets/js/new-template.js +173 -290 4.3.0 → 3.0.4 View file →
@@ -1,303 +1,186 @@
1 -(function(_wordpress_i18n) {
1 +/*! elementor - v3.0.4 - 30-08-2020 */
2 +/******/ (function(modules) { // webpackBootstrap
3 +/******/ // The module cache
4 +/******/ var installedModules = {};
5 +/******/
6 +/******/ // The require function
7 +/******/ function __webpack_require__(moduleId) {
8 +/******/
9 +/******/ // Check if module is in cache
10 +/******/ if(installedModules[moduleId]) {
11 +/******/ return installedModules[moduleId].exports;
12 +/******/ }
13 +/******/ // Create a new module (and put it into the cache)
14 +/******/ var module = installedModules[moduleId] = {
15 +/******/ i: moduleId,
16 +/******/ l: false,
17 +/******/ exports: {}
18 +/******/ };
19 +/******/
20 +/******/ // Execute the module function
21 +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22 +/******/
23 +/******/ // Flag the module as loaded
24 +/******/ module.l = true;
25 +/******/
26 +/******/ // Return the exports of the module
27 +/******/ return module.exports;
28 +/******/ }
29 +/******/
30 +/******/
31 +/******/ // expose the modules object (__webpack_modules__)
32 +/******/ __webpack_require__.m = modules;
33 +/******/
34 +/******/ // expose the module cache
35 +/******/ __webpack_require__.c = installedModules;
36 +/******/
37 +/******/ // define getter function for harmony exports
38 +/******/ __webpack_require__.d = function(exports, name, getter) {
39 +/******/ if(!__webpack_require__.o(exports, name)) {
40 +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41 +/******/ }
42 +/******/ };
43 +/******/
44 +/******/ // define __esModule on exports
45 +/******/ __webpack_require__.r = function(exports) {
46 +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47 +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48 +/******/ }
49 +/******/ Object.defineProperty(exports, '__esModule', { value: true });
50 +/******/ };
51 +/******/
52 +/******/ // create a fake namespace object
53 +/******/ // mode & 1: value is a module id, require it
54 +/******/ // mode & 2: merge all properties of value into the ns
55 +/******/ // mode & 4: return value when already ns object
56 +/******/ // mode & 8|1: behave like require
57 +/******/ __webpack_require__.t = function(value, mode) {
58 +/******/ if(mode & 1) value = __webpack_require__(value);
59 +/******/ if(mode & 8) return value;
60 +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61 +/******/ var ns = Object.create(null);
62 +/******/ __webpack_require__.r(ns);
63 +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64 +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65 +/******/ return ns;
66 +/******/ };
67 +/******/
68 +/******/ // getDefaultExport function for compatibility with non-harmony modules
69 +/******/ __webpack_require__.n = function(module) {
70 +/******/ var getter = module && module.__esModule ?
71 +/******/ function getDefault() { return module['default']; } :
72 +/******/ function getModuleExports() { return module; };
73 +/******/ __webpack_require__.d(getter, 'a', getter);
74 +/******/ return getter;
75 +/******/ };
76 +/******/
77 +/******/ // Object.prototype.hasOwnProperty.call
78 +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79 +/******/
80 +/******/ // __webpack_public_path__
81 +/******/ __webpack_require__.p = "";
82 +/******/
83 +/******/
84 +/******/ // Load entry module and return exports
85 +/******/ return __webpack_require__(__webpack_require__.s = 741);
86 +/******/ })
87 +/************************************************************************/
88 +/******/ ({
2 89
3 -//#region \0rolldown/runtime.js
4 - var __defProp = Object.defineProperty;
5 - var __name = (target, value) => __defProp(target, "name", {
6 - value,
7 - configurable: true
8 - });
9 - var __esmMin = (fn, res, err) => () => {
10 - if (err) throw err[0];
11 - try {
12 - return fn && (res = fn(fn = 0)), res;
13 - } catch (e) {
14 - throw err = [e], e;
15 - }
16 - };
17 - var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
90 +/***/ 741:
91 +/***/ (function(module, exports, __webpack_require__) {
18 92
19 -//#endregion
93 +"use strict";
20 94
21 -//#region node_modules/@babel/runtime/helpers/esm/classCallCheck.js
22 - function _classCallCheck(a, n) {
23 - if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
24 - }
25 - var init_classCallCheck = __esmMin((() => {}));
26 95
27 -//#endregion
28 -//#region node_modules/@babel/runtime/helpers/esm/typeof.js
29 - function _typeof(o) {
30 - "@babel/helpers - typeof";
31 - return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
32 - return typeof o;
33 - } : function(o) {
34 - return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
35 - }, _typeof(o);
36 - }
37 - var init_typeof = __esmMin((() => {}));
96 +var NewTemplateLayout = __webpack_require__(742);
38 97
39 -//#endregion
40 -//#region node_modules/@babel/runtime/helpers/esm/toPrimitive.js
41 - function toPrimitive(t, r) {
42 - if ("object" != _typeof(t) || !t) return t;
43 - var e = t[Symbol.toPrimitive];
44 - if (void 0 !== e) {
45 - var i = e.call(t, r || "default");
46 - if ("object" != _typeof(i)) return i;
47 - throw new TypeError("@@toPrimitive must return a primitive value.");
48 - }
49 - return ("string" === r ? String : Number)(t);
50 - }
51 - var init_toPrimitive = __esmMin((() => {
52 - init_typeof();
53 - }));
98 +var NewTemplateModule = elementorModules.ViewModule.extend({
99 + getDefaultSettings: function getDefaultSettings() {
100 + return {
101 + selectors: {
102 + addButton: '.page-title-action:first, #elementor-template-library-add-new'
103 + }
104 + };
105 + },
106 + getDefaultElements: function getDefaultElements() {
107 + var selectors = this.getSettings('selectors');
108 + return {
109 + $addButton: jQuery(selectors.addButton)
110 + };
111 + },
112 + bindEvents: function bindEvents() {
113 + this.elements.$addButton.on('click', this.onAddButtonClick);
114 + elementorCommon.elements.$window.on('hashchange', this.showModalByHash.bind(this));
115 + },
116 + showModalByHash: function showModalByHash() {
117 + if ('#add_new' === location.hash) {
118 + this.layout.showModal();
119 + location.hash = '';
120 + }
121 + },
122 + onInit: function onInit() {
123 + elementorModules.ViewModule.prototype.onInit.apply(this, arguments);
124 + this.layout = new NewTemplateLayout();
125 + this.showModalByHash();
126 + },
127 + onAddButtonClick: function onAddButtonClick(event) {
128 + event.preventDefault();
129 + this.layout.showModal();
130 + }
131 +});
132 +jQuery(function () {
133 + window.elementorNewTemplate = new NewTemplateModule();
134 +});
54 135
55 -//#endregion
56 -//#region node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
57 - function toPropertyKey(t) {
58 - var i = toPrimitive(t, "string");
59 - return "symbol" == _typeof(i) ? i : i + "";
60 - }
61 - var init_toPropertyKey = __esmMin((() => {
62 - init_typeof();
63 - init_toPrimitive();
64 - }));
136 +/***/ }),
65 137
66 -//#endregion
67 -//#region node_modules/@babel/runtime/helpers/esm/createClass.js
68 - function _defineProperties(e, r) {
69 - for (var t = 0; t < r.length; t++) {
70 - var o = r[t];
71 - o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
72 - }
73 - }
74 - function _createClass(e, r, t) {
75 - return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
76 - }
77 - var init_createClass = __esmMin((() => {
78 - init_toPropertyKey();
79 - }));
138 +/***/ 742:
139 +/***/ (function(module, exports, __webpack_require__) {
80 140
81 -//#endregion
82 -//#region assets/dev/js/admin/new-template/behaviors/lock-pro.js
83 - var LockPro;
84 - var init_lock_pro = __esmMin((() => {
85 - init_classCallCheck();
86 - init_createClass();
87 - LockPro = /*#__PURE__*/ function() {
88 - function LockPro(elements) {
89 - _classCallCheck(this, LockPro);
90 - this.elements = elements;
91 - }
92 - return _createClass(LockPro, [
93 - {
94 - key: "bindEvents",
95 - value: function bindEvents() {
96 - var _this$elements = this.elements;
97 - var form = _this$elements.form;
98 - var templateType = _this$elements.templateType;
99 - form.addEventListener("submit", this.onFormSubmit.bind(this));
100 - templateType.addEventListener("change", this.onTemplateTypeChange.bind(this));
101 - this.onTemplateTypeChange();
102 - }
103 - },
104 - {
105 - key: "onFormSubmit",
106 - value: function onFormSubmit(e) {
107 - if (this.getCurrentLockOptions().is_locked) e.preventDefault();
108 - }
109 - },
110 - {
111 - key: "onTemplateTypeChange",
112 - value: function onTemplateTypeChange() {
113 - var lockOptions = this.getCurrentLockOptions();
114 - if (lockOptions.is_locked) this.lock(lockOptions);
115 - else this.unlock();
116 - }
117 - },
118 - {
119 - key: "getCurrentLockOptions",
120 - value: function getCurrentLockOptions() {
121 - var templateType = this.elements.templateType;
122 - var currentOption = templateType.options[templateType.selectedIndex];
123 - return JSON.parse(currentOption.dataset.lock || "{}");
124 - }
125 - },
126 - {
127 - key: "lock",
128 - value: function lock(lockOptions) {
129 - this.showLockBadge(lockOptions.badge);
130 - this.showLockButton(lockOptions.button);
131 - this.hideSubmitButton();
132 - }
133 - },
134 - {
135 - key: "unlock",
136 - value: function unlock() {
137 - this.hideLockBadge();
138 - this.hideLockButton();
139 - this.showSubmitButton();
140 - }
141 - },
142 - {
143 - key: "showLockBadge",
144 - value: function showLockBadge(badgeConfig) {
145 - var _this$elements2 = this.elements;
146 - var lockBadge = _this$elements2.lockBadge;
147 - var lockBadgeText = _this$elements2.lockBadgeText;
148 - var lockBadgeIcon = _this$elements2.lockBadgeIcon;
149 - lockBadgeText.innerText = badgeConfig.text;
150 - lockBadgeIcon.className = badgeConfig.icon;
151 - lockBadge.classList.remove("e-hidden");
152 - }
153 - },
154 - {
155 - key: "hideLockBadge",
156 - value: function hideLockBadge() {
157 - this.elements.lockBadge.classList.add("e-hidden");
158 - }
159 - },
160 - {
161 - key: "showLockButton",
162 - value: function showLockButton(buttonConfig) {
163 - var lockButton = this.elements.lockButton;
164 - lockButton.href = this.replaceLockLinkPlaceholders(buttonConfig.url);
165 - lockButton.innerText = buttonConfig.text;
166 - lockButton.classList.remove("e-hidden");
167 - }
168 - },
169 - {
170 - key: "hideLockButton",
171 - value: function hideLockButton() {
172 - this.elements.lockButton.classList.add("e-hidden");
173 - }
174 - },
175 - {
176 - key: "showSubmitButton",
177 - value: function showSubmitButton() {
178 - this.elements.submitButton.classList.remove("e-hidden");
179 - }
180 - },
181 - {
182 - key: "hideSubmitButton",
183 - value: function hideSubmitButton() {
184 - this.elements.submitButton.classList.add("e-hidden");
185 - }
186 - },
187 - {
188 - key: "replaceLockLinkPlaceholders",
189 - value: function replaceLockLinkPlaceholders(link) {
190 - return link.replace(/%%utm_source%%/g, "wp-add-new").replace(/%%utm_medium%%/g, "wp-dash");
191 - }
192 - }
193 - ]);
194 - }();
195 - }));
141 +"use strict";
196 142
197 -//#endregion
198 -//#region assets/dev/js/admin/new-template/view.js
199 - var require_view = /* @__PURE__ */ __commonJSMin(((exports, module) => {
200 - module.exports = Marionette.ItemView.extend({
201 - id: "elementor-new-template-dialog-content",
202 - template: "#tmpl-elementor-new-template",
203 - ui: {},
204 - events: {},
205 - onRender: function onRender() {}
206 - });
207 - }));
208 143
209 -//#endregion
210 -//#region assets/dev/js/admin/new-template/layout.js
211 - var require_layout = /* @__PURE__ */ __commonJSMin(((exports, module) => {
212 - init_lock_pro();
213 - var NewTemplateView = require_view();
214 - module.exports = elementorModules.common.views.modal.Layout.extend({
215 - getModalOptions: function getModalOptions() {
216 - return { id: "elementor-new-template-modal" };
217 - },
218 - getLogoOptions: function getLogoOptions() {
219 - return { title: (0, _wordpress_i18n.__)("New Template", "elementor") };
220 - },
221 - initialize: function initialize() {
222 - elementorModules.common.views.modal.Layout.prototype.initialize.apply(this, arguments);
223 - this.showLogo();
224 - this.showContentView();
225 - this.initElements();
226 - this.lockProBehavior = new LockPro(this.elements);
227 - this.lockProBehavior.bindEvents();
228 - this.setupDynamicControlsVisibility();
229 - },
230 - setupDynamicControlsVisibility: function setupDynamicControlsVisibility() {
231 - if (!("undefined" !== typeof elementor_new_template_form_controls)) return;
232 - var CONTROL_ID_PREFIX = "elementor-new-template__form__";
233 - var templateTypeSelectId = "".concat(CONTROL_ID_PREFIX, "template-type");
234 - var dynamicControlsVisibilityListener = function dynamicControlsVisibilityListener() {
235 - elementorAdmin.templateControls.setDynamicControlsVisibility(CONTROL_ID_PREFIX, elementor_new_template_form_controls);
236 - };
237 - this.getModal().onShow = function() {
238 - dynamicControlsVisibilityListener();
239 - document.getElementById(templateTypeSelectId).addEventListener("change", dynamicControlsVisibilityListener);
240 - };
241 - this.getModal().onHide = function() {
242 - document.getElementById(templateTypeSelectId).removeEventListener("change", dynamicControlsVisibilityListener);
243 - };
244 - },
245 - initElements: function initElements() {
246 - var container = this.$el[0];
247 - var root = "#elementor-new-template__form";
248 - this.elements = {
249 - form: container.querySelector(root),
250 - submitButton: container.querySelector("".concat(root, "__submit")),
251 - lockButton: container.querySelector("".concat(root, "__lock_button")),
252 - templateType: container.querySelector("".concat(root, "__template-type")),
253 - lockBadge: container.querySelector("".concat(root, "__template-type-badge")),
254 - lockBadgeText: container.querySelector("".concat(root, "__template-type-badge__text")),
255 - lockBadgeIcon: container.querySelector("".concat(root, "__template-type-badge__icon"))
256 - };
257 - },
258 - showContentView: function showContentView() {
259 - this.modalContent.show(new NewTemplateView());
260 - }
261 - });
262 - }));
144 +var NewTemplateView = __webpack_require__(743);
263 145
264 -//#endregion
265 -//#region assets/dev/js/admin/new-template/new-template.js
266 - var NewTemplateLayout = require_layout();
267 - var NewTemplateModule = elementorModules.ViewModule.extend({
268 - getDefaultSettings: function getDefaultSettings() {
269 - return { selectors: { addButton: "a.page-title-action[href*=\"post-new.php?post_type=elementor_library\"], #elementor-template-library-add-new" } };
270 - },
271 - getDefaultElements: function getDefaultElements() {
272 - var selectors = this.getSettings("selectors");
273 - return { $addButton: jQuery(selectors.addButton) };
274 - },
275 - bindEvents: function bindEvents() {
276 - this.elements.$addButton.on("click", this.onAddButtonClick);
277 - elementorCommon.elements.$window.on("hashchange", this.showModalByHash.bind(this));
278 - },
279 - showModalByHash: function showModalByHash() {
280 - if ("#add_new" === location.hash) {
281 - var _this$layout;
282 - (_this$layout = this.layout) === null || _this$layout === void 0 || _this$layout.showModal();
283 - location.hash = "";
284 - }
285 - },
286 - onInit: function onInit() {
287 - elementorModules.ViewModule.prototype.onInit.apply(this, arguments);
288 - this.layout = new NewTemplateLayout();
289 - this.showModalByHash();
290 - },
291 - onAddButtonClick: function onAddButtonClick(event) {
292 - var _this$layout2;
293 - event.preventDefault();
294 - (_this$layout2 = this.layout) === null || _this$layout2 === void 0 || _this$layout2.showModal();
295 - }
296 - });
297 - jQuery(function() {
298 - window.elementorNewTemplate = new NewTemplateModule();
299 - });
146 +module.exports = elementorModules.common.views.modal.Layout.extend({
147 + getModalOptions: function getModalOptions() {
148 + return {
149 + id: 'elementor-new-template-modal'
150 + };
151 + },
152 + getLogoOptions: function getLogoOptions() {
153 + return {
154 + title: elementorAdmin.translate('new_template')
155 + };
156 + },
157 + initialize: function initialize() {
158 + elementorModules.common.views.modal.Layout.prototype.initialize.apply(this, arguments);
159 + this.showLogo();
160 + this.showContentView();
161 + },
162 + showContentView: function showContentView() {
163 + this.modalContent.show(new NewTemplateView());
164 + }
165 +});
300 166
301 -//#endregion
302 -})(wp.i18n);
167 +/***/ }),
168 +
169 +/***/ 743:
170 +/***/ (function(module, exports, __webpack_require__) {
171 +
172 +"use strict";
173 +
174 +
175 +module.exports = Marionette.ItemView.extend({
176 + id: 'elementor-new-template-dialog-content',
177 + template: '#tmpl-elementor-new-template',
178 + ui: {},
179 + events: {},
180 + onRender: function onRender() {}
181 +});
182 +
183 +/***/ })
184 +
185 +/******/ });
303 186 //# sourceMappingURL=new-template.js.map