File Editor
Directories:
.. (Back)
components
integrations
Files:
admin-builder-conditional-logic-core.js
admin-builder-providers.js
admin-builder.js
admin-editor.js
admin-notifications.js
admin-notifications.min.js
admin-utils.js
admin.js
admin.min.js
chart.min.js
choices.min.js
flatpickr.min.js
jquery.conditionals.min.js
jquery.inputmask.bundle.min.js
jquery.insert-at-caret.min.js
jquery.jquery-confirm.min.js
jquery.matchHeight-min.js
jquery.minicolors.min.js
jquery.payment.min.js
jquery.serialize-object.min.js
jquery.timepicker.min.js
jquery.tooltipster.min.js
jquery.validate.js
jquery.validate.min.js
list.min.js
lity.min.js
mailcheck.min.js
moment-with-locales.min.js
moment.min.js
purify.min.js
text-limit.js
text-limit.min.js
wpforms-confirmation.js
wpforms.js
Create New File
Create
Edit File: admin.min.js
!function(l){"use strict";var f,s={settings:{iconActivate:'<i class="fa fa-toggle-on fa-flip-horizontal" aria-hidden="true"></i>',iconDeactivate:'<i class="fa fa-toggle-on" aria-hidden="true"></i>',iconInstall:'<i class="fa fa-cloud-download" aria-hidden="true"></i>',iconSpinner:'<i class="fa fa-spinner fa-spin" aria-hidden="true"></i>',mediaFrame:!1},init:function(){f=this.settings,l(document).ready(s.ready),s.initFormOverview(),s.initEntriesSingle(),s.initEntriesList(),s.initWelcome(),s.initAddons(),s.initSettings(),s.initTools(),s.initUpgrades()},ready:function(){l(".notice").show(),l("#screen-meta-links, #screen-meta").prependTo("#wpforms-header-temp").show(),s.initChoicesJS(),s.initCheckboxMultiselectColumns(),l(".wpforms-color-picker").minicolors(),l(".wpforms-file-upload").each(function(){var e=l(this).find("input[type=file]"),n=l(this).find("label"),o=n.html();e.on("change",function(e){var t="";this.files&&1<this.files.length?t=(this.getAttribute("data-multiple-caption")||"").replace("{count}",this.files.length):e.target.value&&(t=e.target.value.split("\\").pop()),t?n.find(".fld").html(t):n.html(o)}),e.on("focus",function(){e.addClass("has-focus")}).on("blur",function(){e.removeClass("has-focus")})}),jconfirm.defaults={closeIcon:!0,backgroundDismiss:!0,escapeKey:!0,animationBounce:1,useBootstrap:!1,theme:"modern",boxWidth:"400px",animateFromElement:!1},l(document).on("click",".wpforms-upgrade-modal",function(){l.alert({title:!1,content:wpforms_admin.upgrade_modal,icon:"fa fa-info-circle",type:"blue",boxWidth:"565px",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}})}),s.initLity(),s.initFlyoutMenu(),l(document).trigger("wpformsReady")},initChoicesJS:function(){l(".choicesjs-select").each(function(){var e=l(this),t={searchEnabled:!1};e.attr("multiple")&&(t.searchEnabled=!0,t.removeItemButton=!0),e.data("placeholder")&&(t.placeholderValue=e.data("placeholder")),"off"===e.data("sorting")&&(t.shouldSort=!1),e.data("search")&&(t.searchEnabled=!0),t.loadingText=wpforms_admin.choicesjs_loading,t.noResultsText=wpforms_admin.choicesjs_no_results,t.noChoicesText=wpforms_admin.choicesjs_no_choices,t.itemSelectText=wpforms_admin.choicesjs_item_select,e.data("choicesjs",new Choices(e[0],t))})},initCheckboxMultiselectColumns:function(){l(document).on("change",".checkbox-multiselect-columns input",function(){var e=l(this),t=e.parent(),n=e.closest(".checkbox-multiselect-columns"),o=t.text(),i="check-item-"+e.val(),s=n.find("#"+i);e.prop("checked")?(e.parent().addClass("checked"),s.length||n.find(".second-column ul").append('<li id="'+i+'">'+o+"</li>")):(e.parent().removeClass("checked"),n.find("#"+i).remove())}),l(document).on("click",".checkbox-multiselect-columns .all",function(e){e.preventDefault(),l(this).closest(".checkbox-multiselect-columns").find("input[type=checkbox]").prop("checked",!0).trigger("change"),l(this).remove()})},initFormOverview:function(){l(document).on("click","#wpforms-overview .wp-list-table .delete a, #wpforms-overview .wp-list-table .duplicate a",function(e){e.preventDefault();var t=l(this).attr("href"),n=l(this).parent().hasClass("delete")?wpforms_admin.form_delete_confirm:wpforms_admin.form_duplicate_confirm;l.confirm({title:!1,content:n,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){window.location=t}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})})},initEntriesSingle:function(){"wpforms-entries"===s.getQueryString("page")&&"details"===s.getQueryString("view")&&s.entryHotkeys(),l(document).on("click","#wpforms-entries-single .submitdelete",function(e){e.preventDefault();var t=l(this).attr("href");l.confirm({title:!1,content:wpforms_admin.entry_delete_confirm,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){window.location=t}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})}),l(document).on("click","#wpforms-entries-single .wpforms-entry-print a",function(e){e.preventDefault(),window.open(l(this).attr("href"))}),l(document).on("click","#wpforms-entries-single .wpforms-empty-field-toggle",function(e){e.preventDefault(),"true"===wpCookies.get("wpforms_entry_hide_empty")?(wpCookies.remove("wpforms_entry_hide_empty"),l(this).text(wpforms_admin.entry_empty_fields_hide)):(wpCookies.set("wpforms_entry_hide_empty","true",2592e3),l(this).text(wpforms_admin.entry_empty_fields_show)),l(".wpforms-entry-field.empty, .wpforms-edit-entry-field.empty").toggle()}),l(document).on("click","#wpforms-entries-single .wpforms-entry-notes-new .add",function(e){e.preventDefault(),l(this).hide().next("form").slideToggle()}),l(document).on("click","#wpforms-entries-single .wpforms-entry-notes-new .cancel",function(e){e.preventDefault(),l(this).closest("form").slideToggle(),l(".wpforms-entry-notes-new .add").show()}),l(document).on("click","#wpforms-entries-single .wpforms-entry-notes-byline .note-delete",function(e){e.preventDefault();var t=l(this).attr("href");l.confirm({title:!1,content:wpforms_admin.entry_note_delete_confirm,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){window.location=t}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})})},entryHotkeys:function(){l(document).keydown(function(e){if(74!==e.keyCode||s.isFormTypeNode(e.target.nodeName)){if(75===e.keyCode&&!s.isFormTypeNode(e.target.nodeName)){var t=l("#wpforms-entry-next-link").attr("href");"#"!==t&&(window.location.href=t)}}else{var n=l("#wpforms-entry-prev-link").attr("href");"#"!==n&&(window.location.href=n)}})},initEntriesList:function(){l(document).on("click","#wpforms-entries-table-edit-columns",function(e){e.preventDefault(),s.entriesListFieldColumn()}),l(document).on("click","#wpforms-entries-list .form-selector .toggle",function(e){e.preventDefault(),l(this).toggleClass("active").next(".form-list").toggle()}),l(document).on("click","#wpforms-entries-list .wp-list-table .delete",function(e){e.preventDefault();var t=l(this).attr("href");l.confirm({title:!1,content:wpforms_admin.entry_delete_confirm,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){window.location=t}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})}),l(document).on("click","#wpforms-entries-list .wp-list-table .indicator-star",function(e){e.preventDefault();var t=l(this),n="",o=Number(l("#wpforms-entries-list .starred-num").text()),i=t.data("id"),s=t.data("form-id");t.hasClass("star")?(n="star",o++,t.attr("title",wpforms_admin.entry_unstar)):(n="unstar",o--,t.attr("title",wpforms_admin.entry_star)),t.toggleClass("star unstar"),l("#wpforms-entries-list .starred-num").text(o);var a={task:n,action:"wpforms_entry_list_star",nonce:wpforms_admin.nonce,entryId:i,formId:s};l.post(wpforms_admin.ajax_url,a)}),l(document).on("click","#wpforms-entries-list .wp-list-table .indicator-read",function(e){e.preventDefault();var t=l(this),n="",o=Number(l("#wpforms-entries-list .unread-num").text()),i=t.data("id");t.hasClass("read")?(n="read",o--,t.attr("title",wpforms_admin.entry_unread)):(n="unread",o++,t.attr("title",wpforms_admin.entry_read)),t.toggleClass("read unread"),l("#wpforms-entries-list .unread-num").text(o);var s={task:n,action:"wpforms_entry_list_read",nonce:wpforms_admin.nonce,entryId:i,formId:t.data("form-id")};l.post(wpforms_admin.ajax_url,s)}),l(document).on("click","#wpforms-entries-list .form-details-actions-deleteall",function(e){e.preventDefault();var t=l(this).attr("href");l.confirm({title:wpforms_admin.heads_up,content:wpforms_admin.entry_delete_all_confirm,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){window.location=t}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})}),l(document).on("heartbeat-send",function(e,t){var n=l("#wpforms-entries-list");if(n.length&&!n.find(".wpforms-dash-widget").length){var o=n.find("#wpforms-entries-table").data("last-entry-id");void 0!==o&&(t.wpforms_new_entries_entry_id=o,t.wpforms_new_entries_form_id=n.find("input[name=form_id]").val())}}),l(document).on("heartbeat-tick",function(e,t){var n,o=l("#wpforms-entries-list");o.length&&t.wpforms_new_entries_notification&&(n=o.find(".wp-list-table thead tr").first().children().length,o.find(".new-entries-notification").length||o.find(".wp-list-table thead").append('<tr class="new-entries-notification"><td colspan="'+n+'"><a href=""></a></td></tr>'),o.find(".new-entries-notification a").text(t.wpforms_new_entries_notification).slideDown({duration:500,start:function(){l(this).css({display:"block"})}}))})},entriesListFieldColumn:function(){l.alert({title:wpforms_admin.entry_field_columns,boxWidth:"500px",content:f.iconSpinner+l("#wpforms-field-column-select").html(),onContentReady:function(){var e=this.$content,t=e.find("select"),n=new Choices(t[0],{shouldSort:!1,removeItemButton:!0,placeholderValue:wpforms_admin.choicesjs_fields_select+"...",loadingText:wpforms_admin.choicesjs_loading,noResultsText:wpforms_admin.choicesjs_no_results,noChoicesText:wpforms_admin.choicesjs_no_choices,itemSelectText:wpforms_admin.choicesjs_item_select,callbackOnInit:function(){e.find(".fa").remove(),e.find("form").show()}});l(".jconfirm-content-pane, .jconfirm-box").css("overflow","visible"),n.passedElement.element.addEventListener("change",function(){n.hideDropdown(!0)},!1)},buttons:{confirm:{text:wpforms_admin.save_refresh,btnClass:"btn-confirm",keys:["enter"],action:function(){this.$content.find("form").submit()}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})},initWelcome:function(){l(document).on("click","#wpforms-welcome .play-video",function(e){e.preventDefault();l.dialog({title:!1,content:'<div class="video-container"><iframe width="1280" height="720" src="https://www.youtube-nocookie.com/embed/o2nE1P74WxQ?rel=0&showinfo=0&autoplay=1" frameborder="0" allowfullscreen></iframe></div>',closeIcon:!0,boxWidth:"70%"})})},initAddons:function(){l(document).on("wpformsReady",function(){if(l("#wpforms-admin-addons").length&&(l(".addon-item .details").matchHeight({byrow:!1,property:"height"}),l("#wpforms-admin-addons-list").length)){var n=new List("wpforms-admin-addons-list",{valueNames:["addon-name"]});l("#wpforms-admin-addons-search").on("keyup",function(){var e=l(this).val(),t=l("#addons-heading");e?t.text(wpforms_admin.addon_search):t.text(t.data("text")),n.search(e)})}}),l(document).on("click","#wpforms-admin-addons .addon-item button",function(e){if(e.preventDefault(),l(this).hasClass("disabled"))return!1;s.addonToggle(l(this))})},addonToggle:function(t){var n,o,i,s,a,r,c=t.closest(".addon-item"),e=t.attr("data-plugin"),d=t.attr("data-type");if(t.hasClass("status-go-to-url"))window.open(t.attr("data-plugin"),"_blank");else{if(t.prop("disabled",!0).addClass("loading"),t.html(f.iconSpinner),t.hasClass("status-active"))n="wpforms_deactivate_addon",o="status-inactive","plugin"===d&&(o+=" button button-secondary"),i=wpforms_admin.addon_inactive,s=wpforms_admin.addon_activate,"addon"===d&&(s=f.iconActivate+s),a=f.iconDeactivate+wpforms_admin.addon_deactivate;else if(t.hasClass("status-inactive"))n="wpforms_activate_addon",o="status-active","plugin"===d&&(o+=" button button-secondary disabled"),i=wpforms_admin.addon_active,s=wpforms_admin.addon_deactivate,"addon"===d?s=f.iconDeactivate+s:"plugin"===d&&(s=wpforms_admin.addon_activated),a=f.iconActivate+wpforms_admin.addon_activate;else{if(!t.hasClass("status-download"))return;n="wpforms_install_addon",o="status-active","plugin"===d&&(o+=" button disabled"),i=wpforms_admin.addon_active,s=wpforms_admin.addon_activated,"addon"===d&&(s=f.iconActivate+wpforms_admin.addon_deactivate),a=f.iconInstall+wpforms_admin.addon_activate}var m={action:n,nonce:wpforms_admin.nonce,plugin:e,type:d};l.post(wpforms_admin.ajax_url,m,function(e){e.success?("wpforms_install_addon"===n?(t.attr("data-plugin",e.data.basename),r=e.data.msg,e.data.is_activated||(o="status-inactive","plugin"===d&&(o="button"),i=wpforms_admin.addon_inactive,s=f.iconActivate+wpforms_admin.addon_activate)):r=e.data,c.find(".actions").append('<div class="msg success">'+r+"</div>"),c.find("span.status-label").removeClass("status-active status-inactive status-download").addClass(o).removeClass("button button-primary button-secondary disabled").text(i),t.removeClass("status-active status-inactive status-download").removeClass("button button-primary button-secondary disabled").addClass(o).html(s)):("download_failed"===e.data[0].code?"addon"===d?c.find(".actions").append('<div class="msg error">'+wpforms_admin.addon_error+"</div>"):c.find(".actions").append('<div class="msg error">'+wpforms_admin.plugin_error+"</div>"):c.find(".actions").append('<div class="msg error">'+e.data+"</div>"),t.html(a)),t.prop("disabled",!1).removeClass("loading"),setTimeout(function(){l(".addon-item .msg").remove()},3e3)}).fail(function(e){console.log(e.responseText)})}},initSettings:function(){l(document).on("wpformsReady",function(){if(l("#wpforms-settings").length){var e=s.getQueryString("wpforms-integration"),t=s.getQueryString("jump");e?l("body").animate({scrollTop:l("#wpforms-integration-"+e).offset().top},1e3):t&&l("body").animate({scrollTop:l("#"+t).offset().top},1e3),l(".wpforms-admin-settings-form").conditions([{conditions:{element:"#wpforms-setting-gdpr",type:"checked",operator:"is"},actions:{if:{element:"#wpforms-setting-row-gdpr-disable-uuid,#wpforms-setting-row-gdpr-disable-details",action:"show"},else:{element:"#wpforms-setting-row-gdpr-disable-uuid,#wpforms-setting-row-gdpr-disable-details",action:"hide"}},effect:"appear"},{conditions:{element:"input[name=recaptcha-type]:checked",type:"value",operator:"=",condition:"v3"},actions:{if:{element:"#wpforms-setting-row-recaptcha-v3-threshold",action:"show"},else:{element:"#wpforms-setting-row-recaptcha-v3-threshold",action:"hide"}},effect:"appear"}])}}),l(document).on("change","#wpforms-setting-disable-css",function(){s.settingsFormStylesAlert(l(this).val())}),l(document).on("click",".wpforms-setting-row-image button",function(e){e.preventDefault(),s.imageUploadModal(l(this))}),l(document).on("click","#wpforms-setting-license-key-verify",function(e){e.preventDefault(),s.licenseVerify(l(this))}),l(document).on("click","#wpforms-setting-license-key-deactivate",function(e){e.preventDefault(),s.licenseDeactivate(l(this))}),l(document).on("click","#wpforms-setting-license-key-refresh",function(e){e.preventDefault(),s.licenseRefresh(l(this))}),l(document).on("click",".wpforms-settings-provider-connect",function(e){e.preventDefault();var t=l(this);s.integrationConnect(t)}),l(document).on("click",".wpforms-settings-provider-accounts-list a",function(e){e.preventDefault(),s.integrationDisconnect(l(this))}),l(document).on("click",".wpforms-settings-provider:not(.focus-out) .wpforms-settings-provider-header",function(e){e.preventDefault(),l(this).parent().find(".wpforms-settings-provider-accounts").slideToggle(),l(this).parent().find(".wpforms-settings-provider-logo i").toggleClass("fa-chevron-right fa-chevron-down")}),l(document).on("click",".wpforms-settings-provider-accounts-toggle a",function(e){e.preventDefault();var t=l(this).parent().next(".wpforms-settings-provider-accounts-connect");t.find("input[type=text], input[type=password]").val(""),t.slideToggle()})},settingsFormStylesAlert:function(e){if("2"===e)var t=wpforms_admin.settings_form_style_base;else{if("3"!==e)return;t=wpforms_admin.settings_form_style_none}l.alert({title:wpforms_admin.heads_up,content:t,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}})},imageUploadModal:function(e){if(f.media_frame)f.media_frame.open();else{var t=l(e).closest(".wpforms-setting-field");f.media_frame=wp.media.frames.wpforms_media_frame=wp.media({className:"media-frame wpforms-media-frame",frame:"select",multiple:!1,title:wpforms_admin.upload_image_title,library:{type:"image"},button:{text:wpforms_admin.upload_image_button}}),f.media_frame.on("select",function(){var e=f.media_frame.state().get("selection").first().toJSON();t.find("input[type=text]").val(e.url),t.find("img").remove(),t.prepend('<img src="'+e.url+'">')}),f.media_frame.open()}},licenseVerify:function(e){var i=l(e),s=i.closest(".wpforms-setting-row"),t=i.outerWidth(),a=i.text(),n={action:"wpforms_verify_license",nonce:wpforms_admin.nonce,license:l("#wpforms-setting-license-key").val()};i.html(f.iconSpinner).css("width",t).prop("disabled",!0),l.post(wpforms_admin.ajax_url,n,function(e){var t,n="fa fa-check-circle",o="green";e.success?(t=e.data.msg,s.find(".type, .desc, #wpforms-setting-license-key-deactivate").show(),s.find(".type strong").text(e.data.type),l(".wpforms-license-notice").remove()):(n="fa fa-exclamation-circle",o="orange",t=e.data,s.find(".type, .desc, #wpforms-setting-license-key-deactivate").hide()),l.alert({title:!1,content:t,icon:n,type:o,buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}}),i.html(a).css("width","auto").prop("disabled",!1)}).fail(function(e){console.log(e.responseText)})},licenseDeactivate:function(e){var i=l(e),s=i.closest(".wpforms-setting-row"),t=i.outerWidth(),a=i.text(),n={action:"wpforms_deactivate_license",nonce:wpforms_admin.nonce};i.html(f.iconSpinner).css("width",t).prop("disabled",!0),l.post(wpforms_admin.ajax_url,n,function(e){var t="fa fa-info-circle",n="blue",o=e.data;e.success?(s.find("#wpforms-setting-license-key").val(""),s.find(".type, .desc, #wpforms-setting-license-key-deactivate").hide()):(t="fa fa-exclamation-circle",n="orange"),l.alert({title:!1,content:o,icon:t,type:n,buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}}),i.html(a).css("width","auto").prop("disabled",!1)}).fail(function(e){console.log(e.responseText)})},licenseRefresh:function(e){var i=l(e).closest(".wpforms-setting-row"),t={action:"wpforms_refresh_license",nonce:wpforms_admin.nonce,license:l("#wpforms-setting-license-key").val()};l.post(wpforms_admin.ajax_url,t,function(e){var t,n="fa fa-check-circle",o="green";e.success?(t=e.data.msg,i.find(".type strong").text(e.data.type)):(n="fa fa-exclamation-circle",o="orange",t=e.data,i.find(".type, .desc, #wpforms-setting-license-key-deactivate").hide()),l.alert({title:!1,content:t,icon:n,type:o,buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}})}).fail(function(e){console.log(e.responseText)})},integrationConnect:function(n){var e=n.outerWidth(),o=n.text(),i=n.closest(".wpforms-settings-provider"),t={action:"wpforms_settings_provider_add_"+n.data("provider"),data:n.closest("form").serialize(),provider:n.data("provider"),nonce:wpforms_admin.nonce};n.html("Connecting...").css("width",e).prop("disabled",!0),l.post(wpforms_admin.ajax_url,t,function(e){if(e.success)i.find(".wpforms-settings-provider-accounts-list ul").append(e.data.html),i.addClass("connected"),n.closest(".wpforms-settings-provider-accounts-connect").slideToggle();else{var t=wpforms_admin.provider_auth_error;e.hasOwnProperty("data")&&e.data.hasOwnProperty("error_msg")&&(t+="\n"+e.data.error_msg),l.alert({title:!1,content:t,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}})}n.html(o).css("width","auto").prop("disabled",!1)}).fail(function(e){console.log(e.responseText)})},integrationDisconnect:function(e){var n=l(e),o=n.parents(".wpforms-settings-provider"),t={action:"wpforms_settings_provider_disconnect_"+n.data("provider"),provider:n.data("provider"),key:n.data("key"),nonce:wpforms_admin.nonce};l.confirm({title:wpforms_admin.heads_up,content:wpforms_admin.provider_delete_confirm,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){l.post(wpforms_admin.ajax_url,t,function(e){if(e.success){n.parent().parent().remove();var t=o.find(".wpforms-settings-provider-accounts-list li").length;void 0!==t&&0!==t||o.removeClass("connected")}else console.log(e)}).fail(function(e){console.log(e.responseText)})}},cancel:{text:wpforms_admin.cancel,keys:["esc"]}}})},initTools:function(){l(document).on("click","#wpforms-ssl-verify",function(e){e.preventDefault(),s.verifySSLConnection()}),l(document).on("click","#wpforms-importer-forms-submit",function(e){if(e.preventDefault(),l("#wpforms-importer-forms input:checked").length){var t=[];l("#wpforms-importer-forms input:checked").each(function(e){t[e]=l(this).val()}),wpforms_admin.isPro?s.importForms(t):s.analyzeForms(t)}else l.alert({title:!1,content:wpforms_admin.importer_forms_required,icon:"fa fa-info-circle",type:"blue",buttons:{confirm:{text:wpforms_admin.ok,btnClass:"btn-confirm",keys:["enter"]}}})}),l(document).on("click","#wpforms-importer-continue-submit",function(e){e.preventDefault(),s.importForms(f.formIDs)})},verifySSLConnection:function(){var t=l("#wpforms-ssl-verify"),n=t.text(),o=t.outerWidth(),i=t.parent(),e={action:"wpforms_verify_ssl",nonce:wpforms_admin.nonce};t.css("width",o).prop("disabled",!0).text(wpforms_admin.testing),l.post(wpforms_admin.ajax_url,e,function(e){console.log(e),i.find(".wpforms-alert, .wpforms-ssl-error").remove(),e.success&&t.before('<div class="wpforms-alert wpforms-alert-success">'+e.data.msg+"</div>"),!e.success&&e.data.msg&&t.before('<div class="wpforms-alert wpforms-alert-danger">'+e.data.msg+"</div>"),!e.success&&e.data.debug&&t.before('<div class="wpforms-ssl-error pre-error">'+e.data.debug+"</div>"),t.css("width",o).prop("disabled",!1).text(n)})},analyzeForms:function(e){var t=l("#wpforms-importer-analyze");t.find(".form-total").text(e.length),t.find(".form-current").text("1"),l("#wpforms-importer-forms").hide(),t.show(),f.analyzeQueue=e,f.analyzed=0,f.analyzeUpgrade=[],f.formIDs=e,s.analyzeForm()},analyzeForm:function(){var n=l("#wpforms-importer-analyze"),o=_.first(f.analyzeQueue),e={action:"wpforms_import_form_"+s.getQueryString("provider"),analyze:1,form_id:o,nonce:wpforms_admin.nonce};l.post(wpforms_admin.ajax_url,e,function(e){if(e.success)if(_.isEmpty(e.data.upgrade_plain)&&_.isEmpty(e.data.upgrade_omit)||f.analyzeUpgrade.push({name:e.data.name,fields:_.union(e.data.upgrade_omit,e.data.upgrade_plain)}),f.analyzeQueue=_.without(f.analyzeQueue,o),f.analyzed++,_.isEmpty(f.analyzeQueue))if(_.isEmpty(f.analyzeUpgrade))s.importForms(f.formIDs);else{var t=wp.template("wpforms-importer-upgrade");n.find(".upgrade").append(t(f.analyzeUpgrade)),n.find(".upgrade").show(),n.find(".process-analyze").hide()}else n.find(".form-current").text(f.analyzed+1),s.analyzeForm()})},importForms:function(e){var t=l("#wpforms-importer-process");t.find(".form-total").text(e.length),t.find(".form-current").text("1"),l("#wpforms-importer-forms, #wpforms-importer-analyze").hide(),t.show(),f.importQueue=e,f.imported=0,s.importForm()},importForm:function(){var n=l("#wpforms-importer-process"),o=_.first(f.importQueue),e={action:"wpforms_import_form_"+s.getQueryString("provider"),form_id:o,nonce:wpforms_admin.nonce};l.post(wpforms_admin.ajax_url,e,function(e){var t;e.success&&(t=e.data.error?wp.template("wpforms-importer-status-error"):wp.template("wpforms-importer-status-update"),n.find(".status").prepend(t(e.data)),n.find(".status").show(),f.importQueue=_.without(f.importQueue,o),f.imported++,_.isEmpty(f.importQueue)?(n.find(".process-count").hide(),n.find(".forms-completed").text(f.imported),n.find(".process-completed").show()):(n.find(".form-current").text(f.imported+1),s.importForm()))})},initUpgrades:function(){l(document).on("click","#wpforms-upgrade-143 button",function(e){e.preventDefault();var n=l(this),t=n.outerWidth(),o=l("#wpforms-upgrade-143 .status"),i={action:"wpforms_upgrade_143",nonce:wpforms_admin.nonce,init:!0,incomplete:n.data("incomplete")};n.html(f.iconSpinner).css("width",t).prop("disabled",!0),l.post(wpforms_admin.ajax_url,i,function(e){if(e.success){f.upgraded=Number(e.data.upgraded),f.upgradeTotal=Number(e.data.total);var t=Math.round(Number(f.upgraded)/Number(f.upgradeTotal)*100);n.remove(),o.find(".bar").css("width",t+"%"),o.show().find(".total").text(f.upgradeTotal),o.find(".current").text(f.upgraded),o.find(".percent").text(t+"%"),s.upgrade143()}})})},upgrade143:function(){var n=l("#wpforms-upgrade-143 .status"),e={action:"wpforms_upgrade_143",nonce:wpforms_admin.nonce,upgraded:f.upgraded};l.post(wpforms_admin.ajax_url,e,function(e){if(e.success){f.upgraded=Number(f.upgraded)+Number(e.data.count);var t=Math.round(Number(f.upgraded)/Number(f.upgradeTotal)*100);n.find(".bar").css("width",t+"%"),Number(e.data.count)<10?(n.find(".progress-bar").addClass("complete"),n.find(".msg").text(wpforms_admin.upgrade_completed)):(n.find(".current").text(f.upgraded),n.find(".percent").text(t+"%"),s.upgrade143())}})},initFlyoutMenu:function(){var o=l("#wpforms-flyout");if(0!==o.length){var e=o.find(".wpforms-flyout-head"),t=e.find("img"),n={state:"inactive",srcInactive:t.attr("src"),srcActive:t.data("active")};e.on("click",function(e){e.preventDefault(),"active"===n.state?(o.removeClass("opened"),t.attr("src",n.srcInactive),n.state="inactive"):(o.addClass("opened"),t.attr("src",n.srcActive),n.state="active")});var i=l("#wpfooter");if(0!==i.length){var s=l("#wpforms-overview, #wpforms-entries-list"),a=i.offset().top,r=a+i.height(),c=0<s.length?s.offset().top+s.height()+85:0;l(window).on("resize scroll",_.debounce(function(e){var t=l(window).scrollTop(),n=t+l(window).height();r<=n&&t<=a&&n<c?o.addClass("out"):o.removeClass("out")},50)),l(window).trigger("scroll")}}},initLity:function(){l(document).on("lity:ready",function(e,t){var n=t.element(),o=t.opener(),i=void 0!==o?o.data("lity-srcset"):"";void 0!==i&&""!==i&&n.find(".lity-content img").attr("srcset",i)})},isFormTypeNode:function(e){return"TEXTAREA"===(e=e||!1)||"INPUT"===e||"SELECT"===e},getQueryString:function(e){var t=new RegExp("[?&]"+e+"=([^&]*)").exec(window.location.search);return t&&decodeURIComponent(t[1].replace(/\+/g," "))},debug:function(e){s.isDebug()&&("object"==typeof e||e.constructor===Array?(console.log("WPForms Debug:"),console.log(e)):console.log("WPForms Debug: "+e))},isDebug:function(){return window.location.hash&&"#wpformsdebug"===window.location.hash}};s.init(),window.WPFormsAdmin=s}(jQuery);
Save Changes
Rename File
Rename