PluginProbe
Contact Forms by Cimatti / 1.3
Contact Forms by Cimatti v1.3
2.3.6 2.3.5 2.3.0 2.2.32 2.2.4 2.2.0 2.1.2 2.1.1 trunk 1.0 1.1 1.2 1.2.1 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 All 62 releases
contact-forms / form-settings.js

form-settings.js in Contact Forms by Cimatti 1.3, at form-settings.js

106 lines 4.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery(function($){
2 $('#accua_form_style_border_color .accua_form_value').wpColorPicker();
3 $('#accua_form_style_background_color .accua_form_value').wpColorPicker();
4 $('#accua_form_style_color .accua_form_value').wpColorPicker();
5 $('#accua_form_style_field_border_color .accua_form_value').wpColorPicker();
6 $('#accua_form_style_field_background_color .accua_form_value').wpColorPicker();
7 $('#accua_form_style_field_color .accua_form_value').wpColorPicker();
8 $('#accua_form_style_submit_border_color .accua_form_value').wpColorPicker();
9 $('#accua_form_style_submit_background_color .accua_form_value').wpColorPicker();
10 $('#accua_form_style_submit_color .accua_form_value').wpColorPicker();
11
12 function get_tinymce_content(name){
13 if (jQuery("#"+name+" .wp-editor-wrap").hasClass("tmce-active")){
14 return tinyMCE.get(name+'_textarea').getContent();
15 } else
16 {
17 return jQuery("#" +name+ "_textarea").val();
18 }
19 }
20
21 var save_button = $('.accua_form_save_settings_button');
22 var save_status = $(".accua_form_save_settings_status");
23 $('.accua_form_save_settings_button').click(function(){
24 save_button.attr('disabled', 'disabled')
25 save_status.empty();
26 save_status.append("<span class='accua_form_api_throbbler'></span>");
27
28 var form_id = $('#accua_form_save_settings_id').val();
29
30 var data = {
31 'action': 'accua-save-form-settings',
32 'form-id': form_id,
33 'title': $('#title').val(),
34 'use_ajax': ($('#accua_form_use_ajax .accua_form_value').is(':checked') ? 1 : 0)
35 };
36
37 var layout = $('#accua_form_layout .accua_form_value').val();
38 if (layout == 'toplabel' || layout == 'sidebyside') {
39 data.layout = layout;
40 }
41
42 $.each(
43 ['success_message','error_message','emails_from','admin_emails_to','emails_bcc','admin_emails_subject','admin_emails_message','confirmation_emails_subject','confirmation_emails_message','style_margin','style_border_color','style_border_width','style_border_radius','style_background_color','style_padding','style_color','style_font_size','style_field_spacing','style_field_border_color','style_field_border_width','style_field_border_radius','style_field_background_color','style_field_padding','style_field_color','style_submit_border_color','style_submit_border_width','style_submit_border_radius','style_submit_background_color','style_submit_padding','style_submit_color','style_submit_font_size'],
44 function(i,key){
45 var value = $('#accua_form_'+key+' .accua_form_check_override:checked').val();
46 if(value!=undefined && value!=0) {
47 if(value==-1)
48 {
49 data[key] ='';
50 data[key+"_no_message"] = 1;
51 }
52 else {
53 var element = $('#accua_form_'+key+' .accua_form_value');
54 if(element.is('input')){
55 data[key] = $('#accua_form_'+key+' .accua_form_value').val();
56 }
57 else if(element.is('textarea')) {
58 data[key] = get_tinymce_content('accua_form_'+key);
59 }
60 }
61 }
62 }
63 );
64
65 /*
66 $.post(
67 ajaxurl,
68 data,
69 function(){},
70 'json'
71 )
72 */
73
74 $.ajax(ajaxurl, {
75 'type': 'POST',
76 'data': data,
77 'success': function(){
78 document.getElementById('accua_form_preview_area').src = 'admin-ajax.php?action=accua_forms_preview&fid=' + form_id;
79 try {
80 if (history.pushState && window.location.search.search('page=accua_forms_list') == -1) {
81 history.pushState('', document.title, 'admin.php?page=accua_forms_list&fid=' + form_id);
82 window.onpopstate = function(event) {
83 location.reload();
84 }
85 }
86 } catch (e) {}
87
88 var success_message = $("<span style='color:#0C0'>Settings saved</span>");
89 save_status.empty();
90 save_status.append(success_message);
91 var success_fadeout = function(){
92 success_message.fadeOut(5000);
93 }
94 setTimeout(success_fadeout, 15000);
95 save_button.removeAttr('disabled');
96 },
97 'error': function(){
98 save_status.empty();
99 save_status.append("<span style='color:#c00'>Error saving settings, please retry</span>");
100 save_button.removeAttr('disabled');
101 }
102 });
103
104 });
105 });
106