js/tinymce-plugin-form-button.min.js000064400000001143150732326420013521 0ustar00tinymce.create("tinymce.plugins.grunion_form",{init:function(n){n.addButton("grunion",{title:grunionEditorView.labels.tinymce_label,cmd:"grunion_add_form",icon:"grunion"}),n.addCommand("grunion_add_form",(function(){grunionEditorView.default_form?n.execCommand("mceInsertContent",0,"[contact-form]"+grunionEditorView.default_form+"[/contact-form]"):n.execCommand("mceInsertContent",0,"[contact-form /]")}))},createControl:function(){return null},getInfo:function(){return{longname:"Grunion Contact Form",author:"Automattic",version:"1"}}}),tinymce.PluginManager.add("grunion_form",tinymce.plugins.grunion_form);js/grunion-frontend.min.js000064400000000122150732326420011575 0ustar00jQuery((function(t){t(".contact-form input.jp-contact-form-date").datepicker()}));js/grunion-frontend.min.asset.php000064400000000124150732326420013070 0ustar00 array(), 'version' => '529c9d52a58b3c436d90'); js/dropdown.min.asset.php000064400000000124150732326420011426 0ustar00 array(), 'version' => '7a68d6664a189f5c7949'); js/grunion.min.js000064400000044724150732326420010000 0ustar00window.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","
"),FB.span=jQuery(""),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,r={},l=0;function a(e,i){try{for(var o="",t=0;t'+FB.esc_html(r[e].options[t])+'
':"checkbox-multiple"===i?o+'
'+FB.esc_html(r[e].options[t])+'
':o+'");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 r=0;r
')}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 u(){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 f(e,i){try{"show"===e?(jQuery(".fb-edit-field").is(":visible")&&jQuery(".fb-edit-field").remove(),i.find("label").prepend('
'+GrunionFB_i18n.moveInstructions+"
"+GrunionFB_i18n.moveLabel+'
  |  '+GrunionFB_i18n.editLabel+"
