File Editor
Directories:
.. (Back)
fields
Files:
admin-builder-providers.js
admin-builder-providers.min.js
admin-builder.js
admin-builder.min.js
context-menu.js
context-menu.min.js
drag-fields.js
drag-fields.min.js
dropdown-list.js
dropdown-list.min.js
email-template.js
email-template.min.js
form-templates.js
form-templates.min.js
help.js
help.min.js
panel-loader.js
panel-loader.min.js
providers.js
providers.min.js
search-fields.js
search-fields.min.js
settings.js
settings.min.js
setup.js
setup.min.js
templates.js
templates.min.js
wpforms-choicesjs.js
wpforms-choicesjs.min.js
Create New File
Create
Edit File: setup.min.js
var WPForms=window.WPForms||{};WPForms.Admin=WPForms.Admin||{},WPForms.Admin.Builder=WPForms.Admin.Builder||{},WPForms.Admin.Builder.Setup=WPForms.Admin.Builder.Setup||function(r,l){const s={},o={},a=l(".wpforms-template.selected .wpforms-template-name").text().trim(),m={init(){l(m.ready),l(r).on("load",function(){"function"==typeof l.ready.then?l.ready.then(m.load):m.load()})},ready(){m.setup(),m.setPanelsToggleState(),m.setupTitleFocus(),m.setTriggerBlankLink(),m.events(),s.$panel.length&&s.$builder.trigger("wpformsBuilderPanelLoaded",["setup"]),s.$builder.trigger("wpformsBuilderSetupReady")},load(){m.applyTemplateOnRequest()},setup(){s.$builder=l("#wpforms-builder"),s.$form=l("#wpforms-builder-form"),s.$formName=l("#wpforms-setup-name"),s.$panel=l("#wpforms-panel-setup"),s.$categories=l("#wpforms-panel-setup .wpforms-setup-templates-categories"),s.$subcategories=l("#wpforms-panel-setup .wpforms-setup-templates-subcategories"),o.spinner='<i class="wpforms-loading-spinner wpforms-loading-white wpforms-loading-inline"></i>',o.formID=s.$form.data("id")},events(){s.$builder.on("wpformsBuilderPanelLoaded",m.panelLoaded),s.$builder.on("wpformsPanelSwitched",m.setupTitleFocus),s.$builder.on("input","#wpforms-panel-field-settings-form_title",m.syncTitle).on("input","#wpforms-setup-name",m.syncTitle)},panelEvents(){s.$panel.on("keyup","#wpforms-setup-template-search",_.debounce(WPFormsFormTemplates.searchTemplate,200)).on("click",".wpforms-setup-templates-categories li div",WPFormsFormTemplates.selectCategory).on("click",".wpforms-setup-templates-categories li .chevron",WPFormsFormTemplates.toggleSubcategoriesList).on("click",".wpforms-setup-templates-subcategories li",WPFormsFormTemplates.selectSubCategory).on("click",".wpforms-template-select",m.selectTemplate).on("click",".wpforms-trigger-blank",m.selectBlankTemplate),s.$builder.on("wpformsBuilderReady wpformsBuilderPanelLoaded",m.filterTemplatesBySelectedCategory)},panelLoaded(e,t){"setup"===t&&(WPFormsFormTemplates.setup(),m.setup(),m.setSelectedTemplate(),m.setSelectedCategories(),m.panelEvents())},setPanelsToggleState(){s.$builder.find("#wpforms-panels-toggle button:not(.active)").toggleClass("wpforms-disabled",""===o.formID)},setTriggerBlankLink(){s.$builder.find(".wpforms-trigger-blank").attr({"data-template-name-raw":"Blank Form","data-template":"blank"})},setupTitleFocus(e=0,t=null){"setup"===(t=t||wpf.getQueryString("view"))&&(l("#wpforms-setup-name").val(l("#wpforms-panel-field-settings-form_title").val()),s.$formName.trigger("focus"))},setSelectedTemplate(){var e;s.$panel.length&&wpforms_builder.form_meta?.template&&(e=s.$builder.find(`.wpforms-template-select[data-template="${wpforms_builder.form_meta.template}"]`).closest(".wpforms-template")).length&&(e.addClass("selected").addClass("badge"),e.find(".wpforms-badge").remove(),e.hasClass("wpforms-user-template"))&&e.find(".wpforms-template-edit, .wpforms-template-remove").remove()},setSelectedCategories(){var e;s.$panel.length&&wpforms_builder.form_meta?.category&&(e=s.$categories.find(`li[data-category="${wpforms_builder.form_meta.category}"]`)).length&&(s.$categories.find("li").removeClass("active opened"),e.addClass("active opened"),(e=s.$subcategories.find(`li[data-subcategory="${wpforms_builder.form_meta.subcategory}"]`)).length)&&(s.$subcategories.find("li").removeClass("active"),e.addClass("active"))},filterTemplatesBySelectedCategory(){var e=s.$subcategories.find("li.active"),t=(e.length&&e.trigger("click"),s.$categories.find("> li.active"));!e.length&&t.length&&"all"!==t.data("category")&&t.find("div").trigger("click")},syncTitle(e){("wpforms-setup-name"===e.target.id?l("#wpforms-panel-field-settings-form_title"):l("#wpforms-setup-name")).val(e.target.value)},searchTemplate(e){console.warn('WARNING! Function "WPForms.Admin.Builder.Setup.searchTemplate( e )" has been deprecated, please use the new "WPFormsFormTemplates.searchTemplate( e )" function instead!'),WPFormsFormTemplates.searchTemplate(e)},selectCategory(e){console.warn('WARNING! Function "WPForms.Admin.Builder.Setup.selectCategory( e )" has been deprecated, please use the new "WPFormsFormTemplates.selectCategory( e )" function instead!'),WPFormsFormTemplates.selectCategory(e)},selectTemplate(e){e.preventDefault();var t,a,e=l(this);e.hasClass("education-modal")||(t=e.data("template"),!o.formID&&t.match(/wpforms-user-template-(\d+)/)&&e.data("create-url")?r.location.href=e.data("create-url"):(s.$panel.find(".wpforms-template").removeClass("active"),e.closest(".wpforms-template").addClass("active"),e.data("labelOriginal",e.html()),e.html(o.spinner+wpforms_builder.loading),a=m.getFormName(e),m.applyTemplate(a,t,e)))},getFormName(e){var e=e.data("template-name-raw"),t=s.$formName.val();return!t||a===t?e:t},applyTemplate(e,t,a){s.$builder.trigger("wpformsTemplateSelect",t),o.formID?m.selectTemplateExistingForm(e,t,a):WPFormsFormTemplates.selectTemplateProcess(e,t,a,m.selectTemplateProcessAjax)},selectBlankTemplate(e){e.preventDefault();var e=l(e.target),t=s.$formName.val()||wpforms_builder.blank_form;m.applyTemplate(t,"blank",e)},selectTemplateExistingForm(e,t,a){l.confirm({title:wpforms_builder.heads_up,content:wpforms_builder.template_confirm,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action(){WPFormsFormTemplates.selectTemplateProcess(e,t,a,m.selectTemplateProcessAjax)}},cancel:{text:wpforms_builder.cancel,action(){WPFormsFormTemplates.selectTemplateCancel()}}}})},selectTemplateProcess(e,t,a){console.warn('WARNING! Function "WPForms.Admin.Builder.Setup.selectTemplateProcess( formName, template, $button )" has been deprecated, please use the new "WPFormsFormTemplates.selectTemplateProcess( formName, template, $button, callback )" function instead!'),WPFormsFormTemplates.selectTemplateProcess(e,t,a,m.selectTemplateProcessAjax)},selectTemplateCancel(){console.warn('WARNING! Function "WPForms.Admin.Builder.Setup.selectTemplateCancel" has been deprecated, please use the new "WPFormsFormTemplates.selectTemplateCancel" function instead!'),WPFormsFormTemplates.selectTemplateCancel()},selectTemplateProcessAjax(t,e){WPFormsBuilder.showLoadingOverlay();var e={title:t,action:o.formID?"wpforms_update_form_template":"wpforms_new_form",template:e,form_id:o.formID,nonce:wpforms_builder.nonce},a=l(".wpforms-setup-templates-categories li.active").data("category"),s=l(".wpforms-setup-templates-subcategories li.active").data("subcategory");a&&(e.category=a),s&&(e.subcategory=s),"all"===a&&(e.subcategory="all"),l.post(wpforms_builder.ajax_url,e).done(function(e){e.success?(WPFormsBuilder.setCloseConfirmation(!1),r.location.href=wpf.getQueryString("force_desktop_view")?wpf.updateQueryString("force_desktop_view","1",e.data.redirect):e.data.redirect):(wpf.debug(e),"invalid_template"===e.data.error_type?m.selectTemplateProcessInvalidTemplateError(e.data.message,t):m.selectTemplateProcessError(e.data.message))}).fail(function(e,t){wpf.debug(e.responseText||t||""),m.selectTemplateProcessError("")})},selectTemplateProcessInvalidTemplateError(e,t){l.alert({title:wpforms_builder.heads_up,content:e,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.use_default_template,btnClass:"btn-confirm",keys:["enter"],action(){m.selectTemplateProcessAjax(t,"simple-contact-form-template"),WPFormsBuilder.hideLoadingOverlay()}},cancel:{text:wpforms_builder.cancel,action(){WPFormsFormTemplates.selectTemplateCancel(),WPFormsBuilder.hideLoadingOverlay()}}}})},selectTemplateProcessError(e){l.alert({title:e,content:wpforms_builder.error_select_template,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action(){WPFormsFormTemplates.selectTemplateCancel(),WPFormsBuilder.hideLoadingOverlay()}}}})},addonsModal(e,t,a){console.warn('WARNING! Function "WPForms.Admin.Builder.Setup.addonsModal( formName, template, $button )" has been deprecated, please use the new "WPFormsFormTemplates.addonsModal( formName, template, $button, callback )" function instead!'),WPFormsFormTemplates.addonsModal(e,t,a,m.selectTemplateProcessAjax)},installActivateAddons(e,t,a,s){console.warn('WARNING! Function "WPForms.Admin.Builder.Setup.installActivateAddons( addons, previousModal, formName, template )" has been deprecated, please use the new "WPFormsFormTemplates.installActivateAddons( addons, previousModal, formName, template, callback )" function instead!'),WPFormsFormTemplates.installActivateAddons(e,t,a,s,m.selectTemplateProcessAjax)},installActivateAddonsError(e,t){console.warn('WARNING! Function "WPForms.Admin.Builder.Setup.installActivateAddonsError( formName, template )" has been deprecated, please use the new "WPFormsFormTemplates.installActivateAddonsError( formName, template, callback )" function instead!'),WPFormsFormTemplates.installActivateAddonsError(e,t,m.selectTemplateProcessAjax)},installActivateAddonAjax(e){return console.warn('WARNING! Function "WPForms.Admin.Builder.Setup.installActivateAddonAjax( addon )" has been deprecated, please use the new "WPFormsFormTemplates.installActivateAddonAjax( addon )" function instead!'),WPFormsFormTemplates.installActivateAddonAjax(e)},applyTemplateOnRequest(){var e=new URLSearchParams(r.location.search),t=e.get("template_id");"setup"===e.get("view")&&!e.get("form_id")&&t&&s.$panel.find('.wpforms-template .wpforms-btn[data-template="'+t+'"]').trigger("click")}};return m}((document,window),jQuery),WPForms.Admin.Builder.Setup.init();
Save Changes
Rename File
Rename