PluginProbe
Contact Forms by Cimatti / 1.4.1
Contact Forms by Cimatti v1.4.1
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.4.1, at form-settings.js

112 lines 4.6 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_name','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 if (accuaWidgets) {
75 $('#widgets-right .button-primary.widget-control-save').click();
76 accuaWidgets.saveOrder();
77 }
78
79
80 setTimeout(function(){
81 $.ajax(ajaxurl, {
82 'type': 'POST',
83 'data': data,
84 'success': function(){
85 document.getElementById('accua_form_preview_area').src = 'admin-ajax.php?action=accua_forms_preview&fid=' + form_id;
86 try {
87 if (history.pushState && window.location.search.search('page=accua_forms_list') == -1) {
88 history.pushState('', document.title, 'admin.php?page=accua_forms_list&fid=' + form_id);
89 window.onpopstate = function(event) {
90 location.reload();
91 }
92 }
93 } catch (e) {}
94
95 var success_message = $("<span style='color:#0C0'>Settings saved</span>");
96 save_status.empty();
97 save_status.append(success_message);
98 var success_fadeout = function(){
99 success_message.fadeOut(5000);
100 }
101 setTimeout(success_fadeout, 15000);
102 save_button.removeAttr('disabled');
103 },
104 'error': function(){
105 save_status.empty();
106 save_status.append("<span style='color:#c00'>Error saving settings, please retry</span>");
107 save_button.removeAttr('disabled');
108 }
109 }); }, 400);
110 });
111 });
112