")):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===r[i]&&(r[i]={}),r[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'+GrunionFB_i18n.requiredLabel+"":"",u='",f='',b='",p='
',y='
',v='',m='',w='
',j='',Q='',h='
',x='";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(u+w+'
'),void 0!==r[d]&&0!==r[d].options.length?(e.fields[d].options=r[d].options,jQuery("#fb-custom-checkbox-multiple"+d).append(a(d,i))):(jQuery("#fb-new-options").html(''),jQuery("#fb-custom-checkbox-multiple"+d).append('
'+m+""+GrunionFB_i18n.firstOptionLabel+""+h+"
"),e.fields[d].options[l]=GrunionFB_i18n.firstOptionLabel),jQuery("#fb-options").show(),setTimeout((function(){jQuery("#fb-option0").focus().select()}),100);break;case"email":case"name":case"text":case"url":c(),jQuery("#fb-new-field"+d+" .fb-fields").html(y+u+j);break;case"radio":jQuery("#fb-new-field"+d+" .fb-fields").html(u+p+'
'),void 0!==r[d]&&0!==r[d].options.length?(e.fields[d].options=r[d].options,jQuery("#fb-custom-radio"+d).append(a(d,i))):(jQuery("#fb-new-options").html(''),jQuery("#fb-custom-radio"+d).append('
'+f+""+GrunionFB_i18n.firstOptionLabel+""+h+"
"),e.fields[d].options[l]=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+u+x),void 0!==r[d]&&0!==r[d].options.length?(e.fields[d].options=r[d].options,jQuery("#fb-field"+d).html(a(d,i))):(jQuery("#fb-new-options").html(''),e.fields[d].options[l]=GrunionFB_i18n.firstOptionLabel),jQuery("#fb-options").show(),setTimeout((function(){jQuery("#fb-option0").focus().select()}),100);break;case"textarea":c(),jQuery("#fb-new-field"+d+" .fb-fields").html(y+u+Q)}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),a=jQuery("#edButtonPreview",window.parent.document).hasClass("active")||jQuery("#wp-content-wrap",window.parent.document).hasClass("tmce-active")?(window.dialogArguments||opener||parent||top).tinyMCE.activeEditor.getContent():jQuery("#content",window.parent.document).val();var c={action:"grunion_shortcode_to_json",_ajax_nonce:ajax_nonce_json,post_id:postId,content:a},v=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('
'),jQuery("#fb-field-id").val(e),r[e]={},r[e].options=[],"radio"!==i.type&&"select"!==i.type&&"checkbox-multiple"!==i.type||jQuery.each(i.options,(function(i,n){r[e].options[i]=n})),m(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('
'),e.fields[o]={label:GrunionFB_i18n.newLabel,type:"text",required:!1,options:[],order:"5"},o===t&&jQuery("#fb-new-field").hide(),l=0,r={},jQuery("#fb-new-options").html(''),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(){m()})),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(''+GrunionFB_i18n.requiredLabel+"")):(e.fields[i].required=!1,jQuery("#fb-new-field"+i+" label .label-required").remove())}catch(e){n&&console.log("updateRequired(): "+e)}}()})),v.on("click",".fb-remove",(function(){b(),function(i){try{o--;var r=i.attr("id");delete e.fields[r],jQuery("#"+r).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){}))}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)}u()}))}catch(e){n&&console.log("sendShortcodeToEditor(): "+e)}}(),!1})),jQuery("#TB_overlay, #TB_closeWindowButton",window.parent.document).mousedown((function(){confirm(GrunionFB_i18n.exitConfirmMessage)&&u()})),v.on("click","#fb-another-option",(function(){!function(){try{l=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('
'),jQuery("#fb-new-field"+i+" .fb-fields").append('
'+GrunionFB_i18n.optionLabel+'
')):"checkbox-multiple"===o?(jQuery("#fb-new-options").append('
'),jQuery("#fb-new-field"+i+" .fb-fields").append('
'+GrunionFB_i18n.optionLabel+'
')):(jQuery("#fb-new-options").append('
'),jQuery("#fb-field"+i).append('')),e.fields[i].options[l]="",jQuery("#fb-option"+l).focus().select()}catch(e){n&&console.log("addOption(): "+e)}}()})),v.on("keyup",".fb-options",(function(){!function(i){try{var o=jQuery("#fb-field-id").val(),t=i.attr("optionid"),r=i.val(),l=jQuery("#fb-new-type").val();"radio"===l?jQuery("#fb-radio-"+o+"-"+t+" span").text(r):"checkbox-multiple"===l?jQuery("#fb-checkbox-multiple-"+o+"-"+t+" span").text(r):jQuery("#fb-"+o+"-"+t).text(r),e.fields[o].options[t]=r}catch(e){n&&console.log("updateOption(): "+e)}}(jQuery(this))})),v.on("click",".fb-remove-option",(function(){!function(i){try{var o=jQuery("#fb-field-id").val(),t=jQuery("#fb-option"+i).val(),r=jQuery("#fb-new-type").val();jQuery("#fb-option-box-"+i).remove(),"radio"===r?jQuery("#fb-radio-"+o+"-"+i).remove():"checkbox-multiple"===r?jQuery("#fb-checkbox-multiple-"+o+"-"+i).remove():jQuery("#fb-"+o+"-"+i).remove();var l=e.fields[o].options.indexOf(t);-1!==l&&e.fields[o].options.splice(l,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)}}()})),v.on("mouseenter",".fb-form-case .fb-new-fields",(function(){f("show",jQuery(this))})),v.on("mouseleave",".fb-form-case .fb-new-fields",(function(){return f("hide"),!1})),v.on("click",".fb-edit-field",(function(){return d(jQuery(this)),!1})),v.on("click",".fb-edit-field .fb-reorder",(function(){return!1})),v.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"})}}}();js/grunion-admin.min.js000064400000013025150732326420011054 0ustar00jQuery((function(t){if("undefined"!=typeof jetpack_empty_spam_button_parameters){var e=t("
").addClass("jetpack-empty-spam-container"),a=t("").addClass("button-secondary").addClass("jetpack-empty-spam").attr("href","#").attr("data-progress-label",jetpack_empty_spam_button_parameters.progress_label).attr("data-success-url",jetpack_empty_spam_button_parameters.success_url).attr("data-failure-url",jetpack_empty_spam_button_parameters.failure_url).attr("data-spam-feedbacks-count",jetpack_empty_spam_button_parameters.spam_count).attr("data-nonce",jetpack_empty_spam_button_parameters.nonce).text(jetpack_empty_spam_button_parameters.label);e.append(a);var n=t("").addClass("jetpack-empty-spam-spinner");e.append(n),t(".tablenav.top .actions, .tablenav.bottom .actions").not(".bulkactions").append(e)}function o(e,a){var n=t("#jetpack-check-feedback-spam").data("nonce-name"),s=t("#"+n).attr("value"),c=t("#jetpack-check-feedback-spam").data("failure-url"),r={action:"grunion_recheck_queue",offset:e,limit:a};r[n]=s,t.post(ajaxurl,r).fail((function(){window.location.href=c})).done((function(t){t.processed array(), 'version' => '1d059fcb69f6f86f8295'); js/editor-view.min.js000064400000012020150732326420010535 0ustar00!function(t,e,n){if(e.mce=e.mce||{},void 0!==e.mce.views){e.mce.grunion_wp_view_renderer={shortcode_string:"contact-form",template:e.template("grunion-contact-form"),field_templates:{email:e.template("grunion-field-email"),telephone:e.template("grunion-field-telephone"),textarea:e.template("grunion-field-textarea"),radio:e.template("grunion-field-radio"),checkbox:e.template("grunion-field-checkbox"),"checkbox-multiple":e.template("grunion-field-checkbox-multiple"),select:e.template("grunion-field-select"),date:e.template("grunion-field-date"),text:e.template("grunion-field-text"),name:e.template("grunion-field-text"),url:e.template("grunion-field-url")},edit_template:e.template("grunion-field-edit"),editor_inline:e.template("grunion-editor-inline"),editor_option:e.template("grunion-field-edit-option"),getContent:function(){var t,i,o=this.shortcode.content,r=0,c="";for(o||(o=n.default_form);t=e.shortcode.next("contact-field",o,r);)r=t.index+t.content.length,(i=t.shortcode.attrs.named).type&&this.field_templates[i.type]||(i.type="text"),i.required&&(i.required=n.labels.required_field_text),i.options&&"string"==typeof i.options&&(i.options=i.options.split(",")),c+=this.field_templates[i.type](i);var s={body:c,submit_button_text:n.labels.submit_button_text};return this.template(s)},edit:function(i,o){var r,c,s=e.shortcode.next(this.shortcode_string,i).shortcode,l=t(tinyMCE.activeEditor.getDoc()).find(".wpview.wpview-wrap").filter((function(){return t(this).attr("data-mce-selected")})),a=t('