File Editor
Directories:
.. (Back)
Files:
editor-modern.js
editor-modern.min.js
editor.js
editor.min.js
frontend.js
frontend.min.js
Create New File
Create
Edit File: editor.min.js
"use strict";var WPFormsElementor=window.WPFormsElementor||function(r,i){var l={},s={init:function(){s.events()},events:function(){i(r).on("elementor/frontend/init",function(e,t,n){elementor.channels.editor.on("elementorWPFormsAddFormBtnClick",s.addFormBtnClick),elementorFrontend.hooks.addAction("frontend/element_ready/wpforms.default",s.widgetPreviewEvents),elementor.hooks.addAction("panel/open_editor/widget/wpforms",s.widgetPanelOpen),elementorFrontend.hooks.addAction("frontend/element_ready/wpforms.default",s.loadChoicesJS)})},loadChoicesJS(e){if("function"==typeof parent.Choices){e=e.find(".wpforms-field .choicesjs-select");const o=r.wpforms_choicesjs_config||{};e.each(function(e,t){if(t instanceof parent.HTMLSelectElement){var n=i(t);if(!n.data("choicesjs")){const r=n.closest(".wpforms-field");o.callbackOnInit=function(){var e=this,t=i(e.passedElement.element),n=i(e.input.element),o=t.data("size-class");o&&i(e.containerOuter.element).addClass(o),t.prop("multiple")&&(n.data("placeholder",n.attr("placeholder")),e.getValue(!0).length)&&n.hide(),this.disable(),r.find(".is-disabled").removeClass("is-disabled")},n.data("choicesjs",new parent.Choices(t,o))}}})}},widgetPreviewEvents:function(e){e.on("click",".wpforms-btn",s.addFormBtnClick).on("click",".wpforms-admin-no-forms-container a",s.clickLinkInPreview).on("change",".wpforms-elementor-form-selector select",s.selectFormInPreview).on("click mousedown focus keydown submit",".wpforms-container *",s.disableEvents).on("click",".wpforms-comprehensive-link",s.openComprehensiveLink),s.updateSameForms(e)},updateSameForms:function(e){var t=e.data("id"),n=e.find(".wpforms-container"),o=n.html(),r=n.attr("id");e.closest(".elementor-editor-active").find(".elementor-widget-wpforms:not(.elementor-element-"+t+")").each(function(){var e=i(this).find(".wpforms-container");e.attr("id")===r&&e.html(o)})},widgetPanelOpen:function(e,t){l.widgetId=t.attributes.id,l.formId=t.attributes.settings.attributes.form_id,s.widgetPanelInit(e),s.widgetPanelObserver.init(e)},widgetPanelInit:function(e){var t=e.$el.find(".elementor-control.elementor-control-form_id"),n=t.find("select"),o=e.$el.find(".elementor-control.elementor-control-add_form_notice"),r=e.$el.find(".elementor-control.elementor-control-test_form_notice");l.formSelectOptions&&n.html(l.formSelectOptions),l.formId&&""!==l.formId&&n.val(l.formId),(0<n.find("option").length?o:(t.hide(),r)).hide(),0<parseInt(n.val(),10)&&r.show(),e.$el.find(".elementor-control.elementor-control-form_id").on("change","select",function(){l.formId=i(this).val()}),e.$el.find(".elementor-control.elementor-control-edit_form").on("click","a",s.editFormLinkClick)},widgetPanelObserver:{init:function(e){var t;l.observerWidgetId!==l.widgetId&&(void 0!==l.observer&&"function"==typeof l.observer.disconnect&&l.observer.disconnect(),t={targetNode:e.$el.find("#elementor-panel-content-wrapper")[0],config:{childList:!0,subtree:!0,attributes:!0}},s.widgetPanelObserver.panel=e,t.observer=new MutationObserver(s.widgetPanelObserver.callback),t.observer.observe(t.targetNode,t.config),l.observerWidgetId=l.widgetId,l.observer=t.observer)},callback:function(e){var t,n,o=!1;for(n in e)if("childList"===(t=e[n]).type&&0<t.addedNodes.length&&(o=s.widgetPanelObserver.callbackMutationChildList(t)),o="attributes"===t.type?s.widgetPanelObserver.callbackMutationAttributes(t):o)return},callbackMutationChildList:function(e){var t,n,o=e.addedNodes||[];for(n in o)if((t=o[n])&&t.classList&&t.classList.contains("elementor-control-section_form"))return s.widgetPanelInit(s.widgetPanelObserver.panel),!0;return!1},callbackMutationAttributes:function(e){return!!(e.target&&e.target.classList&&e.target.classList.contains("elementor-tab-control-content"))&&(s.widgetPanelInit(s.widgetPanelObserver.panel),!0)}},editFormLinkClick:function(e){s.findFormSelector(e),s.openBuilderPopup(l.$select.val())},addFormBtnClick:function(e){s.findFormSelector(e),s.openBuilderPopup(0)},findFormSelector:function(e){var t=elementor.getPanelView().getCurrentPageView();t.activeSection&&"section_form"!==t.activeSection&&i(t.ui.tabs[0]).trigger("click"),l.$select=e&&e.$el?e.$el.closest("#elementor-controls").find('select[data-setting="form_id"]'):r.parent.jQuery('#elementor-controls select[data-setting="form_id"]')},selectFormInPreview:function(){l.formId=i(this).val(),s.findFormSelector(),s.refreshFormsList(null,l.formId)},clickLinkInPreview:function(e){e.target&&e.target.href&&r.open(e.target.href,"_blank","noopener,noreferrer")},disableEvents:function(e){return e.preventDefault(),e.stopImmediatePropagation(),!1},openComprehensiveLink:function(e){var t=i(this).attr("href");r.open(t,"_blank").focus()},openBuilderPopup:function(e){e=parseInt(e||"0",10),l.$popup||(n=r.parent.jQuery("#elementor-editor-wrapper"),t=wp.template("wpforms-builder-elementor-popup"),n.after(t()),l.$popup=n.siblings("#wpforms-builder-elementor-popup"));var t=0<e?wpformsElementorVars.edit_form_url+e:wpformsElementorVars.add_form_url,n=l.$popup.find("iframe");s.builderCloseButtonEvent(),n.attr("src",t),l.$popup.fadeIn()},builderCloseButtonEvent:function(){l.$popup.off("wpformsBuilderInPopupClose").on("wpformsBuilderInPopupClose",function(e,t,n){"saved"===t&&n&&s.refreshFormsList(null,n)})},refreshFormsList:function(e,t){e&&e.preventDefault(),s.findFormSelector();e={action:"wpforms_admin_get_form_selector_options",nonce:wpformsElementorVars.nonce};l.$select.prop("disabled",!0),i.post(wpformsElementorVars.ajax_url,e).done(function(e){e.success?(l.formSelectOptions=e.data,l.$select.html(e.data),t&&(l.formId=t),l.formId&&""!==l.formId&&l.$select.val(l.formId).trigger("change")):s.debug(e)}).fail(function(e,t){s.debug({xhr:e,textStatus:t})}).always(function(){var e,t;!l.$select||l.$select.length<1||(l.$select.prop("disabled",!1),e=l.$select.find("option"),t=l.$select.closest(".elementor-control"),0<e.length&&(t.show(),t.siblings(".elementor-control-add_form_notice").hide()),0<parseInt(l.$select.val(),10)&&t.siblings(".elementor-control-test_form_notice").show())})},debug:function(e){s.isDebug()&&console.log("WPForms Debug:",e)},isDebug:function(){return r.top.location.hash&&"#wpformsdebug"===r.top.location.hash||wpformsElementorVars.debug}};return s}((document,window),jQuery);WPFormsElementor.init();
Save Changes
Rename File
Rename