|
1
|
|
-(function(e){var __esmMin=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(e){throw n=[e],e}},__commonJSMin=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports);function _classCallCheck(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var t=__esmMin((()=>{}));function _typeof(e){"@babel/helpers - typeof";return _typeof=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},_typeof(e)}var n=__esmMin((()=>{}));function toPrimitive(e,t){if(_typeof(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(_typeof(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var r=__esmMin((()=>{n()}));function toPropertyKey(e){var t=toPrimitive(e,`string`);return _typeof(t)==`symbol`?t:t+``}var i=__esmMin((()=>{n(),r()}));function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,toPropertyKey(r.key),r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var a=__esmMin((()=>{i()})),o,s=__esmMin((()=>{t(),a(),o=function(){function LockPro(e){_classCallCheck(this,LockPro),this.elements=e}return _createClass(LockPro,[{key:`bindEvents`,value:function bindEvents(){var e=this.elements,t=e.form,n=e.templateType;t.addEventListener(`submit`,this.onFormSubmit.bind(this)),n.addEventListener(`change`,this.onTemplateTypeChange.bind(this)),this.onTemplateTypeChange()}},{key:`onFormSubmit`,value:function onFormSubmit(e){this.getCurrentLockOptions().is_locked&&e.preventDefault()}},{key:`onTemplateTypeChange`,value:function onTemplateTypeChange(){var e=this.getCurrentLockOptions();e.is_locked?this.lock(e):this.unlock()}},{key:`getCurrentLockOptions`,value:function getCurrentLockOptions(){var e=this.elements.templateType,t=e.options[e.selectedIndex];return JSON.parse(t.dataset.lock||`{}`)}},{key:`lock`,value:function lock(e){this.showLockBadge(e.badge),this.showLockButton(e.button),this.hideSubmitButton()}},{key:`unlock`,value:function unlock(){this.hideLockBadge(),this.hideLockButton(),this.showSubmitButton()}},{key:`showLockBadge`,value:function showLockBadge(e){var t=this.elements,n=t.lockBadge,r=t.lockBadgeText,i=t.lockBadgeIcon;r.innerText=e.text,i.className=e.icon,n.classList.remove(`e-hidden`)}},{key:`hideLockBadge`,value:function hideLockBadge(){this.elements.lockBadge.classList.add(`e-hidden`)}},{key:`showLockButton`,value:function showLockButton(e){var t=this.elements.lockButton;t.href=this.replaceLockLinkPlaceholders(e.url),t.innerText=e.text,t.classList.remove(`e-hidden`)}},{key:`hideLockButton`,value:function hideLockButton(){this.elements.lockButton.classList.add(`e-hidden`)}},{key:`showSubmitButton`,value:function showSubmitButton(){this.elements.submitButton.classList.remove(`e-hidden`)}},{key:`hideSubmitButton`,value:function hideSubmitButton(){this.elements.submitButton.classList.add(`e-hidden`)}},{key:`replaceLockLinkPlaceholders`,value:function replaceLockLinkPlaceholders(e){return e.replace(/%%utm_source%%/g,`wp-add-new`).replace(/%%utm_medium%%/g,`wp-dash`)}}])}()})),c=__commonJSMin(((e,t)=>{t.exports=Marionette.ItemView.extend({id:`elementor-new-template-dialog-content`,template:`#tmpl-elementor-new-template`,ui:{},events:{},onRender:function onRender(){}})})),l=__commonJSMin(((t,n)=>{s();var r=c();n.exports=elementorModules.common.views.modal.Layout.extend({getModalOptions:function getModalOptions(){return{id:`elementor-new-template-modal`}},getLogoOptions:function getLogoOptions(){return{title:(0,e.__)(`New Template`,`elementor`)}},initialize:function initialize(){elementorModules.common.views.modal.Layout.prototype.initialize.apply(this,arguments),this.showLogo(),this.showContentView(),this.initElements(),this.lockProBehavior=new o(this.elements),this.lockProBehavior.bindEvents(),this.setupDynamicControlsVisibility()},setupDynamicControlsVisibility:function setupDynamicControlsVisibility(){if(typeof elementor_new_template_form_controls<`u`){var e=`elementor-new-template__form__`,t=`${e}template-type`,n=function dynamicControlsVisibilityListener(){elementorAdmin.templateControls.setDynamicControlsVisibility(e,elementor_new_template_form_controls)};this.getModal().onShow=function(){n(),document.getElementById(t).addEventListener(`change`,n)},this.getModal().onHide=function(){document.getElementById(t).removeEventListener(`change`,n)}}},initElements:function initElements(){var e=this.$el[0],t=`#elementor-new-template__form`;this.elements={form:e.querySelector(t),submitButton:e.querySelector(`${t}__submit`),lockButton:e.querySelector(`${t}__lock_button`),templateType:e.querySelector(`${t}__template-type`),lockBadge:e.querySelector(`${t}__template-type-badge`),lockBadgeText:e.querySelector(`${t}__template-type-badge__text`),lockBadgeIcon:e.querySelector(`${t}__template-type-badge__icon`)}},showContentView:function showContentView(){this.modalContent.show(new r)}})}))(),u=elementorModules.ViewModule.extend({getDefaultSettings:function getDefaultSettings(){return{selectors:{addButton:`a.page-title-action[href*="post-new.php?post_type=elementor_library"], #elementor-template-library-add-new`}}},getDefaultElements:function getDefaultElements(){var e=this.getSettings(`selectors`);return{$addButton:jQuery(e.addButton)}},bindEvents:function bindEvents(){this.elements.$addButton.on(`click`,this.onAddButtonClick),elementorCommon.elements.$window.on(`hashchange`,this.showModalByHash.bind(this))},showModalByHash:function showModalByHash(){if(location.hash===`#add_new`){var e;(e=this.layout)==null||e.showModal(),location.hash=``}},onInit:function onInit(){elementorModules.ViewModule.prototype.onInit.apply(this,arguments),this.layout=new l,this.showModalByHash()},onAddButtonClick:function onAddButtonClick(e){var t;e.preventDefault(),(t=this.layout)==null||t.showModal()}});jQuery(function(){window.elementorNewTemplate=new u})})(wp.i18n); |
|
2
|
+(()=>{"use strict";var e,t,o={70119:(e,t,o)=>{var n=o(38003).__,i=o(97631);e.exports=elementorModules.common.views.modal.Layout.extend({getModalOptions:function getModalOptions(){return{id:"elementor-new-template-modal"}},getLogoOptions:function getLogoOptions(){return{title:n("New Template","elementor")}},initialize:function initialize(){elementorModules.common.views.modal.Layout.prototype.initialize.apply(this,arguments),this.showLogo(),this.showContentView()},showContentView:function showContentView(){this.modalContent.show(new i)}})},97631:e=>{e.exports=Marionette.ItemView.extend({id:"elementor-new-template-dialog-content",template:"#tmpl-elementor-new-template",ui:{},events:{},onRender:function onRender(){}})},38003:e=>{e.exports=wp.i18n}},n={};function __webpack_require__(e){var t=n[e];if(void 0!==t)return t.exports;var i=n[e]={exports:{}};return o[e](i,i.exports,__webpack_require__),i.exports}e=__webpack_require__(70119),t=elementorModules.ViewModule.extend({getDefaultSettings:function getDefaultSettings(){return{selectors:{addButton:".page-title-action:first, #elementor-template-library-add-new"}}},getDefaultElements:function getDefaultElements(){var e=this.getSettings("selectors");return{$addButton:jQuery(e.addButton)}},bindEvents:function bindEvents(){this.elements.$addButton.on("click",this.onAddButtonClick),elementorCommon.elements.$window.on("hashchange",this.showModalByHash.bind(this))},showModalByHash:function showModalByHash(){"#add_new"===location.hash&&(this.layout.showModal(),location.hash="")},onInit:function onInit(){elementorModules.ViewModule.prototype.onInit.apply(this,arguments),this.layout=new e,this.showModalByHash()},onAddButtonClick:function onAddButtonClick(e){e.preventDefault(),this.layout.showModal()}}),jQuery((function(){window.elementorNewTemplate=new t}))})(); |