navasena/wp-content/plugins/mailchimp-for-wp/assets/js/forms-admin.js

1 line
278 KiB
JavaScript
Raw Permalink Normal View History

2024-07-31 13:12:38 +07:00
(()=>{var e={361:(e,t,n)=>{const r=window.mc4wp_forms_i18n,i=n(4862),o={showType:function(e){let t=e.type;return t=t.charAt(0).toUpperCase()+t.slice(1),i("div",[i("label",r.fieldType),i("span",t)])},label:function(e){return i("div",[i("label",r.fieldLabel),i("input.widefat",{type:"text",value:e.label,onchange:t=>{e.label=t.target.value},placeholder:e.title})])},value:function(e){const t="hidden"===e.type;return i("div",[i("label",[t?r.value:r.initialValue," ",t?"":i("small",{style:"float: right; font-weight: normal;"},r.optional)]),i("input.widefat",{type:"text",value:e.value,onchange:t=>{e.value=t.target.value}}),t?"":i("p.description",r.valueHelp)])},numberMinMax:function(e){return i("div.mc4wp-row",[i("div.mc4wp-col.mc4wp-col-3",[i("label",r.min),i("input",{type:"number",onchange:t=>{e.min=t.target.value}})]),i("div.mc4wp-col.mc4wp-col-3",[i("label",r.max),i("input",{type:"number",onchange:t=>{e.max=t.target.value}})])])},isRequired:function(e){const t={type:"checkbox",checked:e.required,onchange:t=>{e.required=t.target.checked}};let n;return e.forceRequired&&(t.required=!0,t.disabled=!0,n=i("p.description",r.forceRequired)),i("div",[i("label.cb-wrap",[i("input",t),r.isFieldRequired]),n])},placeholder:function(e){return i("div",[i("label",[r.placeholder," ",i("small",{style:"float: right; font-weight: normal;"},r.optional)]),i("input.widefat",{type:"text",value:e.placeholder,onchange:t=>{e.placeholder=t.target.value},placeholder:""}),i("p.description",r.placeholderHelp)])},useParagraphs:function(e){return i("div",[i("label.cb-wrap",[i("input",{type:"checkbox",checked:e.wrap,onchange:t=>{e.wrap=t.target.checked}}),r.wrapInParagraphTags])])},choiceType:function(e){const t=[i("option",{value:"select",selected:"select"===e.type&&"selected"},r.dropdown),i("option",{value:"radio",selected:"radio"===e.type&&"selected"},r.radioButtons)];return e.acceptsMultipleValues&&t.push(i("option",{value:"checkbox",selected:"checkbox"===e.type&&"selected"},r.checkboxes)),i("div",[i("label",r.choiceType),i("select",{value:e.type,onchange:t=>{e.type=t.target.value}},t)])},choices:function(e){const t=[];return t.push(i("div",[i("label",r.choices),i("div.limit-height",[i("table",e.choices.map((function(t,n){return i("tr",{"data-id":n},[i("td.cb",i("input",{name:"selected",type:"checkbox"===e.type?"checkbox":"radio",onchange:t=>{e.choices=e.choices.map((n=>(n.value===t.target.value?n.selected=!n.selected:"checkbox"!==e.type&&(n.selected=!1),n)))},checked:t.selected,value:t.value,title:r.preselect})),i("td.stretch",i("input.widefat",{type:"text",value:t.label,placeholder:t.title,onchange:e=>{t.label=e.target.value}})),i("td",i("span",{title:r.remove,class:"dashicons dashicons-no-alt hover-activated",onclick:function(e){this.choices.splice(e,1)}.bind(e,n)},""))])})))])])),t},linkToTerms:function(e){return i("div",[i("label",r.agreeToTermsLink),i("input.widefat",{type:"text",value:e.link,onchange:t=>{e.link=t.target.value},placeholder:"https://..."})])}};e.exports=o},7779:(e,t,n)=>{const r={},i=n(361),o=n(4862);function a(e){for(let t=0;t<e.length;t++)e[t]=o("div.mc4wp-margin-s",e[t]);return e}r.render=function(e){const t=e.type;return"function"==typeof r[t]?a(r[t](e)):["select","radio","checkbox"].indexOf(t)>-1?a(r.choice(e)):a(r.text(e))},r.text=function(e){return[i.label(e),i.placeholder(e),i.value(e),i.isRequired(e),i.useParagraphs(e)]},r.choice=function(e){const t=[i.label(e),i.choiceType(e),i.choices(e)];return"select"===e.type&&t.push(i.placeholder(e)),t.push(i.useParagraphs(e)),"select"!==e.type&&"radio"!==e.type||t.push(i.isRequired(e)),t},r.hidden=function(e){return e.placeholder="",e.label="",e.wrap=!1,[i.showType(e),i.value(e)]},r.submit=function(e){return e.label="",e.placeholder="",[i.value(e),i.useParagraphs(e)]},r["terms-checkbox"]=function(e){return[i.label(e),i.linkToTerms(e),i.isRequired(e),i.useParagraphs(e)]},r.number=function(e){return[r.text(e),i.numberMinMax(e)]},e.exports=r},6685:(e,t,n)=>{const r=n(8915),i=n(4862),o=function(e){e.dom.checked&&e.dom.setAttribute("checked","true"),e.dom.value&&e.dom.setAttribute("value",