%PDF- %PDF-
Direktori : /home/tradesc/www/relax/wp-content/plugins/wpforms-lite/assets/js/admin/builder/ |
Current File : /home/tradesc/www/relax/wp-content/plugins/wpforms-lite/assets/js/admin/builder/settings.min.js |
var WPForms=window.WPForms||{};WPForms.Admin=WPForms.Admin||{},WPForms.Admin.Builder=WPForms.Admin.Builder||{},WPForms.Admin.Builder.Settings=WPForms.Admin.Builder.Settings||function(t,i){let a={};const n={};var l={init(){i(l.ready)},ready(){l.setup(),l.initTags(),l.events()},setup(){a={$builder:i("#wpforms-builder"),$panel:i("#wpforms-panel-settings"),$selectTags:i("#wpforms-panel-field-settings-form_tags")}},events(){a.$panel.on("keydown","#wpforms-panel-field-settings-form_tags-wrap input",l.addCustomTagInput).on("removeItem","#wpforms-panel-field-settings-form_tags-wrap select",l.editTagsRemoveItem).on("change","#wpforms-panel-field-settings-antispam_v3",l.enableAntispamV3).on("change","#wpforms-panel-field-settings-disable_entries",l.disableEntries).on("change","#wpforms-panel-field-settings-store_spam_entries",l.storeSpamEntries),a.$selectTags.on("change",l.changeTags)},enableAntispamV3(){i("#wpforms-panel-field-settings-antispam").prop("checked",!1).closest(".wpforms-panel-field").toggleClass("wpforms-hidden")},disableEntries(){l.toggleFilteringMessages(!i(this).prop("checked")&&i("#wpforms-panel-field-settings-store_spam_entries").prop("checked"))},storeSpamEntries(){l.toggleFilteringMessages(i(this).prop("checked"))},toggleFilteringMessages(e){i("#wpforms-panel-field-anti_spam-filtering_store_spam").is(":checked")&&(i("#wpforms-panel-field-anti_spam-country_filter-message-wrap").toggleClass("wpforms-hidden",e),i("#wpforms-panel-field-anti_spam-keyword_filter-message-wrap").toggleClass("wpforms-hidden",e))},initTags(e=null){var s;(e=e?.length?e:a.$selectTags).length&&"function"==typeof t.Choices&&(n.tagsChoicesObj=new Choices(e[0],wpforms_builder_settings.choicesjs_config),s=n.tagsChoicesObj.getValue(!0),n.tagsChoicesObj.clearStore().setChoices(wpforms_builder_settings.all_tags_choices,"value","label",!0).setChoiceByValue(s),e.data("choicesjs",n.tagsChoicesObj),l.initTagsHiddenInput())},initTagsHiddenInput(){a.$selectTagsHiddenInput=i('<input type="hidden" name="settings[form_tags_json]">'),a.$selectTags.closest(".wpforms-panel-field").append(a.$selectTagsHiddenInput),l.changeTags(null),!0===wpf.initialSave&&(wpf.savedState=wpf.getFormState("#wpforms-builder-form"))},addCustomTagInput(e){var s,t;["Enter",","].indexOf(e.key)<0||(e.preventDefault(),e.stopPropagation(),n.tagsChoicesObj&&0!==e.target.value.length&&(s=_.escape(e.target.value).trim(),t=_.map(n.tagsChoicesObj.getValue(),"label").map(function(e){return e.toLowerCase().trim()}),""===s||0<=t.indexOf(s.toLowerCase())?n.tagsChoicesObj.clearInput():(l.addCustomTagInputCreate(s),l.changeTags(e))))},editTagsRemoveItem(s){var e,t,a;0<=_.map(wpforms_builder_settings.all_tags_choices,"value").indexOf(s.detail.value)||(t=(e=i(s.target).data("choicesjs")).getValue(!0),a=_.filter(e._currentState.choices,function(e){return e.value!==s.detail.value}),e.clearStore().setChoices(a,"value","label",!0).setChoiceByValue(t))},addCustomTagInputCreate(e){var s=_.find(wpforms_builder_settings.all_tags_choices,{label:e});s&&s.value?n.tagsChoicesObj.setChoiceByValue(s.value):n.tagsChoicesObj.setChoices([{value:e,label:e,selected:!0}],"value","label",!1),n.tagsChoicesObj.clearInput()},changeTags(e){var s=n.tagsChoicesObj.getValue(),t=[];for(let e=0;e<s.length;e++)t.push({value:s[e].value,label:s[e].label});a.$selectTagsHiddenInput.val(JSON.stringify(t))}};return l}((document,window),jQuery),WPForms.Admin.Builder.Settings.init();