/
var
/
www
/
barefootlaw.org
/
wp-content
/
plugins
/
archub-elementor-addons
/
assets
/
js
/
Upload File
HOME
!function(e,$,t){var o=Backbone.Model.extend({defaults:{template_id:0,title:"",source:"",type:"",subtype:"",author:"",thumbnail:"",url:"",export_link:"",tags:[]}}),r=Backbone.Collection.extend({model:o}),n=Marionette.Behavior.extend({ui:{insertButton:".elementor-template-library-template-insert"},events:{"click @ui.insertButton":"onInsertButtonClick"},onInsertButtonClick:function(){var e={model:this.view.model};$e.run("hub_collections/insert-template",e)}}),i=Marionette.ItemView.extend({className:function(){var e="elementor-template-library-template",t=this.model.get("source");return e+=" elementor-template-library-template-remote",e+=" elementor-template-library-template-"+t,"hub_collections"===t&&(e+=" elementor-template-library-template-"+this.model.get("type")),this.model.get("isPro")&&(e+=" elementor-template-library-pro-template"),e},ui:function(){return{previewButton:".elementor-template-library-template-preview"}},events:function(){return{"click @ui.previewButton":"onPreviewButtonClick"}},behaviors:{insertTemplate:{behaviorClass:n}}}),a=i.extend({template:"#tmpl-elementor-template-library-template-hub",ui:function(){return jQuery.extend(i.prototype.ui.apply(this,arguments),{favoriteCheckbox:".elementor-template-library-template-favorite-input"})},events:function(){return jQuery.extend(i.prototype.events.apply(this,arguments),{"change @ui.favoriteCheckbox":"onFavoriteCheckboxChange"})},onPreviewButtonClick:function(){$e.route("hub_collections/preview",{model:this.model})},onFavoriteCheckboxChange:function(){var t=this.ui.favoriteCheckbox[0].checked;this.model.set("favorite",t),hub_templates_lib.templates.markAsFavorite(this.model,t),!t&&hub_templates_lib.templates.getFilter("favorite")&&e.channels.templates.trigger("filter:change")}}),l=Marionette.ItemView.extend({template:"#tmpl-elementor-template-library-preview",id:"elementor-template-library-preview",ui:{iframe:"> iframe"},onRender:function(){this.ui.iframe.attr("src",this.getOption("url"))}}),s=Marionette.ItemView.extend({template:"#tmpl-elementor-template-library-header-preview-hub",id:"elementor-template-library-header-preview",behaviors:{insertTemplate:{behaviorClass:n}}}),u=Marionette.ItemView.extend({template:"#tmpl-elementor-template-library-header-back",id:"elementor-template-library-header-preview-back",events:{click:"onClick"},onClick:function(){$e.routes.restoreState("hub_collections")}}),c=Marionette.CompositeView.extend({template:"#tmpl-elementor-template-library-templates-hub",id:"elementor-template-library-templates",childViewContainer:"#elementor-template-library-templates-container",reorderOnSort:!0,ui:{textFilter:"#elementor-template-library-filter-text",selectFilter:".elementor-template-library-filter-select",myFavoritesFilter:"#elementor-template-library-filter-my-favorites",orderInputs:".elementor-template-library-order-input",orderLabels:"label.elementor-template-library-order-label"},events:{"input @ui.textFilter":"onTextFilterInput","change @ui.selectFilter":"onSelectFilterChange","change @ui.myFavoritesFilter":"onMyFavoritesFilterChange","mousedown @ui.orderLabels":"onOrderLabelsClick"},comparators:{title:function(e){return e.get("title").toLowerCase()}},getChildView:function(e){return a},initialize:function(){this.listenTo(e.channels.templates,"filter:change",this._renderChildren)},filter:function(e){var t=hub_templates_lib.templates.getFilterTerms(),o=!0;return jQuery.each(t,(function(t){var r=hub_templates_lib.templates.getFilter(t);if(r){if(this.callback){var n=this.callback.call(e,r);return n||(o=!1),n}var i=r===e.get(t);return i||(o=!1),i}})),o},order:function(e,t){var o=this.comparators[e]||e;t&&(o=this.reverseOrder(o)),this.collection.comparator=o,this.collection.sort()},reverseOrder:function(e){if("function"!=typeof e){var t=e;e=function(e){return e.get(t)}}return function(t,o){var r=e(t),n=e(o);return void 0===r?-1:void 0===n||r<n?1:r>n?-1:0}},addSourceData:function(){var e=this.children.isEmpty();this.$el.attr("data-template-source",e?"empty":hub_templates_lib.templates.getFilter("source"))},setFiltersUI:function(){this.$(this.ui.selectFilter).select2({placeholder:e.translate("category"),allowClear:!0,width:150,dropdownParent:this.$el})},setMasonrySkin:function(){var e=new elementorModules.utils.Masonry({container:this.$childViewContainer,items:this.$childViewContainer.children()});this.$childViewContainer.imagesLoaded(e.run.bind(e))},toggleFilterClass:function(){this.$el.toggleClass("elementor-templates-filter-active",!(!hub_templates_lib.templates.getFilter("text")&&!hub_templates_lib.templates.getFilter("favorite")))},onRender:function(){"hub_collections"===hub_templates_lib.templates.getFilter("source")&&this.setFiltersUI()},onRenderCollection:function(){this.addSourceData(),this.toggleFilterClass(),"hub_collections"===hub_templates_lib.templates.getFilter("source")&&"page"!==hub_templates_lib.templates.getFilter("type")&&this.setMasonrySkin()},onBeforeRenderEmpty:function(){this.addSourceData()},onTextFilterInput:function(){hub_templates_lib.templates.setFilter("text",this.ui.textFilter.val())},onSelectFilterChange:function(e){var t=jQuery(e.currentTarget),o=t.data("elementor-filter");hub_templates_lib.templates.setFilter(o,t.val())},onMyFavoritesFilterChange:function(){hub_templates_lib.templates.setFilter("favorite",this.ui.myFavoritesFilter[0].checked)},onOrderLabelsClick:function(e){var t,o=jQuery(e.currentTarget.control);o[0].checked||(t="asc"!==o.data("default-ordering-direction")),o.toggleClass("elementor-template-library-order-reverse",t),this.order(o.val(),o.hasClass("elementor-template-library-order-reverse"))}}),m=Marionette.ItemView.extend({template:"#tmpl-elementor-templates-modal__header__logo_hub",className:function(){return"elementor-templates-modal__header__logo"},events:function(){return{click:"onClick"}},templateHelpers:function(){return{title:this.getOption("title")}},onClick:function(){var e=this.getOption("click");e&&e()}}),p=Marionette.ItemView.extend({template:"#tmpl-elementor-template-library-header-actions-hub",id:"elementor-template-library-header-actions",ui:{sync:"#elementor-template-library-header-sync i"},events:{"click @ui.sync":"onSyncClick"},onSyncClick:function(){var e=this;e.ui.sync.addClass("eicon-animation-spin"),hub_templates_lib.templates.requestLibraryData({onUpdate:function(){e.ui.sync.removeClass("eicon-animation-spin"),$e.routes.refreshContainer("hub_collections")},forceUpdate:!0,forceSync:!0})}}),d=Marionette.ItemView.extend({template:"#tmpl-elementor-template-library-header-menu",id:"elementor-template-library-header-menu",templateHelpers:function(){return{tabs:$e.components.get("hub_collections").getTabs()}}}),h=elementorModules.common.views.modal.Layout.extend({getModalOptions:function(){return{id:"elementor-template-library-modal",effects:{show:"show",hide:"hide"}}},getLogoOptions:function(){return{title:"ArcHub Collections",click:function(){return $e.run("hub_collections/open",{toDefault:!0}),!1}}},getTemplateActionButton:function(e){var t="#tmpl-elementor-template-library-insert-button";e.isPro&&"inactive"===e.proStatus&&(t="#tmpl-elementor-template-library-get-pro-buttohub"),e.isPro&&"license_inactive"===e.proStatus&&(t="#tmpl-elementor-pro-template-library-activate-license-button-hub");var o=Marionette.TemplateCache.get(t);return Marionette.Renderer.render(o)},setHeaderDefaultParts:function(){var e=this.getHeaderView();e.tools.show(new p),e.menuArea.show(new d),this.showLogo()},showLogo:function(){this.getHeaderView().logoArea.show(new m(this.getLogoOptions()))},showTemplatesView:function(e){this.modalContent.show(new c({collection:e}))},showPreviewView:function(e){this.modalContent.show(new l({url:e.get("url")}));var t=this.getHeaderView();t.menuArea.reset(),t.tools.show(new s({model:e})),t.logoArea.show(new u)}}),g=function(t){function o(){return Object.getPrototypeOf(o).apply(this,arguments)}o.prototype=Object.create(t&&t.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),Object.setPrototypeOf(o,t);var r=Object.getPrototypeOf(o.prototype);return o.prototype.__construct=function(t){r.__construct.call(this,t),e.on("document:loaded",this.onDocumentLoaded.bind(this)),$e.data.deleteCache(this,"hub_collections")},o.prototype.getNamespace=function(){return"hub_collections"},o.prototype.defaultTabs=function(){return{"templates/blocks":{title:"Blocks",getFilter:function(){return{source:"hub_collections",type:"block"}}},"templates/pages":{title:"Pages",filter:{source:"hub_collections",type:"page"}}}},o.prototype.defaultRoutes=function(){return{preview:function(e){this.manager.layout.showPreviewView(e.model)}}},o.prototype.defaultCommands=function(){return Object.assign(r.defaultCommands.call(this),{open:this.show.bind(this),"insert-template":this.insertTemplate.bind(this)})},o.prototype.defaultShortcuts=function(){return{open:{keys:"ctrl+shift+p"}}},o.prototype.onDocumentLoaded=function(e){this.setDefaultRoute("templates/blocks"),this.maybeOpenLibrary()},o.prototype.renderTab=function(e){var t=this.tabs[e],o=t.getFilter?t.getFilter():t.filter;this.manager.setScreen(o)},o.prototype.activateTab=function(e){$e.routes.saveState("hub_collections"),r.activateTab.call(this,e)},o.prototype.open=function(){return r.open.call(this),this.manager.layout||(this.manager.layout=this.layout),this.manager.layout.setHeaderDefaultParts(),!0},o.prototype.close=function(){return!!r.close.call(this)&&(this.manager.modalConfig={},!0)},o.prototype.show=function(e){this.manager.modalConfig=e,!e.toDefault&&$e.routes.restoreState("hub_collections")||$e.route(this.getDefaultRoute())},o.prototype.insertTemplate=function(t){var r=t.model,n=this,i=t.withPageSettings||null;null===i&&r.get("hasPageSettings")?this.getImportSettingsDialog().showImportDialog(r):(this.manager.layout.showLoadingView(),this.manager.requestTemplateContent(r.get("source"),r.get("template_id"),{data:{with_page_settings:i},success:function(e){var t=jQuery.extend({},n.manager.modalConfig.importOptions);t.withPageSettings=i,n.manager.layout.hideLoadingView(),n.manager.layout.hideModal(),$e.run("document/elements/import",{model:r,data:e,options:t})},error:function(e){n.manager.showErrorDialog(e)},complete:function(){n.manager.layout.hideLoadingView()}}),o.prototype.getImportSettingsDialog=function(){var t={dialog:null,showImportDialog:function(e){var o=t.getDialog();o.onConfirm=function(){$e.run("library/insert-template",{model:e,withPageSettings:!0})},o.onCancel=function(){$e.run("library/insert-template",{model:e,withPageSettings:!1})},o.show()},initDialog:function(){t.dialog=elementorCommon.dialogsManager.createWidget("confirm",{id:"elementor-insert-template-settings-dialog",headerMessage:e.translate("import_template_dialog_header"),message:e.translate("import_template_dialog_message")+"<br>"+e.translate("import_template_dialog_message_attention"),strings:{confirm:e.translate("yes"),cancel:e.translate("no")}})},getDialog:function(){return t.dialog||t.initDialog(),t.dialog}};return t})},o.prototype.getTabsWrapperSelector=function(){return"#elementor-template-library-header-menu"},o.prototype.getModalLayout=function(){return h},o.prototype.maybeOpenLibrary=function(){"#hub_collections"===location.hash&&($e.run("hub_collections/open"),location.hash="")},o}($e.modules.ComponentModalBase);hub_templates_lib.templates=new function(){var t,o=this,n={},i={},a=!1;this.modalConfig={};this.getFilter=function(t){return e.channels.templates.request("filter:"+t)},this.setFilter=function(t,o,r){e.channels.templates.reply("filter:"+t,o),r||e.channels.templates.trigger("filter:change")},this.setScreen=function(t){e.channels.templates.stopReplying(),o.setFilter("source",t.source,!0),o.setFilter("type",t.type,!0),o.setFilter("subtype",t.subtype,!0),o.showTemplates()},this.getTemplatesCollection=function(){return a},this.getConfig=function(e){return e?n[e]?n[e]:{}:n},this.getFilterTerms=function(e){return e?i[e]:i},this.requestLibraryData=function(e){if(!a||e.forceUpdate){e.onBeforeUpdate&&e.onBeforeUpdate();var t={data:{},success:function(t){a=new r(t.templates),t.config&&(n=t.config),e.onUpdate&&e.onUpdate()}};e.forceSync&&(t.data.sync=!0),elementorCommon.ajax.addRequest("hub_get_library_data",t)}else e.onUpdate&&e.onUpdate()},this.loadTemplates=function(e){o.requestLibraryData({onBeforeUpdate:o.layout.showLoadingView.bind(o.layout),onUpdate:function(){o.layout.hideLoadingView(),e&&e()}})},this.showTemplates=function(){o.layout.setHeaderDefaultParts(),o.layout.showModal(),o.loadTemplates((function(){var e=o.filterTemplates();o.layout.showTemplatesView(new r(e))}))},this.filterTemplates=function(){return a.filter((function(e){return"hub_collections"===e.get("source")&&("block"===e.get("type")||"page"===e.get("type"))}))},this.requestTemplateContent=function(e,t,o){var r={unique_id:t,data:{source:e,edit_mode:!0,display:!0,template_id:t}};return o&&jQuery.extend(!0,r,o),elementorCommon.ajax.addRequest("get_template_data",r)},this.markAsFavorite=function(e,t){var o={data:{source:e.get("source"),template_id:e.get("template_id"),favorite:t}};return elementorCommon.ajax.addRequest("mark_template_as_favorite",o)},this.getErrorDialog=function(){return t||(t=elementorCommon.dialogsManager.createWidget("alert",{id:"elementor-template-library-error-dialog",headerMessage:e.translate("an_error_occurred")})),t},this.showErrorDialog=function(t){if("object"==typeof t){var r="";_.each(t,(function(e){r+="<div>"+e.message+".</div>"})),t=r}else t?t+=".":t="<i><The error message is empty></i>";o.getErrorDialog().setMessage(e.translate("templates_request_error")+'<div id="elementor-template-library-error-info">'+t+"</div>").show()},this.init=function(){i={text:{callback:function(e){return e=e.toLowerCase(),this.get("title").toLowerCase().indexOf(e)>=0||_.any(this.get("tags"),(function(t){return t.toLowerCase().indexOf(e)>=0}))}},type:{},subtype:{},favorite:{}},this.component=$e.components.register(new g({manager:this}))}},hub_templates_lib.templates.init(),e.on("document:loaded",(function(){var t=e.$previewContents,o=$("<style />");o.html(".elementor-add-section-area-button.hub-add-template-button { margin-left: 8px; vertical-align: bottom; }.elementor-add-section-area-button.hub-add-template-button img { height: 40px; padding: 5px; }"),t.find("head").append(o);var r=$("<div />");r.addClass("elementor-add-section-area-button hub-add-template-button"),r.attr("title","Hub Collections"),r.html('<img src="'+hub_templates_lib.logoUrl+'" />'),r.on("click",(()=>{$e.run("hub_collections/open",{importOptions:{at:void 0}})})),r.insertAfter(t.find(".elementor-add-section-area-button.elementor-add-template-button")),t.find("body").delegate(".elementor-editor-element-add","click",(t=>{const o=setTimeout((()=>{const n=$(t.currentTarget).closest(".elementor-element"),i=n.prev(".elementor-add-section-inline"),a=r.clone(!1);a.on("click",(()=>{const t=n.data("model-cid"),o=e.elements.findIndex((e=>e.cid===t)),r={};o>-1&&(r.at=o),$e.run("hub_collections/open",{importOptions:r})})),a.insertAfter(i.find(".elementor-add-section-area-button.elementor-add-template-button")),i.find(".elementor-add-section-close").on("click",(()=>{const e=setTimeout((()=>{a.off(),a.remove(),clearTimeout(e)}),200)})),clearTimeout(o)}),100)}))}))}(elementor,jQuery,window);