JezK
Edit File: floating-elements-modal.min.js
(function(e){var t=Object.defineProperty,__name=(e,n)=>t(e,`name`,{value:n,configurable:!0});function _classCallCheck(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}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)}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)}function toPropertyKey(e){var t=toPrimitive(e,`string`);return _typeof(t)==`symbol`?t:t+``}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}function _assertThisInitialized(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function _possibleConstructorReturn(e,t){if(t&&(_typeof(t)==`object`||typeof t==`function`))return t;if(t!==void 0)throw TypeError(`Derived constructors may only return object or undefined`);return _assertThisInitialized(e)}function _getPrototypeOf(e){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},_getPrototypeOf(e)}function _superPropBase(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=_getPrototypeOf(e))!==null;);return e}function _get(){return _get=typeof Reflect<`u`&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=_superPropBase(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},_get.apply(null,arguments)}function _setPrototypeOf(e,t){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_setPrototypeOf(e,t)}function _inherits(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Super expression must either be null or a function`);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}var n=Marionette.ItemView.extend({id:`elementor-new-floating-elements-dialog-content`,template:`#tmpl-elementor-new-floating-elements`,ui:{},events:{},onRender:function onRender(){}});function _callSuper$4(e,t,n){return t=_getPrototypeOf(t),_possibleConstructorReturn(e,_isNativeReflectConstruct$4()?Reflect.construct(t,n||[],_getPrototypeOf(e).constructor):t.apply(e,n))}__name(_callSuper$4,`_callSuper`);function _isNativeReflectConstruct$4(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_isNativeReflectConstruct$4=function _isNativeReflectConstruct(){return!!e})()}__name(_isNativeReflectConstruct$4,`_isNativeReflectConstruct`);var r=function(e){function _default(){return _classCallCheck(this,_default),_callSuper$4(this,_default,arguments)}return _inherits(_default,e),_createClass(_default,[{key:`tagName`,value:function tagName(){return`header`}},{key:`className`,value:function className(){return`elementor-templates-modal__header`}},{key:`getTemplate`,value:function getTemplate(){return`#tmpl-elementor-templates-modal__header`}},{key:`regions`,value:function regions(){return{logoArea:`.elementor-templates-modal__header__logo-area`,tools:`#elementor-template-library-header-tools`,menuArea:`.elementor-templates-modal__header__menu-area`}}},{key:`ui`,value:function ui(){return{closeModal:`.elementor-templates-modal__header__close`}}},{key:`events`,value:function events(){return{"click @ui.closeModal":`onCloseModalClick`}}},{key:`onRender`,value:function onRender(){this.bindEscapeKey()}},{key:`bindEscapeKey`,value:function bindEscapeKey(){var e=this;this.onDocumentKeyDown=function(t){t.key===`Escape`&&e.onCloseModalClick()},document.addEventListener(`keydown`,this.onDocumentKeyDown)}},{key:`onDestroy`,value:function onDestroy(){this.onDocumentKeyDown&&document.removeEventListener(`keydown`,this.onDocumentKeyDown)}},{key:`templateHelpers`,value:function templateHelpers(){return{closeType:this.getOption(`closeType`)}}},{key:`onCloseModalClick`,value:function onCloseModalClick(){this._parent._parent._parent.hideModal();var e=this.getDocumentType(),t=new CustomEvent(`core/modal/close/${e}`);window.dispatchEvent(t),this.isFloatingButtonLibraryClose()&&($e.internal(`document/save/set-is-modified`,{status:!1}),window.location.href=elementor.config.admin_floating_button_admin_url)}},{key:`getDocumentType`,value:function getDocumentType(){var e,t;return window.elementor===void 0||(e=(t=elementor)==null||(t=t.config)==null||(t=t.document)==null?void 0:t.type)==null?`default`:e}},{key:`isFloatingButtonLibraryClose`,value:function isFloatingButtonLibraryClose(){var e,t;return window.elementor&&((e=elementor.config)==null?void 0:e.admin_floating_button_admin_url)&&((t=elementor.config)==null||(t=t.document)==null?void 0:t.type)===`floating-buttons`&&(this.$el.closest(`.dialog-lightbox-widget-content`).find(`.elementor-template-library-template-floating_button`).length||this.$el.closest(`.dialog-lightbox-widget-content`).find(`#elementor-template-library-preview`).length||this.$el.closest(`.dialog-lightbox-widget-content`).find(`#elementor-template-library-templates-empty`).length)}}])}(Marionette.LayoutView);function _callSuper$3(e,t,n){return t=_getPrototypeOf(t),_possibleConstructorReturn(e,_isNativeReflectConstruct$3()?Reflect.construct(t,n||[],_getPrototypeOf(e).constructor):t.apply(e,n))}__name(_callSuper$3,`_callSuper`);function _isNativeReflectConstruct$3(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_isNativeReflectConstruct$3=function _isNativeReflectConstruct(){return!!e})()}__name(_isNativeReflectConstruct$3,`_isNativeReflectConstruct`);var i=function(e){function _default(){return _classCallCheck(this,_default),_callSuper$3(this,_default,arguments)}return _inherits(_default,e),_createClass(_default,[{key:`getTemplate`,value:function getTemplate(){return`#tmpl-elementor-templates-modal__header__logo`}},{key:`className`,value:function className(){return`elementor-templates-modal__header__logo`}},{key:`events`,value:function events(){return{click:`onClick`}}},{key:`templateHelpers`,value:function templateHelpers(){return{title:this.getOption(`title`)}}},{key:`onClick`,value:function onClick(){var e=this.getOption(`click`);e&&e()}}])}(Marionette.ItemView);function _callSuper$2(e,t,n){return t=_getPrototypeOf(t),_possibleConstructorReturn(e,_isNativeReflectConstruct$2()?Reflect.construct(t,n||[],_getPrototypeOf(e).constructor):t.apply(e,n))}__name(_callSuper$2,`_callSuper`);function _isNativeReflectConstruct$2(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_isNativeReflectConstruct$2=function _isNativeReflectConstruct(){return!!e})()}__name(_isNativeReflectConstruct$2,`_isNativeReflectConstruct`);var a=function(e){function _default(){return _classCallCheck(this,_default),_callSuper$2(this,_default,arguments)}return _inherits(_default,e),_createClass(_default,[{key:`id`,value:function id(){return`elementor-template-library-loading`}},{key:`getTemplate`,value:function getTemplate(){return`#tmpl-elementor-template-library-loading`}}])}(Marionette.ItemView);function _callSuper$1(e,t,n){return t=_getPrototypeOf(t),_possibleConstructorReturn(e,_isNativeReflectConstruct$1()?Reflect.construct(t,n||[],_getPrototypeOf(e).constructor):t.apply(e,n))}__name(_callSuper$1,`_callSuper`);function _isNativeReflectConstruct$1(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_isNativeReflectConstruct$1=function _isNativeReflectConstruct(){return!!e})()}__name(_isNativeReflectConstruct$1,`_isNativeReflectConstruct`);var o=function(e){function _default(){return _classCallCheck(this,_default),_callSuper$1(this,_default,arguments)}return _inherits(_default,e),_createClass(_default,[{key:`el`,value:function el(){return this.getModal().getElements(`widget`)}},{key:`regions`,value:function regions(){return{modalHeader:`.dialog-header`,modalContent:`.dialog-lightbox-content`,modalLoading:`.dialog-lightbox-loading`}}},{key:`initialize`,value:function initialize(){this.modalHeader.show(new r(this.getHeaderOptions()))}},{key:`getModal`,value:function getModal(){return this.modal||this.initModal(),this.modal}},{key:`initModal`,value:function initModal(){var e={className:`elementor-templates-modal`,closeButton:!1,draggable:!1,hide:{onOutsideClick:!1,onEscKeyPress:!1}};jQuery.extend(!0,e,this.getModalOptions()),this.modal=elementorCommon.dialogsManager.createWidget(`lightbox`,e),this.modal.getElements(`message`).append(this.modal.addElement(`content`),this.modal.addElement(`loading`)),e.draggable&&this.draggableModal()}},{key:`showModal`,value:function showModal(){this.getModal().show()}},{key:`hideModal`,value:function hideModal(){this.getModal().hide()}},{key:`draggableModal`,value:function draggableModal(){var e=this.getModal().getElements(`widgetContent`);e.draggable({containment:`parent`,stop:function stop(){e.height(``)}}),e.css(`position`,`absolute`)}},{key:`getModalOptions`,value:function getModalOptions(){return{}}},{key:`getLogoOptions`,value:function getLogoOptions(){return{}}},{key:`getHeaderOptions`,value:function getHeaderOptions(){return{closeType:`normal`}}},{key:`getHeaderView`,value:function getHeaderView(){return this.modalHeader.currentView}},{key:`showLoadingView`,value:function showLoadingView(){this.modalLoading.show(new a),this.modalLoading.$el.show(),this.modalContent.$el.hide()}},{key:`hideLoadingView`,value:function hideLoadingView(){this.modalContent.$el.show(),this.modalLoading.$el.hide()}},{key:`showLogo`,value:function showLogo(){this.getHeaderView().logoArea.show(new i(this.getLogoOptions()))}}])}(Marionette.LayoutView);function _callSuper(e,t,n){return t=_getPrototypeOf(t),_possibleConstructorReturn(e,_isNativeReflectConstruct()?Reflect.construct(t,n||[],_getPrototypeOf(e).constructor):t.apply(e,n))}function _isNativeReflectConstruct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!e})()}function _superPropGet(e,t,n,r){var i=_get(_getPrototypeOf(1&r?e.prototype:e),t,n);return 2&r&&typeof i==`function`?function(e){return i.apply(n,e)}:i}var s=function(t){function _default(){return _classCallCheck(this,_default),_callSuper(this,_default,arguments)}return _inherits(_default,t),_createClass(_default,[{key:`getModalOptions`,value:function getModalOptions(){return{id:`elementor-new-floating-elements-modal`}}},{key:`getLogoOptions`,value:function getLogoOptions(){return{title:(0,e.__)(`New Floating Elements`,`elementor`)}}},{key:`initialize`,value:function initialize(){_superPropGet(_default,`initialize`,this,3)([]),this.showLogo(),this.showContentView()}},{key:`showContentView`,value:function showContentView(){this.modalContent.show(new n)}}])}(o),c=elementorModules.ViewModule.extend({getDefaultSettings:function getDefaultSettings(){return{selectors:{addButtonTopBar:`a.page-title-action[href*="e-floating-buttons"]`,addButtonAdminBar:`#wp-admin-bar-new-e-floating-buttons a`,addButtonEmptyTemplate:`#elementor-template-library-add-new`}}},getDefaultElements:function getDefaultElements(){var e=this.getSettings(`selectors`);return{addButtonTopBar:document.querySelector(e.addButtonTopBar),addButtonAdminBar:document.querySelector(e.addButtonAdminBar),addButtonEmptyTemplate:document.querySelector(e.addButtonEmptyTemplate)}},bindEvents:function bindEvents(){this.elements.addButtonTopBar!==null&&this.elements.addButtonTopBar.addEventListener(`click`,this.onAddButtonClick),this.elements.addButtonAdminBar!==null&&this.elements.addButtonAdminBar.addEventListener(`click`,this.onAddButtonClick),this.elements.addButtonEmptyTemplate!==null&&this.elements.addButtonEmptyTemplate.addEventListener(`click`,this.onAddButtonClick)},onInit:function onInit(){elementorModules.ViewModule.prototype.onInit.apply(this,arguments),this.layout=new s},onAddButtonClick:function onAddButtonClick(e){e.preventDefault(),this.layout.showModal()}});document.addEventListener(`DOMContentLoaded`,function(){window.elementorNewFloatingElements=new c})})(wp.i18n);