3 lines
82 KiB
JavaScript
3 lines
82 KiB
JavaScript
|
|
function MakeNoFieldsDroppable(){jQuery("#no-fields").droppable({over:function(a,b){jQuery("#gform_fields").height(jQuery(this).height()),jQuery(this).hide()},out:function(a,b){jQuery(this).show()}})}function CloseStatus(){jQuery(".updated_base, .error_base").slideUp()}function InitializeFieldSettings(){jQuery("#field_max_file_size").on("input propertychange",function(){var a=jQuery(this),b=parseInt(a.val());SetFieldProperty("maxFileSize",b||"")}).on("change",function(){var a=GetSelectedField(),b=a.maxFileSize?a.maxFileSize:"",c=""===b?"":b+"MB";this.value=c}),jQuery(document).on("input propertychange",".field_default_value",function(){SetFieldDefaultValue(this.value)}),jQuery(document).on("input propertychange",".field_placeholder, .field_placeholder_textarea",function(){SetFieldPlaceholder(this.value)}),jQuery("#field_choices").on("change",".field-choice-price",function(){var a=GetSelectedField(),b=jQuery(this).parent("li").index(),c=a.choices[b].price;this.value=c}),jQuery(".field_input_choices").on("input propertychange","input",function(){var a=jQuery(this).closest("li"),b=a.data("index");SetInputChoice(a.data("input_id"),b,a.find(".field-choice-value").val(),a.find(".field-choice-text").val())}).on("click keypress","input:radio, input:checkbox",function(){var a=jQuery(this).closest("li"),b=a.data("index");SetInputChoice(a.data("input_id"),b,a.find(".field-choice-value").val(),a.find(".field-choice-text").val())}).on("click keypress",".field-input-insert-choice",function(){var a=jQuery(this).closest("li"),b=a.closest("ul"),c=a.data("index");InsertInputChoice(b,a.data("input_id"),c+1)}).on("click keypress",".field-input-delete-choice",function(){var a=jQuery(this).closest("li"),b=a.closest("ul"),c=a.data("index");DeleteInputChoice(b,a.data("input_id"),c)}),jQuery(".field_input_choice_values_enabled").on("click keypress",function(){var a=jQuery(this).parent().siblings(".gfield_settings_input_choices_container");ToggleInputChoiceValue(a,this.checked),SetInputChoices(a.find("ul"))}),jQuery(".input_placeholders_setting").on("input propertychange",".input_placeholder",function(){var a=jQuery(this).closest(".input_placeholder_row").data("input_id");SetInputPlaceholder(this.value,a)}).on("input propertychange","#field_single_placeholder",function(){SetFieldPlaceholder(this.value)}),jQuery("#field_rich_text_editor").on("click keypress",function(){var a=GetSelectedField();if(this.checked){var b=!0;HasConditionalLogicDependency(a.id,a.value)&&(confirm(gf_vars.conditionalLogicRichTextEditorWarning)||(jQuery("#field_rich_text_editor").prop("checked",!1),b=!1)),b&&(jQuery("#field_placeholder, #field_placeholder_textarea").prop("disabled",!0),jQuery("span#placeholder_warning").css("display","block"))}else jQuery("#field_placeholder, #field_placeholder_textarea").prop("disabled",!1),jQuery("span#placeholder_warning").css("display","none")}),jQuery(".prepopulate_field_setting").on("input propertychange",".field_input_name",function(){var a=jQuery(this).closest(".field_input_name_row").data("input_id");SetInputName(this.value,a)}).on("input propertychange","#field_input_name",function(){SetInputName(this.value)}),jQuery(".custom_inputs_setting, .custom_inputs_sub_setting, .sub_labels_setting").on("click keypress",".input_active_icon",function(){var a=jQuery(this).closest(".field_custom_input_row").data("input_id");ToggleInputHidden(this,a)}).on("input propertychange",".field_custom_input_default_label",function(){var a=jQuery(this).closest(".field_custom_input_row").data("input_id");SetInputCustomLabel(this.value,a)}).on("input propertychange","#field_single_custom_label",function(){SetInputCustomLabel(this.value)}),jQuery(".default_input_values_setting").on("input propertychange",".default_input_value",function(){var a=jQuery(this).closest(".default_input_value_row").data("input_id");SetInputDefaultValue(this.value,a)}).on("input","#field_single_default_value",function(){SetFieldDefaultValue(this.value)}),jQuery(".choices_setting, .columns_setting").on("input propertychange",".field-choice-input",function(a){var b=jQuery(this),c=b.
|
||
|
|
var a=jQuery("#gfield_post_category_initial_item_enabled").is(":checked");SetFieldProperty("categoryInitialItem",a?jQuery("#field_post_category_initial_item").val():null),SetFieldProperty("categoryInitialItemEnabled",a)}function PopulateContentTemplate(a){if(0==jQuery("#"+a).val().length){var b=GetSelectedField();jQuery("#"+a).val("{"+b.label+":"+b.id+"}")}}function TogglePostContentTemplate(a){var b=a?"":"slow";jQuery("#gfield_post_content_enabled").is(":checked")?(jQuery("#gfield_post_content_container").show(b),a||PopulateContentTemplate("field_post_content_template")):jQuery("#gfield_post_content_container").hide(b)}function TogglePostTitleTemplate(a){var b=a?"":"slow";jQuery("#gfield_post_title_enabled").is(":checked")?(jQuery("#gfield_post_title_container").show(b),a||PopulateContentTemplate("field_post_title_template")):jQuery("#gfield_post_title_container").hide(b)}function ToggleCustomFieldTemplate(a){var b=a?"":"slow";jQuery("#gfield_customfield_content_enabled").is(":checked")?(jQuery("#gfield_customfield_content_container").show(b),a||PopulateContentTemplate("field_customfield_content_template")):jQuery("#gfield_customfield_content_container").hide(b)}function ToggleInputName(a){var b=a?"":"slow";jQuery("#field_prepopulate").is(":checked")?jQuery("#field_input_name_container").show(b):(jQuery("#field_input_name_container").hide(b),jQuery("#field_input_name").val(""))}function SetFieldColumns(){SetFieldChoices()}function ToggleChoiceValue(a){var b=GetSelectedField(),c=b.enablePrice?"_and_price":"",d=jQuery("#gfield_settings_choices_container");d.removeClass("choice_with_price choice_with_value choice_with_value_and_price"),jQuery("#field_choice_values_enabled").is(":checked")?d.addClass("choice_with_value"+c):b.enablePrice&&d.addClass("choice_with_price")}function ToggleInputChoiceValue(a,b){void 0===b&&(b=!1);var c=GetSelectedField(),d=a.find("li").data("input_id");GetInput(c,d).enableChoiceValue=b,a.removeClass("choice_with_value"),b&&a.addClass("choice_with_value")}function ToggleCopyValuesActivated(a){jQuery(".field_selected .copy_values_activated").prop("checked",a);var b=GetSelectedField();jQuery("#input_"+b.id).toggle(!a)}function TogglePageButton(a,b){var c=jQuery("#"+a+"_button_text").is(":checked");show_element=c?"#"+a+"_button_text_container":"#"+a+"_button_image_container",hide_element=c?"#"+a+"_button_image_container":"#"+a+"_button_text_container",b?(jQuery(hide_element).hide(),jQuery(show_element).show()):(jQuery(hide_element).hide(),jQuery(show_element).fadeIn(800))}function SetPageButton(a){field=GetSelectedField();var b=jQuery("#"+a+"_button_image").is(":checked")?"image":"text";field[a+"Button"].type=b,"image"==b?(field[a+"Button"].text="",field[a+"Button"].imageUrl=jQuery("#"+a+"_button_image_url").val()):(field[a+"Button"].text=jQuery("#"+a+"_button_text_input").val(),field[a+"Button"].imageUrl="")}function ToggleCustomField(a){var b=jQuery("#field_custom_existing").is(":checked");show_element=b?"#field_custom_field_name_select":"#field_custom_field_name_text",hide_element=b?"#field_custom_field_name_text":"#field_custom_field_name_select";var c="";jQuery(hide_element).hide(c),jQuery(show_element).show(c)}function ToggleInputMask(a){var b=a?"":"slow";jQuery("#field_input_mask").is(":checked")?(jQuery("#gform_input_mask").show(b),jQuery(".maxlen_setting").hide(),SetFieldProperty("inputMask",!0),jQuery("#field_maxlen").val(""),SetFieldProperty("maxLength","")):(jQuery("#gform_input_mask").hide(b),jQuery(".maxlen_setting").show(),SetFieldProperty("inputMask",!1),SetFieldProperty("inputMaskValue",""))}function ToggleInputMaskOptions(a){var b=jQuery("#field_mask_standard").is(":checked");show_element=b?"#field_mask_select":"#field_mask_text, .mask_text_description",hide_element=b?"#field_mask_text, .mask_text_description":"#field_mask_select";var c="";jQuery(hide_element).val("").hide(c),jQuery(show_element).show(c),a||SetFieldProperty("inputMaskValue","")}function ToggleAutoresponder(){jQuery("#form_autoresponder_enabled").is(":checked")?jQuery("#form_autoresponder_container").show("slow"):jQ
|
||
|
|
;for(var d=0;d<c.inputs.length;d++)if(c.inputs[d].id==b)return c.inputs[d].placeholder=a,void jQuery('[name="input_'+b+'"], #input_'+b.toString().replace(".","_")).each(function(){var b=this.nodeName;"INPUT"==b?jQuery(this).prop("placeholder",a):"SELECT"==b&&jQuery(this).find('option[value=""]').text(a)})}function ResetInputPlaceholders(a){a||(a=GetSelectedField()),a.inputs&&jQuery(a.inputs).each(function(){SetInputPlaceholder(void 0!==this.placeholder?this.placeholder:"",this.id)})}function ResetDefaultInputValues(a){a||(a=GetSelectedField()),a.inputs&&jQuery(a.inputs).each(function(){SetInputDefaultValue(void 0!==this.defaultValue?this.defaultValue:"",this.id)})}function SetInputCustomLabel(a,b){var c,d,e,f=GetSelectedField();a&&(a=a.trim());for(var g=0;g<f.inputs.length;g++)if(e=f.inputs[g],e.id==b)return""==a?(delete e.customLabel,d=void 0!==e.defaultLabel?e.defaultLabel:e.label):(e.customLabel=a,d=a),c="input_"+f.inputs[g].id,c=c.replace(".","_"),c=".ginput_container label[for="+c+"]",void jQuery(c).text(d)}function SetInputHidden(a,b){for(var c=GetSelectedField(),d=0;d<c.inputs.length;d++)if(c.inputs[d].id==b)return c.inputs[d].isHidden=a,b=b.toString().replace(".","_"),void jQuery("#input_"+b+"_container").toggle(!a)}function SetSelectedCategories(){var a=GetSelectedField();a.choices=new Array,jQuery(".gfield_category_checkbox").each(function(){this.checked&&a.choices.push(new Choice(this.name,this.value))}),a.choices.sort(function(a,b){return a.text.toLowerCase()>b.text.toLowerCase()})}function SetFieldLabel(a){var b=jQuery(".field_selected .gfield_required")[0];jQuery(".field_selected .gfield_label, .field_selected .gsection_title").text(a).append(b),SetFieldProperty("label",a)}function SetCaptchaTheme(a,b){jQuery(".field_selected .gfield_captcha").attr("src",b),SetFieldProperty("captchaTheme",a)}function SetCaptchaSize(a){var b=jQuery("#field_captcha_type").val();SetFieldProperty("simpleCaptchaSize",a),RedrawCaptcha(),jQuery(".field_selected .gfield_captcha_input_container").removeClass(b+"_small").removeClass(b+"_medium").removeClass(b+"_large").addClass(b+"_"+a)}function SetCaptchaFontColor(a){SetFieldProperty("simpleCaptchaFontColor",a),RedrawCaptcha()}function SetCaptchaBackgroundColor(a){SetFieldProperty("simpleCaptchaBackgroundColor",a),RedrawCaptcha()}function RedrawCaptcha(){"math"==jQuery("#field_captcha_type").val()?(url_1=GetCaptchaUrl(1),url_2=GetCaptchaUrl(2),url_3=GetCaptchaUrl(3),jQuery(".field_selected .gfield_captcha:eq(0)").attr("src",url_1),jQuery(".field_selected .gfield_captcha:eq(1)").attr("src",url_2),jQuery(".field_selected .gfield_captcha:eq(2)").attr("src",url_3)):(url=GetCaptchaUrl(),jQuery(".field_selected .gfield_captcha").attr("src",url))}function SetFieldSize(a){jQuery(".field_selected .small, .field_selected .medium, .field_selected .large").removeClass("small").removeClass("medium").removeClass("large").addClass(a),SetFieldProperty("size",a)}function SetFieldLabelPlacement(a){var b=a||form.labelPlacement;SetFieldProperty("labelPlacement",a),jQuery(".field_selected").removeClass("top_label").removeClass("right_label").removeClass("left_label").removeClass("hidden_label").addClass(b),"left_label"==field.labelPlacement||"right_label"==field.labelPlacement||""==field.labelPlacement&&"top_label"!=form.labelPlacement?(jQuery("#field_description_placement").val(""),SetFieldProperty("descriptionPlacement",""),jQuery("#field_description_placement_container").hide("slow")):jQuery("#field_description_placement_container").show("slow"),SetFieldProperty("labelPlacement",a),RefreshSelectedFieldPreview()}function SetFieldDescriptionPlacement(a){var b="above"==a||""==a&&"above)"==form.descriptionPlacement;SetFieldProperty("descriptionPlacement",a),RefreshSelectedFieldPreview(function(){b?jQuery(".field_selected").addClass("description_above"):jQuery(".field_selected").removeClass("description_above")})}function SetFieldSubLabelPlacement(a){SetFieldProperty("subLabelPlacement",a),RefreshSelectedFieldPreview()}function SetFieldVisibility(a,b,c){if(!c&&"administrative"==a&&HasConditionalLogicDepe
|