diff options
Diffstat (limited to 'plugins/jetpack/_inc/build/contact-form/js/grunion.min.js')
-rw-r--r-- | plugins/jetpack/_inc/build/contact-form/js/grunion.min.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/plugins/jetpack/_inc/build/contact-form/js/grunion.min.js b/plugins/jetpack/_inc/build/contact-form/js/grunion.min.js index c7a7a82d..f04cd4f6 100644 --- a/plugins/jetpack/_inc/build/contact-form/js/grunion.min.js +++ b/plugins/jetpack/_inc/build/contact-form/js/grunion.min.js @@ -1,4 +1,4 @@ /* Do not modify this file directly. It is compiled from other files. */ /* jshint onevar: false, devel: true, smarttabs: true */ /* global GrunionFB_i18n: true, FB, ajax_nonce_shortcode, ajax_nonce_json, ajaxurl, postId */ -window.FB||(window.FB={}),GrunionFB_i18n=jQuery.extend({nameLabel:"Name",emailLabel:"Email",urlLabel:"Website",commentLabel:"Comment",newLabel:"New Field",optionsLabel:"Options",optionLabel:"Option",firstOptionLabel:"First option",problemGeneratingForm:"Oops, there was a problem generating your form. You'll likely need to try again.",moveInstructions:"Drag up or down\nto re-arrange",moveLabel:"move",editLabel:"edit",savedMessage:"Saved successfully",requiredLabel:"(required)",exitConfirmMessage:"Are you sure you want to exit the form editor without saving? Any changes you have made will be lost.",maxNewFields:5,invalidEmail:" is an invalid email address."},GrunionFB_i18n),GrunionFB_i18n.moveInstructions=GrunionFB_i18n.moveInstructions.replace("\n","<br />"),FB.span=jQuery("<span>"),FB.esc_html=function(e){return FB.span.text(e).html()},FB.esc_attr=function(e){return e=FB.esc_html(e),e.replace('"',""").replace("'","'")},FB.ContactForm=function(){function e(){try{C++,C<=q?(jQuery("#fb-extra-fields").append('<div id="fb-new-field'+C+'" fieldid="'+C+'" class="fb-new-fields"><div class="fb-fields"><div id="'+C+'" class="fb-remove"></div><label fieldid="'+C+'" for="fb-field'+C+'"><span class="label-text">'+GrunionFB_i18n.newLabel+'</span> </label><input type="text" id="fb-field'+C+'" disabled="disabled" /></div></div>'),k.fields[C]={label:GrunionFB_i18n.newLabel,type:"text",required:!1,options:[],order:"5"},C===q&&jQuery("#fb-new-field").hide(),O=0,T={},jQuery("#fb-new-options").html('<label for="fb-option0">'+GrunionFB_i18n.optionsLabel+'</label><input type="text" id="fb-option0" optionid="0" value="'+GrunionFB_i18n.firstOptionLabel+'" class="fb-options" />'),jQuery("#fb-options").hide(),jQuery("#fb-new-label").val(GrunionFB_i18n.newLabel),jQuery("#fb-new-type").val("text"),jQuery("#fb-field-id").val(C),setTimeout(function(){jQuery("#fb-new-label").focus().select()},100)):jQuery("#fb-new-field").hide()}catch(e){G&&console.log("addField(): "+e)}}function i(){try{O=jQuery("#fb-new-options .fb-options").length;var e=jQuery("#fb-field-id").val(),i=jQuery("#fb-new-type").val();"radio"===i?(jQuery("#fb-new-options").append('<div id="fb-option-box-'+O+'" class="fb-new-fields"><span optionid="'+O+'" class="fb-remove-option"></span><label></label><input type="text" id="fb-option'+O+'" optionid="'+O+'" value="'+GrunionFB_i18n.optionLabel+'" class="fb-options" /><div>'),jQuery("#fb-new-field"+e+" .fb-fields").append('<div id="fb-radio-'+e+"-"+O+'"><input type="radio" disabled="disabled" id="fb-field'+e+'" name="radio-'+e+'" /><span>'+GrunionFB_i18n.optionLabel+'</span><div class="clear"></div></div>')):"checkbox-multiple"===i?(jQuery("#fb-new-options").append('<div id="fb-option-box-'+O+'" class="fb-new-fields"><span optionid="'+O+'" class="fb-remove-option"></span><label></label><input type="text" id="fb-option'+O+'" optionid="'+O+'" value="'+GrunionFB_i18n.optionLabel+'" class="fb-options" /><div>'),jQuery("#fb-new-field"+e+" .fb-fields").append('<div id="fb-checkbox-multiple-'+e+"-"+O+'"><input type="checkbox" disabled="disabled" id="fb-field'+e+'" name="checkbox-multiple-'+e+'" /><span>'+GrunionFB_i18n.optionLabel+'</span><div class="clear"></div></div>')):(jQuery("#fb-new-options").append('<div id="fb-option-box-'+O+'" class="fb-new-fields"><span optionid="'+O+'" class="fb-remove-option"></span><label></label><input type="text" id="fb-option'+O+'" optionid="'+O+'" value="" class="fb-options" /><div>'),jQuery("#fb-field"+e).append('<option id="fb-'+e+"-"+O+'" value="'+e+"-"+O+'"></option>')),k.fields[e].options[O]="",jQuery("#fb-option"+O).focus().select()}catch(e){G&&console.log("addOption(): "+e)}}function n(){try{k.to&&jQuery("#fb-field-my-email").val(k.to),k.subject&&jQuery("#fb-field-subject").val(k.subject),jQuery.each(k.fields,function(e,i){jQuery("#fb-extra-fields").before('<div class="fb-new-fields ui-state-default" fieldid="'+e+'" id="fb-new-field'+e+'"><div class="fb-fields"></div></div>'),jQuery("#fb-field-id").val(e),T[e]={},T[e].options=[],"radio"!==i.type&&"select"!==i.type&&"checkbox-multiple"!==i.type||jQuery.each(i.options,function(i,n){T[e].options[i]=n}),B(i.type,i.label,i.required)})}catch(e){G&&console.log("buildPreview(): "+e)}}function o(e,i){try{for(var n="",o=0;o<T[e].options.length;o++)void 0!==T[e].options[o]&&(n="radio"===i?n+'<div id="fb-radio-'+e+"-"+o+'"><input type="radio" id="fb-field'+e+'" name="radio-'+e+'" /><span>'+FB.esc_html(T[e].options[o])+'</span><div class="clear"></div></div>':"checkbox-multiple"===i?n+'<div id="fb-checkbox-multiple-'+e+"-"+o+'"><input type="checkbox" id="fb-field'+e+'" name="checkbox-multiple-'+e+'" /><span>'+FB.esc_html(T[e].options[o])+'</span><div class="clear"></div></div>':n+'<option id="fb-'+e+"-"+o+'" value="'+e+"-"+o+'">'+FB.esc_html(T[e].options[o])+"</option>");return n}catch(e){G&&console.log("customOptions(): "+e)}}function t(e){try{C--;var i=e.attr("id");delete k.fields[i],jQuery("#"+i).parent().parent().remove(),C<=q&&jQuery("#fb-new-field").show()}catch(e){G&&console.log("deleteField(): "+e)}}function l(e){try{scroll(0,0),setTimeout(function(){jQuery("#fb-new-label").focus().select()},100);f(e.parent().attr("fieldid"))}catch(e){G&&console.log("editField(): "+e)}}function r(){try{jQuery.post(ajaxurl,k,function(e){F=e})}catch(e){alert(GrunionFB_i18n.problemGeneratingForm),G&&console.log("grabShortcode(): "+e)}}function a(){jQuery("#fb-desc").hide(),jQuery("#fb-add-field").show()}function d(){try{return jQuery("#TB_imageOff",window.parent.document).unbind("click"),jQuery("#TB_closeWindowButton",window.parent.document).unbind("click"),jQuery("#TB_window",window.parent.document).fadeOut("fast"),jQuery("body",window.parent.document).removeClass("modal-open"),jQuery("#TB_window,#TB_overlay,#TB_HideSelect",window.parent.document).trigger("unload").unbind().remove(),jQuery("#TB_load",window.parent.document).remove(),void 0===window.parent.document.body.style.maxHeight&&(jQuery("body","html",window.parent.document).css({height:"auto",width:"auto"}),jQuery("html",window.parent.document).css("overflow","")),window.parent.document.onkeydown="",window.parent.document.onkeyup="",!1}catch(e){G&&console.log("hidePopup(): "+e)}}function s(e,i){try{"show"===e?(jQuery(".fb-edit-field").is(":visible")&&jQuery(".fb-edit-field").remove(),i.find("label").prepend('<span class="right fb-edit-field" style="font-weight: normal;"><a href="" class="fb-reorder"><div style="display: none;">'+GrunionFB_i18n.moveInstructions+"</div>"+GrunionFB_i18n.moveLabel+'</a> <span style="color: #C7D8DE;">|</span> <a href="" class="fb-edit">'+GrunionFB_i18n.editLabel+"</a></span>")):jQuery(".fb-edit-field").remove()}catch(e){G&&console.log("hideShowEditLink(): "+e)}}function f(e){try{var i=k.fields[e].type;if(jQuery("#fb-options").hide(),jQuery("#fb-field-id").val(e),jQuery("#fb-new-label").val(k.fields[e].label),jQuery("#fb-new-type").val(k.fields[e].type),k.fields[e].required?jQuery("#fb-new-required").prop("checked",!0):jQuery("#fb-new-required").prop("checked",!1),"select"===i||"radio"===i||"checkbox-multiple"===i){var n=k.fields[e].options;jQuery("#fb-options").show(),jQuery("#fb-new-options").html("");for(var o=0;o<n.length;o++)void 0!==n[o]&&jQuery("#fb-new-options").append('<div id="fb-option-box-'+o+'" class="fb-new-fields"><span optionid="'+o+'" class="fb-remove-option"></span><label></label><input type="text" id="fb-option'+o+'" optionid="'+o+'" value="'+FB.esc_attr(k.fields[e].options[o])+'" class="fb-options" /><div>')}a()}catch(e){G&&console.log("loadFieldEditor(): "+e)}}function u(e){try{k.fields={},e?(jQuery.each(e.fields,function(e,i){1===parseInt(i.required,10)&&(i.required="true"),k.fields[e]=i}),k.to=e.to,k.subject=e.subject):k.fields=L}catch(e){G&&console.log("parseShortcode(): "+e)}}function c(e){try{var i=jQuery("#fb-field-id").val(),n=jQuery("#fb-option"+e).val(),o=jQuery("#fb-new-type").val();jQuery("#fb-option-box-"+e).remove(),"radio"===o?jQuery("#fb-radio-"+i+"-"+e).remove():"checkbox-multiple"===o?jQuery("#fb-checkbox-multiple-"+i+"-"+e).remove():jQuery("#fb-"+i+"-"+e).remove();var t=k.fields[i].options.indexOf(n);-1!==t&&k.fields[i].options.splice(t,1)}catch(e){G&&console.log("removeOption(): "+e)}}function b(){try{var e=jQuery("#fb-field-id").val();jQuery("#fb-options").hide(),void 0===T[e]&&(T[e]={}),T[e].options=k.fields[e].options,k.fields[e].options=[]}catch(e){G&&console.log("removeOptions(): "+e)}}function p(){try{jQuery("div#sortable div.fb-new-fields").each(function(e){var i=jQuery(this).attr("fieldid");k.fields[i].order=e}),jQuery.post(ajaxurl,k,function(e){var i=jQuery("#edButtonPreview",window.parent.document).hasClass("active");i||(i=jQuery("#wp-content-wrap",window.parent.document).hasClass("tmce-active"));var n,o=window.dialogArguments||opener||parent||top;i?n=o.tinyMCE.activeEditor.getContent():"string"!=typeof(n=jQuery("#editorcontainer textarea",window.parent.document).val())&&(n=jQuery(".wp-editor-area",window.parent.document).val());var t=new RegExp("\\[contact-form\\b.*?\\/?\\](?:[\\s\\S]+?\\[\\/contact-form\\])?");if(e=e.replace(/\n/g," "),e=e.replace(/%26#x002c;/g,","),n.match(t))i?o.tinyMCE.activeEditor.execCommand("mceSetContent",!1,n.replace(t,e)):jQuery("#content",window.parent.document).val(n.replace(t,e));else try{o.send_to_editor(e)}catch(t){i?o.tinyMCE.activeEditor.execCommand("mceInsertContent",!1,e):jQuery("#content",window.parent.document).val(n+e)}d()})}catch(e){G&&console.log("sendShortcodeToEditor(): "+e)}}function y(){jQuery("#fb-desc").show(),jQuery("#fb-add-field").hide()}function m(e){try{var i=e||GrunionFB_i18n.savedMessage;jQuery("#fb-success").text(i),jQuery("#fb-success").slideDown("fast"),setTimeout(function(){jQuery("#fb-success").slideUp("fast")},2500)}catch(e){G&&console.log("showAndHideMessage(): "+e)}}function v(e){try{if("preview"===e){if(!w(jQuery("#fb-field-my-email").val()))return;jQuery("#tab-preview a").addClass("current"),jQuery("#tab-settings a").removeClass("current"),jQuery("#fb-preview-form, #fb-desc").show(),jQuery("#fb-email-settings, #fb-email-desc").hide(),m(GrunionFB_i18n.savedMessage)}else jQuery("#tab-preview a").removeClass("current"),jQuery("#tab-settings a").addClass("current"),jQuery("#fb-preview-form, #fb-desc, #fb-add-field").hide(),jQuery("#fb-email-settings, #fb-email-desc").show(),jQuery("#fb-field-my-email").focus().select()}catch(e){G&&console.log("switchTabs(): "+e)}}function w(e){if(0===e.length)return!0;var i,n=e.split(",");for(i=0;i<n.length;i++)if(!1===j(n[i]))return alert(n[i]+GrunionFB_i18n.invalidEmail),!1;return!0}function j(e){return/[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i.test(e)}function Q(){try{var e=jQuery("#fb-field-id").val(),i=jQuery("#fb-new-label").val();0===i.length?jQuery("#fb-new-field"+e+" label .label-text").text(GrunionFB_i18n.newLabel):jQuery("#fb-new-field"+e+" label .label-text").text(i),k.fields[e].label=i}catch(e){G&&console.log("updateLabel(): "+e)}}function h(){try{var e=jQuery("#fb-field-my-email").val();k.to=e}catch(e){G&&console.log("updateMyEmail(): "+e)}}function x(e){try{var i=jQuery("#fb-field-id").val(),n=e.attr("optionid"),o=e.val(),t=jQuery("#fb-new-type").val();"radio"===t?jQuery("#fb-radio-"+i+"-"+n+" span").text(o):"checkbox-multiple"===t?jQuery("#fb-checkbox-multiple-"+i+"-"+n+" span").text(o):jQuery("#fb-"+i+"-"+n).text(o),k.fields[i].options[n]=o}catch(e){G&&console.log("updateOption(): "+e)}}function g(){try{var e=jQuery("#fb-field-id").val();jQuery("#fb-new-required").is(":checked")?(k.fields[e].required=!0,jQuery("#fb-new-field"+e+" label").append('<span class="label-required">'+GrunionFB_i18n.requiredLabel+"</span>")):(k.fields[e].required=!1,jQuery("#fb-new-field"+e+" label .label-required").remove())}catch(e){G&&console.log("updateRequired(): "+e)}}function _(){try{var e=jQuery("#fb-field-subject").val();k.subject=e}catch(e){G&&console.log("updateSubject(): "+e)}}function B(e,i,n){try{var t=jQuery("#fb-field-id").val();e||(e=jQuery("#fb-new-type").val()),i||(i=jQuery("#fb-new-field"+t+" .label-text").text());var l=n?'<span class="label-required">'+GrunionFB_i18n.requiredLabel+"</span>":"",r='<label fieldid="'+t+'" for="fb-field'+t+'"><span class="label-text">'+FB.esc_html(i)+"</span>"+l+"</label>",a='<input type="radio" name="radio-'+t+'" id="fb-field'+t+' "disabled="disabled" />',d='<label fieldid="'+t+'" for="fb-field'+t+'" class="fb-radio-label"><span class="label-text">'+FB.esc_html(i)+"</span>"+l+"</label>",s='<div class="fb-remove fb-remove-small" id="'+t+'"></div>',f='<div class="fb-remove" id="'+t+'"></div>',u='<input type="checkbox" id="fb-field'+t+'" "disabled="disabled" />',c='<input type="checkbox" id="fb-field'+t+'" "disabled="disabled" />',p='<div class="fb-remove fb-remove-small" id="'+t+'"></div>',y='<input type="text" id="fb-field'+t+'" "disabled="disabled" />',m='<textarea id="fb-field'+t+'" "disabled="disabled"></textarea>',v='<div class="clear"></div>',w='<select id="fb-field'+t+'" fieldid="'+t+'"><option id="fb-'+t+"-"+O+'" value="'+t+"-"+O+'">'+GrunionFB_i18n.firstOptionLabel+"</option></select>";switch(e){case"checkbox":b(),jQuery("#fb-new-field"+t+" .fb-fields").html(s+u+d+v);break;case"checkbox-multiple":jQuery("#fb-new-field"+t+" .fb-fields").html(r+p+'<div fieldid="'+t+'" id="fb-custom-checkbox-multiple'+t+'"></div>'),void 0!==T[t]&&0!==T[t].options.length?(k.fields[t].options=T[t].options,jQuery("#fb-custom-checkbox-multiple"+t).append(o(t,e))):(jQuery("#fb-new-options").html('<label for="fb-option0">'+GrunionFB_i18n.optionsLabel+'</label><input type="text" id="fb-option0" optionid="0" value="'+GrunionFB_i18n.firstOptionLabel+'" class="fb-options" />'),jQuery("#fb-custom-checkbox-multiple"+t).append('<div id="fb-checkbox-multiple-'+t+'-0">'+c+"<span>"+GrunionFB_i18n.firstOptionLabel+"</span>"+v+"</div>"),k.fields[t].options[O]=GrunionFB_i18n.firstOptionLabel),jQuery("#fb-options").show(),setTimeout(function(){jQuery("#fb-option0").focus().select()},100);break;case"email":case"name":b(),jQuery("#fb-new-field"+t+" .fb-fields").html(f+r+y);break;case"radio":jQuery("#fb-new-field"+t+" .fb-fields").html(r+s+'<div fieldid="'+t+'" id="fb-custom-radio'+t+'"></div>'),void 0!==T[t]&&0!==T[t].options.length?(k.fields[t].options=T[t].options,jQuery("#fb-custom-radio"+t).append(o(t,e))):(jQuery("#fb-new-options").html('<label for="fb-option0">'+GrunionFB_i18n.optionsLabel+'</label><input type="text" id="fb-option0" optionid="0" value="'+GrunionFB_i18n.firstOptionLabel+'" class="fb-options" />'),jQuery("#fb-custom-radio"+t).append('<div id="fb-radio-'+t+'-0">'+a+"<span>"+GrunionFB_i18n.firstOptionLabel+"</span>"+v+"</div>"),k.fields[t].options[O]=GrunionFB_i18n.firstOptionLabel),jQuery("#fb-options").show(),setTimeout(function(){jQuery("#fb-option0").focus().select()},100);break;case"select":jQuery("#fb-new-field"+t+" .fb-fields").html(f+r+w),void 0!==T[t]&&0!==T[t].options.length?(k.fields[t].options=T[t].options,jQuery("#fb-field"+t).html(o(t,e))):(jQuery("#fb-new-options").html('<label for="fb-option0">'+GrunionFB_i18n.optionsLabel+'</label><input type="text" id="fb-option0" optionid="0" value="'+GrunionFB_i18n.firstOptionLabel+'" class="fb-options" />'),k.fields[t].options[O]=GrunionFB_i18n.firstOptionLabel),jQuery("#fb-options").show(),setTimeout(function(){jQuery("#fb-option0").focus().select()},100);break;case"text":b(),jQuery("#fb-new-field"+t+" .fb-fields").html(f+r+y);break;case"textarea":b(),jQuery("#fb-new-field"+t+" .fb-fields").html(f+r+m);break;case"url":b(),jQuery("#fb-new-field"+t+" .fb-fields").html(f+r+y)}k.fields[t].type=e}catch(e){G&&console.log("updateType(): "+e)}}var F,k={action:"grunion_shortcode",_ajax_nonce:ajax_nonce_shortcode,to:"",subject:"",fields:{}},L={name:{label:GrunionFB_i18n.nameLabel,type:"name",required:!0,options:[],order:"1"},email:{label:GrunionFB_i18n.emailLabel,type:"email",required:!0,options:[],order:"2"},url:{label:GrunionFB_i18n.urlLabel,type:"url",required:!1,options:[],order:"3"},comment:{label:GrunionFB_i18n.commentLabel,type:"textarea",required:!0,options:[],order:"4"}},G=!1,C=0,q=GrunionFB_i18n.maxNewFields,T={},O=0;return{resizePop:function(){try{var e=jQuery("body",window.parent.document).width(),i=jQuery("body",window.parent.document).height(),n=void 0===document.body.style.maxHeight;jQuery("#TB_window, #TB_iframeContent",window.parent.document).css("width","768px"),jQuery("#TB_window",window.parent.document).css({left:(e-768)/2+"px",top:"23px",position:"absolute",marginLeft:"0"}),n||jQuery("#TB_window, #TB_iframeContent",window.parent.document).css("height",i-73+"px")}catch(e){G&&console.log("resizePop(): "+e)}},init:function(){window.parent.scroll(0,0);var o;if(jQuery("#edButtonPreview",window.parent.document).hasClass("active")||jQuery("#wp-content-wrap",window.parent.document).hasClass("tmce-active")){o=(window.dialogArguments||opener||parent||top).tinyMCE.activeEditor.getContent()}else o=jQuery("#content",window.parent.document).val();var f={action:"grunion_shortcode_to_json",_ajax_nonce:ajax_nonce_json,post_id:postId,content:o},b=jQuery(document);jQuery.post(ajaxurl,f,function(e){u(jQuery.parseJSON(e)),n()}),jQuery(".fb-add-field").click(function(){return e(),a(),!1}),jQuery("#fb-new-label").keyup(function(){Q()}),jQuery("#fb-new-type").change(function(){B()}),jQuery("#fb-new-required").click(function(){g()}),b.on("click",".fb-remove",function(){y(),t(jQuery(this)),r()}),jQuery("#fb-preview").submit(function(){return p(),!1}),jQuery("#TB_overlay, #TB_closeWindowButton",window.parent.document).mousedown(function(){confirm(GrunionFB_i18n.exitConfirmMessage)&&d()}),b.on("click","#fb-another-option",function(){i()}),b.on("keyup",".fb-options",function(){x(jQuery(this))}),b.on("click",".fb-remove-option",function(){c(jQuery(this).attr("optionid"))}),jQuery("#tab-preview a").click(function(){return v("preview"),!1}),jQuery("#fb-prev-form").click(function(){return v("preview"),!1}),jQuery("#tab-settings a").click(function(){return v(),!1}),jQuery("#fb-field-my-email").blur(function(){h()}),jQuery("#fb-field-subject").blur(function(){_()}),b.on("mouseenter",".fb-form-case .fb-new-fields",function(){s("show",jQuery(this))}),b.on("mouseleave",".fb-form-case .fb-new-fields",function(){return s("hide"),!1}),b.on("click",".fb-edit-field",function(){return l(jQuery(this)),!1}),b.on("click",".fb-edit-field .fb-reorder",function(){return!1}),b.on("click","#fb-save-field",function(){return y(),m(),!1}),jQuery("#fb-feedback").click(function(){var e=jQuery(this).attr("href");return window.parent.location=e,!1}),jQuery("#sortable").sortable({axis:"y",handle:".fb-reorder",revert:!0,start:function(){jQuery(".fb-edit-field").hide()}}),jQuery("#draggable").draggable({axis:"y",handle:".fb-reorder",connectToSortable:"#sortable",helper:"clone",revert:"invalid"})}}}();
\ No newline at end of file +window.FB||(window.FB={}),GrunionFB_i18n=jQuery.extend({nameLabel:"Name",emailLabel:"Email",urlLabel:"Website",commentLabel:"Comment",newLabel:"New Field",optionsLabel:"Options",optionLabel:"Option",firstOptionLabel:"First option",problemGeneratingForm:"Oops, there was a problem generating your form. You'll likely need to try again.",moveInstructions:"Drag up or down\nto re-arrange",moveLabel:"move",editLabel:"edit",savedMessage:"Saved successfully",requiredLabel:"(required)",exitConfirmMessage:"Are you sure you want to exit the form editor without saving? Any changes you have made will be lost.",maxNewFields:5,invalidEmail:" is an invalid email address."},GrunionFB_i18n),GrunionFB_i18n.moveInstructions=GrunionFB_i18n.moveInstructions.replace("\n","<br />"),FB.span=jQuery("<span>"),FB.esc_html=function(e){return FB.span.text(e).html()},FB.esc_attr=function(e){return(e=FB.esc_html(e)).replace('"',""").replace("'","'")},FB.ContactForm=function(){var e={action:"grunion_shortcode",_ajax_nonce:ajax_nonce_shortcode,to:"",subject:"",fields:{}},i={name:{label:GrunionFB_i18n.nameLabel,type:"name",required:!0,options:[],order:"1"},email:{label:GrunionFB_i18n.emailLabel,type:"email",required:!0,options:[],order:"2"},url:{label:GrunionFB_i18n.urlLabel,type:"url",required:!1,options:[],order:"3"},comment:{label:GrunionFB_i18n.commentLabel,type:"textarea",required:!0,options:[],order:"4"}},n=!1,o=0,t=GrunionFB_i18n.maxNewFields,l={},r=0;function a(e,i){try{for(var o="",t=0;t<l[e].options.length;t++)void 0!==l[e].options[t]&&(o="radio"===i?o+'<div id="fb-radio-'+e+"-"+t+'"><input type="radio" id="fb-field'+e+'" name="radio-'+e+'" /><span>'+FB.esc_html(l[e].options[t])+'</span><div class="clear"></div></div>':"checkbox-multiple"===i?o+'<div id="fb-checkbox-multiple-'+e+"-"+t+'"><input type="checkbox" id="fb-field'+e+'" name="checkbox-multiple-'+e+'" /><span>'+FB.esc_html(l[e].options[t])+'</span><div class="clear"></div></div>':o+'<option id="fb-'+e+"-"+t+'" value="'+e+"-"+t+'">'+FB.esc_html(l[e].options[t])+"</option>");return o}catch(e){n&&console.log("customOptions(): "+e)}}function d(i){try{scroll(0,0),setTimeout(function(){jQuery("#fb-new-label").focus().select()},100),function(i){try{var o=e.fields[i].type;if(jQuery("#fb-options").hide(),jQuery("#fb-field-id").val(i),jQuery("#fb-new-label").val(e.fields[i].label),jQuery("#fb-new-type").val(e.fields[i].type),e.fields[i].required?jQuery("#fb-new-required").prop("checked",!0):jQuery("#fb-new-required").prop("checked",!1),"select"===o||"radio"===o||"checkbox-multiple"===o){var t=e.fields[i].options;jQuery("#fb-options").show(),jQuery("#fb-new-options").html("");for(var l=0;l<t.length;l++)void 0!==t[l]&&jQuery("#fb-new-options").append('<div id="fb-option-box-'+l+'" class="fb-new-fields"><span optionid="'+l+'" class="fb-remove-option"></span><label></label><input type="text" id="fb-option'+l+'" optionid="'+l+'" value="'+FB.esc_attr(e.fields[i].options[l])+'" class="fb-options" /><div>')}s()}catch(e){n&&console.log("loadFieldEditor(): "+e)}}(i.parent().attr("fieldid"))}catch(e){n&&console.log("editField(): "+e)}}function s(){jQuery("#fb-desc").hide(),jQuery("#fb-add-field").show()}function f(){try{return jQuery("#TB_imageOff",window.parent.document).unbind("click"),jQuery("#TB_closeWindowButton",window.parent.document).unbind("click"),jQuery("#TB_window",window.parent.document).fadeOut("fast"),jQuery("body",window.parent.document).removeClass("modal-open"),jQuery("#TB_window,#TB_overlay,#TB_HideSelect",window.parent.document).trigger("unload").unbind().remove(),jQuery("#TB_load",window.parent.document).remove(),void 0===window.parent.document.body.style.maxHeight&&(jQuery("body","html",window.parent.document).css({height:"auto",width:"auto"}),jQuery("html",window.parent.document).css("overflow","")),window.parent.document.onkeydown="",window.parent.document.onkeyup="",!1}catch(e){n&&console.log("hidePopup(): "+e)}}function u(e,i){try{"show"===e?(jQuery(".fb-edit-field").is(":visible")&&jQuery(".fb-edit-field").remove(),i.find("label").prepend('<span class="right fb-edit-field" style="font-weight: normal;"><a href="" class="fb-reorder"><div style="display: none;">'+GrunionFB_i18n.moveInstructions+"</div>"+GrunionFB_i18n.moveLabel+'</a> <span style="color: #C7D8DE;">|</span> <a href="" class="fb-edit">'+GrunionFB_i18n.editLabel+"</a></span>")):jQuery(".fb-edit-field").remove()}catch(e){n&&console.log("hideShowEditLink(): "+e)}}function c(){try{var i=jQuery("#fb-field-id").val();jQuery("#fb-options").hide(),void 0===l[i]&&(l[i]={}),l[i].options=e.fields[i].options,e.fields[i].options=[]}catch(e){n&&console.log("removeOptions(): "+e)}}function b(){jQuery("#fb-desc").show(),jQuery("#fb-add-field").hide()}function p(e){try{var i=e||GrunionFB_i18n.savedMessage;jQuery("#fb-success").text(i),jQuery("#fb-success").slideDown("fast"),setTimeout(function(){jQuery("#fb-success").slideUp("fast")},2500)}catch(e){n&&console.log("showAndHideMessage(): "+e)}}function y(e){try{if("preview"===e){if(!function(e){if(0===e.length)return!0;var i,n=e.split(",");for(i=0;i<n.length;i++)if(!1===(o=n[i],void 0,/[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i,/[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i.test(o)))return alert(n[i]+GrunionFB_i18n.invalidEmail),!1;var o;return!0}(jQuery("#fb-field-my-email").val()))return;jQuery("#tab-preview a").addClass("current"),jQuery("#tab-settings a").removeClass("current"),jQuery("#fb-preview-form, #fb-desc").show(),jQuery("#fb-email-settings, #fb-email-desc").hide(),p(GrunionFB_i18n.savedMessage)}else jQuery("#tab-preview a").removeClass("current"),jQuery("#tab-settings a").addClass("current"),jQuery("#fb-preview-form, #fb-desc, #fb-add-field").hide(),jQuery("#fb-email-settings, #fb-email-desc").show(),jQuery("#fb-field-my-email").focus().select()}catch(e){n&&console.log("switchTabs(): "+e)}}function v(i,o,t){try{var d=jQuery("#fb-field-id").val();i||(i=jQuery("#fb-new-type").val()),o||(o=jQuery("#fb-new-field"+d+" .label-text").text());var s=t?'<span class="label-required">'+GrunionFB_i18n.requiredLabel+"</span>":"",f='<label fieldid="'+d+'" for="fb-field'+d+'"><span class="label-text">'+FB.esc_html(o)+"</span>"+s+"</label>",u='<input type="radio" name="radio-'+d+'" id="fb-field'+d+' "disabled="disabled" />',b='<label fieldid="'+d+'" for="fb-field'+d+'" class="fb-radio-label"><span class="label-text">'+FB.esc_html(o)+"</span>"+s+"</label>",p='<div class="fb-remove fb-remove-small" id="'+d+'"></div>',y='<div class="fb-remove" id="'+d+'"></div>',v='<input type="checkbox" id="fb-field'+d+'" "disabled="disabled" />',m='<input type="checkbox" id="fb-field'+d+'" "disabled="disabled" />',w='<div class="fb-remove fb-remove-small" id="'+d+'"></div>',j='<input type="text" id="fb-field'+d+'" "disabled="disabled" />',Q='<textarea id="fb-field'+d+'" "disabled="disabled"></textarea>',h='<div class="clear"></div>',x='<select id="fb-field'+d+'" fieldid="'+d+'"><option id="fb-'+d+"-"+r+'" value="'+d+"-"+r+'">'+GrunionFB_i18n.firstOptionLabel+"</option></select>";switch(i){case"checkbox":c(),jQuery("#fb-new-field"+d+" .fb-fields").html(p+v+b+h);break;case"checkbox-multiple":jQuery("#fb-new-field"+d+" .fb-fields").html(f+w+'<div fieldid="'+d+'" id="fb-custom-checkbox-multiple'+d+'"></div>'),void 0!==l[d]&&0!==l[d].options.length?(e.fields[d].options=l[d].options,jQuery("#fb-custom-checkbox-multiple"+d).append(a(d,i))):(jQuery("#fb-new-options").html('<label for="fb-option0">'+GrunionFB_i18n.optionsLabel+'</label><input type="text" id="fb-option0" optionid="0" value="'+GrunionFB_i18n.firstOptionLabel+'" class="fb-options" />'),jQuery("#fb-custom-checkbox-multiple"+d).append('<div id="fb-checkbox-multiple-'+d+'-0">'+m+"<span>"+GrunionFB_i18n.firstOptionLabel+"</span>"+h+"</div>"),e.fields[d].options[r]=GrunionFB_i18n.firstOptionLabel),jQuery("#fb-options").show(),setTimeout(function(){jQuery("#fb-option0").focus().select()},100);break;case"email":case"name":c(),jQuery("#fb-new-field"+d+" .fb-fields").html(y+f+j);break;case"radio":jQuery("#fb-new-field"+d+" .fb-fields").html(f+p+'<div fieldid="'+d+'" id="fb-custom-radio'+d+'"></div>'),void 0!==l[d]&&0!==l[d].options.length?(e.fields[d].options=l[d].options,jQuery("#fb-custom-radio"+d).append(a(d,i))):(jQuery("#fb-new-options").html('<label for="fb-option0">'+GrunionFB_i18n.optionsLabel+'</label><input type="text" id="fb-option0" optionid="0" value="'+GrunionFB_i18n.firstOptionLabel+'" class="fb-options" />'),jQuery("#fb-custom-radio"+d).append('<div id="fb-radio-'+d+'-0">'+u+"<span>"+GrunionFB_i18n.firstOptionLabel+"</span>"+h+"</div>"),e.fields[d].options[r]=GrunionFB_i18n.firstOptionLabel),jQuery("#fb-options").show(),setTimeout(function(){jQuery("#fb-option0").focus().select()},100);break;case"select":jQuery("#fb-new-field"+d+" .fb-fields").html(y+f+x),void 0!==l[d]&&0!==l[d].options.length?(e.fields[d].options=l[d].options,jQuery("#fb-field"+d).html(a(d,i))):(jQuery("#fb-new-options").html('<label for="fb-option0">'+GrunionFB_i18n.optionsLabel+'</label><input type="text" id="fb-option0" optionid="0" value="'+GrunionFB_i18n.firstOptionLabel+'" class="fb-options" />'),e.fields[d].options[r]=GrunionFB_i18n.firstOptionLabel),jQuery("#fb-options").show(),setTimeout(function(){jQuery("#fb-option0").focus().select()},100);break;case"text":c(),jQuery("#fb-new-field"+d+" .fb-fields").html(y+f+j);break;case"textarea":c(),jQuery("#fb-new-field"+d+" .fb-fields").html(y+f+Q);break;case"url":c(),jQuery("#fb-new-field"+d+" .fb-fields").html(y+f+j)}e.fields[d].type=i}catch(e){n&&console.log("updateType(): "+e)}}return{resizePop:function(){try{var e=jQuery("body",window.parent.document).width(),i=jQuery("body",window.parent.document).height(),o=void 0===document.body.style.maxHeight;jQuery("#TB_window, #TB_iframeContent",window.parent.document).css("width","768px"),jQuery("#TB_window",window.parent.document).css({left:(e-768)/2+"px",top:"23px",position:"absolute",marginLeft:"0"}),o||jQuery("#TB_window, #TB_iframeContent",window.parent.document).css("height",i-73+"px")}catch(e){n&&console.log("resizePop(): "+e)}},init:function(){var a;(window.parent.scroll(0,0),jQuery("#edButtonPreview",window.parent.document).hasClass("active")||jQuery("#wp-content-wrap",window.parent.document).hasClass("tmce-active"))?a=(window.dialogArguments||opener||parent||top).tinyMCE.activeEditor.getContent():a=jQuery("#content",window.parent.document).val();var c={action:"grunion_shortcode_to_json",_ajax_nonce:ajax_nonce_json,post_id:postId,content:a},m=jQuery(document);jQuery.post(ajaxurl,c,function(o){!function(o){try{e.fields={},o?(jQuery.each(o.fields,function(i,n){1===parseInt(n.required,10)&&(n.required="true"),e.fields[i]=n}),e.to=o.to,e.subject=o.subject):e.fields=i}catch(e){n&&console.log("parseShortcode(): "+e)}}(jQuery.parseJSON(o)),function(){try{e.to&&jQuery("#fb-field-my-email").val(e.to),e.subject&&jQuery("#fb-field-subject").val(e.subject),jQuery.each(e.fields,function(e,i){jQuery("#fb-extra-fields").before('<div class="fb-new-fields ui-state-default" fieldid="'+e+'" id="fb-new-field'+e+'"><div class="fb-fields"></div></div>'),jQuery("#fb-field-id").val(e),l[e]={},l[e].options=[],"radio"!==i.type&&"select"!==i.type&&"checkbox-multiple"!==i.type||jQuery.each(i.options,function(i,n){l[e].options[i]=n}),v(i.type,i.label,i.required)})}catch(e){n&&console.log("buildPreview(): "+e)}}()}),jQuery(".fb-add-field").click(function(){return function(){try{++o<=t?(jQuery("#fb-extra-fields").append('<div id="fb-new-field'+o+'" fieldid="'+o+'" class="fb-new-fields"><div class="fb-fields"><div id="'+o+'" class="fb-remove"></div><label fieldid="'+o+'" for="fb-field'+o+'"><span class="label-text">'+GrunionFB_i18n.newLabel+'</span> </label><input type="text" id="fb-field'+o+'" disabled="disabled" /></div></div>'),e.fields[o]={label:GrunionFB_i18n.newLabel,type:"text",required:!1,options:[],order:"5"},o===t&&jQuery("#fb-new-field").hide(),r=0,l={},jQuery("#fb-new-options").html('<label for="fb-option0">'+GrunionFB_i18n.optionsLabel+'</label><input type="text" id="fb-option0" optionid="0" value="'+GrunionFB_i18n.firstOptionLabel+'" class="fb-options" />'),jQuery("#fb-options").hide(),jQuery("#fb-new-label").val(GrunionFB_i18n.newLabel),jQuery("#fb-new-type").val("text"),jQuery("#fb-field-id").val(o),setTimeout(function(){jQuery("#fb-new-label").focus().select()},100)):jQuery("#fb-new-field").hide()}catch(e){n&&console.log("addField(): "+e)}}(),s(),!1}),jQuery("#fb-new-label").keyup(function(){!function(){try{var i=jQuery("#fb-field-id").val(),o=jQuery("#fb-new-label").val();0===o.length?jQuery("#fb-new-field"+i+" label .label-text").text(GrunionFB_i18n.newLabel):jQuery("#fb-new-field"+i+" label .label-text").text(o),e.fields[i].label=o}catch(e){n&&console.log("updateLabel(): "+e)}}()}),jQuery("#fb-new-type").change(function(){v()}),jQuery("#fb-new-required").click(function(){!function(){try{var i=jQuery("#fb-field-id").val();jQuery("#fb-new-required").is(":checked")?(e.fields[i].required=!0,jQuery("#fb-new-field"+i+" label").append('<span class="label-required">'+GrunionFB_i18n.requiredLabel+"</span>")):(e.fields[i].required=!1,jQuery("#fb-new-field"+i+" label .label-required").remove())}catch(e){n&&console.log("updateRequired(): "+e)}}()}),m.on("click",".fb-remove",function(){b(),function(i){try{o--;var l=i.attr("id");delete e.fields[l],jQuery("#"+l).parent().parent().remove(),o<=t&&jQuery("#fb-new-field").show()}catch(e){n&&console.log("deleteField(): "+e)}}(jQuery(this)),function(){try{jQuery.post(ajaxurl,e,function(e){e})}catch(e){alert(GrunionFB_i18n.problemGeneratingForm),n&&console.log("grabShortcode(): "+e)}}()}),jQuery("#fb-preview").submit(function(){return function(){try{jQuery("div#sortable div.fb-new-fields").each(function(i){var n=jQuery(this).attr("fieldid");e.fields[n].order=i}),jQuery.post(ajaxurl,e,function(e){var i=jQuery("#edButtonPreview",window.parent.document).hasClass("active");i||(i=jQuery("#wp-content-wrap",window.parent.document).hasClass("tmce-active"));var n,o=window.dialogArguments||opener||parent||top;i?n=o.tinyMCE.activeEditor.getContent():"string"!=typeof(n=jQuery("#editorcontainer textarea",window.parent.document).val())&&(n=jQuery(".wp-editor-area",window.parent.document).val());var t=new RegExp("\\[contact-form\\b.*?\\/?\\](?:[\\s\\S]+?\\[\\/contact-form\\])?");if(e=(e=e.replace(/\n/g," ")).replace(/%26#x002c;/g,","),n.match(t))i?o.tinyMCE.activeEditor.execCommand("mceSetContent",!1,n.replace(t,e)):jQuery("#content",window.parent.document).val(n.replace(t,e));else try{o.send_to_editor(e)}catch(t){i?o.tinyMCE.activeEditor.execCommand("mceInsertContent",!1,e):jQuery("#content",window.parent.document).val(n+e)}f()})}catch(e){n&&console.log("sendShortcodeToEditor(): "+e)}}(),!1}),jQuery("#TB_overlay, #TB_closeWindowButton",window.parent.document).mousedown(function(){confirm(GrunionFB_i18n.exitConfirmMessage)&&f()}),m.on("click","#fb-another-option",function(){!function(){try{r=jQuery("#fb-new-options .fb-options").length;var i=jQuery("#fb-field-id").val(),o=jQuery("#fb-new-type").val();"radio"===o?(jQuery("#fb-new-options").append('<div id="fb-option-box-'+r+'" class="fb-new-fields"><span optionid="'+r+'" class="fb-remove-option"></span><label></label><input type="text" id="fb-option'+r+'" optionid="'+r+'" value="'+GrunionFB_i18n.optionLabel+'" class="fb-options" /><div>'),jQuery("#fb-new-field"+i+" .fb-fields").append('<div id="fb-radio-'+i+"-"+r+'"><input type="radio" disabled="disabled" id="fb-field'+i+'" name="radio-'+i+'" /><span>'+GrunionFB_i18n.optionLabel+'</span><div class="clear"></div></div>')):"checkbox-multiple"===o?(jQuery("#fb-new-options").append('<div id="fb-option-box-'+r+'" class="fb-new-fields"><span optionid="'+r+'" class="fb-remove-option"></span><label></label><input type="text" id="fb-option'+r+'" optionid="'+r+'" value="'+GrunionFB_i18n.optionLabel+'" class="fb-options" /><div>'),jQuery("#fb-new-field"+i+" .fb-fields").append('<div id="fb-checkbox-multiple-'+i+"-"+r+'"><input type="checkbox" disabled="disabled" id="fb-field'+i+'" name="checkbox-multiple-'+i+'" /><span>'+GrunionFB_i18n.optionLabel+'</span><div class="clear"></div></div>')):(jQuery("#fb-new-options").append('<div id="fb-option-box-'+r+'" class="fb-new-fields"><span optionid="'+r+'" class="fb-remove-option"></span><label></label><input type="text" id="fb-option'+r+'" optionid="'+r+'" value="" class="fb-options" /><div>'),jQuery("#fb-field"+i).append('<option id="fb-'+i+"-"+r+'" value="'+i+"-"+r+'"></option>')),e.fields[i].options[r]="",jQuery("#fb-option"+r).focus().select()}catch(e){n&&console.log("addOption(): "+e)}}()}),m.on("keyup",".fb-options",function(){!function(i){try{var o=jQuery("#fb-field-id").val(),t=i.attr("optionid"),l=i.val(),r=jQuery("#fb-new-type").val();"radio"===r?jQuery("#fb-radio-"+o+"-"+t+" span").text(l):"checkbox-multiple"===r?jQuery("#fb-checkbox-multiple-"+o+"-"+t+" span").text(l):jQuery("#fb-"+o+"-"+t).text(l),e.fields[o].options[t]=l}catch(e){n&&console.log("updateOption(): "+e)}}(jQuery(this))}),m.on("click",".fb-remove-option",function(){!function(i){try{var o=jQuery("#fb-field-id").val(),t=jQuery("#fb-option"+i).val(),l=jQuery("#fb-new-type").val();jQuery("#fb-option-box-"+i).remove(),"radio"===l?jQuery("#fb-radio-"+o+"-"+i).remove():"checkbox-multiple"===l?jQuery("#fb-checkbox-multiple-"+o+"-"+i).remove():jQuery("#fb-"+o+"-"+i).remove();var r=e.fields[o].options.indexOf(t);-1!==r&&e.fields[o].options.splice(r,1)}catch(e){n&&console.log("removeOption(): "+e)}}(jQuery(this).attr("optionid"))}),jQuery("#tab-preview a").click(function(){return y("preview"),!1}),jQuery("#fb-prev-form").click(function(){return y("preview"),!1}),jQuery("#tab-settings a").click(function(){return y(),!1}),jQuery("#fb-field-my-email").blur(function(){!function(){try{var i=jQuery("#fb-field-my-email").val();e.to=i}catch(e){n&&console.log("updateMyEmail(): "+e)}}()}),jQuery("#fb-field-subject").blur(function(){!function(){try{var i=jQuery("#fb-field-subject").val();e.subject=i}catch(e){n&&console.log("updateSubject(): "+e)}}()}),m.on("mouseenter",".fb-form-case .fb-new-fields",function(){u("show",jQuery(this))}),m.on("mouseleave",".fb-form-case .fb-new-fields",function(){return u("hide"),!1}),m.on("click",".fb-edit-field",function(){return d(jQuery(this)),!1}),m.on("click",".fb-edit-field .fb-reorder",function(){return!1}),m.on("click","#fb-save-field",function(){return b(),p(),!1}),jQuery("#fb-feedback").click(function(){var e=jQuery(this).attr("href");return window.parent.location=e,!1}),jQuery("#sortable").sortable({axis:"y",handle:".fb-reorder",revert:!0,start:function(){jQuery(".fb-edit-field").hide()}}),jQuery("#draggable").draggable({axis:"y",handle:".fb-reorder",connectToSortable:"#sortable",helper:"clone",revert:"invalid"})}}}();
\ No newline at end of file |