Version Description
- When some styling settings are blank, allow inheritance from theme styling.
- Allow a form action to be updated during form migration.
- Code: Update javascript codestyling.
Download this release
Release Info
Developer | sswells |
Plugin | Formidable Forms – Form Builder for WordPress |
Version | 4.04.05 |
Comparing to | |
See all releases |
Code changes from version 4.04.04 to 4.04.05
- classes/helpers/FrmAppHelper.php +3 -3
- classes/helpers/FrmFormMigratorsHelper.php +2 -2
- classes/models/FrmFormAction.php +9 -2
- classes/models/FrmFormMigrator.php +2 -0
- css/_single_theme.css.php +182 -61
- css/custom_theme.css.php +22 -6
- formidable.php +1 -1
- js/formidable.js +467 -404
- js/formidable.min.js +55 -53
- js/formidable_admin.js +698 -640
- js/formidable_admin_global.js +188 -137
- languages/formidable.pot +9 -9
- readme.txt +6 -7
classes/helpers/FrmAppHelper.php
CHANGED
@@ -11,7 +11,7 @@ class FrmAppHelper {
|
|
11 |
/**
|
12 |
* @since 2.0
|
13 |
*/
|
14 |
-
public static $plug_version = '4.04.
|
15 |
|
16 |
/**
|
17 |
* @since 1.07.02
|
@@ -2215,7 +2215,7 @@ class FrmAppHelper {
|
|
2215 |
'saved' => esc_attr( __( 'Saved', 'formidable' ) ),
|
2216 |
'ok' => __( 'OK', 'formidable' ),
|
2217 |
'cancel' => __( 'Cancel', 'formidable' ),
|
2218 |
-
'
|
2219 |
'clear_default' => __( 'Clear default value when typing', 'formidable' ),
|
2220 |
'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ),
|
2221 |
'valid_default' => __( 'Default value will pass form validation', 'formidable' ),
|
@@ -2237,7 +2237,7 @@ class FrmAppHelper {
|
|
2237 |
'import_complete' => __( 'Import Complete', 'formidable' ),
|
2238 |
'updating' => __( 'Please wait while your site updates.', 'formidable' ),
|
2239 |
'no_save_warning' => __( 'Warning: There is no way to retrieve unsaved entries.', 'formidable' ),
|
2240 |
-
'
|
2241 |
'jquery_ui_url' => self::jquery_ui_base_url(),
|
2242 |
'pro_url' => is_callable( 'FrmProAppHelper::plugin_url' ) ? FrmProAppHelper::plugin_url() : '',
|
2243 |
'no_licenses' => __( 'No new licenses were found', 'formidable' ),
|
11 |
/**
|
12 |
* @since 2.0
|
13 |
*/
|
14 |
+
public static $plug_version = '4.04.05';
|
15 |
|
16 |
/**
|
17 |
* @since 1.07.02
|
2215 |
'saved' => esc_attr( __( 'Saved', 'formidable' ) ),
|
2216 |
'ok' => __( 'OK', 'formidable' ),
|
2217 |
'cancel' => __( 'Cancel', 'formidable' ),
|
2218 |
+
'default_label' => __( 'Default', 'formidable' ),
|
2219 |
'clear_default' => __( 'Clear default value when typing', 'formidable' ),
|
2220 |
'no_clear_default' => __( 'Do not clear default value when typing', 'formidable' ),
|
2221 |
'valid_default' => __( 'Default value will pass form validation', 'formidable' ),
|
2237 |
'import_complete' => __( 'Import Complete', 'formidable' ),
|
2238 |
'updating' => __( 'Please wait while your site updates.', 'formidable' ),
|
2239 |
'no_save_warning' => __( 'Warning: There is no way to retrieve unsaved entries.', 'formidable' ),
|
2240 |
+
'private_label' => __( 'Private', 'formidable' ),
|
2241 |
'jquery_ui_url' => self::jquery_ui_base_url(),
|
2242 |
'pro_url' => is_callable( 'FrmProAppHelper::plugin_url' ) ? FrmProAppHelper::plugin_url() : '',
|
2243 |
'no_licenses' => __( 'No new licenses were found', 'formidable' ),
|
classes/helpers/FrmFormMigratorsHelper.php
CHANGED
@@ -76,13 +76,13 @@ class FrmFormMigratorsHelper {
|
|
76 |
|
77 |
private static function importable_forms() {
|
78 |
return array(
|
79 |
-
|
80 |
'class' => 'FrmGravityImporter',
|
81 |
'plugin' => 'gravityforms/gravityforms.php',
|
82 |
'importer' => 'formidable-gravity-forms-importer/formidable-gravity-forms-importer.php',
|
83 |
'name' => 'Gravity Forms',
|
84 |
'package' => 'https://downloads.wordpress.org/plugin/formidable-gravity-forms-importer.zip',
|
85 |
-
)
|
86 |
'pf' => array(
|
87 |
'class' => 'FrmPirateImporter',
|
88 |
'plugin' => 'pirate-forms/pirate-forms.php',
|
76 |
|
77 |
private static function importable_forms() {
|
78 |
return array(
|
79 |
+
'gf' => array(
|
80 |
'class' => 'FrmGravityImporter',
|
81 |
'plugin' => 'gravityforms/gravityforms.php',
|
82 |
'importer' => 'formidable-gravity-forms-importer/formidable-gravity-forms-importer.php',
|
83 |
'name' => 'Gravity Forms',
|
84 |
'package' => 'https://downloads.wordpress.org/plugin/formidable-gravity-forms-importer.zip',
|
85 |
+
),
|
86 |
'pf' => array(
|
87 |
'class' => 'FrmPirateImporter',
|
88 |
'plugin' => 'pirate-forms/pirate-forms.php',
|
classes/models/FrmFormAction.php
CHANGED
@@ -729,7 +729,7 @@ class FrmFormAction {
|
|
729 |
continue;
|
730 |
}
|
731 |
|
732 |
-
self::prepare_logic_value( $condition['hide_opt'] );
|
733 |
|
734 |
$observed_value = self::get_value_from_entry( $entry, $condition['hide_field'] );
|
735 |
|
@@ -758,7 +758,7 @@ class FrmFormAction {
|
|
758 |
*
|
759 |
* @param array|string $logic_value
|
760 |
*/
|
761 |
-
private static function prepare_logic_value( &$logic_value ) {
|
762 |
if ( is_array( $logic_value ) ) {
|
763 |
$logic_value = reset( $logic_value );
|
764 |
}
|
@@ -766,6 +766,13 @@ class FrmFormAction {
|
|
766 |
if ( $logic_value == 'current_user' ) {
|
767 |
$logic_value = get_current_user_id();
|
768 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
}
|
770 |
|
771 |
/**
|
729 |
continue;
|
730 |
}
|
731 |
|
732 |
+
self::prepare_logic_value( $condition['hide_opt'], $action, $entry );
|
733 |
|
734 |
$observed_value = self::get_value_from_entry( $entry, $condition['hide_field'] );
|
735 |
|
758 |
*
|
759 |
* @param array|string $logic_value
|
760 |
*/
|
761 |
+
private static function prepare_logic_value( &$logic_value, $action, $entry ) {
|
762 |
if ( is_array( $logic_value ) ) {
|
763 |
$logic_value = reset( $logic_value );
|
764 |
}
|
766 |
if ( $logic_value == 'current_user' ) {
|
767 |
$logic_value = get_current_user_id();
|
768 |
}
|
769 |
+
|
770 |
+
$logic_value = apply_filters( 'frm_content', $logic_value, $action->menu_order, $entry );
|
771 |
+
|
772 |
+
/**
|
773 |
+
* @since 4.04.05
|
774 |
+
*/
|
775 |
+
$logic_value = apply_filters( 'frm_action_logic_value', $logic_value );
|
776 |
}
|
777 |
|
778 |
/**
|
classes/models/FrmFormMigrator.php
CHANGED
@@ -423,6 +423,8 @@ abstract class FrmFormMigrator {
|
|
423 |
foreach ( $action as $key => $value ) {
|
424 |
if ( $key === 'post_title' ) {
|
425 |
$new_action->post_title = $value;
|
|
|
|
|
426 |
} elseif ( $key === 'the_post_title' ) {
|
427 |
$new_action->post_content['post_title'] = $value;
|
428 |
} elseif ( is_string( $value ) ) {
|
423 |
foreach ( $action as $key => $value ) {
|
424 |
if ( $key === 'post_title' ) {
|
425 |
$new_action->post_title = $value;
|
426 |
+
} elseif ( $key === 'ID' ) {
|
427 |
+
$new_action->ID = $value;
|
428 |
} elseif ( $key === 'the_post_title' ) {
|
429 |
$new_action->post_content['post_title'] = $value;
|
430 |
} elseif ( is_string( $value ) ) {
|
css/_single_theme.css.php
CHANGED
@@ -35,54 +35,98 @@ $arrow_icons = FrmStylesHelper::arrow_icons();
|
|
35 |
<?php } ?>
|
36 |
|
37 |
.<?php echo esc_html( $style_class ); ?> .frm_form_fields > fieldset{
|
38 |
-
|
|
|
|
|
39 |
border-style:solid;
|
40 |
-
|
|
|
|
|
41 |
margin:0;
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
|
47 |
.<?php echo esc_html( $style_class ); ?> legend + h3,
|
48 |
.<?php echo esc_html( $style_class ); ?> h3.frm_form_title{
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
|
56 |
.<?php echo esc_html( $style_class ); ?> .frm_primary_label{
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
margin:0;
|
63 |
-
|
|
|
|
|
64 |
width:auto;
|
65 |
display:block;
|
66 |
}
|
67 |
|
68 |
.<?php echo esc_html( $style_class ); ?> .frm_form_field.frm_html_container,
|
69 |
.<?php echo esc_html( $style_class ); ?> .frm_form_field .frm_show_it{
|
70 |
-
|
71 |
-
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
|
|
|
74 |
.<?php echo esc_html( $style_class ); ?> .frm_form_field.frm_html_container{
|
75 |
font-size:<?php echo esc_html( $form_desc_size . $important ); ?>;
|
76 |
}
|
|
|
77 |
|
78 |
.<?php echo esc_html( $style_class ); ?> .frm_form_field .frm_show_it{
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
|
|
|
83 |
.<?php echo esc_html( $style_class ); ?> .frm_icon_font{
|
84 |
color:<?php echo esc_html( $label_color . $important ); ?>;
|
85 |
}
|
|
|
86 |
|
87 |
.<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_minus_icon:before{
|
88 |
content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['-'] : $minus_icons[1]['-'] ); ?>";
|
@@ -94,23 +138,31 @@ $arrow_icons = FrmStylesHelper::arrow_icons();
|
|
94 |
|
95 |
.<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_minus_icon:before,
|
96 |
.<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_plus_icon:before{
|
97 |
-
|
|
|
|
|
98 |
vertical-align:middle;
|
99 |
}
|
100 |
|
101 |
.<?php echo esc_html( $style_class ); ?> .frm_trigger.active .frm_icon_font.frm_arrow_icon:before{
|
102 |
content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['-'] : $arrow_icons[1]['-'] ); ?>";
|
103 |
-
|
|
|
|
|
104 |
}
|
105 |
|
106 |
.<?php echo esc_html( $style_class ); ?> .frm_trigger .frm_icon_font.frm_arrow_icon:before{
|
107 |
content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['+'] : $arrow_icons[1]['+'] ); ?>";
|
108 |
-
|
|
|
|
|
109 |
}
|
110 |
|
|
|
111 |
.<?php echo esc_html( $style_class ); ?> .form-field{
|
112 |
margin-bottom:<?php echo esc_html( $field_margin . $important ); ?>;
|
113 |
}
|
|
|
114 |
.<?php echo esc_html( $style_class ); ?> .frm_grid,
|
115 |
.<?php echo esc_html( $style_class ); ?> .frm_grid_first,
|
116 |
.<?php echo esc_html( $style_class ); ?> .frm_grid_odd {
|
@@ -125,24 +177,45 @@ $arrow_icons = FrmStylesHelper::arrow_icons();
|
|
125 |
.<?php echo esc_html( $style_class ); ?> div.frm_description,
|
126 |
.<?php echo esc_html( $style_class ); ?> .frm-show-form > div.frm_description,
|
127 |
.<?php echo esc_html( $style_class ); ?> .frm_error{
|
128 |
-
|
|
|
|
|
129 |
padding:0;
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
max-width:100%;
|
137 |
}
|
138 |
|
139 |
/* Form description */
|
140 |
.<?php echo esc_html( $style_class ); ?> .frm-show-form div.frm_description p{
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
}
|
147 |
|
148 |
/* Left and right labels */
|
@@ -200,15 +273,27 @@ if ( '' === $field_height || 'auto' === $field_height ) {
|
|
200 |
}
|
201 |
|
202 |
.<?php echo esc_html( $style_class ); ?> .frm_scale label{
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
}
|
208 |
|
209 |
.<?php echo esc_html( $style_class ); ?> .frm_required{
|
210 |
-
|
211 |
-
|
|
|
|
|
|
|
|
|
212 |
}
|
213 |
|
214 |
.<?php echo esc_html( $style_class ); ?> input[type=text],
|
@@ -222,8 +307,12 @@ if ( '' === $field_height || 'auto' === $field_height ) {
|
|
222 |
.<?php echo esc_html( $style_class ); ?> textarea,
|
223 |
.<?php echo esc_html( $style_class ); ?> .frm-card-element.StripeElement,
|
224 |
.<?php echo esc_html( $style_class ); ?> .chosen-container{
|
225 |
-
|
226 |
-
|
|
|
|
|
|
|
|
|
227 |
margin-bottom:0<?php echo esc_html( $important ); ?>;
|
228 |
}
|
229 |
|
@@ -300,7 +389,9 @@ if ( ! empty( $important ) ) {
|
|
300 |
.<?php echo esc_html( $style_class ); ?> input[type=file]{
|
301 |
color: <?php echo esc_html( $text_color . $important ); ?>;
|
302 |
padding:0px;
|
303 |
-
|
|
|
|
|
304 |
font-size:<?php echo esc_html( $field_font_size . $important ); ?>;
|
305 |
}
|
306 |
|
@@ -407,7 +498,9 @@ if ( ! empty( $important ) ) {
|
|
407 |
.frm_form_submit_style,
|
408 |
.<?php echo esc_html( $style_class ); ?> .frm-edit-page-btn {
|
409 |
width:<?php echo esc_html( ( $submit_width == '' ? 'auto' : $submit_width ) . $important ); ?>;
|
410 |
-
|
|
|
|
|
411 |
font-size:<?php echo esc_html( $submit_font_size . $important ); ?>;
|
412 |
height:<?php echo esc_html( $submit_height . $important ); ?>;
|
413 |
line-height:normal<?php echo esc_html( $important ); ?>;
|
@@ -507,7 +600,9 @@ if ( ! empty( $important ) ) {
|
|
507 |
.<?php echo esc_html( $style_class ); ?>.frm_inline_top .frm_submit::before,
|
508 |
.<?php echo esc_html( $style_class ); ?> .frm_submit.frm_inline_submit::before {
|
509 |
content:"before";
|
510 |
-
|
|
|
|
|
511 |
font-size:<?php echo esc_html( $font_size . $important ); ?>;
|
512 |
color:<?php echo esc_html( $label_color . $important ); ?>;
|
513 |
font-weight:<?php echo esc_html( $weight . $important ); ?>;
|
@@ -526,13 +621,17 @@ if ( ! empty( $important ) ) {
|
|
526 |
}
|
527 |
|
528 |
.<?php echo esc_html( $style_class ); ?> a.frm_save_draft{
|
529 |
-
|
|
|
|
|
530 |
font-size:<?php echo esc_html( $submit_font_size ); ?>;
|
531 |
font-weight:<?php echo esc_html( $submit_weight ); ?>;
|
532 |
}
|
533 |
|
534 |
.<?php echo esc_html( $style_class ); ?> #frm_field_cptch_number_container{
|
535 |
-
|
|
|
|
|
536 |
font-size:<?php echo esc_html( $font_size . $important ); ?>;
|
537 |
color:<?php echo esc_html( $label_color . $important ); ?>;
|
538 |
font-weight:<?php echo esc_html( $weight . $important ); ?>;
|
@@ -561,7 +660,9 @@ if ( ! empty( $important ) ) {
|
|
561 |
|
562 |
.<?php echo esc_html( $style_class ); ?> .frm_radio label,
|
563 |
.<?php echo esc_html( $style_class ); ?> .frm_checkbox label{
|
564 |
-
|
|
|
|
|
565 |
font-size:<?php echo esc_html( $check_font_size . $important ); ?>;
|
566 |
color:<?php echo esc_html( $check_label_color . $important ); ?>;
|
567 |
font-weight:<?php echo esc_html( $check_weight . $important ); ?>;
|
@@ -711,18 +812,38 @@ if ( ! empty( $important ) ) {
|
|
711 |
}
|
712 |
|
713 |
.<?php echo esc_html( $style_class ); ?> .frm_button{
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
726 |
}
|
727 |
|
728 |
<?php do_action( 'frm_output_single_style', $settings ); ?>
|
35 |
<?php } ?>
|
36 |
|
37 |
.<?php echo esc_html( $style_class ); ?> .frm_form_fields > fieldset{
|
38 |
+
<?php if ( ! empty( $fieldset ) ) { ?>
|
39 |
+
border-width:<?php echo esc_html( $fieldset . $important ); ?>;
|
40 |
+
<?php } ?>
|
41 |
border-style:solid;
|
42 |
+
<?php if ( ! empty( $fieldset_color ) ) { ?>
|
43 |
+
border-color:<?php echo esc_html( $fieldset_color . $important ); ?>;
|
44 |
+
<?php } ?>
|
45 |
margin:0;
|
46 |
+
<?php if ( ! empty( $fieldset_padding ) ) { ?>
|
47 |
+
padding:<?php echo esc_html( $fieldset_padding . $important ); ?>;
|
48 |
+
<?php } ?>
|
49 |
+
<?php if ( ! empty( $fieldset_bg_color ) ) { ?>
|
50 |
+
background-color:<?php echo esc_html( $fieldset_bg_color ); ?>;
|
51 |
+
<?php } ?>
|
52 |
+
<?php if ( ! empty( $font ) ) { ?>
|
53 |
+
font-family:<?php echo FrmAppHelper::kses( $font ); // WPCS: XSS ok. ?>;
|
54 |
+
<?php } ?>
|
55 |
}
|
56 |
|
57 |
.<?php echo esc_html( $style_class ); ?> legend + h3,
|
58 |
.<?php echo esc_html( $style_class ); ?> h3.frm_form_title{
|
59 |
+
<?php if ( ! empty( $title_size ) ) { ?>
|
60 |
+
font-size:<?php echo esc_html( $title_size . $important ); ?>;
|
61 |
+
<?php } ?>
|
62 |
+
<?php if ( ! empty( $title_color ) ) { ?>
|
63 |
+
color:<?php echo esc_html( $title_color . $important ); ?>;
|
64 |
+
<?php } ?>
|
65 |
+
<?php if ( ! empty( $font ) ) { ?>
|
66 |
+
font-family:<?php echo FrmAppHelper::kses( $font ); // WPCS: XSS ok. ?>;
|
67 |
+
<?php } ?>
|
68 |
+
<?php if ( ! empty( $title_margin_top ) ) { ?>
|
69 |
+
margin-top:<?php echo esc_html( $title_margin_top . $important ); ?>;
|
70 |
+
<?php } ?>
|
71 |
+
<?php if ( ! empty( $title_margin_bottom ) ) { ?>
|
72 |
+
margin-bottom:<?php echo esc_html( $title_margin_bottom . $important ); ?>;
|
73 |
+
<?php } ?>
|
74 |
}
|
75 |
|
76 |
.<?php echo esc_html( $style_class ); ?> .frm_primary_label{
|
77 |
+
<?php if ( ! empty( $font ) ) { ?>
|
78 |
+
font-family:<?php echo FrmAppHelper::kses( $font ); // WPCS: XSS ok. ?>;
|
79 |
+
<?php } ?>
|
80 |
+
<?php if ( ! empty( $font_size ) ) { ?>
|
81 |
+
font-size:<?php echo esc_html( $font_size . $important ); ?>;
|
82 |
+
<?php } ?>
|
83 |
+
<?php if ( ! empty( $label_color ) ) { ?>
|
84 |
+
color:<?php echo esc_html( $label_color . $important ); ?>;
|
85 |
+
<?php } ?>
|
86 |
+
<?php if ( ! empty( $weight ) ) { ?>
|
87 |
+
font-weight:<?php echo esc_html( $weight . $important ); ?>;
|
88 |
+
<?php } ?>
|
89 |
+
<?php if ( ! empty( $align ) ) { ?>
|
90 |
+
text-align:<?php echo esc_html( $align . $important ); ?>;
|
91 |
+
<?php } ?>
|
92 |
margin:0;
|
93 |
+
<?php if ( ! empty( $label_padding ) ) { ?>
|
94 |
+
padding:<?php echo esc_html( $label_padding . $important ); ?>;
|
95 |
+
<?php } ?>
|
96 |
width:auto;
|
97 |
display:block;
|
98 |
}
|
99 |
|
100 |
.<?php echo esc_html( $style_class ); ?> .frm_form_field.frm_html_container,
|
101 |
.<?php echo esc_html( $style_class ); ?> .frm_form_field .frm_show_it{
|
102 |
+
<?php if ( ! empty( $font ) ) { ?>
|
103 |
+
font-family:<?php echo FrmAppHelper::kses( $font . $important ); // WPCS: XSS ok. ?>;
|
104 |
+
<?php } ?>
|
105 |
+
<?php if ( ! empty( $form_desc_color ) ) { ?>
|
106 |
+
color:<?php echo esc_html( $form_desc_color . $important ); ?>;
|
107 |
+
<?php } ?>
|
108 |
}
|
109 |
|
110 |
+
<?php if ( ! empty( $form_desc_size ) ) { ?>
|
111 |
.<?php echo esc_html( $style_class ); ?> .frm_form_field.frm_html_container{
|
112 |
font-size:<?php echo esc_html( $form_desc_size . $important ); ?>;
|
113 |
}
|
114 |
+
<?php } ?>
|
115 |
|
116 |
.<?php echo esc_html( $style_class ); ?> .frm_form_field .frm_show_it{
|
117 |
+
<?php if ( ! empty( $field_font_size ) ) { ?>
|
118 |
+
font-size:<?php echo esc_html( $field_font_size . $important ); ?>;
|
119 |
+
<?php } ?>
|
120 |
+
<?php if ( ! empty( $field_weight ) ) { ?>
|
121 |
+
font-weight:<?php echo esc_html( $field_weight ); ?>;
|
122 |
+
<?php } ?>
|
123 |
}
|
124 |
|
125 |
+
<?php if ( ! empty( $label_color ) ) { ?>
|
126 |
.<?php echo esc_html( $style_class ); ?> .frm_icon_font{
|
127 |
color:<?php echo esc_html( $label_color . $important ); ?>;
|
128 |
}
|
129 |
+
<?php } ?>
|
130 |
|
131 |
.<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_minus_icon:before{
|
132 |
content:"\e<?php echo esc_html( isset( $minus_icons[ $repeat_icon ] ) ? $minus_icons[ $repeat_icon ]['-'] : $minus_icons[1]['-'] ); ?>";
|
138 |
|
139 |
.<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_minus_icon:before,
|
140 |
.<?php echo esc_html( $style_class ); ?> .frm_icon_font.frm_plus_icon:before{
|
141 |
+
<?php if ( ! empty( $submit_text_color ) ) { ?>
|
142 |
+
color:<?php echo esc_html( $submit_text_color . $important ); ?>;
|
143 |
+
<?php } ?>
|
144 |
vertical-align:middle;
|
145 |
}
|
146 |
|
147 |
.<?php echo esc_html( $style_class ); ?> .frm_trigger.active .frm_icon_font.frm_arrow_icon:before{
|
148 |
content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['-'] : $arrow_icons[1]['-'] ); ?>";
|
149 |
+
<?php if ( ! empty( $section_color ) ) { ?>
|
150 |
+
color:<?php echo esc_html( $section_color . $important ); ?>;
|
151 |
+
<?php } ?>
|
152 |
}
|
153 |
|
154 |
.<?php echo esc_html( $style_class ); ?> .frm_trigger .frm_icon_font.frm_arrow_icon:before{
|
155 |
content:"\e<?php echo esc_html( isset( $arrow_icons[ $collapse_icon ] ) ? $arrow_icons[ $collapse_icon ]['+'] : $arrow_icons[1]['+'] ); ?>";
|
156 |
+
<?php if ( ! empty( $section_color ) ) { ?>
|
157 |
+
color:<?php echo esc_html( $section_color . $important ); ?>;
|
158 |
+
<?php } ?>
|
159 |
}
|
160 |
|
161 |
+
<?php if ( ! empty( $field_margin ) ) { ?>
|
162 |
.<?php echo esc_html( $style_class ); ?> .form-field{
|
163 |
margin-bottom:<?php echo esc_html( $field_margin . $important ); ?>;
|
164 |
}
|
165 |
+
<?php } ?>
|
166 |
.<?php echo esc_html( $style_class ); ?> .frm_grid,
|
167 |
.<?php echo esc_html( $style_class ); ?> .frm_grid_first,
|
168 |
.<?php echo esc_html( $style_class ); ?> .frm_grid_odd {
|
177 |
.<?php echo esc_html( $style_class ); ?> div.frm_description,
|
178 |
.<?php echo esc_html( $style_class ); ?> .frm-show-form > div.frm_description,
|
179 |
.<?php echo esc_html( $style_class ); ?> .frm_error{
|
180 |
+
<?php if ( ! empty( $description_margin ) ) { ?>
|
181 |
+
margin:<?php echo esc_html( $description_margin . $important ); ?>;
|
182 |
+
<?php } ?>
|
183 |
padding:0;
|
184 |
+
<?php if ( ! empty( $font ) ) { ?>
|
185 |
+
font-family:<?php echo FrmAppHelper::kses( $font . $important ); // WPCS: XSS ok. ?>;
|
186 |
+
<?php } ?>
|
187 |
+
<?php if ( ! empty( $description_font_size ) ) { ?>
|
188 |
+
font-size:<?php echo esc_html( $description_font_size . $important ); ?>;
|
189 |
+
<?php } ?>
|
190 |
+
<?php if ( ! empty( $description_color ) ) { ?>
|
191 |
+
color:<?php echo esc_html( $description_color . $important ); ?>;
|
192 |
+
<?php } ?>
|
193 |
+
<?php if ( ! empty( $description_weight ) ) { ?>
|
194 |
+
font-weight:<?php echo esc_html( $description_weight . $important ); ?>;
|
195 |
+
<?php } ?>
|
196 |
+
<?php if ( ! empty( $description_align ) ) { ?>
|
197 |
+
text-align:<?php echo esc_html( $description_align . $important ); ?>;
|
198 |
+
<?php } ?>
|
199 |
+
<?php if ( ! empty( $description_style ) ) { ?>
|
200 |
+
font-style:<?php echo esc_html( $description_style . $important ); ?>;
|
201 |
+
<?php } ?>
|
202 |
max-width:100%;
|
203 |
}
|
204 |
|
205 |
/* Form description */
|
206 |
.<?php echo esc_html( $style_class ); ?> .frm-show-form div.frm_description p{
|
207 |
+
<?php if ( ! empty( $form_desc_size ) ) { ?>
|
208 |
+
font-size:<?php echo esc_html( $form_desc_size . $important ); ?>;
|
209 |
+
<?php } ?>
|
210 |
+
<?php if ( ! empty( $form_desc_color ) ) { ?>
|
211 |
+
color:<?php echo esc_html( $form_desc_color . $important ); ?>;
|
212 |
+
<?php } ?>
|
213 |
+
<?php if ( ! empty( $form_desc_margin_top ) ) { ?>
|
214 |
+
margin-top:<?php echo esc_html( $form_desc_margin_top . $important ); ?>;
|
215 |
+
<?php } ?>
|
216 |
+
<?php if ( ! empty( $form_desc_margin_bottom ) ) { ?>
|
217 |
+
margin-bottom:<?php echo esc_html( $form_desc_margin_bottom . $important ); ?>;
|
218 |
+
<?php } ?>
|
219 |
}
|
220 |
|
221 |
/* Left and right labels */
|
273 |
}
|
274 |
|
275 |
.<?php echo esc_html( $style_class ); ?> .frm_scale label{
|
276 |
+
<?php if ( ! empty( $check_weight ) ) { ?>
|
277 |
+
font-weight:<?php echo esc_html( $check_weight . $important ); ?>;
|
278 |
+
<?php } ?>
|
279 |
+
<?php if ( ! empty( $font ) ) { ?>
|
280 |
+
font-family:<?php echo FrmAppHelper::kses( $font . $important ); // WPCS: XSS ok. ?>;
|
281 |
+
<?php } ?>
|
282 |
+
<?php if ( ! empty( $check_font_size ) ) { ?>
|
283 |
+
font-size:<?php echo esc_html( $check_font_size . $important ); ?>;
|
284 |
+
<?php } ?>
|
285 |
+
<?php if ( ! empty( $check_label_color ) ) { ?>
|
286 |
+
color:<?php echo esc_html( $check_label_color . $important ); ?>;
|
287 |
+
<?php } ?>
|
288 |
}
|
289 |
|
290 |
.<?php echo esc_html( $style_class ); ?> .frm_required{
|
291 |
+
<?php if ( ! empty( $required_color ) ) { ?>
|
292 |
+
color:<?php echo esc_html( $required_color . $important ); ?>;
|
293 |
+
<?php } ?>
|
294 |
+
<?php if ( ! empty( $required_weight ) ) { ?>
|
295 |
+
font-weight:<?php echo esc_html( $required_weight . $important ); ?>;
|
296 |
+
<?php } ?>
|
297 |
}
|
298 |
|
299 |
.<?php echo esc_html( $style_class ); ?> input[type=text],
|
307 |
.<?php echo esc_html( $style_class ); ?> textarea,
|
308 |
.<?php echo esc_html( $style_class ); ?> .frm-card-element.StripeElement,
|
309 |
.<?php echo esc_html( $style_class ); ?> .chosen-container{
|
310 |
+
<?php if ( ! empty( $font ) ) { ?>
|
311 |
+
font-family:<?php echo FrmAppHelper::kses( $font . $important ); // WPCS: XSS ok. ?>;
|
312 |
+
<?php } ?>
|
313 |
+
<?php if ( ! empty( $field_font_size ) ) { ?>
|
314 |
+
font-size:<?php echo esc_html( $field_font_size ); ?>;
|
315 |
+
<?php } ?>
|
316 |
margin-bottom:0<?php echo esc_html( $important ); ?>;
|
317 |
}
|
318 |
|
389 |
.<?php echo esc_html( $style_class ); ?> input[type=file]{
|
390 |
color: <?php echo esc_html( $text_color . $important ); ?>;
|
391 |
padding:0px;
|
392 |
+
<?php if ( ! empty( $font ) ) { ?>
|
393 |
+
font-family:<?php echo FrmAppHelper::kses( $font . $important ); // WPCS: XSS ok. ?>;
|
394 |
+
<?php } ?>
|
395 |
font-size:<?php echo esc_html( $field_font_size . $important ); ?>;
|
396 |
}
|
397 |
|
498 |
.frm_form_submit_style,
|
499 |
.<?php echo esc_html( $style_class ); ?> .frm-edit-page-btn {
|
500 |
width:<?php echo esc_html( ( $submit_width == '' ? 'auto' : $submit_width ) . $important ); ?>;
|
501 |
+
<?php if ( ! empty( $font ) ) { ?>
|
502 |
+
font-family:<?php echo FrmAppHelper::kses( $font ); // WPCS: XSS ok. ?>;
|
503 |
+
<?php } ?>
|
504 |
font-size:<?php echo esc_html( $submit_font_size . $important ); ?>;
|
505 |
height:<?php echo esc_html( $submit_height . $important ); ?>;
|
506 |
line-height:normal<?php echo esc_html( $important ); ?>;
|
600 |
.<?php echo esc_html( $style_class ); ?>.frm_inline_top .frm_submit::before,
|
601 |
.<?php echo esc_html( $style_class ); ?> .frm_submit.frm_inline_submit::before {
|
602 |
content:"before";
|
603 |
+
<?php if ( ! empty( $font ) ) { ?>
|
604 |
+
font-family:<?php echo FrmAppHelper::kses( $font ); // WPCS: XSS ok. ?>;
|
605 |
+
<?php } ?>
|
606 |
font-size:<?php echo esc_html( $font_size . $important ); ?>;
|
607 |
color:<?php echo esc_html( $label_color . $important ); ?>;
|
608 |
font-weight:<?php echo esc_html( $weight . $important ); ?>;
|
621 |
}
|
622 |
|
623 |
.<?php echo esc_html( $style_class ); ?> a.frm_save_draft{
|
624 |
+
<?php if ( ! empty( $font ) ) { ?>
|
625 |
+
font-family:<?php echo FrmAppHelper::kses( $font ); // WPCS: XSS ok. ?>;
|
626 |
+
<?php } ?>
|
627 |
font-size:<?php echo esc_html( $submit_font_size ); ?>;
|
628 |
font-weight:<?php echo esc_html( $submit_weight ); ?>;
|
629 |
}
|
630 |
|
631 |
.<?php echo esc_html( $style_class ); ?> #frm_field_cptch_number_container{
|
632 |
+
<?php if ( ! empty( $font ) ) { ?>
|
633 |
+
font-family:<?php echo FrmAppHelper::kses( $font ); // WPCS: XSS ok. ?>;
|
634 |
+
<?php } ?>
|
635 |
font-size:<?php echo esc_html( $font_size . $important ); ?>;
|
636 |
color:<?php echo esc_html( $label_color . $important ); ?>;
|
637 |
font-weight:<?php echo esc_html( $weight . $important ); ?>;
|
660 |
|
661 |
.<?php echo esc_html( $style_class ); ?> .frm_radio label,
|
662 |
.<?php echo esc_html( $style_class ); ?> .frm_checkbox label{
|
663 |
+
<?php if ( ! empty( $font ) ) { ?>
|
664 |
+
font-family:<?php echo FrmAppHelper::kses( $font . $important ); // WPCS: XSS ok. ?>;
|
665 |
+
<?php } ?>
|
666 |
font-size:<?php echo esc_html( $check_font_size . $important ); ?>;
|
667 |
color:<?php echo esc_html( $check_label_color . $important ); ?>;
|
668 |
font-weight:<?php echo esc_html( $check_weight . $important ); ?>;
|
812 |
}
|
813 |
|
814 |
.<?php echo esc_html( $style_class ); ?> .frm_button{
|
815 |
+
<?php if ( ! empty( $submit_padding ) ) { ?>
|
816 |
+
padding:<?php echo esc_html( $submit_padding . $important ); ?>;
|
817 |
+
<?php } ?>
|
818 |
+
<?php if ( ! empty( $border_radius ) ) { ?>
|
819 |
+
-moz-border-radius:<?php echo esc_html( $border_radius . $important ); ?>;
|
820 |
+
-webkit-border-radius:<?php echo esc_html( $border_radius . $important ); ?>;
|
821 |
+
border-radius:<?php echo esc_html( $border_radius . $important ); ?>;
|
822 |
+
<?php } ?>
|
823 |
+
<?php if ( ! empty( $submit_font_size ) ) { ?>
|
824 |
+
font-size:<?php echo esc_html( $submit_font_size . $important ); ?>;
|
825 |
+
<?php } ?>
|
826 |
+
<?php if ( ! empty( $font ) ) { ?>
|
827 |
+
font-family:<?php echo FrmAppHelper::kses( $font . $important ); // WPCS: XSS ok. ?>;
|
828 |
+
<?php } ?>
|
829 |
+
<?php if ( ! empty( $submit_weight ) ) { ?>
|
830 |
+
font-weight:<?php echo esc_html( $submit_weight . $important ); ?>;
|
831 |
+
<?php } ?>
|
832 |
+
<?php if ( ! empty( $submit_text_color ) ) { ?>
|
833 |
+
color:<?php echo esc_html( $submit_text_color . $important ); ?>;
|
834 |
+
<?php } ?>
|
835 |
+
<?php if ( ! empty( $submit_bg_color ) ) { ?>
|
836 |
+
background: <?php echo esc_html( $submit_bg_color . $important ); ?>;
|
837 |
+
<?php } ?>
|
838 |
+
<?php if ( ! empty( $submit_border_width ) ) { ?>
|
839 |
+
border-width:<?php echo esc_html( $submit_border_width ); ?>;
|
840 |
+
<?php } ?>
|
841 |
+
<?php if ( ! empty( $submit_border_color ) ) { ?>
|
842 |
+
border-color: <?php echo esc_html( $submit_border_color . $important ); ?>;
|
843 |
+
<?php } ?>
|
844 |
+
<?php if ( ! empty( $submit_height ) ) { ?>
|
845 |
+
height:<?php echo esc_html( $submit_height . $important ); ?>;
|
846 |
+
<?php } ?>
|
847 |
}
|
848 |
|
849 |
<?php do_action( 'frm_output_single_style', $settings ); ?>
|
css/custom_theme.css.php
CHANGED
@@ -412,7 +412,9 @@ a.frm_save_draft{
|
|
412 |
padding:5px;
|
413 |
border-width:1px;
|
414 |
border-style:solid;
|
415 |
-
|
|
|
|
|
416 |
border-top:none;
|
417 |
border-left:none;
|
418 |
border-right:none;
|
@@ -451,9 +453,13 @@ table.form_results.with_frm_style{
|
|
451 |
|
452 |
table.form_results.with_frm_style tr td{
|
453 |
text-align:left;
|
454 |
-
|
|
|
|
|
455 |
padding:7px 9px;
|
456 |
-
|
|
|
|
|
457 |
}
|
458 |
|
459 |
table.form_results.with_frm_style tr.frm_even,
|
@@ -463,7 +469,9 @@ table.form_results.with_frm_style tr.frm_even,
|
|
463 |
|
464 |
table.form_results.with_frm_style tr.frm_odd,
|
465 |
.frm-grid .frm_odd{
|
466 |
-
|
|
|
|
|
467 |
}
|
468 |
|
469 |
.frm_collapse .ui-icon{
|
@@ -535,7 +543,9 @@ table.form_results.with_frm_style tr.frm_odd,
|
|
535 |
|
536 |
<?php if ( ! empty( $defaults['bg_color'] ) ) { ?>
|
537 |
#frm_loading .progress-striped .progress-bar{
|
538 |
-
|
|
|
|
|
539 |
background-size:40px 40px;
|
540 |
}
|
541 |
<?php } ?>
|
@@ -589,7 +599,9 @@ select.frm_loading_lookup{
|
|
589 |
padding:5px;
|
590 |
border-width:1px;
|
591 |
border-style:solid;
|
592 |
-
|
|
|
|
|
593 |
border-left:none;
|
594 |
border-right:none;
|
595 |
}
|
@@ -620,14 +632,18 @@ select.frm_loading_lookup{
|
|
620 |
margin-top:20px;
|
621 |
}
|
622 |
|
|
|
623 |
.frm_grid_first,
|
624 |
.frm_grid_odd{
|
625 |
background-color:<?php echo esc_html( $defaults['bg_color'] ); ?>;
|
626 |
}
|
|
|
627 |
|
|
|
628 |
.frm_grid{
|
629 |
background-color:<?php echo esc_html( $defaults['bg_color_active'] ); ?>;
|
630 |
}
|
|
|
631 |
|
632 |
.frm_grid .frm_primary_label,
|
633 |
.frm_grid_first .frm_primary_label,
|
412 |
padding:5px;
|
413 |
border-width:1px;
|
414 |
border-style:solid;
|
415 |
+
<?php if ( ! empty( $defaults['border_color'] ) ) { ?>
|
416 |
+
border-color:<?php echo esc_html( $defaults['border_color'] ); ?>;
|
417 |
+
<?php } ?>
|
418 |
border-top:none;
|
419 |
border-left:none;
|
420 |
border-right:none;
|
453 |
|
454 |
table.form_results.with_frm_style tr td{
|
455 |
text-align:left;
|
456 |
+
<?php if ( ! empty( $defaults['text_color'] ) ) { ?>
|
457 |
+
color:<?php echo esc_html( $defaults['text_color'] ); ?>;
|
458 |
+
<?php } ?>
|
459 |
padding:7px 9px;
|
460 |
+
<?php if ( ! empty( $defaults['border_color'] ) ) { ?>
|
461 |
+
border-top:1px solid <?php echo esc_html( $defaults['border_color'] ); ?>;
|
462 |
+
<?php } ?>
|
463 |
}
|
464 |
|
465 |
table.form_results.with_frm_style tr.frm_even,
|
469 |
|
470 |
table.form_results.with_frm_style tr.frm_odd,
|
471 |
.frm-grid .frm_odd{
|
472 |
+
<?php if ( ! empty( $defaults['border_color'] ) ) { ?>
|
473 |
+
background-color:<?php echo esc_html( FrmStylesHelper::adjust_brightness( $defaults['border_color'], 45 ) ); ?>;
|
474 |
+
<?php } ?>
|
475 |
}
|
476 |
|
477 |
.frm_collapse .ui-icon{
|
543 |
|
544 |
<?php if ( ! empty( $defaults['bg_color'] ) ) { ?>
|
545 |
#frm_loading .progress-striped .progress-bar{
|
546 |
+
<?php if ( ! empty( $defaults['border_color'] ) ) { ?>
|
547 |
+
background-image:linear-gradient(45deg, <?php echo esc_html( $defaults['border_color'] ); ?> 25%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 50%, <?php echo esc_html( $defaults['border_color'] ); ?> 50%, <?php echo esc_html( $defaults['border_color'] ); ?> 75%, rgba(0, 0, 0, 0) 75%, rgba(0, 0, 0, 0));
|
548 |
+
<?php } ?>
|
549 |
background-size:40px 40px;
|
550 |
}
|
551 |
<?php } ?>
|
599 |
padding:5px;
|
600 |
border-width:1px;
|
601 |
border-style:solid;
|
602 |
+
<?php if ( ! empty( $defaults['border_color'] ) ) { ?>
|
603 |
+
border-color:<?php echo esc_html( $defaults['border_color'] ); ?>;
|
604 |
+
<?php } ?>
|
605 |
border-left:none;
|
606 |
border-right:none;
|
607 |
}
|
632 |
margin-top:20px;
|
633 |
}
|
634 |
|
635 |
+
<?php if ( ! empty( $defaults['bg_color'] ) ) { ?>
|
636 |
.frm_grid_first,
|
637 |
.frm_grid_odd{
|
638 |
background-color:<?php echo esc_html( $defaults['bg_color'] ); ?>;
|
639 |
}
|
640 |
+
<?php } ?>
|
641 |
|
642 |
+
<?php if ( ! empty( $defaults['bg_color_active'] ) ) { ?>
|
643 |
.frm_grid{
|
644 |
background-color:<?php echo esc_html( $defaults['bg_color_active'] ); ?>;
|
645 |
}
|
646 |
+
<?php } ?>
|
647 |
|
648 |
.frm_grid .frm_primary_label,
|
649 |
.frm_grid_first .frm_primary_label,
|
formidable.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/*
|
3 |
Plugin Name: Formidable Forms
|
4 |
Description: Quickly and easily create drag-and-drop forms
|
5 |
-
Version: 4.04.
|
6 |
Plugin URI: https://formidableforms.com/
|
7 |
Author URI: https://formidableforms.com/
|
8 |
Author: Strategy11
|
2 |
/*
|
3 |
Plugin Name: Formidable Forms
|
4 |
Description: Quickly and easily create drag-and-drop forms
|
5 |
+
Version: 4.04.05
|
6 |
Plugin URI: https://formidableforms.com/
|
7 |
Author URI: https://formidableforms.com/
|
8 |
Author: Strategy11
|
js/formidable.js
CHANGED
@@ -1,28 +1,36 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
2 |
'use strict';
|
3 |
|
4 |
-
|
|
|
5 |
|
6 |
var action = '';
|
7 |
var jsErrors = [];
|
8 |
|
9 |
-
function maybeShowLabel(){
|
10 |
/*jshint validthis:true */
|
11 |
-
var $field = jQuery(this)
|
12 |
-
|
|
|
13 |
|
14 |
-
if (
|
15 |
-
$label.addClass('frm_visible');
|
16 |
} else {
|
17 |
-
$label.removeClass('frm_visible');
|
18 |
}
|
19 |
}
|
20 |
|
21 |
/* Get the ID of the field that changed*/
|
22 |
function getFieldId( field, fullID ) {
|
23 |
-
var
|
|
|
|
|
24 |
if ( field instanceof jQuery ) {
|
25 |
-
fieldName = field.attr('name');
|
26 |
} else {
|
27 |
fieldName = field.name;
|
28 |
}
|
@@ -33,9 +41,9 @@ function frmFrontFormJS(){
|
|
33 |
|
34 |
if ( fieldName === '' ) {
|
35 |
if ( field instanceof jQuery ) {
|
36 |
-
fieldName = field.data('name');
|
37 |
} else {
|
38 |
-
fieldName = field.getAttribute('data-name');
|
39 |
}
|
40 |
|
41 |
if ( typeof fieldName === 'undefined' ) {
|
@@ -48,54 +56,54 @@ function frmFrontFormJS(){
|
|
48 |
return 0;
|
49 |
}
|
50 |
|
51 |
-
|
52 |
//TODO: Fix this for checkboxes and address fields
|
53 |
if ( nameParts.length < 1 ) {
|
54 |
return 0;
|
55 |
}
|
56 |
-
nameParts = nameParts.filter(function(
|
|
|
|
|
57 |
|
58 |
-
|
59 |
-
var isRepeating = false;
|
60 |
|
61 |
if ( nameParts.length === 1 ) {
|
62 |
-
return
|
63 |
}
|
64 |
|
65 |
if ( nameParts[1] === '[form' || nameParts[1] === '[row_ids' ) {
|
66 |
return 0;
|
67 |
}
|
68 |
|
69 |
-
|
70 |
// Check if 'this' is in a repeating section
|
71 |
-
if ( jQuery('input[name="item_meta['+
|
72 |
|
73 |
// this is a repeatable section with name: item_meta[repeating-section-id][row-id][field-id]
|
74 |
-
|
75 |
isRepeating = true;
|
76 |
}
|
77 |
|
78 |
// Check if 'this' is an other text field and get field ID for it
|
79 |
-
if ( 'other' ===
|
80 |
if ( isRepeating ) {
|
81 |
// name for other fields: item_meta[370][0][other][414]
|
82 |
-
|
83 |
} else {
|
84 |
// Other field name: item_meta[other][370]
|
85 |
-
|
86 |
}
|
87 |
}
|
88 |
|
89 |
if ( fullID === true ) {
|
90 |
// For use in the container div id
|
91 |
-
if (
|
92 |
-
|
93 |
} else {
|
94 |
-
|
95 |
}
|
96 |
}
|
97 |
|
98 |
-
return
|
99 |
}
|
100 |
|
101 |
/**
|
@@ -106,7 +114,7 @@ function frmFrontFormJS(){
|
|
106 |
* @param {object} $form
|
107 |
*/
|
108 |
function disableSubmitButton( $form ) {
|
109 |
-
$form.find('input[type="submit"], input[type="button"], button[type="submit"]').attr('disabled','disabled');
|
110 |
}
|
111 |
|
112 |
/**
|
@@ -143,24 +151,25 @@ function frmFrontFormJS(){
|
|
143 |
}
|
144 |
|
145 |
function validateForm( object ) {
|
146 |
-
var
|
|
|
147 |
|
148 |
// Make sure required text field is filled in
|
149 |
-
|
150 |
'.frm_required_field:visible input, .frm_required_field:visible select, .frm_required_field:visible textarea'
|
151 |
-
).filter(':not(.frm_optional)');
|
152 |
if ( requiredFields.length ) {
|
153 |
-
for (
|
154 |
errors = checkRequiredField( requiredFields[r], errors );
|
155 |
}
|
156 |
}
|
157 |
|
158 |
-
|
159 |
-
|
160 |
if ( fields.length ) {
|
161 |
-
for (
|
162 |
-
|
163 |
-
|
164 |
if ( value !== '' ) {
|
165 |
if ( field.type === 'hidden' ) {
|
166 |
// don't validate
|
@@ -180,12 +189,12 @@ function frmFrontFormJS(){
|
|
180 |
return errors;
|
181 |
}
|
182 |
|
183 |
-
function maybeValidateChange(
|
184 |
if ( field.type === 'url' ) {
|
185 |
maybeAddHttpToUrl( field );
|
186 |
}
|
187 |
-
if ( jQuery(field).closest('form').hasClass('frm_js_validate') ) {
|
188 |
-
validateField(
|
189 |
}
|
190 |
}
|
191 |
|
@@ -198,16 +207,17 @@ function frmFrontFormJS(){
|
|
198 |
}
|
199 |
|
200 |
function validateField( fieldId, field ) {
|
201 |
-
var
|
|
|
202 |
|
203 |
-
var $fieldCont = jQuery(field).closest('.frm_form_field');
|
204 |
-
if ( $fieldCont.hasClass('frm_required_field') && ! jQuery(field).hasClass('frm_optional') ) {
|
205 |
errors = checkRequiredField( field, errors );
|
206 |
}
|
207 |
|
208 |
if ( errors.length < 1 ) {
|
209 |
if ( field.type === 'email' ) {
|
210 |
-
|
211 |
errors = checkEmailField( field, errors, emailFields );
|
212 |
} else if ( field.type === 'number' ) {
|
213 |
errors = checkNumberField( field, errors );
|
@@ -217,30 +227,32 @@ function frmFrontFormJS(){
|
|
217 |
}
|
218 |
|
219 |
removeFieldError( $fieldCont );
|
220 |
-
if ( Object.keys(errors).length > 0 ) {
|
221 |
-
for (
|
222 |
addFieldError( $fieldCont, key, errors );
|
223 |
}
|
224 |
}
|
225 |
}
|
226 |
|
227 |
function checkRequiredField( field, errors ) {
|
228 |
-
var
|
|
|
|
|
|
|
|
|
229 |
if ( field.type === 'hidden' && fileID === null ) {
|
230 |
return errors;
|
231 |
}
|
232 |
|
233 |
-
var val = '';
|
234 |
-
var fieldID = '';
|
235 |
if ( field.type === 'checkbox' || field.type === 'radio' ) {
|
236 |
-
|
237 |
-
jQuery(checkGroup).each(function() {
|
238 |
-
|
239 |
});
|
240 |
} else if ( field.type === 'file' || fileID ) {
|
241 |
if ( typeof fileID === 'undefined' ) {
|
242 |
fileID = getFieldId( field, true );
|
243 |
-
fileID = fileID.replace('file', '');
|
244 |
}
|
245 |
|
246 |
if ( typeof errors[ fileID ] === 'undefined' ) {
|
@@ -248,37 +260,37 @@ function frmFrontFormJS(){
|
|
248 |
}
|
249 |
fieldID = fileID;
|
250 |
} else {
|
251 |
-
|
252 |
-
if ( fieldClasses.indexOf('frm_pos_none') !== -1 ) {
|
253 |
// skip hidden other fields
|
254 |
return errors;
|
255 |
}
|
256 |
|
257 |
-
val = jQuery(field).val();
|
258 |
if ( val === null ) {
|
259 |
val = '';
|
260 |
} else if ( typeof val !== 'string' ) {
|
261 |
-
|
262 |
val = '';
|
263 |
-
for (
|
264 |
if ( tempVal[i] !== '' ) {
|
265 |
val = tempVal[i];
|
266 |
}
|
267 |
}
|
268 |
}
|
269 |
|
270 |
-
if ( fieldClasses.indexOf('frm_other_input') === -1 ) {
|
271 |
fieldID = getFieldId( field, true );
|
272 |
} else {
|
273 |
fieldID = getFieldId( field, false );
|
274 |
}
|
275 |
|
276 |
-
if ( fieldClasses.indexOf('frm_time_select') !== -1 ) {
|
277 |
// set id for time field
|
278 |
-
fieldID = fieldID.replace('-H', '').replace('-m', '');
|
279 |
}
|
280 |
|
281 |
-
|
282 |
if ( placeholder !== null && val === placeholder ) {
|
283 |
val = '';
|
284 |
}
|
@@ -288,7 +300,7 @@ function frmFrontFormJS(){
|
|
288 |
if ( fieldID === '' ) {
|
289 |
fieldID = getFieldId( field, true );
|
290 |
}
|
291 |
-
if ( !(fieldID in errors) ) {
|
292 |
errors[ fieldID ] = getFieldValidationMessage( field, 'data-reqmsg' );
|
293 |
}
|
294 |
}
|
@@ -297,9 +309,10 @@ function frmFrontFormJS(){
|
|
297 |
}
|
298 |
|
299 |
function getFileVals( fileID ) {
|
300 |
-
var val = ''
|
301 |
-
|
302 |
-
|
|
|
303 |
if ( val === '' ) {
|
304 |
val = this.value;
|
305 |
}
|
@@ -308,27 +321,29 @@ function frmFrontFormJS(){
|
|
308 |
}
|
309 |
|
310 |
function checkEmailField( field, errors, emailFields ) {
|
311 |
-
var
|
312 |
-
|
|
|
|
|
313 |
if ( fieldID in errors ) {
|
314 |
return errors;
|
315 |
}
|
316 |
|
317 |
-
|
318 |
if ( emailAddress !== '' || isConf ) {
|
319 |
-
|
320 |
-
|
321 |
if ( emailAddress !== '' && re.test( emailAddress ) === false ) {
|
322 |
errors[ fieldID ] = invalidMsg;
|
323 |
if ( isConf ) {
|
324 |
-
errors[ fieldID.replace('conf_', '') ] = '';
|
325 |
}
|
326 |
} else if ( isConf ) {
|
327 |
-
|
328 |
-
|
329 |
if ( match !== emailAddress ) {
|
330 |
errors[ fieldID ] = '';
|
331 |
-
errors[ fieldID.replace('conf_', '') ] = '';
|
332 |
}
|
333 |
}
|
334 |
}
|
@@ -336,10 +351,12 @@ function frmFrontFormJS(){
|
|
336 |
}
|
337 |
|
338 |
function checkNumberField( field, errors ) {
|
339 |
-
var
|
340 |
-
|
341 |
-
|
342 |
-
|
|
|
|
|
343 |
errors[ fieldID ] = getFieldValidationMessage( field, 'data-invmsg' );
|
344 |
}
|
345 |
}
|
@@ -347,13 +364,14 @@ function frmFrontFormJS(){
|
|
347 |
}
|
348 |
|
349 |
function checkPatternField( field, errors ) {
|
350 |
-
var
|
351 |
-
|
|
|
352 |
|
353 |
if ( format !== '' && text !== '' ) {
|
354 |
-
|
355 |
-
if ( !(fieldID in errors) ) {
|
356 |
-
format = new RegExp( '^'+ format +'$', 'i' );
|
357 |
if ( format.test( text ) === false ) {
|
358 |
errors[ fieldID ] = getFieldValidationMessage( field, 'data-invmsg' );
|
359 |
}
|
@@ -363,14 +381,16 @@ function frmFrontFormJS(){
|
|
363 |
}
|
364 |
|
365 |
function hasInvisibleRecaptcha( object ) {
|
|
|
|
|
366 |
if ( isGoingToPrevPage( object ) ) {
|
367 |
return false;
|
368 |
}
|
369 |
|
370 |
-
|
371 |
if ( recaptcha.length ) {
|
372 |
-
|
373 |
-
|
374 |
if ( alreadyChecked.length === 0 ) {
|
375 |
return recaptcha;
|
376 |
} else {
|
@@ -382,20 +402,21 @@ function frmFrontFormJS(){
|
|
382 |
}
|
383 |
|
384 |
function executeInvisibleRecaptcha( invisibleRecaptcha ) {
|
385 |
-
var recaptchaID = invisibleRecaptcha.data('rid');
|
386 |
grecaptcha.reset( recaptchaID );
|
387 |
grecaptcha.execute( recaptchaID );
|
388 |
}
|
389 |
|
390 |
function validateRecaptcha( form, errors ) {
|
391 |
-
var
|
|
|
392 |
if ( $recaptcha.length ) {
|
393 |
-
|
394 |
-
|
395 |
|
396 |
if ( response.length === 0 ) {
|
397 |
-
|
398 |
-
|
399 |
errors[ fieldID ] = '';
|
400 |
}
|
401 |
}
|
@@ -403,7 +424,7 @@ function frmFrontFormJS(){
|
|
403 |
}
|
404 |
|
405 |
function getFieldValidationMessage( field, messageType ) {
|
406 |
-
var msg = field.getAttribute(messageType);
|
407 |
if ( msg === null ) {
|
408 |
msg = '';
|
409 |
}
|
@@ -411,7 +432,7 @@ function frmFrontFormJS(){
|
|
411 |
}
|
412 |
|
413 |
function shouldJSValidate( object ) {
|
414 |
-
var validate = jQuery(object).hasClass('frm_js_validate');
|
415 |
if ( validate && typeof frmProForm !== 'undefined' && ( frmProForm.savingDraft( object ) || frmProForm.goingToPreviousPage( object ) ) ) {
|
416 |
validate = false;
|
417 |
}
|
@@ -419,92 +440,98 @@ function frmFrontFormJS(){
|
|
419 |
return validate;
|
420 |
}
|
421 |
|
422 |
-
function getFormErrors(object, action){
|
423 |
-
|
424 |
-
|
|
|
|
|
425 |
}
|
426 |
|
427 |
-
|
428 |
-
fieldset.addClass('frm_doing_ajax');
|
429 |
jQuery.ajax({
|
430 |
-
type:'POST',url:frm_js.ajax_url,
|
431 |
-
data:jQuery(object).serialize() +'&action=frm_entries_'+ action +'&nonce='+frm_js.nonce,
|
432 |
-
success:function(response){
|
433 |
-
var
|
|
|
|
|
|
|
434 |
if ( response === null ) {
|
435 |
response = defaultResponse;
|
436 |
}
|
437 |
|
438 |
-
response = response.replace(/^\s+|\s+$/g,'');
|
439 |
-
if ( response.indexOf('{') === 0 ) {
|
440 |
-
response = jQuery.parseJSON(response);
|
441 |
-
}else{
|
442 |
response = defaultResponse;
|
443 |
}
|
444 |
|
445 |
if ( typeof response.redirect !== 'undefined' ) {
|
446 |
-
jQuery(document).trigger( 'frmBeforeFormRedirect', [ object, response ]
|
447 |
window.location = response.redirect;
|
448 |
} else if ( response.content !== '' ) {
|
449 |
// the form or success message was returned
|
450 |
|
451 |
-
removeSubmitLoading( jQuery(object) );
|
452 |
if ( frm_js.offset != -1 ) {
|
453 |
-
frmFrontForm.scrollMsg( jQuery(object), false );
|
454 |
}
|
455 |
-
|
456 |
-
response.content = response.content.replace(/ frm_pro_form /g, ' frm_pro_form frm_no_hide ');
|
457 |
-
|
458 |
removeAddedScripts( replaceContent, formID );
|
459 |
replaceContent.replaceWith( response.content );
|
460 |
|
461 |
-
addUrlParam(response);
|
462 |
|
463 |
-
if(typeof
|
464 |
-
|
465 |
-
|
466 |
-
frmThemeOverride_frmAfterSubmit(formReturned, pageOrder, response.content, object);
|
467 |
}
|
468 |
|
469 |
afterFormSubmitted( object, response );
|
470 |
|
471 |
-
} else if ( Object.keys(response.errors).length ) {
|
472 |
// errors were returned
|
473 |
|
474 |
-
removeSubmitLoading( jQuery(object), 'enable' );
|
475 |
|
476 |
//show errors
|
477 |
-
|
478 |
removeAllErrors();
|
479 |
|
480 |
-
|
481 |
-
|
482 |
|
483 |
-
for (
|
484 |
-
|
|
|
485 |
|
486 |
if ( $fieldCont.length ) {
|
487 |
-
if ( ! $fieldCont.is(':visible') ) {
|
488 |
-
|
489 |
if ( inCollapsedSection.length ) {
|
490 |
-
|
491 |
-
if ( ! frmTrigger.hasClass('frm_trigger') ) {
|
492 |
// If the frmTrigger object is the section description, check to see if the previous element is the trigger
|
493 |
-
frmTrigger = frmTrigger.prev('.frm_trigger');
|
494 |
}
|
495 |
frmTrigger.click();
|
496 |
}
|
497 |
}
|
498 |
|
499 |
-
if ( $fieldCont.is(':visible') ) {
|
500 |
addFieldError( $fieldCont, key, response.errors );
|
501 |
|
502 |
-
|
503 |
|
504 |
-
|
505 |
if ( $recaptcha.length ) {
|
506 |
-
|
507 |
-
|
508 |
if ( jQuery().grecaptcha ) {
|
509 |
if ( recaptchaID ) {
|
510 |
grecaptcha.reset( recaptchaID );
|
@@ -517,19 +544,19 @@ function frmFrontFormJS(){
|
|
517 |
}
|
518 |
}
|
519 |
|
520 |
-
jQuery(document).trigger( 'frmFormErrors', [ object, response ]
|
521 |
|
522 |
-
fieldset.removeClass('frm_doing_ajax');
|
523 |
scrollToFirstField( object );
|
524 |
|
525 |
-
if(
|
526 |
replaceCheckedRecaptcha( object, false );
|
527 |
}
|
528 |
|
529 |
-
if(
|
530 |
object.submit();
|
531 |
-
}else{
|
532 |
-
jQuery(object).prepend(response.error_message);
|
533 |
}
|
534 |
} else {
|
535 |
// there may have been a plugin conflict, or the form is not set to submit with ajax
|
@@ -540,19 +567,19 @@ function frmFrontFormJS(){
|
|
540 |
object.submit();
|
541 |
}
|
542 |
},
|
543 |
-
error:function(){
|
544 |
-
jQuery(object).find('input[type="submit"], input[type="button"]').removeAttr('disabled');
|
545 |
object.submit();
|
546 |
}
|
547 |
});
|
548 |
}
|
549 |
|
550 |
function afterFormSubmitted( object, response ) {
|
551 |
-
var formCompleted = jQuery(response.content).find('.frm_message');
|
552 |
if ( formCompleted.length ) {
|
553 |
-
jQuery(document).trigger( 'frmFormComplete', [ object, response ]
|
554 |
} else {
|
555 |
-
jQuery(document).trigger( 'frmPageChanged', [ object, response ]
|
556 |
}
|
557 |
}
|
558 |
|
@@ -564,47 +591,52 @@ function frmFrontFormJS(){
|
|
564 |
}
|
565 |
}
|
566 |
|
567 |
-
function addUrlParam(response){
|
|
|
568 |
if ( history.pushState && typeof response.page !== 'undefined' ) {
|
569 |
-
|
570 |
-
window.history.pushState({
|
571 |
}
|
572 |
}
|
573 |
|
574 |
-
function addQueryVar(key, value) {
|
575 |
-
|
576 |
-
|
|
|
|
|
577 |
|
578 |
-
|
579 |
|
580 |
-
|
581 |
-
|
|
|
582 |
|
583 |
-
if (x[0]==key) {
|
584 |
x[1] = value;
|
585 |
-
kvp[i] = x.join('=');
|
586 |
break;
|
587 |
}
|
588 |
}
|
589 |
|
590 |
-
if (i<0) {
|
591 |
-
kvp[kvp.length] = [key,value].join('=');
|
592 |
}
|
593 |
|
594 |
-
return kvp.join('&');
|
595 |
}
|
596 |
|
597 |
function addFieldError( $fieldCont, key, jsErrors ) {
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
|
|
603 |
|
604 |
-
if ( typeof frmThemeOverride_frmPlaceError === 'function' ) {
|
605 |
frmThemeOverride_frmPlaceError( key, jsErrors );
|
606 |
} else {
|
607 |
-
$fieldCont.append( '<div class="frm_error" id="' + id + '">'+ jsErrors[key] +'</div>' );
|
608 |
|
609 |
if ( typeof describedBy === 'undefined' ) {
|
610 |
describedBy = id;
|
@@ -615,17 +647,17 @@ function frmFrontFormJS(){
|
|
615 |
}
|
616 |
input.attr( 'aria-invalid', true );
|
617 |
|
618 |
-
jQuery(document).trigger('frmAddFieldError', [ $fieldCont, key, jsErrors ]
|
619 |
}
|
620 |
}
|
621 |
|
622 |
function removeFieldError( $fieldCont ) {
|
623 |
-
var errorMessage = $fieldCont.find('.frm_error'),
|
624 |
-
errorId = errorMessage.attr('id'),
|
625 |
input = $fieldCont.find( 'input, select, textarea' ),
|
626 |
describedBy = input.attr( 'aria-describedby' );
|
627 |
|
628 |
-
$fieldCont.removeClass('frm_blank_field has-error');
|
629 |
errorMessage.remove();
|
630 |
input.attr( 'aria-invalid', false );
|
631 |
|
@@ -636,13 +668,13 @@ function frmFrontFormJS(){
|
|
636 |
}
|
637 |
|
638 |
function removeAllErrors() {
|
639 |
-
jQuery('.form-field').removeClass('frm_blank_field has-error');
|
640 |
-
jQuery('.form-field .frm_error').replaceWith('');
|
641 |
-
jQuery('.frm_error_style').remove();
|
642 |
}
|
643 |
|
644 |
function scrollToFirstField( object ) {
|
645 |
-
var field = jQuery(object).find('.frm_blank_field:first');
|
646 |
if ( field.length ) {
|
647 |
frmFrontForm.scrollMsg( field, object, true );
|
648 |
}
|
@@ -660,11 +692,11 @@ function frmFrontFormJS(){
|
|
660 |
$object.trigger( 'frmStartFormLoading' );
|
661 |
}
|
662 |
}
|
663 |
-
|
664 |
function addLoadingClass( $object ) {
|
665 |
-
var
|
666 |
|
667 |
-
$object.addClass(
|
668 |
}
|
669 |
|
670 |
function isGoingToPrevPage( $object ) {
|
@@ -672,12 +704,14 @@ function frmFrontFormJS(){
|
|
672 |
}
|
673 |
|
674 |
function removeSubmitLoading( $object, enable, processesRunning ) {
|
|
|
|
|
675 |
if ( processesRunning > 0 ) {
|
676 |
return;
|
677 |
}
|
678 |
|
679 |
-
|
680 |
-
loadingForm.removeClass('frm_loading_form');
|
681 |
loadingForm.removeClass( 'frm_loading_prev' );
|
682 |
|
683 |
loadingForm.trigger( 'frmEndFormLoading' );
|
@@ -689,78 +723,81 @@ function frmFrontFormJS(){
|
|
689 |
}
|
690 |
|
691 |
function showFileLoading( object ) {
|
692 |
-
var
|
|
|
693 |
if ( loading !== null ) {
|
694 |
-
|
695 |
-
if ( typeof
|
696 |
-
setTimeout(function(){
|
697 |
-
jQuery(loading).fadeIn('slow');
|
698 |
-
},2000);
|
699 |
}
|
700 |
}
|
701 |
}
|
702 |
|
703 |
function replaceCheckedRecaptcha( object, checkPage ) {
|
704 |
-
var
|
705 |
-
|
|
|
706 |
if ( checkPage ) {
|
707 |
-
|
708 |
if ( ! morePages ) {
|
709 |
return;
|
710 |
}
|
711 |
}
|
712 |
-
$recapField.closest('.frm_form_field').replaceWith('<input type="hidden" name="recaptcha_checked" value="'+ frm_js.nonce +'">');
|
713 |
}
|
714 |
}
|
715 |
|
716 |
-
function clearDefault(){
|
717 |
/*jshint validthis:true */
|
718 |
-
toggleDefault(jQuery(this), 'clear');
|
719 |
}
|
720 |
|
721 |
-
function replaceDefault(){
|
722 |
/*jshint validthis:true */
|
723 |
-
toggleDefault(jQuery(this), 'replace');
|
724 |
}
|
725 |
|
726 |
-
function toggleDefault($thisField, e){
|
727 |
// TODO: Fix this for a default value that is a number or array
|
728 |
-
var
|
|
|
729 |
if ( v === '' || typeof v === 'undefined' ) {
|
730 |
return false;
|
731 |
}
|
732 |
-
|
733 |
|
734 |
-
if ( 'replace'
|
735 |
if ( thisVal === '' ) {
|
736 |
-
$thisField.addClass('frm_default').val(v);
|
737 |
}
|
738 |
} else if ( thisVal == v ) {
|
739 |
-
$thisField.removeClass('frm_default').val('');
|
740 |
}
|
741 |
}
|
742 |
|
743 |
-
function resendEmail(){
|
744 |
/*jshint validthis:true */
|
745 |
-
var $link = jQuery(this),
|
746 |
-
|
747 |
-
|
748 |
label = $link.find( '.frm_link_label' );
|
749 |
if ( label.length < 1 ) {
|
750 |
label = $link;
|
751 |
}
|
752 |
-
label.append('<span class="frm-wait"></span>');
|
753 |
|
754 |
jQuery.ajax({
|
755 |
-
type:'POST',
|
756 |
-
url:frm_js.ajax_url,
|
757 |
-
data:{
|
758 |
-
action:'frm_entries_send_email',
|
759 |
-
entry_id:
|
760 |
-
form_id:
|
761 |
-
nonce:frm_js.nonce
|
762 |
},
|
763 |
-
success:function(msg){
|
764 |
var admin = document.getElementById( 'wpbody' );
|
765 |
if ( admin === null ) {
|
766 |
label.html( msg );
|
@@ -779,11 +816,11 @@ function frmFrontFormJS(){
|
|
779 |
|
780 |
function confirmClick() {
|
781 |
/*jshint validthis:true */
|
782 |
-
var message = jQuery(this).data('frmconfirm');
|
783 |
-
return confirm(message);
|
784 |
}
|
785 |
|
786 |
-
function toggleDiv(){
|
787 |
/*jshint validthis:true */
|
788 |
var div = jQuery( this ).data( 'frmtoggle' );
|
789 |
if ( jQuery( div ).is( ':visible' ) ) {
|
@@ -799,17 +836,19 @@ function frmFrontFormJS(){
|
|
799 |
*********************************************/
|
800 |
|
801 |
function addIndexOfFallbackForIE8() {
|
802 |
-
|
803 |
-
|
804 |
-
|
|
|
|
|
805 |
|
806 |
-
|
807 |
-
from = (from < 0) ? Math.ceil(from) : Math.floor(from);
|
808 |
-
if (from < 0) {
|
809 |
from += len;
|
810 |
}
|
811 |
|
812 |
-
for (; from < len; from++) {
|
813 |
if ( from in this && this[from] === elt ) {
|
814 |
return from;
|
815 |
}
|
@@ -819,36 +858,39 @@ function frmFrontFormJS(){
|
|
819 |
}
|
820 |
}
|
821 |
|
822 |
-
function addTrimFallbackForIE8(){
|
823 |
if ( typeof String.prototype.trim !== 'function' ) {
|
824 |
String.prototype.trim = function() {
|
825 |
-
return this.replace(/^\s+|\s+$/g, '');
|
826 |
};
|
827 |
}
|
828 |
}
|
829 |
|
830 |
-
function addFilterFallbackForIE8(){
|
831 |
-
|
832 |
|
833 |
-
|
|
|
|
|
834 |
|
835 |
if ( this === void 0 || this === null ) {
|
836 |
throw new TypeError();
|
837 |
}
|
838 |
|
839 |
-
|
840 |
-
|
841 |
if ( typeof fun !== 'function' ) {
|
842 |
throw new TypeError();
|
843 |
}
|
844 |
|
845 |
-
|
846 |
-
|
847 |
-
for (
|
848 |
if ( i in t ) {
|
849 |
-
|
850 |
-
if (fun.call(thisp, val, i, t))
|
851 |
-
res.push(val);
|
|
|
852 |
}
|
853 |
}
|
854 |
|
@@ -857,44 +899,46 @@ function frmFrontFormJS(){
|
|
857 |
}
|
858 |
}
|
859 |
|
860 |
-
function addKeysFallbackForIE8(){
|
861 |
-
|
862 |
-
|
863 |
-
|
|
|
|
|
864 |
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
|
871 |
-
|
872 |
-
|
873 |
}
|
874 |
}
|
875 |
|
876 |
-
return{
|
877 |
-
init: function(){
|
878 |
-
jQuery(document).off('submit.formidable','.frm-show-form');
|
879 |
-
jQuery(document).on('submit.formidable','.frm-show-form', frmFrontForm.submitForm);
|
880 |
|
881 |
jQuery( '.frm-show-form input[onblur], .frm-show-form textarea[onblur]' ).each( function() {
|
882 |
if ( jQuery( this ).val() === '' ) {
|
883 |
jQuery( this ).blur();
|
884 |
}
|
885 |
-
}
|
886 |
|
887 |
-
jQuery(document).on('focus', '.frm_toggle_default', clearDefault);
|
888 |
-
jQuery(document).on('blur', '.frm_toggle_default', replaceDefault);
|
889 |
-
jQuery('.frm_toggle_default').blur();
|
890 |
|
891 |
-
jQuery(document.getElementById('frm_resend_email')).click(resendEmail);
|
892 |
|
893 |
-
jQuery(document).on('change', '.frm-show-form input[name^="item_meta"], .frm-show-form select[name^="item_meta"], .frm-show-form textarea[name^="item_meta"]', frmFrontForm.fieldValueChanged );
|
894 |
-
jQuery(document).on('change keyup', '.frm-show-form .frm_inside_container input, .frm-show-form .frm_inside_container select, .frm-show-form .frm_inside_container textarea', maybeShowLabel);
|
895 |
|
896 |
-
jQuery(document).on('click', 'a[data-frmconfirm]', confirmClick);
|
897 |
-
jQuery('a[data-frmtoggle]').click(toggleDiv);
|
898 |
|
899 |
// Add fallbacks for the beloved IE8
|
900 |
addIndexOfFallbackForIE8();
|
@@ -908,12 +952,13 @@ function frmFrontFormJS(){
|
|
908 |
},
|
909 |
|
910 |
renderRecaptcha: function( captcha ) {
|
911 |
-
var
|
912 |
-
|
|
|
913 |
params = {
|
914 |
-
'sitekey': captcha.getAttribute('data-sitekey'),
|
915 |
'size': size,
|
916 |
-
'theme': captcha.getAttribute('data-theme')
|
917 |
};
|
918 |
|
919 |
if ( rendered ) {
|
@@ -921,44 +966,45 @@ function frmFrontFormJS(){
|
|
921 |
}
|
922 |
|
923 |
if ( size === 'invisible' ) {
|
924 |
-
|
925 |
-
jQuery(captcha).closest('.frm_form_field .frm_primary_label').hide();
|
926 |
-
params.callback = function(token) {
|
927 |
-
frmFrontForm.afterRecaptcha(token, formID);
|
928 |
};
|
929 |
}
|
930 |
|
931 |
-
|
932 |
|
933 |
-
captcha.setAttribute('data-rid', recaptchaID);
|
934 |
},
|
935 |
|
936 |
-
afterSingleRecaptcha: function(
|
937 |
-
var object = jQuery('.frm-show-form .g-recaptcha').closest('form')[0];
|
938 |
frmFrontForm.submitFormNow( object );
|
939 |
},
|
940 |
|
941 |
-
afterRecaptcha: function(token, formID){
|
942 |
-
var object = jQuery('#frm_form_'+ formID +'_container form')[0];
|
943 |
frmFrontForm.submitFormNow( object );
|
944 |
},
|
945 |
|
946 |
-
submitForm: function(e){
|
947 |
frmFrontForm.submitFormManual( e, this );
|
948 |
},
|
949 |
|
950 |
-
submitFormManual: function(e, object){
|
951 |
-
var
|
|
|
|
|
952 |
|
953 |
-
var classList = object.className.trim().split(/\s+/gi);
|
954 |
if ( classList && invisibleRecaptcha.length < 1 ) {
|
955 |
-
|
956 |
if ( ! isPro ) {
|
957 |
return;
|
958 |
}
|
959 |
}
|
960 |
|
961 |
-
if ( jQuery('body').hasClass('wp-admin') && jQuery(object).closest('.frmapi-form').length < 1 ) {
|
962 |
return;
|
963 |
}
|
964 |
|
@@ -971,28 +1017,29 @@ function frmFrontFormJS(){
|
|
971 |
}
|
972 |
|
973 |
if ( invisibleRecaptcha.length ) {
|
974 |
-
showLoadingIndicator( jQuery(object) );
|
975 |
executeInvisibleRecaptcha( invisibleRecaptcha );
|
976 |
} else {
|
977 |
|
978 |
-
|
979 |
|
980 |
-
if ( Object.keys(errors).length === 0 ) {
|
981 |
-
showSubmitLoading( jQuery(object) );
|
982 |
|
983 |
frmFrontForm.submitFormNow( object, classList );
|
984 |
}
|
985 |
}
|
986 |
},
|
987 |
|
988 |
-
submitFormNow: function(object) {
|
989 |
-
var
|
990 |
-
|
991 |
-
|
992 |
-
|
|
|
993 |
}).length;
|
994 |
if ( hasFileFields < 1 ) {
|
995 |
-
action = jQuery(object).find('input[name="frm_action"]').val();
|
996 |
frmFrontForm.checkFormErrors( object, action );
|
997 |
} else {
|
998 |
object.submit();
|
@@ -1002,8 +1049,8 @@ function frmFrontFormJS(){
|
|
1002 |
}
|
1003 |
},
|
1004 |
|
1005 |
-
validateFormSubmit: function( object ){
|
1006 |
-
if ( typeof tinyMCE !== 'undefined' && jQuery(object).find('.wp-editor-wrap').length ) {
|
1007 |
tinyMCE.triggerSave();
|
1008 |
}
|
1009 |
|
@@ -1012,7 +1059,7 @@ function frmFrontFormJS(){
|
|
1012 |
if ( shouldJSValidate( object ) ) {
|
1013 |
frmFrontForm.getAjaxFormErrors( object );
|
1014 |
|
1015 |
-
if ( Object.keys(jsErrors).length ) {
|
1016 |
frmFrontForm.addAjaxFormErrors( object );
|
1017 |
}
|
1018 |
}
|
@@ -1021,12 +1068,14 @@ function frmFrontFormJS(){
|
|
1021 |
},
|
1022 |
|
1023 |
getAjaxFormErrors: function( object ) {
|
|
|
|
|
1024 |
jsErrors = validateForm( object );
|
1025 |
-
if ( typeof frmThemeOverride_jsErrors === 'function' ) {
|
1026 |
-
action = jQuery(object).find('input[name="frm_action"]').val();
|
1027 |
-
|
1028 |
-
if ( Object.keys(customErrors).length ) {
|
1029 |
-
for (
|
1030 |
jsErrors[ key ] = customErrors[ key ];
|
1031 |
}
|
1032 |
}
|
@@ -1036,10 +1085,11 @@ function frmFrontFormJS(){
|
|
1036 |
},
|
1037 |
|
1038 |
addAjaxFormErrors: function( object ) {
|
|
|
1039 |
removeAllErrors();
|
1040 |
|
1041 |
-
for (
|
1042 |
-
|
1043 |
|
1044 |
if ( $fieldCont.length ) {
|
1045 |
addFieldError( $fieldCont, key, jsErrors );
|
@@ -1052,221 +1102,234 @@ function frmFrontFormJS(){
|
|
1052 |
scrollToFirstField( object );
|
1053 |
},
|
1054 |
|
1055 |
-
checkFormErrors: function(object, action){
|
1056 |
getFormErrors( object, action );
|
1057 |
},
|
1058 |
|
1059 |
-
checkRequiredField: function( field, errors ){
|
1060 |
return checkRequiredField( field, errors );
|
1061 |
},
|
1062 |
|
1063 |
-
showSubmitLoading: function( $object ){
|
1064 |
showSubmitLoading( $object );
|
1065 |
},
|
1066 |
|
1067 |
-
removeSubmitLoading: function( $object, enable, processesRunning ){
|
1068 |
removeSubmitLoading( $object, enable, processesRunning );
|
1069 |
},
|
1070 |
|
1071 |
-
scrollToID: function(id){
|
1072 |
-
var object = jQuery(document.getElementById(id));
|
1073 |
frmFrontForm.scrollMsg( object, false );
|
1074 |
},
|
1075 |
|
1076 |
scrollMsg: function( id, object, animate ) {
|
1077 |
-
var
|
1078 |
-
|
1079 |
-
|
1080 |
-
|
|
|
1081 |
return;
|
1082 |
}
|
1083 |
} else if ( typeof id === 'string' ) {
|
1084 |
-
scrollObj = jQuery(object).find('#frm_field_'+id+'_container');
|
1085 |
} else {
|
1086 |
scrollObj = id;
|
1087 |
}
|
1088 |
|
1089 |
-
|
1090 |
-
if ( !newPos ){
|
1091 |
return;
|
1092 |
}
|
1093 |
-
newPos = newPos-frm_js.offset;
|
1094 |
|
1095 |
-
|
1096 |
-
|
1097 |
-
if(m || b){
|
1098 |
-
newPos = newPos - parseInt(m) - parseInt(b);
|
1099 |
}
|
1100 |
|
1101 |
if ( newPos && window.innerHeight ) {
|
1102 |
-
|
1103 |
-
|
1104 |
|
1105 |
-
if( newPos > screenBottom || newPos < screenTop ) {
|
1106 |
// Not in view
|
1107 |
if ( typeof animate === 'undefined' ) {
|
1108 |
-
jQuery(window).scrollTop(newPos);
|
1109 |
-
}else{
|
1110 |
-
jQuery('html,body').animate({scrollTop: newPos}, 500);
|
1111 |
}
|
1112 |
return false;
|
1113 |
}
|
1114 |
}
|
1115 |
},
|
1116 |
|
1117 |
-
fieldValueChanged: function(e){
|
1118 |
/*jshint validthis:true */
|
1119 |
|
1120 |
-
var
|
1121 |
-
if ( !
|
1122 |
return;
|
1123 |
}
|
1124 |
|
1125 |
-
if ( e.frmTriggered && e.frmTriggered ==
|
1126 |
return;
|
1127 |
}
|
1128 |
|
1129 |
-
jQuery(document).trigger( 'frmFieldChanged', [ this,
|
1130 |
|
1131 |
if ( e.selfTriggered !== true ) {
|
1132 |
-
maybeValidateChange(
|
1133 |
}
|
1134 |
},
|
1135 |
|
1136 |
-
savingDraft: function(object){
|
1137 |
-
console.warn('DEPRECATED: function frmFrontForm.savingDraft in v3.0 use frmProForm.savingDraft');
|
1138 |
if ( typeof frmProForm !== 'undefined' ) {
|
1139 |
-
return frmProForm.savingDraft(object);
|
1140 |
}
|
1141 |
},
|
1142 |
|
1143 |
-
goingToPreviousPage: function(object){
|
1144 |
-
console.warn('DEPRECATED: function frmFrontForm.goingToPreviousPage in v3.0 use frmProForm.goingToPreviousPage');
|
1145 |
if ( typeof frmProForm !== 'undefined' ) {
|
1146 |
-
return frmProForm.goingToPreviousPage(object);
|
1147 |
}
|
1148 |
},
|
1149 |
|
1150 |
-
hideOrShowFields: function(
|
1151 |
-
console.warn('DEPRECATED: function frmFrontForm.hideOrShowFields in v3.0 use frmProForm.hideOrShowFields');
|
1152 |
if ( typeof frmProForm !== 'undefined' ) {
|
1153 |
frmProForm.hideOrShowFields();
|
1154 |
}
|
1155 |
},
|
1156 |
|
1157 |
-
hidePreviouslyHiddenFields: function(){
|
1158 |
-
console.warn('DEPRECATED: function frmFrontForm.hidePreviouslyHiddenFields in v3.0 use frmProForm.hidePreviouslyHiddenFields');
|
1159 |
if ( typeof frmProForm !== 'undefined' ) {
|
1160 |
frmProForm.hidePreviouslyHiddenFields();
|
1161 |
}
|
1162 |
},
|
1163 |
|
1164 |
-
checkDependentDynamicFields: function(ids){
|
1165 |
-
console.warn('DEPRECATED: function frmFrontForm.checkDependentDynamicFields in v3.0 use frmProForm.checkDependentDynamicFields');
|
1166 |
if ( typeof frmProForm !== 'undefined' ) {
|
1167 |
-
frmProForm.checkDependentDynamicFields(ids);
|
1168 |
}
|
1169 |
},
|
1170 |
|
1171 |
-
checkDependentLookupFields: function(ids){
|
1172 |
-
console.warn('DEPRECATED: function frmFrontForm.checkDependentLookupFields in v3.0 use frmProForm.checkDependentLookupFields');
|
1173 |
if ( typeof frmProForm !== 'undefined' ) {
|
1174 |
-
frmProForm.checkDependentLookupFields(ids);
|
1175 |
}
|
1176 |
},
|
1177 |
|
1178 |
-
loadGoogle: function(){
|
1179 |
-
console.warn('DEPRECATED: function frmFrontForm.loadGoogle in v3.0 use frmProForm.loadGoogle');
|
1180 |
frmProForm.loadGoogle();
|
1181 |
},
|
1182 |
|
1183 |
-
|
1184 |
-
console.warn('DEPRECATED: function frmFrontForm.removeUsedTimes in v3.0 use frmProForm.removeUsedTimes');
|
1185 |
-
if ( typeof frmProForm !== 'undefined' ) {
|
1186 |
-
frmProForm.removeUsedTimes();
|
1187 |
-
}
|
1188 |
-
},
|
1189 |
-
|
1190 |
-
escapeHtml: function(text){
|
1191 |
return text
|
1192 |
-
.replace(/&/g, '&')
|
1193 |
-
.replace(/</g, '<')
|
1194 |
-
.replace(/>/g, '>')
|
1195 |
-
.replace(/"/g, '"')
|
1196 |
-
.replace(/'/g, ''');
|
1197 |
},
|
1198 |
|
1199 |
-
invisible: function(classes) {
|
1200 |
-
jQuery(classes).css('visibility', 'hidden');
|
1201 |
},
|
1202 |
|
1203 |
-
visible: function(classes) {
|
1204 |
-
jQuery(classes).css('visibility', 'visible');
|
1205 |
}
|
1206 |
};
|
1207 |
}
|
1208 |
-
|
1209 |
|
1210 |
-
jQuery(document).ready(function(
|
1211 |
frmFrontForm.init();
|
1212 |
});
|
1213 |
|
1214 |
function frmRecaptcha() {
|
1215 |
-
var
|
1216 |
-
|
1217 |
-
|
|
|
1218 |
}
|
1219 |
}
|
1220 |
|
1221 |
-
function frmAfterRecaptcha(token){
|
1222 |
-
frmFrontForm.afterSingleRecaptcha(token);
|
1223 |
}
|
1224 |
|
1225 |
-
function frmUpdateField(
|
1226 |
-
jQuery(document.getElementById('frm_update_field_'+
|
1227 |
jQuery.ajax({
|
1228 |
-
type:'POST',
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1235 |
}
|
1236 |
}
|
1237 |
});
|
1238 |
}
|
1239 |
|
1240 |
-
function frmDeleteEntry(
|
1241 |
-
console.warn('DEPRECATED: function frmDeleteEntry in v2.0.13 use frmFrontForm.deleteEntry');
|
1242 |
-
jQuery(document.getElementById('frm_delete_'+
|
1243 |
jQuery.ajax({
|
1244 |
-
type:'POST',
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
|
|
|
|
|
|
|
|
|
|
1252 |
}
|
1253 |
});
|
1254 |
}
|
1255 |
|
1256 |
-
function frmOnSubmit(e){
|
1257 |
-
console.warn('DEPRECATED: function frmOnSubmit in v2.0 use frmFrontForm.submitForm');
|
1258 |
-
frmFrontForm.submitForm(e, this);
|
1259 |
}
|
1260 |
|
1261 |
-
function frm_resend_email(
|
1262 |
-
|
1263 |
-
|
1264 |
-
$link.append('<span class="spinner" style="display:inline"></span>');
|
1265 |
jQuery.ajax({
|
1266 |
-
type:'POST',
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1270 |
}
|
1271 |
});
|
1272 |
}
|
1 |
+
/* exported frmRecaptcha, frmAfterRecaptcha, frmUpdateField, frmDeleteEntry, frmOnSubmit, frm_resend_email */
|
2 |
+
|
3 |
+
var frmFrontForm;
|
4 |
+
|
5 |
+
function frmFrontFormJS() {
|
6 |
'use strict';
|
7 |
|
8 |
+
/*global jQuery:false, frm_js, grecaptcha, frmProForm, tinyMCE */
|
9 |
+
/*global frmThemeOverride_jsErrors, frmThemeOverride_frmPlaceError, frmThemeOverride_frmAfterSubmit */
|
10 |
|
11 |
var action = '';
|
12 |
var jsErrors = [];
|
13 |
|
14 |
+
function maybeShowLabel() {
|
15 |
/*jshint validthis:true */
|
16 |
+
var $field = jQuery( this ),
|
17 |
+
$label = $field.closest( '.frm_inside_container' ).find( '.frm_primary_label' ),
|
18 |
+
val = $field.val();
|
19 |
|
20 |
+
if ( val !== null && val.length > 0 ) {
|
21 |
+
$label.addClass( 'frm_visible' );
|
22 |
} else {
|
23 |
+
$label.removeClass( 'frm_visible' );
|
24 |
}
|
25 |
}
|
26 |
|
27 |
/* Get the ID of the field that changed*/
|
28 |
function getFieldId( field, fullID ) {
|
29 |
+
var nameParts, fieldId,
|
30 |
+
isRepeating = false,
|
31 |
+
fieldName = '';
|
32 |
if ( field instanceof jQuery ) {
|
33 |
+
fieldName = field.attr( 'name' );
|
34 |
} else {
|
35 |
fieldName = field.name;
|
36 |
}
|
41 |
|
42 |
if ( fieldName === '' ) {
|
43 |
if ( field instanceof jQuery ) {
|
44 |
+
fieldName = field.data( 'name' );
|
45 |
} else {
|
46 |
+
fieldName = field.getAttribute( 'data-name' );
|
47 |
}
|
48 |
|
49 |
if ( typeof fieldName === 'undefined' ) {
|
56 |
return 0;
|
57 |
}
|
58 |
|
59 |
+
nameParts = fieldName.replace( 'item_meta[', '' ).replace( '[]', '' ).split( ']' );
|
60 |
//TODO: Fix this for checkboxes and address fields
|
61 |
if ( nameParts.length < 1 ) {
|
62 |
return 0;
|
63 |
}
|
64 |
+
nameParts = nameParts.filter( function( n ) {
|
65 |
+
return n !== '';
|
66 |
+
});
|
67 |
|
68 |
+
fieldId = nameParts[0];
|
|
|
69 |
|
70 |
if ( nameParts.length === 1 ) {
|
71 |
+
return fieldId;
|
72 |
}
|
73 |
|
74 |
if ( nameParts[1] === '[form' || nameParts[1] === '[row_ids' ) {
|
75 |
return 0;
|
76 |
}
|
77 |
|
|
|
78 |
// Check if 'this' is in a repeating section
|
79 |
+
if ( jQuery( 'input[name="item_meta[' + fieldId + '][form]"]' ).length ) {
|
80 |
|
81 |
// this is a repeatable section with name: item_meta[repeating-section-id][row-id][field-id]
|
82 |
+
fieldId = nameParts[2].replace( '[', '' );
|
83 |
isRepeating = true;
|
84 |
}
|
85 |
|
86 |
// Check if 'this' is an other text field and get field ID for it
|
87 |
+
if ( 'other' === fieldId ) {
|
88 |
if ( isRepeating ) {
|
89 |
// name for other fields: item_meta[370][0][other][414]
|
90 |
+
fieldId = nameParts[3].replace( '[', '' );
|
91 |
} else {
|
92 |
// Other field name: item_meta[other][370]
|
93 |
+
fieldId = nameParts[1].replace( '[', '' );
|
94 |
}
|
95 |
}
|
96 |
|
97 |
if ( fullID === true ) {
|
98 |
// For use in the container div id
|
99 |
+
if ( fieldId === nameParts[0]) {
|
100 |
+
fieldId = fieldId + '-' + nameParts[1].replace( '[', '' );
|
101 |
} else {
|
102 |
+
fieldId = fieldId + '-' + nameParts[0] + '-' + nameParts[1].replace( '[', '' );
|
103 |
}
|
104 |
}
|
105 |
|
106 |
+
return fieldId;
|
107 |
}
|
108 |
|
109 |
/**
|
114 |
* @param {object} $form
|
115 |
*/
|
116 |
function disableSubmitButton( $form ) {
|
117 |
+
$form.find( 'input[type="submit"], input[type="button"], button[type="submit"]' ).attr( 'disabled', 'disabled' );
|
118 |
}
|
119 |
|
120 |
/**
|
151 |
}
|
152 |
|
153 |
function validateForm( object ) {
|
154 |
+
var r, rl, n, nl, emailFields, fields, field, value, requiredFields,
|
155 |
+
errors = [];
|
156 |
|
157 |
// Make sure required text field is filled in
|
158 |
+
requiredFields = jQuery( object ).find(
|
159 |
'.frm_required_field:visible input, .frm_required_field:visible select, .frm_required_field:visible textarea'
|
160 |
+
).filter( ':not(.frm_optional)' );
|
161 |
if ( requiredFields.length ) {
|
162 |
+
for ( r = 0, rl = requiredFields.length; r < rl; r++ ) {
|
163 |
errors = checkRequiredField( requiredFields[r], errors );
|
164 |
}
|
165 |
}
|
166 |
|
167 |
+
emailFields = jQuery( object ).find( 'input[type=email]' ).filter( ':visible' );
|
168 |
+
fields = jQuery( object ).find( 'input,select,textarea' );
|
169 |
if ( fields.length ) {
|
170 |
+
for ( n = 0, nl = fields.length; n < nl; n++ ) {
|
171 |
+
field = fields[n];
|
172 |
+
value = field.value;
|
173 |
if ( value !== '' ) {
|
174 |
if ( field.type === 'hidden' ) {
|
175 |
// don't validate
|
189 |
return errors;
|
190 |
}
|
191 |
|
192 |
+
function maybeValidateChange( fieldId, field ) {
|
193 |
if ( field.type === 'url' ) {
|
194 |
maybeAddHttpToUrl( field );
|
195 |
}
|
196 |
+
if ( jQuery( field ).closest( 'form' ).hasClass( 'frm_js_validate' ) ) {
|
197 |
+
validateField( fieldId, field );
|
198 |
}
|
199 |
}
|
200 |
|
207 |
}
|
208 |
|
209 |
function validateField( fieldId, field ) {
|
210 |
+
var key, emailFields,
|
211 |
+
errors = [];
|
212 |
|
213 |
+
var $fieldCont = jQuery( field ).closest( '.frm_form_field' );
|
214 |
+
if ( $fieldCont.hasClass( 'frm_required_field' ) && ! jQuery( field ).hasClass( 'frm_optional' ) ) {
|
215 |
errors = checkRequiredField( field, errors );
|
216 |
}
|
217 |
|
218 |
if ( errors.length < 1 ) {
|
219 |
if ( field.type === 'email' ) {
|
220 |
+
emailFields = jQuery( field ).closest( 'form' ).find( 'input[type=email]' );
|
221 |
errors = checkEmailField( field, errors, emailFields );
|
222 |
} else if ( field.type === 'number' ) {
|
223 |
errors = checkNumberField( field, errors );
|
227 |
}
|
228 |
|
229 |
removeFieldError( $fieldCont );
|
230 |
+
if ( Object.keys( errors ).length > 0 ) {
|
231 |
+
for ( key in errors ) {
|
232 |
addFieldError( $fieldCont, key, errors );
|
233 |
}
|
234 |
}
|
235 |
}
|
236 |
|
237 |
function checkRequiredField( field, errors ) {
|
238 |
+
var checkGroup, fieldClasses, tempVal, i, placeholder,
|
239 |
+
val = '',
|
240 |
+
fieldID = '',
|
241 |
+
fileID = field.getAttribute( 'data-frmfile' );
|
242 |
+
|
243 |
if ( field.type === 'hidden' && fileID === null ) {
|
244 |
return errors;
|
245 |
}
|
246 |
|
|
|
|
|
247 |
if ( field.type === 'checkbox' || field.type === 'radio' ) {
|
248 |
+
checkGroup = jQuery( 'input[name="' + field.name + '"]' ).closest( '.frm_required_field' ).find( 'input:checked' );
|
249 |
+
jQuery( checkGroup ).each( function() {
|
250 |
+
val = this.value;
|
251 |
});
|
252 |
} else if ( field.type === 'file' || fileID ) {
|
253 |
if ( typeof fileID === 'undefined' ) {
|
254 |
fileID = getFieldId( field, true );
|
255 |
+
fileID = fileID.replace( 'file', '' );
|
256 |
}
|
257 |
|
258 |
if ( typeof errors[ fileID ] === 'undefined' ) {
|
260 |
}
|
261 |
fieldID = fileID;
|
262 |
} else {
|
263 |
+
fieldClasses = field.className;
|
264 |
+
if ( fieldClasses.indexOf( 'frm_pos_none' ) !== -1 ) {
|
265 |
// skip hidden other fields
|
266 |
return errors;
|
267 |
}
|
268 |
|
269 |
+
val = jQuery( field ).val();
|
270 |
if ( val === null ) {
|
271 |
val = '';
|
272 |
} else if ( typeof val !== 'string' ) {
|
273 |
+
tempVal = val;
|
274 |
val = '';
|
275 |
+
for ( i = 0; i < tempVal.length; i++ ) {
|
276 |
if ( tempVal[i] !== '' ) {
|
277 |
val = tempVal[i];
|
278 |
}
|
279 |
}
|
280 |
}
|
281 |
|
282 |
+
if ( fieldClasses.indexOf( 'frm_other_input' ) === -1 ) {
|
283 |
fieldID = getFieldId( field, true );
|
284 |
} else {
|
285 |
fieldID = getFieldId( field, false );
|
286 |
}
|
287 |
|
288 |
+
if ( fieldClasses.indexOf( 'frm_time_select' ) !== -1 ) {
|
289 |
// set id for time field
|
290 |
+
fieldID = fieldID.replace( '-H', '' ).replace( '-m', '' );
|
291 |
}
|
292 |
|
293 |
+
placeholder = field.getAttribute( 'data-frmplaceholder' );
|
294 |
if ( placeholder !== null && val === placeholder ) {
|
295 |
val = '';
|
296 |
}
|
300 |
if ( fieldID === '' ) {
|
301 |
fieldID = getFieldId( field, true );
|
302 |
}
|
303 |
+
if ( ! ( fieldID in errors ) ) {
|
304 |
errors[ fieldID ] = getFieldValidationMessage( field, 'data-reqmsg' );
|
305 |
}
|
306 |
}
|
309 |
}
|
310 |
|
311 |
function getFileVals( fileID ) {
|
312 |
+
var val = '',
|
313 |
+
fileFields = jQuery( 'input[name="file' + fileID + '"], input[name="file' + fileID + '[]"], input[name^="item_meta[' + fileID + ']"]' );
|
314 |
+
|
315 |
+
fileFields.each( function() {
|
316 |
if ( val === '' ) {
|
317 |
val = this.value;
|
318 |
}
|
321 |
}
|
322 |
|
323 |
function checkEmailField( field, errors, emailFields ) {
|
324 |
+
var isConf, re, invalidMsg, confName, match,
|
325 |
+
emailAddress = field.value,
|
326 |
+
fieldID = getFieldId( field, true );
|
327 |
+
|
328 |
if ( fieldID in errors ) {
|
329 |
return errors;
|
330 |
}
|
331 |
|
332 |
+
isConf = ( fieldID.indexOf( 'conf_' ) === 0 );
|
333 |
if ( emailAddress !== '' || isConf ) {
|
334 |
+
re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i;
|
335 |
+
invalidMsg = getFieldValidationMessage( field, 'data-invmsg' );
|
336 |
if ( emailAddress !== '' && re.test( emailAddress ) === false ) {
|
337 |
errors[ fieldID ] = invalidMsg;
|
338 |
if ( isConf ) {
|
339 |
+
errors[ fieldID.replace( 'conf_', '' ) ] = '';
|
340 |
}
|
341 |
} else if ( isConf ) {
|
342 |
+
confName = field.name.replace( 'conf_', '' );
|
343 |
+
match = emailFields.filter( '[name="' + confName + '"]' ).val();
|
344 |
if ( match !== emailAddress ) {
|
345 |
errors[ fieldID ] = '';
|
346 |
+
errors[ fieldID.replace( 'conf_', '' ) ] = '';
|
347 |
}
|
348 |
}
|
349 |
}
|
351 |
}
|
352 |
|
353 |
function checkNumberField( field, errors ) {
|
354 |
+
var fieldID,
|
355 |
+
number = field.value;
|
356 |
+
|
357 |
+
if ( number !== '' && isNaN( number / 1 ) !== false ) {
|
358 |
+
fieldID = getFieldId( field, true );
|
359 |
+
if ( ! ( fieldID in errors ) ) {
|
360 |
errors[ fieldID ] = getFieldValidationMessage( field, 'data-invmsg' );
|
361 |
}
|
362 |
}
|
364 |
}
|
365 |
|
366 |
function checkPatternField( field, errors ) {
|
367 |
+
var fieldID,
|
368 |
+
text = field.value,
|
369 |
+
format = getFieldValidationMessage( field, 'pattern' );
|
370 |
|
371 |
if ( format !== '' && text !== '' ) {
|
372 |
+
fieldID = getFieldId( field, true );
|
373 |
+
if ( ! ( fieldID in errors ) ) {
|
374 |
+
format = new RegExp( '^' + format + '$', 'i' );
|
375 |
if ( format.test( text ) === false ) {
|
376 |
errors[ fieldID ] = getFieldValidationMessage( field, 'data-invmsg' );
|
377 |
}
|
381 |
}
|
382 |
|
383 |
function hasInvisibleRecaptcha( object ) {
|
384 |
+
var recaptcha, recaptchaID, alreadyChecked;
|
385 |
+
|
386 |
if ( isGoingToPrevPage( object ) ) {
|
387 |
return false;
|
388 |
}
|
389 |
|
390 |
+
recaptcha = jQuery( object ).find( '.frm-g-recaptcha[data-size="invisible"], .g-recaptcha[data-size="invisible"]' );
|
391 |
if ( recaptcha.length ) {
|
392 |
+
recaptchaID = recaptcha.data( 'rid' );
|
393 |
+
alreadyChecked = grecaptcha.getResponse( recaptchaID );
|
394 |
if ( alreadyChecked.length === 0 ) {
|
395 |
return recaptcha;
|
396 |
} else {
|
402 |
}
|
403 |
|
404 |
function executeInvisibleRecaptcha( invisibleRecaptcha ) {
|
405 |
+
var recaptchaID = invisibleRecaptcha.data( 'rid' );
|
406 |
grecaptcha.reset( recaptchaID );
|
407 |
grecaptcha.execute( recaptchaID );
|
408 |
}
|
409 |
|
410 |
function validateRecaptcha( form, errors ) {
|
411 |
+
var recaptchaID, response, fieldContainer, fieldID,
|
412 |
+
$recaptcha = jQuery( form ).find( '.frm-g-recaptcha' );
|
413 |
if ( $recaptcha.length ) {
|
414 |
+
recaptchaID = $recaptcha.data( 'rid' );
|
415 |
+
response = grecaptcha.getResponse( recaptchaID );
|
416 |
|
417 |
if ( response.length === 0 ) {
|
418 |
+
fieldContainer = $recaptcha.closest( '.frm_form_field' );
|
419 |
+
fieldID = fieldContainer.attr( 'id' ).replace( 'frm_field_', '' ).replace( '_container', '' );
|
420 |
errors[ fieldID ] = '';
|
421 |
}
|
422 |
}
|
424 |
}
|
425 |
|
426 |
function getFieldValidationMessage( field, messageType ) {
|
427 |
+
var msg = field.getAttribute( messageType );
|
428 |
if ( msg === null ) {
|
429 |
msg = '';
|
430 |
}
|
432 |
}
|
433 |
|
434 |
function shouldJSValidate( object ) {
|
435 |
+
var validate = jQuery( object ).hasClass( 'frm_js_validate' );
|
436 |
if ( validate && typeof frmProForm !== 'undefined' && ( frmProForm.savingDraft( object ) || frmProForm.goingToPreviousPage( object ) ) ) {
|
437 |
validate = false;
|
438 |
}
|
440 |
return validate;
|
441 |
}
|
442 |
|
443 |
+
function getFormErrors( object, action ) {
|
444 |
+
var fieldset;
|
445 |
+
|
446 |
+
if ( typeof action === 'undefined' ) {
|
447 |
+
jQuery( object ).find( 'input[name="frm_action"]' ).val();
|
448 |
}
|
449 |
|
450 |
+
fieldset = jQuery( object ).find( '.frm_form_field' );
|
451 |
+
fieldset.addClass( 'frm_doing_ajax' );
|
452 |
jQuery.ajax({
|
453 |
+
type: 'POST', url: frm_js.ajax_url,
|
454 |
+
data: jQuery( object ).serialize() + '&action=frm_entries_' + action + '&nonce=' + frm_js.nonce,
|
455 |
+
success: function( response ) {
|
456 |
+
var formID, replaceContent, pageOrder, formReturned, contSubmit,
|
457 |
+
showCaptcha, $fieldCont, key, inCollapsedSection, frmTrigger,
|
458 |
+
$recaptcha, recaptchaID,
|
459 |
+
defaultResponse = { 'content': '', 'errors': {}, 'pass': false };
|
460 |
if ( response === null ) {
|
461 |
response = defaultResponse;
|
462 |
}
|
463 |
|
464 |
+
response = response.replace( /^\s+|\s+$/g, '' );
|
465 |
+
if ( response.indexOf( '{' ) === 0 ) {
|
466 |
+
response = jQuery.parseJSON( response );
|
467 |
+
} else {
|
468 |
response = defaultResponse;
|
469 |
}
|
470 |
|
471 |
if ( typeof response.redirect !== 'undefined' ) {
|
472 |
+
jQuery( document ).trigger( 'frmBeforeFormRedirect', [ object, response ]);
|
473 |
window.location = response.redirect;
|
474 |
} else if ( response.content !== '' ) {
|
475 |
// the form or success message was returned
|
476 |
|
477 |
+
removeSubmitLoading( jQuery( object ) );
|
478 |
if ( frm_js.offset != -1 ) {
|
479 |
+
frmFrontForm.scrollMsg( jQuery( object ), false );
|
480 |
}
|
481 |
+
formID = jQuery( object ).find( 'input[name="form_id"]' ).val();
|
482 |
+
response.content = response.content.replace( / frm_pro_form /g, ' frm_pro_form frm_no_hide ' );
|
483 |
+
replaceContent = jQuery( object ).closest( '.frm_forms' );
|
484 |
removeAddedScripts( replaceContent, formID );
|
485 |
replaceContent.replaceWith( response.content );
|
486 |
|
487 |
+
addUrlParam( response );
|
488 |
|
489 |
+
if ( typeof frmThemeOverride_frmAfterSubmit === 'function' ) { // eslint-disable-line camelcase
|
490 |
+
pageOrder = jQuery( 'input[name="frm_page_order_' + formID + '"]' ).val();
|
491 |
+
formReturned = jQuery( response.content ).find( 'input[name="form_id"]' ).val();
|
492 |
+
frmThemeOverride_frmAfterSubmit( formReturned, pageOrder, response.content, object );
|
493 |
}
|
494 |
|
495 |
afterFormSubmitted( object, response );
|
496 |
|
497 |
+
} else if ( Object.keys( response.errors ).length ) {
|
498 |
// errors were returned
|
499 |
|
500 |
+
removeSubmitLoading( jQuery( object ), 'enable' );
|
501 |
|
502 |
//show errors
|
503 |
+
contSubmit = true;
|
504 |
removeAllErrors();
|
505 |
|
506 |
+
showCaptcha = false;
|
507 |
+
$fieldCont = null;
|
508 |
|
509 |
+
for ( key in response.errors ) {
|
510 |
+
|
511 |
+
$fieldCont = jQuery( object ).find( '#frm_field_' + key + '_container' );
|
512 |
|
513 |
if ( $fieldCont.length ) {
|
514 |
+
if ( ! $fieldCont.is( ':visible' ) ) {
|
515 |
+
inCollapsedSection = $fieldCont.closest( '.frm_toggle_container' );
|
516 |
if ( inCollapsedSection.length ) {
|
517 |
+
frmTrigger = inCollapsedSection.prev();
|
518 |
+
if ( ! frmTrigger.hasClass( 'frm_trigger' ) ) {
|
519 |
// If the frmTrigger object is the section description, check to see if the previous element is the trigger
|
520 |
+
frmTrigger = frmTrigger.prev( '.frm_trigger' );
|
521 |
}
|
522 |
frmTrigger.click();
|
523 |
}
|
524 |
}
|
525 |
|
526 |
+
if ( $fieldCont.is( ':visible' ) ) {
|
527 |
addFieldError( $fieldCont, key, response.errors );
|
528 |
|
529 |
+
contSubmit = false;
|
530 |
|
531 |
+
$recaptcha = jQuery( object ).find( '#frm_field_' + key + '_container .frm-g-recaptcha, #frm_field_' + key + '_container .g-recaptcha' );
|
532 |
if ( $recaptcha.length ) {
|
533 |
+
showCaptcha = true;
|
534 |
+
recaptchaID = $recaptcha.data( 'rid' );
|
535 |
if ( jQuery().grecaptcha ) {
|
536 |
if ( recaptchaID ) {
|
537 |
grecaptcha.reset( recaptchaID );
|
544 |
}
|
545 |
}
|
546 |
|
547 |
+
jQuery( document ).trigger( 'frmFormErrors', [ object, response ]);
|
548 |
|
549 |
+
fieldset.removeClass( 'frm_doing_ajax' );
|
550 |
scrollToFirstField( object );
|
551 |
|
552 |
+
if ( showCaptcha !== true ) {
|
553 |
replaceCheckedRecaptcha( object, false );
|
554 |
}
|
555 |
|
556 |
+
if ( contSubmit ) {
|
557 |
object.submit();
|
558 |
+
} else {
|
559 |
+
jQuery( object ).prepend( response.error_message );
|
560 |
}
|
561 |
} else {
|
562 |
// there may have been a plugin conflict, or the form is not set to submit with ajax
|
567 |
object.submit();
|
568 |
}
|
569 |
},
|
570 |
+
error: function() {
|
571 |
+
jQuery( object ).find( 'input[type="submit"], input[type="button"]' ).removeAttr( 'disabled' );
|
572 |
object.submit();
|
573 |
}
|
574 |
});
|
575 |
}
|
576 |
|
577 |
function afterFormSubmitted( object, response ) {
|
578 |
+
var formCompleted = jQuery( response.content ).find( '.frm_message' );
|
579 |
if ( formCompleted.length ) {
|
580 |
+
jQuery( document ).trigger( 'frmFormComplete', [ object, response ]);
|
581 |
} else {
|
582 |
+
jQuery( document ).trigger( 'frmPageChanged', [ object, response ]);
|
583 |
}
|
584 |
}
|
585 |
|
591 |
}
|
592 |
}
|
593 |
|
594 |
+
function addUrlParam( response ) {
|
595 |
+
var url;
|
596 |
if ( history.pushState && typeof response.page !== 'undefined' ) {
|
597 |
+
url = addQueryVar( 'frm_page', response.page );
|
598 |
+
window.history.pushState({ 'html': response.html }, '', '?' + url );
|
599 |
}
|
600 |
}
|
601 |
|
602 |
+
function addQueryVar( key, value ) {
|
603 |
+
var kvp, i, x;
|
604 |
+
|
605 |
+
key = encodeURI( key );
|
606 |
+
value = encodeURI( value );
|
607 |
|
608 |
+
kvp = document.location.search.substr( 1 ).split( '&' );
|
609 |
|
610 |
+
i = kvp.length;
|
611 |
+
while ( i-- ) {
|
612 |
+
x = kvp[i].split( '=' );
|
613 |
|
614 |
+
if ( x[0] == key ) {
|
615 |
x[1] = value;
|
616 |
+
kvp[i] = x.join( '=' );
|
617 |
break;
|
618 |
}
|
619 |
}
|
620 |
|
621 |
+
if ( i < 0 ) {
|
622 |
+
kvp[ kvp.length ] = [ key, value ].join( '=' );
|
623 |
}
|
624 |
|
625 |
+
return kvp.join( '&' );
|
626 |
}
|
627 |
|
628 |
function addFieldError( $fieldCont, key, jsErrors ) {
|
629 |
+
var input, id, describedBy;
|
630 |
+
if ( $fieldCont.length && $fieldCont.is( ':visible' ) ) {
|
631 |
+
$fieldCont.addClass( 'frm_blank_field' );
|
632 |
+
input = $fieldCont.find( 'input, select, textarea' );
|
633 |
+
id = 'frm_error_field_' + key;
|
634 |
+
describedBy = input.attr( 'aria-describedby' );
|
635 |
|
636 |
+
if ( typeof frmThemeOverride_frmPlaceError === 'function' ) { // eslint-disable-line camelcase
|
637 |
frmThemeOverride_frmPlaceError( key, jsErrors );
|
638 |
} else {
|
639 |
+
$fieldCont.append( '<div class="frm_error" id="' + id + '">' + jsErrors[key] + '</div>' );
|
640 |
|
641 |
if ( typeof describedBy === 'undefined' ) {
|
642 |
describedBy = id;
|
647 |
}
|
648 |
input.attr( 'aria-invalid', true );
|
649 |
|
650 |
+
jQuery( document ).trigger( 'frmAddFieldError', [ $fieldCont, key, jsErrors ]);
|
651 |
}
|
652 |
}
|
653 |
|
654 |
function removeFieldError( $fieldCont ) {
|
655 |
+
var errorMessage = $fieldCont.find( '.frm_error' ),
|
656 |
+
errorId = errorMessage.attr( 'id' ),
|
657 |
input = $fieldCont.find( 'input, select, textarea' ),
|
658 |
describedBy = input.attr( 'aria-describedby' );
|
659 |
|
660 |
+
$fieldCont.removeClass( 'frm_blank_field has-error' );
|
661 |
errorMessage.remove();
|
662 |
input.attr( 'aria-invalid', false );
|
663 |
|
668 |
}
|
669 |
|
670 |
function removeAllErrors() {
|
671 |
+
jQuery( '.form-field' ).removeClass( 'frm_blank_field has-error' );
|
672 |
+
jQuery( '.form-field .frm_error' ).replaceWith( '' );
|
673 |
+
jQuery( '.frm_error_style' ).remove();
|
674 |
}
|
675 |
|
676 |
function scrollToFirstField( object ) {
|
677 |
+
var field = jQuery( object ).find( '.frm_blank_field:first' );
|
678 |
if ( field.length ) {
|
679 |
frmFrontForm.scrollMsg( field, object, true );
|
680 |
}
|
692 |
$object.trigger( 'frmStartFormLoading' );
|
693 |
}
|
694 |
}
|
695 |
+
|
696 |
function addLoadingClass( $object ) {
|
697 |
+
var loadingClass = isGoingToPrevPage( $object ) ? 'frm_loading_prev' : 'frm_loading_form';
|
698 |
|
699 |
+
$object.addClass( loadingClass );
|
700 |
}
|
701 |
|
702 |
function isGoingToPrevPage( $object ) {
|
704 |
}
|
705 |
|
706 |
function removeSubmitLoading( $object, enable, processesRunning ) {
|
707 |
+
var loadingForm;
|
708 |
+
|
709 |
if ( processesRunning > 0 ) {
|
710 |
return;
|
711 |
}
|
712 |
|
713 |
+
loadingForm = jQuery( '.frm_loading_form' );
|
714 |
+
loadingForm.removeClass( 'frm_loading_form' );
|
715 |
loadingForm.removeClass( 'frm_loading_prev' );
|
716 |
|
717 |
loadingForm.trigger( 'frmEndFormLoading' );
|
723 |
}
|
724 |
|
725 |
function showFileLoading( object ) {
|
726 |
+
var fileval,
|
727 |
+
loading = document.getElementById( 'frm_loading' );
|
728 |
if ( loading !== null ) {
|
729 |
+
fileval = jQuery( object ).find( 'input[type=file]' ).val();
|
730 |
+
if ( typeof fileval !== 'undefined' && fileval !== '' ) {
|
731 |
+
setTimeout( function() {
|
732 |
+
jQuery( loading ).fadeIn( 'slow' );
|
733 |
+
}, 2000 );
|
734 |
}
|
735 |
}
|
736 |
}
|
737 |
|
738 |
function replaceCheckedRecaptcha( object, checkPage ) {
|
739 |
+
var morePages,
|
740 |
+
$recapField = jQuery( object ).find( '.frm-g-recaptcha, .g-recaptcha' );
|
741 |
+
if ( $recapField.length ) {
|
742 |
if ( checkPage ) {
|
743 |
+
morePages = jQuery( object ).find( '.frm_next_page' ).length < 1 || jQuery( object ).find( '.frm_next_page' ).val() < 1;
|
744 |
if ( ! morePages ) {
|
745 |
return;
|
746 |
}
|
747 |
}
|
748 |
+
$recapField.closest( '.frm_form_field' ).replaceWith( '<input type="hidden" name="recaptcha_checked" value="' + frm_js.nonce + '">' );
|
749 |
}
|
750 |
}
|
751 |
|
752 |
+
function clearDefault() {
|
753 |
/*jshint validthis:true */
|
754 |
+
toggleDefault( jQuery( this ), 'clear' );
|
755 |
}
|
756 |
|
757 |
+
function replaceDefault() {
|
758 |
/*jshint validthis:true */
|
759 |
+
toggleDefault( jQuery( this ), 'replace' );
|
760 |
}
|
761 |
|
762 |
+
function toggleDefault( $thisField, e ) {
|
763 |
// TODO: Fix this for a default value that is a number or array
|
764 |
+
var thisVal,
|
765 |
+
v = $thisField.data( 'frmval' ).replace( /(\n|\r\n)/g, '\r' );
|
766 |
if ( v === '' || typeof v === 'undefined' ) {
|
767 |
return false;
|
768 |
}
|
769 |
+
thisVal = $thisField.val().replace( /(\n|\r\n)/g, '\r' );
|
770 |
|
771 |
+
if ( 'replace' === e ) {
|
772 |
if ( thisVal === '' ) {
|
773 |
+
$thisField.addClass( 'frm_default' ).val( v );
|
774 |
}
|
775 |
} else if ( thisVal == v ) {
|
776 |
+
$thisField.removeClass( 'frm_default' ).val( '' );
|
777 |
}
|
778 |
}
|
779 |
|
780 |
+
function resendEmail() {
|
781 |
/*jshint validthis:true */
|
782 |
+
var $link = jQuery( this ),
|
783 |
+
entryId = this.getAttribute( 'data-eid' ),
|
784 |
+
formId = this.getAttribute( 'data-fid' ),
|
785 |
label = $link.find( '.frm_link_label' );
|
786 |
if ( label.length < 1 ) {
|
787 |
label = $link;
|
788 |
}
|
789 |
+
label.append( '<span class="frm-wait"></span>' );
|
790 |
|
791 |
jQuery.ajax({
|
792 |
+
type: 'POST',
|
793 |
+
url: frm_js.ajax_url,
|
794 |
+
data: {
|
795 |
+
action: 'frm_entries_send_email',
|
796 |
+
entry_id: entryId,
|
797 |
+
form_id: formId,
|
798 |
+
nonce: frm_js.nonce
|
799 |
},
|
800 |
+
success: function( msg ) {
|
801 |
var admin = document.getElementById( 'wpbody' );
|
802 |
if ( admin === null ) {
|
803 |
label.html( msg );
|
816 |
|
817 |
function confirmClick() {
|
818 |
/*jshint validthis:true */
|
819 |
+
var message = jQuery( this ).data( 'frmconfirm' );
|
820 |
+
return confirm( message );
|
821 |
}
|
822 |
|
823 |
+
function toggleDiv() {
|
824 |
/*jshint validthis:true */
|
825 |
var div = jQuery( this ).data( 'frmtoggle' );
|
826 |
if ( jQuery( div ).is( ':visible' ) ) {
|
836 |
*********************************************/
|
837 |
|
838 |
function addIndexOfFallbackForIE8() {
|
839 |
+
var len, from;
|
840 |
+
|
841 |
+
if ( ! Array.prototype.indexOf ) {
|
842 |
+
Array.prototype.indexOf = function( elt /*, from*/ ) {
|
843 |
+
len = this.length >>> 0;
|
844 |
|
845 |
+
from = Number( arguments[1]) || 0;
|
846 |
+
from = ( from < 0 ) ? Math.ceil( from ) : Math.floor( from );
|
847 |
+
if ( from < 0 ) {
|
848 |
from += len;
|
849 |
}
|
850 |
|
851 |
+
for ( ; from < len; from++ ) {
|
852 |
if ( from in this && this[from] === elt ) {
|
853 |
return from;
|
854 |
}
|
858 |
}
|
859 |
}
|
860 |
|
861 |
+
function addTrimFallbackForIE8() {
|
862 |
if ( typeof String.prototype.trim !== 'function' ) {
|
863 |
String.prototype.trim = function() {
|
864 |
+
return this.replace( /^\s+|\s+$/g, '' );
|
865 |
};
|
866 |
}
|
867 |
}
|
868 |
|
869 |
+
function addFilterFallbackForIE8() {
|
870 |
+
var t, len, res, thisp, i, val;
|
871 |
|
872 |
+
if ( ! Array.prototype.filter ) {
|
873 |
+
|
874 |
+
Array.prototype.filter = function( fun /*, thisp */ ) {
|
875 |
|
876 |
if ( this === void 0 || this === null ) {
|
877 |
throw new TypeError();
|
878 |
}
|
879 |
|
880 |
+
t = Object( this );
|
881 |
+
len = t.length >>> 0;
|
882 |
if ( typeof fun !== 'function' ) {
|
883 |
throw new TypeError();
|
884 |
}
|
885 |
|
886 |
+
res = [];
|
887 |
+
thisp = arguments[1];
|
888 |
+
for ( i = 0; i < len; i++ ) {
|
889 |
if ( i in t ) {
|
890 |
+
val = t[i]; // in case fun mutates this
|
891 |
+
if ( fun.call( thisp, val, i, t ) ) {
|
892 |
+
res.push( val );
|
893 |
+
}
|
894 |
}
|
895 |
}
|
896 |
|
899 |
}
|
900 |
}
|
901 |
|
902 |
+
function addKeysFallbackForIE8() {
|
903 |
+
var keys, i;
|
904 |
+
|
905 |
+
if ( ! Object.keys ) {
|
906 |
+
Object.keys = function( obj ) {
|
907 |
+
keys = [];
|
908 |
|
909 |
+
for ( i in obj ) {
|
910 |
+
if ( obj.hasOwnProperty( i ) ) {
|
911 |
+
keys.push( i );
|
912 |
+
}
|
913 |
+
}
|
914 |
|
915 |
+
return keys;
|
916 |
+
};
|
917 |
}
|
918 |
}
|
919 |
|
920 |
+
return {
|
921 |
+
init: function() {
|
922 |
+
jQuery( document ).off( 'submit.formidable', '.frm-show-form' );
|
923 |
+
jQuery( document ).on( 'submit.formidable', '.frm-show-form', frmFrontForm.submitForm );
|
924 |
|
925 |
jQuery( '.frm-show-form input[onblur], .frm-show-form textarea[onblur]' ).each( function() {
|
926 |
if ( jQuery( this ).val() === '' ) {
|
927 |
jQuery( this ).blur();
|
928 |
}
|
929 |
+
});
|
930 |
|
931 |
+
jQuery( document ).on( 'focus', '.frm_toggle_default', clearDefault );
|
932 |
+
jQuery( document ).on( 'blur', '.frm_toggle_default', replaceDefault );
|
933 |
+
jQuery( '.frm_toggle_default' ).blur();
|
934 |
|
935 |
+
jQuery( document.getElementById( 'frm_resend_email' ) ).click( resendEmail );
|
936 |
|
937 |
+
jQuery( document ).on( 'change', '.frm-show-form input[name^="item_meta"], .frm-show-form select[name^="item_meta"], .frm-show-form textarea[name^="item_meta"]', frmFrontForm.fieldValueChanged );
|
938 |
+
jQuery( document ).on( 'change keyup', '.frm-show-form .frm_inside_container input, .frm-show-form .frm_inside_container select, .frm-show-form .frm_inside_container textarea', maybeShowLabel );
|
939 |
|
940 |
+
jQuery( document ).on( 'click', 'a[data-frmconfirm]', confirmClick );
|
941 |
+
jQuery( 'a[data-frmtoggle]' ).click( toggleDiv );
|
942 |
|
943 |
// Add fallbacks for the beloved IE8
|
944 |
addIndexOfFallbackForIE8();
|
952 |
},
|
953 |
|
954 |
renderRecaptcha: function( captcha ) {
|
955 |
+
var formID, recaptchaID,
|
956 |
+
size = captcha.getAttribute( 'data-size' ),
|
957 |
+
rendered = captcha.getAttribute( 'data-rid' ) !== null,
|
958 |
params = {
|
959 |
+
'sitekey': captcha.getAttribute( 'data-sitekey' ),
|
960 |
'size': size,
|
961 |
+
'theme': captcha.getAttribute( 'data-theme' )
|
962 |
};
|
963 |
|
964 |
if ( rendered ) {
|
966 |
}
|
967 |
|
968 |
if ( size === 'invisible' ) {
|
969 |
+
formID = jQuery( captcha ).closest( 'form' ).find( 'input[name="form_id"]' ).val();
|
970 |
+
jQuery( captcha ).closest( '.frm_form_field .frm_primary_label' ).hide();
|
971 |
+
params.callback = function( token ) {
|
972 |
+
frmFrontForm.afterRecaptcha( token, formID );
|
973 |
};
|
974 |
}
|
975 |
|
976 |
+
recaptchaID = grecaptcha.render( captcha.id, params );
|
977 |
|
978 |
+
captcha.setAttribute( 'data-rid', recaptchaID );
|
979 |
},
|
980 |
|
981 |
+
afterSingleRecaptcha: function() {
|
982 |
+
var object = jQuery( '.frm-show-form .g-recaptcha' ).closest( 'form' )[0];
|
983 |
frmFrontForm.submitFormNow( object );
|
984 |
},
|
985 |
|
986 |
+
afterRecaptcha: function( token, formID ) {
|
987 |
+
var object = jQuery( '#frm_form_' + formID + '_container form' )[0];
|
988 |
frmFrontForm.submitFormNow( object );
|
989 |
},
|
990 |
|
991 |
+
submitForm: function( e ) {
|
992 |
frmFrontForm.submitFormManual( e, this );
|
993 |
},
|
994 |
|
995 |
+
submitFormManual: function( e, object ) {
|
996 |
+
var isPro, errors,
|
997 |
+
invisibleRecaptcha = hasInvisibleRecaptcha( object ),
|
998 |
+
classList = object.className.trim().split( /\s+/gi );
|
999 |
|
|
|
1000 |
if ( classList && invisibleRecaptcha.length < 1 ) {
|
1001 |
+
isPro = classList.indexOf( 'frm_pro_form' ) > -1;
|
1002 |
if ( ! isPro ) {
|
1003 |
return;
|
1004 |
}
|
1005 |
}
|
1006 |
|
1007 |
+
if ( jQuery( 'body' ).hasClass( 'wp-admin' ) && jQuery( object ).closest( '.frmapi-form' ).length < 1 ) {
|
1008 |
return;
|
1009 |
}
|
1010 |
|
1017 |
}
|
1018 |
|
1019 |
if ( invisibleRecaptcha.length ) {
|
1020 |
+
showLoadingIndicator( jQuery( object ) );
|
1021 |
executeInvisibleRecaptcha( invisibleRecaptcha );
|
1022 |
} else {
|
1023 |
|
1024 |
+
errors = frmFrontForm.validateFormSubmit( object );
|
1025 |
|
1026 |
+
if ( Object.keys( errors ).length === 0 ) {
|
1027 |
+
showSubmitLoading( jQuery( object ) );
|
1028 |
|
1029 |
frmFrontForm.submitFormNow( object, classList );
|
1030 |
}
|
1031 |
}
|
1032 |
},
|
1033 |
|
1034 |
+
submitFormNow: function( object ) {
|
1035 |
+
var hasFileFields,
|
1036 |
+
classList = object.className.trim().split( /\s+/gi );
|
1037 |
+
if ( classList.indexOf( 'frm_ajax_submit' ) > -1 ) {
|
1038 |
+
hasFileFields = jQuery( object ).find( 'input[type="file"]' ).filter( function() {
|
1039 |
+
return !! this.value;
|
1040 |
}).length;
|
1041 |
if ( hasFileFields < 1 ) {
|
1042 |
+
action = jQuery( object ).find( 'input[name="frm_action"]' ).val();
|
1043 |
frmFrontForm.checkFormErrors( object, action );
|
1044 |
} else {
|
1045 |
object.submit();
|
1049 |
}
|
1050 |
},
|
1051 |
|
1052 |
+
validateFormSubmit: function( object ) {
|
1053 |
+
if ( typeof tinyMCE !== 'undefined' && jQuery( object ).find( '.wp-editor-wrap' ).length ) {
|
1054 |
tinyMCE.triggerSave();
|
1055 |
}
|
1056 |
|
1059 |
if ( shouldJSValidate( object ) ) {
|
1060 |
frmFrontForm.getAjaxFormErrors( object );
|
1061 |
|
1062 |
+
if ( Object.keys( jsErrors ).length ) {
|
1063 |
frmFrontForm.addAjaxFormErrors( object );
|
1064 |
}
|
1065 |
}
|
1068 |
},
|
1069 |
|
1070 |
getAjaxFormErrors: function( object ) {
|
1071 |
+
var customErrors, key;
|
1072 |
+
|
1073 |
jsErrors = validateForm( object );
|
1074 |
+
if ( typeof frmThemeOverride_jsErrors === 'function' ) { // eslint-disable-line camelcase
|
1075 |
+
action = jQuery( object ).find( 'input[name="frm_action"]' ).val();
|
1076 |
+
customErrors = frmThemeOverride_jsErrors( action, object );
|
1077 |
+
if ( Object.keys( customErrors ).length ) {
|
1078 |
+
for ( key in customErrors ) {
|
1079 |
jsErrors[ key ] = customErrors[ key ];
|
1080 |
}
|
1081 |
}
|
1085 |
},
|
1086 |
|
1087 |
addAjaxFormErrors: function( object ) {
|
1088 |
+
var key, $fieldCont;
|
1089 |
removeAllErrors();
|
1090 |
|
1091 |
+
for ( key in jsErrors ) {
|
1092 |
+
$fieldCont = jQuery( object ).find( '#frm_field_' + key + '_container' );
|
1093 |
|
1094 |
if ( $fieldCont.length ) {
|
1095 |
addFieldError( $fieldCont, key, jsErrors );
|
1102 |
scrollToFirstField( object );
|
1103 |
},
|
1104 |
|
1105 |
+
checkFormErrors: function( object, action ) {
|
1106 |
getFormErrors( object, action );
|
1107 |
},
|
1108 |
|
1109 |
+
checkRequiredField: function( field, errors ) {
|
1110 |
return checkRequiredField( field, errors );
|
1111 |
},
|
1112 |
|
1113 |
+
showSubmitLoading: function( $object ) {
|
1114 |
showSubmitLoading( $object );
|
1115 |
},
|
1116 |
|
1117 |
+
removeSubmitLoading: function( $object, enable, processesRunning ) {
|
1118 |
removeSubmitLoading( $object, enable, processesRunning );
|
1119 |
},
|
1120 |
|
1121 |
+
scrollToID: function( id ) {
|
1122 |
+
var object = jQuery( document.getElementById( id ) );
|
1123 |
frmFrontForm.scrollMsg( object, false );
|
1124 |
},
|
1125 |
|
1126 |
scrollMsg: function( id, object, animate ) {
|
1127 |
+
var newPos, m, b, screenTop, screenBottom,
|
1128 |
+
scrollObj = '';
|
1129 |
+
if ( typeof object === 'undefined' ) {
|
1130 |
+
scrollObj = jQuery( document.getElementById( 'frm_form_' + id + '_container' ) );
|
1131 |
+
if ( scrollObj.length < 1 ) {
|
1132 |
return;
|
1133 |
}
|
1134 |
} else if ( typeof id === 'string' ) {
|
1135 |
+
scrollObj = jQuery( object ).find( '#frm_field_' + id + '_container' );
|
1136 |
} else {
|
1137 |
scrollObj = id;
|
1138 |
}
|
1139 |
|
1140 |
+
newPos = scrollObj.offset().top;
|
1141 |
+
if ( ! newPos || frm_js.offset === '-1' ) {
|
1142 |
return;
|
1143 |
}
|
1144 |
+
newPos = newPos - frm_js.offset;
|
1145 |
|
1146 |
+
m = jQuery( 'html' ).css( 'margin-top' );
|
1147 |
+
b = jQuery( 'body' ).css( 'margin-top' );
|
1148 |
+
if ( m || b ) {
|
1149 |
+
newPos = newPos - parseInt( m ) - parseInt( b );
|
1150 |
}
|
1151 |
|
1152 |
if ( newPos && window.innerHeight ) {
|
1153 |
+
screenTop = document.documentElement.scrollTop || document.body.scrollTop;
|
1154 |
+
screenBottom = screenTop + window.innerHeight;
|
1155 |
|
1156 |
+
if ( newPos > screenBottom || newPos < screenTop ) {
|
1157 |
// Not in view
|
1158 |
if ( typeof animate === 'undefined' ) {
|
1159 |
+
jQuery( window ).scrollTop( newPos );
|
1160 |
+
} else {
|
1161 |
+
jQuery( 'html,body' ).animate({ scrollTop: newPos }, 500 );
|
1162 |
}
|
1163 |
return false;
|
1164 |
}
|
1165 |
}
|
1166 |
},
|
1167 |
|
1168 |
+
fieldValueChanged: function( e ) {
|
1169 |
/*jshint validthis:true */
|
1170 |
|
1171 |
+
var fieldId = frmFrontForm.getFieldId( this, false );
|
1172 |
+
if ( ! fieldId || typeof fieldId === 'undefined' ) {
|
1173 |
return;
|
1174 |
}
|
1175 |
|
1176 |
+
if ( e.frmTriggered && e.frmTriggered == fieldId ) {
|
1177 |
return;
|
1178 |
}
|
1179 |
|
1180 |
+
jQuery( document ).trigger( 'frmFieldChanged', [ this, fieldId, e ]);
|
1181 |
|
1182 |
if ( e.selfTriggered !== true ) {
|
1183 |
+
maybeValidateChange( fieldId, this );
|
1184 |
}
|
1185 |
},
|
1186 |
|
1187 |
+
savingDraft: function( object ) {
|
1188 |
+
console.warn( 'DEPRECATED: function frmFrontForm.savingDraft in v3.0 use frmProForm.savingDraft' );
|
1189 |
if ( typeof frmProForm !== 'undefined' ) {
|
1190 |
+
return frmProForm.savingDraft( object );
|
1191 |
}
|
1192 |
},
|
1193 |
|
1194 |
+
goingToPreviousPage: function( object ) {
|
1195 |
+
console.warn( 'DEPRECATED: function frmFrontForm.goingToPreviousPage in v3.0 use frmProForm.goingToPreviousPage' );
|
1196 |
if ( typeof frmProForm !== 'undefined' ) {
|
1197 |
+
return frmProForm.goingToPreviousPage( object );
|
1198 |
}
|
1199 |
},
|
1200 |
|
1201 |
+
hideOrShowFields: function() {
|
1202 |
+
console.warn( 'DEPRECATED: function frmFrontForm.hideOrShowFields in v3.0 use frmProForm.hideOrShowFields' );
|
1203 |
if ( typeof frmProForm !== 'undefined' ) {
|
1204 |
frmProForm.hideOrShowFields();
|
1205 |
}
|
1206 |
},
|
1207 |
|
1208 |
+
hidePreviouslyHiddenFields: function() {
|
1209 |
+
console.warn( 'DEPRECATED: function frmFrontForm.hidePreviouslyHiddenFields in v3.0 use frmProForm.hidePreviouslyHiddenFields' );
|
1210 |
if ( typeof frmProForm !== 'undefined' ) {
|
1211 |
frmProForm.hidePreviouslyHiddenFields();
|
1212 |
}
|
1213 |
},
|
1214 |
|
1215 |
+
checkDependentDynamicFields: function( ids ) {
|
1216 |
+
console.warn( 'DEPRECATED: function frmFrontForm.checkDependentDynamicFields in v3.0 use frmProForm.checkDependentDynamicFields' );
|
1217 |
if ( typeof frmProForm !== 'undefined' ) {
|
1218 |
+
frmProForm.checkDependentDynamicFields( ids );
|
1219 |
}
|
1220 |
},
|
1221 |
|
1222 |
+
checkDependentLookupFields: function( ids ) {
|
1223 |
+
console.warn( 'DEPRECATED: function frmFrontForm.checkDependentLookupFields in v3.0 use frmProForm.checkDependentLookupFields' );
|
1224 |
if ( typeof frmProForm !== 'undefined' ) {
|
1225 |
+
frmProForm.checkDependentLookupFields( ids );
|
1226 |
}
|
1227 |
},
|
1228 |
|
1229 |
+
loadGoogle: function() {
|
1230 |
+
console.warn( 'DEPRECATED: function frmFrontForm.loadGoogle in v3.0 use frmProForm.loadGoogle' );
|
1231 |
frmProForm.loadGoogle();
|
1232 |
},
|
1233 |
|
1234 |
+
escapeHtml: function( text ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1235 |
return text
|
1236 |
+
.replace( /&/g, '&' )
|
1237 |
+
.replace( /</g, '<' )
|
1238 |
+
.replace( />/g, '>' )
|
1239 |
+
.replace( /"/g, '"' )
|
1240 |
+
.replace( /'/g, ''' );
|
1241 |
},
|
1242 |
|
1243 |
+
invisible: function( classes ) {
|
1244 |
+
jQuery( classes ).css( 'visibility', 'hidden' );
|
1245 |
},
|
1246 |
|
1247 |
+
visible: function( classes ) {
|
1248 |
+
jQuery( classes ).css( 'visibility', 'visible' );
|
1249 |
}
|
1250 |
};
|
1251 |
}
|
1252 |
+
frmFrontForm = frmFrontFormJS();
|
1253 |
|
1254 |
+
jQuery( document ).ready( function() {
|
1255 |
frmFrontForm.init();
|
1256 |
});
|
1257 |
|
1258 |
function frmRecaptcha() {
|
1259 |
+
var c, cl,
|
1260 |
+
captchas = jQuery( '.frm-g-recaptcha' );
|
1261 |
+
for ( c = 0, cl = captchas.length; c < cl; c++ ) {
|
1262 |
+
frmFrontForm.renderRecaptcha( captchas[c]);
|
1263 |
}
|
1264 |
}
|
1265 |
|
1266 |
+
function frmAfterRecaptcha( token ) {
|
1267 |
+
frmFrontForm.afterSingleRecaptcha( token );
|
1268 |
}
|
1269 |
|
1270 |
+
function frmUpdateField( entryId, fieldId, value, message, num ) {
|
1271 |
+
jQuery( document.getElementById( 'frm_update_field_' + entryId + '_' + fieldId + '_' + num ) ).html( '<span class="frm-loading-img"></span>' );
|
1272 |
jQuery.ajax({
|
1273 |
+
type: 'POST',
|
1274 |
+
url: frm_js.ajax_url,
|
1275 |
+
data: {
|
1276 |
+
action: 'frm_entries_update_field_ajax',
|
1277 |
+
entry_id: entryId,
|
1278 |
+
field_id: fieldId,
|
1279 |
+
value: value,
|
1280 |
+
nonce: frm_js.nonce
|
1281 |
+
},
|
1282 |
+
success: function() {
|
1283 |
+
if ( message.replace( /^\s+|\s+$/g, '' ) === '' ) {
|
1284 |
+
jQuery( document.getElementById( 'frm_update_field_' + entryId + '_' + fieldId + '_' + num ) ).fadeOut( 'slow' );
|
1285 |
+
} else {
|
1286 |
+
jQuery( document.getElementById( 'frm_update_field_' + entryId + '_' + fieldId + '_' + num ) ).replaceWith( message );
|
1287 |
}
|
1288 |
}
|
1289 |
});
|
1290 |
}
|
1291 |
|
1292 |
+
function frmDeleteEntry( entryId, prefix ) {
|
1293 |
+
console.warn( 'DEPRECATED: function frmDeleteEntry in v2.0.13 use frmFrontForm.deleteEntry' );
|
1294 |
+
jQuery( document.getElementById( 'frm_delete_' + entryId ) ).replaceWith( '<span class="frm-loading-img" id="frm_delete_' + entryId + '"></span>' );
|
1295 |
jQuery.ajax({
|
1296 |
+
type: 'POST',
|
1297 |
+
url: frm_js.ajax_url,
|
1298 |
+
data: {
|
1299 |
+
action: 'frm_entries_destroy',
|
1300 |
+
entry: entryId,
|
1301 |
+
nonce: frm_js.nonce
|
1302 |
+
},
|
1303 |
+
success: function( html ) {
|
1304 |
+
if ( html.replace( /^\s+|\s+$/g, '' ) === 'success' ) {
|
1305 |
+
jQuery( document.getElementById( prefix + entryId ) ).fadeOut( 'slow' );
|
1306 |
+
} else {
|
1307 |
+
jQuery( document.getElementById( 'frm_delete_' + entryId ) ).replaceWith( html );
|
1308 |
+
}
|
1309 |
}
|
1310 |
});
|
1311 |
}
|
1312 |
|
1313 |
+
function frmOnSubmit( e ) {
|
1314 |
+
console.warn( 'DEPRECATED: function frmOnSubmit in v2.0 use frmFrontForm.submitForm' );
|
1315 |
+
frmFrontForm.submitForm( e, this );
|
1316 |
}
|
1317 |
|
1318 |
+
function frm_resend_email( entryId, formId ) { // eslint-disable-line camelcase
|
1319 |
+
var $link = jQuery( document.getElementById( 'frm_resend_email' ) );
|
1320 |
+
console.warn( 'DEPRECATED: function frm_resend_email in v2.0' );
|
1321 |
+
$link.append( '<span class="spinner" style="display:inline"></span>' );
|
1322 |
jQuery.ajax({
|
1323 |
+
type: 'POST',
|
1324 |
+
url: frm_js.ajax_url,
|
1325 |
+
data: {
|
1326 |
+
action: 'frm_entries_send_email',
|
1327 |
+
entry_id: entryId,
|
1328 |
+
form_id: formId,
|
1329 |
+
nonce: frm_js.nonce
|
1330 |
+
},
|
1331 |
+
success: function( msg ) {
|
1332 |
+
$link.replaceWith( msg );
|
1333 |
}
|
1334 |
});
|
1335 |
}
|
js/formidable.min.js
CHANGED
@@ -1,54 +1,56 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
jQuery(
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
object.
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
"");
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
jQuery(object).
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
46 |
if(typeof frmProForm!=="undefined")frmProForm.hideOrShowFields()},hidePreviouslyHiddenFields:function(){console.warn("DEPRECATED: function frmFrontForm.hidePreviouslyHiddenFields in v3.0 use frmProForm.hidePreviouslyHiddenFields");if(typeof frmProForm!=="undefined")frmProForm.hidePreviouslyHiddenFields()},checkDependentDynamicFields:function(ids){console.warn("DEPRECATED: function frmFrontForm.checkDependentDynamicFields in v3.0 use frmProForm.checkDependentDynamicFields");if(typeof frmProForm!==
|
47 |
-
"undefined")frmProForm.checkDependentDynamicFields(ids)},checkDependentLookupFields:function(ids){console.warn("DEPRECATED: function frmFrontForm.checkDependentLookupFields in v3.0 use frmProForm.checkDependentLookupFields");if(typeof frmProForm!=="undefined")frmProForm.checkDependentLookupFields(ids)},loadGoogle:function(){console.warn("DEPRECATED: function frmFrontForm.loadGoogle in v3.0 use frmProForm.loadGoogle");frmProForm.loadGoogle()},
|
48 |
-
|
49 |
-
function
|
50 |
-
function frmUpdateField(
|
51 |
-
|
52 |
-
function frmDeleteEntry(
|
53 |
-
else jQuery(document.getElementById("frm_delete_"+
|
54 |
-
function frm_resend_email(
|
1 |
+
var frmFrontForm;
|
2 |
+
function frmFrontFormJS(){var action="";var jsErrors=[];function maybeShowLabel(){var $field=jQuery(this),$label=$field.closest(".frm_inside_container").find(".frm_primary_label"),val=$field.val();if(val!==null&&val.length>0)$label.addClass("frm_visible");else $label.removeClass("frm_visible")}function getFieldId(field,fullID){var nameParts,fieldId,isRepeating=false,fieldName="";if(field instanceof jQuery)fieldName=field.attr("name");else fieldName=field.name;if(typeof fieldName==="undefined")fieldName=
|
3 |
+
"";if(fieldName===""){if(field instanceof jQuery)fieldName=field.data("name");else fieldName=field.getAttribute("data-name");if(typeof fieldName==="undefined")fieldName="";if(fieldName!==""&&fieldName)return fieldName;return 0}nameParts=fieldName.replace("item_meta[","").replace("[]","").split("]");if(nameParts.length<1)return 0;nameParts=nameParts.filter(function(n){return n!==""});fieldId=nameParts[0];if(nameParts.length===1)return fieldId;if(nameParts[1]==="[form"||nameParts[1]==="[row_ids")return 0;
|
4 |
+
if(jQuery('input[name="item_meta['+fieldId+'][form]"]').length){fieldId=nameParts[2].replace("[","");isRepeating=true}if("other"===fieldId)if(isRepeating)fieldId=nameParts[3].replace("[","");else fieldId=nameParts[1].replace("[","");if(fullID===true)if(fieldId===nameParts[0])fieldId=fieldId+"-"+nameParts[1].replace("[","");else fieldId=fieldId+"-"+nameParts[0]+"-"+nameParts[1].replace("[","");return fieldId}function disableSubmitButton($form){$form.find('input[type="submit"], input[type="button"], button[type="submit"]').attr("disabled",
|
5 |
+
"disabled")}function enableSubmitButton($form){$form.find('input[type="submit"], input[type="button"], button[type="submit"]').removeAttr("disabled")}function disableSaveDraft($form){$form.find("a.frm_save_draft").css("pointer-events","none")}function enableSaveDraft($form){$form.find("a.frm_save_draft").css("pointer-events","")}function validateForm(object){var r,rl,n,nl,emailFields,fields,field,value,requiredFields,errors=[];requiredFields=jQuery(object).find(".frm_required_field:visible input, .frm_required_field:visible select, .frm_required_field:visible textarea").filter(":not(.frm_optional)");
|
6 |
+
if(requiredFields.length)for(r=0,rl=requiredFields.length;r<rl;r++)errors=checkRequiredField(requiredFields[r],errors);emailFields=jQuery(object).find("input[type=email]").filter(":visible");fields=jQuery(object).find("input,select,textarea");if(fields.length)for(n=0,nl=fields.length;n<nl;n++){field=fields[n];value=field.value;if(value!=="")if(field.type==="hidden");else if(field.type==="number")errors=checkNumberField(field,errors);else if(field.type==="email")errors=checkEmailField(field,errors,
|
7 |
+
emailFields);else if(field.pattern!==null)errors=checkPatternField(field,errors)}errors=validateRecaptcha(object,errors);return errors}function maybeValidateChange(fieldId,field){if(field.type==="url")maybeAddHttpToUrl(field);if(jQuery(field).closest("form").hasClass("frm_js_validate"))validateField(fieldId,field)}function maybeAddHttpToUrl(field){var url=field.value;var matches=url.match(/^(https?|ftps?|mailto|news|feed|telnet):/);if(field.value!==""&&matches===null)field.value="http://"+url}function validateField(fieldId,
|
8 |
+
field){var key,emailFields,errors=[];var $fieldCont=jQuery(field).closest(".frm_form_field");if($fieldCont.hasClass("frm_required_field")&&!jQuery(field).hasClass("frm_optional"))errors=checkRequiredField(field,errors);if(errors.length<1)if(field.type==="email"){emailFields=jQuery(field).closest("form").find("input[type=email]");errors=checkEmailField(field,errors,emailFields)}else if(field.type==="number")errors=checkNumberField(field,errors);else if(field.pattern!==null)errors=checkPatternField(field,
|
9 |
+
errors);removeFieldError($fieldCont);if(Object.keys(errors).length>0)for(key in errors)addFieldError($fieldCont,key,errors)}function checkRequiredField(field,errors){var checkGroup,fieldClasses,tempVal,i,placeholder,val="",fieldID="",fileID=field.getAttribute("data-frmfile");if(field.type==="hidden"&&fileID===null)return errors;if(field.type==="checkbox"||field.type==="radio"){checkGroup=jQuery('input[name="'+field.name+'"]').closest(".frm_required_field").find("input:checked");jQuery(checkGroup).each(function(){val=
|
10 |
+
this.value})}else if(field.type==="file"||fileID){if(typeof fileID==="undefined"){fileID=getFieldId(field,true);fileID=fileID.replace("file","")}if(typeof errors[fileID]==="undefined")val=getFileVals(fileID);fieldID=fileID}else{fieldClasses=field.className;if(fieldClasses.indexOf("frm_pos_none")!==-1)return errors;val=jQuery(field).val();if(val===null)val="";else if(typeof val!=="string"){tempVal=val;val="";for(i=0;i<tempVal.length;i++)if(tempVal[i]!=="")val=tempVal[i]}if(fieldClasses.indexOf("frm_other_input")===
|
11 |
+
-1)fieldID=getFieldId(field,true);else fieldID=getFieldId(field,false);if(fieldClasses.indexOf("frm_time_select")!==-1)fieldID=fieldID.replace("-H","").replace("-m","");placeholder=field.getAttribute("data-frmplaceholder");if(placeholder!==null&&val===placeholder)val=""}if(val===""){if(fieldID==="")fieldID=getFieldId(field,true);if(!(fieldID in errors))errors[fieldID]=getFieldValidationMessage(field,"data-reqmsg")}return errors}function getFileVals(fileID){var val="",fileFields=jQuery('input[name="file'+
|
12 |
+
fileID+'"], input[name="file'+fileID+'[]"], input[name^="item_meta['+fileID+']"]');fileFields.each(function(){if(val==="")val=this.value});return val}function checkEmailField(field,errors,emailFields){var isConf,re,invalidMsg,confName,match,emailAddress=field.value,fieldID=getFieldId(field,true);if(fieldID in errors)return errors;isConf=fieldID.indexOf("conf_")===0;if(emailAddress!==""||isConf){re=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i;
|
13 |
+
invalidMsg=getFieldValidationMessage(field,"data-invmsg");if(emailAddress!==""&&re.test(emailAddress)===false){errors[fieldID]=invalidMsg;if(isConf)errors[fieldID.replace("conf_","")]=""}else if(isConf){confName=field.name.replace("conf_","");match=emailFields.filter('[name="'+confName+'"]').val();if(match!==emailAddress){errors[fieldID]="";errors[fieldID.replace("conf_","")]=""}}}return errors}function checkNumberField(field,errors){var fieldID,number=field.value;if(number!==""&&isNaN(number/1)!==
|
14 |
+
false){fieldID=getFieldId(field,true);if(!(fieldID in errors))errors[fieldID]=getFieldValidationMessage(field,"data-invmsg")}return errors}function checkPatternField(field,errors){var fieldID,text=field.value,format=getFieldValidationMessage(field,"pattern");if(format!==""&&text!==""){fieldID=getFieldId(field,true);if(!(fieldID in errors)){format=new RegExp("^"+format+"$","i");if(format.test(text)===false)errors[fieldID]=getFieldValidationMessage(field,"data-invmsg")}}return errors}function hasInvisibleRecaptcha(object){var recaptcha,
|
15 |
+
recaptchaID,alreadyChecked;if(isGoingToPrevPage(object))return false;recaptcha=jQuery(object).find('.frm-g-recaptcha[data-size="invisible"], .g-recaptcha[data-size="invisible"]');if(recaptcha.length){recaptchaID=recaptcha.data("rid");alreadyChecked=grecaptcha.getResponse(recaptchaID);if(alreadyChecked.length===0)return recaptcha;else return false}else return false}function executeInvisibleRecaptcha(invisibleRecaptcha){var recaptchaID=invisibleRecaptcha.data("rid");grecaptcha.reset(recaptchaID);grecaptcha.execute(recaptchaID)}
|
16 |
+
function validateRecaptcha(form,errors){var recaptchaID,response,fieldContainer,fieldID,$recaptcha=jQuery(form).find(".frm-g-recaptcha");if($recaptcha.length){recaptchaID=$recaptcha.data("rid");response=grecaptcha.getResponse(recaptchaID);if(response.length===0){fieldContainer=$recaptcha.closest(".frm_form_field");fieldID=fieldContainer.attr("id").replace("frm_field_","").replace("_container","");errors[fieldID]=""}}return errors}function getFieldValidationMessage(field,messageType){var msg=field.getAttribute(messageType);
|
17 |
+
if(msg===null)msg="";return msg}function shouldJSValidate(object){var validate=jQuery(object).hasClass("frm_js_validate");if(validate&&typeof frmProForm!=="undefined"&&(frmProForm.savingDraft(object)||frmProForm.goingToPreviousPage(object)))validate=false;return validate}function getFormErrors(object,action){var fieldset;if(typeof action==="undefined")jQuery(object).find('input[name="frm_action"]').val();fieldset=jQuery(object).find(".frm_form_field");fieldset.addClass("frm_doing_ajax");jQuery.ajax({type:"POST",
|
18 |
+
url:frm_js.ajax_url,data:jQuery(object).serialize()+"&action=frm_entries_"+action+"&nonce="+frm_js.nonce,success:function(response){var formID,replaceContent,pageOrder,formReturned,contSubmit,showCaptcha,$fieldCont,key,inCollapsedSection,frmTrigger,$recaptcha,recaptchaID,defaultResponse={"content":"","errors":{},"pass":false};if(response===null)response=defaultResponse;response=response.replace(/^\s+|\s+$/g,"");if(response.indexOf("{")===0)response=jQuery.parseJSON(response);else response=defaultResponse;
|
19 |
+
if(typeof response.redirect!=="undefined"){jQuery(document).trigger("frmBeforeFormRedirect",[object,response]);window.location=response.redirect}else if(response.content!==""){removeSubmitLoading(jQuery(object));if(frm_js.offset!=-1)frmFrontForm.scrollMsg(jQuery(object),false);formID=jQuery(object).find('input[name="form_id"]').val();response.content=response.content.replace(/ frm_pro_form /g," frm_pro_form frm_no_hide ");replaceContent=jQuery(object).closest(".frm_forms");removeAddedScripts(replaceContent,
|
20 |
+
formID);replaceContent.replaceWith(response.content);addUrlParam(response);if(typeof frmThemeOverride_frmAfterSubmit==="function"){pageOrder=jQuery('input[name="frm_page_order_'+formID+'"]').val();formReturned=jQuery(response.content).find('input[name="form_id"]').val();frmThemeOverride_frmAfterSubmit(formReturned,pageOrder,response.content,object)}afterFormSubmitted(object,response)}else if(Object.keys(response.errors).length){removeSubmitLoading(jQuery(object),"enable");contSubmit=true;removeAllErrors();
|
21 |
+
showCaptcha=false;$fieldCont=null;for(key in response.errors){$fieldCont=jQuery(object).find("#frm_field_"+key+"_container");if($fieldCont.length){if(!$fieldCont.is(":visible")){inCollapsedSection=$fieldCont.closest(".frm_toggle_container");if(inCollapsedSection.length){frmTrigger=inCollapsedSection.prev();if(!frmTrigger.hasClass("frm_trigger"))frmTrigger=frmTrigger.prev(".frm_trigger");frmTrigger.click()}}if($fieldCont.is(":visible")){addFieldError($fieldCont,key,response.errors);contSubmit=false;
|
22 |
+
$recaptcha=jQuery(object).find("#frm_field_"+key+"_container .frm-g-recaptcha, #frm_field_"+key+"_container .g-recaptcha");if($recaptcha.length){showCaptcha=true;recaptchaID=$recaptcha.data("rid");if(jQuery().grecaptcha)if(recaptchaID)grecaptcha.reset(recaptchaID);else grecaptcha.reset()}}}}jQuery(document).trigger("frmFormErrors",[object,response]);fieldset.removeClass("frm_doing_ajax");scrollToFirstField(object);if(showCaptcha!==true)replaceCheckedRecaptcha(object,false);if(contSubmit)object.submit();
|
23 |
+
else jQuery(object).prepend(response.error_message)}else{showFileLoading(object);replaceCheckedRecaptcha(object,true);object.submit()}},error:function(){jQuery(object).find('input[type="submit"], input[type="button"]').removeAttr("disabled");object.submit()}})}function afterFormSubmitted(object,response){var formCompleted=jQuery(response.content).find(".frm_message");if(formCompleted.length)jQuery(document).trigger("frmFormComplete",[object,response]);else jQuery(document).trigger("frmPageChanged",
|
24 |
+
[object,response])}function removeAddedScripts(formContainer,formID){var endReplace=jQuery(".frm_end_ajax_"+formID);if(endReplace.length){formContainer.nextUntil(".frm_end_ajax_"+formID).remove();endReplace.remove()}}function addUrlParam(response){var url;if(history.pushState&&typeof response.page!=="undefined"){url=addQueryVar("frm_page",response.page);window.history.pushState({"html":response.html},"","?"+url)}}function addQueryVar(key,value){var kvp,i,x;key=encodeURI(key);value=encodeURI(value);
|
25 |
+
kvp=document.location.search.substr(1).split("&");i=kvp.length;while(i--){x=kvp[i].split("=");if(x[0]==key){x[1]=value;kvp[i]=x.join("=");break}}if(i<0)kvp[kvp.length]=[key,value].join("=");return kvp.join("&")}function addFieldError($fieldCont,key,jsErrors){var input,id,describedBy;if($fieldCont.length&&$fieldCont.is(":visible")){$fieldCont.addClass("frm_blank_field");input=$fieldCont.find("input, select, textarea");id="frm_error_field_"+key;describedBy=input.attr("aria-describedby");if(typeof frmThemeOverride_frmPlaceError===
|
26 |
+
"function")frmThemeOverride_frmPlaceError(key,jsErrors);else{$fieldCont.append('<div class="frm_error" id="'+id+'">'+jsErrors[key]+"</div>");if(typeof describedBy==="undefined")describedBy=id;else if(describedBy.indexOf(id)===-1)describedBy=describedBy+" "+id;input.attr("aria-describedby",describedBy)}input.attr("aria-invalid",true);jQuery(document).trigger("frmAddFieldError",[$fieldCont,key,jsErrors])}}function removeFieldError($fieldCont){var errorMessage=$fieldCont.find(".frm_error"),errorId=errorMessage.attr("id"),
|
27 |
+
input=$fieldCont.find("input, select, textarea"),describedBy=input.attr("aria-describedby");$fieldCont.removeClass("frm_blank_field has-error");errorMessage.remove();input.attr("aria-invalid",false);if(typeof describedBy!=="undefined"){describedBy=describedBy.replace(errorId,"");input.attr("aria-describedby",describedBy)}}function removeAllErrors(){jQuery(".form-field").removeClass("frm_blank_field has-error");jQuery(".form-field .frm_error").replaceWith("");jQuery(".frm_error_style").remove()}function scrollToFirstField(object){var field=
|
28 |
+
jQuery(object).find(".frm_blank_field:first");if(field.length)frmFrontForm.scrollMsg(field,object,true)}function showSubmitLoading($object){showLoadingIndicator($object);disableSubmitButton($object);disableSaveDraft($object)}function showLoadingIndicator($object){if(!$object.hasClass("frm_loading_form")&&!$object.hasClass("frm_loading_prev")){addLoadingClass($object);$object.trigger("frmStartFormLoading")}}function addLoadingClass($object){var loadingClass=isGoingToPrevPage($object)?"frm_loading_prev":
|
29 |
+
"frm_loading_form";$object.addClass(loadingClass)}function isGoingToPrevPage($object){return typeof frmProForm!=="undefined"&&frmProForm.goingToPreviousPage($object)}function removeSubmitLoading($object,enable,processesRunning){var loadingForm;if(processesRunning>0)return;loadingForm=jQuery(".frm_loading_form");loadingForm.removeClass("frm_loading_form");loadingForm.removeClass("frm_loading_prev");loadingForm.trigger("frmEndFormLoading");if(enable==="enable"){enableSubmitButton(loadingForm);enableSaveDraft(loadingForm)}}
|
30 |
+
function showFileLoading(object){var fileval,loading=document.getElementById("frm_loading");if(loading!==null){fileval=jQuery(object).find("input[type=file]").val();if(typeof fileval!=="undefined"&&fileval!=="")setTimeout(function(){jQuery(loading).fadeIn("slow")},2E3)}}function replaceCheckedRecaptcha(object,checkPage){var morePages,$recapField=jQuery(object).find(".frm-g-recaptcha, .g-recaptcha");if($recapField.length){if(checkPage){morePages=jQuery(object).find(".frm_next_page").length<1||jQuery(object).find(".frm_next_page").val()<
|
31 |
+
1;if(!morePages)return}$recapField.closest(".frm_form_field").replaceWith('<input type="hidden" name="recaptcha_checked" value="'+frm_js.nonce+'">')}}function clearDefault(){toggleDefault(jQuery(this),"clear")}function replaceDefault(){toggleDefault(jQuery(this),"replace")}function toggleDefault($thisField,e){var thisVal,v=$thisField.data("frmval").replace(/(\n|\r\n)/g,"\r");if(v===""||typeof v==="undefined")return false;thisVal=$thisField.val().replace(/(\n|\r\n)/g,"\r");if("replace"===e){if(thisVal===
|
32 |
+
"")$thisField.addClass("frm_default").val(v)}else if(thisVal==v)$thisField.removeClass("frm_default").val("")}function resendEmail(){var $link=jQuery(this),entryId=this.getAttribute("data-eid"),formId=this.getAttribute("data-fid"),label=$link.find(".frm_link_label");if(label.length<1)label=$link;label.append('<span class="frm-wait"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_send_email",entry_id:entryId,form_id:formId,nonce:frm_js.nonce},success:function(msg){var admin=
|
33 |
+
document.getElementById("wpbody");if(admin===null)label.html(msg);else{label.html("");$link.after(msg)}}});return false}function confirmClick(){var message=jQuery(this).data("frmconfirm");return confirm(message)}function toggleDiv(){var div=jQuery(this).data("frmtoggle");if(jQuery(div).is(":visible"))jQuery(div).slideUp("fast");else jQuery(div).slideDown("fast");return false}function addIndexOfFallbackForIE8(){var len,from;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(elt){len=this.length>>>
|
34 |
+
0;from=Number(arguments[1])||0;from=from<0?Math.ceil(from):Math.floor(from);if(from<0)from+=len;for(;from<len;from++)if(from in this&&this[from]===elt)return from;return-1}}function addTrimFallbackForIE8(){if(typeof String.prototype.trim!=="function")String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}}function addFilterFallbackForIE8(){var t,len,res,thisp,i,val;if(!Array.prototype.filter)Array.prototype.filter=function(fun){if(this===void 0||this===null)throw new TypeError;t=Object(this);
|
35 |
+
len=t.length>>>0;if(typeof fun!=="function")throw new TypeError;res=[];thisp=arguments[1];for(i=0;i<len;i++)if(i in t){val=t[i];if(fun.call(thisp,val,i,t))res.push(val)}return res}}function addKeysFallbackForIE8(){var keys,i;if(!Object.keys)Object.keys=function(obj){keys=[];for(i in obj)if(obj.hasOwnProperty(i))keys.push(i);return keys}}return{init:function(){jQuery(document).off("submit.formidable",".frm-show-form");jQuery(document).on("submit.formidable",".frm-show-form",frmFrontForm.submitForm);
|
36 |
+
jQuery(".frm-show-form input[onblur], .frm-show-form textarea[onblur]").each(function(){if(jQuery(this).val()==="")jQuery(this).blur()});jQuery(document).on("focus",".frm_toggle_default",clearDefault);jQuery(document).on("blur",".frm_toggle_default",replaceDefault);jQuery(".frm_toggle_default").blur();jQuery(document.getElementById("frm_resend_email")).click(resendEmail);jQuery(document).on("change",'.frm-show-form input[name^="item_meta"], .frm-show-form select[name^="item_meta"], .frm-show-form textarea[name^="item_meta"]',
|
37 |
+
frmFrontForm.fieldValueChanged);jQuery(document).on("change keyup",".frm-show-form .frm_inside_container input, .frm-show-form .frm_inside_container select, .frm-show-form .frm_inside_container textarea",maybeShowLabel);jQuery(document).on("click","a[data-frmconfirm]",confirmClick);jQuery("a[data-frmtoggle]").click(toggleDiv);addIndexOfFallbackForIE8();addTrimFallbackForIE8();addFilterFallbackForIE8();addKeysFallbackForIE8()},getFieldId:function(field,fullID){return getFieldId(field,fullID)},renderRecaptcha:function(captcha){var formID,
|
38 |
+
recaptchaID,size=captcha.getAttribute("data-size"),rendered=captcha.getAttribute("data-rid")!==null,params={"sitekey":captcha.getAttribute("data-sitekey"),"size":size,"theme":captcha.getAttribute("data-theme")};if(rendered)return;if(size==="invisible"){formID=jQuery(captcha).closest("form").find('input[name="form_id"]').val();jQuery(captcha).closest(".frm_form_field .frm_primary_label").hide();params.callback=function(token){frmFrontForm.afterRecaptcha(token,formID)}}recaptchaID=grecaptcha.render(captcha.id,
|
39 |
+
params);captcha.setAttribute("data-rid",recaptchaID)},afterSingleRecaptcha:function(){var object=jQuery(".frm-show-form .g-recaptcha").closest("form")[0];frmFrontForm.submitFormNow(object)},afterRecaptcha:function(token,formID){var object=jQuery("#frm_form_"+formID+"_container form")[0];frmFrontForm.submitFormNow(object)},submitForm:function(e){frmFrontForm.submitFormManual(e,this)},submitFormManual:function(e,object){var isPro,errors,invisibleRecaptcha=hasInvisibleRecaptcha(object),classList=object.className.trim().split(/\s+/gi);
|
40 |
+
if(classList&&invisibleRecaptcha.length<1){isPro=classList.indexOf("frm_pro_form")>-1;if(!isPro)return}if(jQuery("body").hasClass("wp-admin")&&jQuery(object).closest(".frmapi-form").length<1)return;e.preventDefault();if(typeof frmProForm!=="undefined"&&typeof frmProForm.submitAllowed==="function")if(!frmProForm.submitAllowed(object))return;if(invisibleRecaptcha.length){showLoadingIndicator(jQuery(object));executeInvisibleRecaptcha(invisibleRecaptcha)}else{errors=frmFrontForm.validateFormSubmit(object);
|
41 |
+
if(Object.keys(errors).length===0){showSubmitLoading(jQuery(object));frmFrontForm.submitFormNow(object,classList)}}},submitFormNow:function(object){var hasFileFields,classList=object.className.trim().split(/\s+/gi);if(classList.indexOf("frm_ajax_submit")>-1){hasFileFields=jQuery(object).find('input[type="file"]').filter(function(){return!!this.value}).length;if(hasFileFields<1){action=jQuery(object).find('input[name="frm_action"]').val();frmFrontForm.checkFormErrors(object,action)}else object.submit()}else object.submit()},
|
42 |
+
validateFormSubmit:function(object){if(typeof tinyMCE!=="undefined"&&jQuery(object).find(".wp-editor-wrap").length)tinyMCE.triggerSave();jsErrors=[];if(shouldJSValidate(object)){frmFrontForm.getAjaxFormErrors(object);if(Object.keys(jsErrors).length)frmFrontForm.addAjaxFormErrors(object)}return jsErrors},getAjaxFormErrors:function(object){var customErrors,key;jsErrors=validateForm(object);if(typeof frmThemeOverride_jsErrors==="function"){action=jQuery(object).find('input[name="frm_action"]').val();
|
43 |
+
customErrors=frmThemeOverride_jsErrors(action,object);if(Object.keys(customErrors).length)for(key in customErrors)jsErrors[key]=customErrors[key]}return jsErrors},addAjaxFormErrors:function(object){var key,$fieldCont;removeAllErrors();for(key in jsErrors){$fieldCont=jQuery(object).find("#frm_field_"+key+"_container");if($fieldCont.length)addFieldError($fieldCont,key,jsErrors);else delete jsErrors[key]}scrollToFirstField(object)},checkFormErrors:function(object,action){getFormErrors(object,action)},
|
44 |
+
checkRequiredField:function(field,errors){return checkRequiredField(field,errors)},showSubmitLoading:function($object){showSubmitLoading($object)},removeSubmitLoading:function($object,enable,processesRunning){removeSubmitLoading($object,enable,processesRunning)},scrollToID:function(id){var object=jQuery(document.getElementById(id));frmFrontForm.scrollMsg(object,false)},scrollMsg:function(id,object,animate){var newPos,m,b,screenTop,screenBottom,scrollObj="";if(typeof object==="undefined"){scrollObj=
|
45 |
+
jQuery(document.getElementById("frm_form_"+id+"_container"));if(scrollObj.length<1)return}else if(typeof id==="string")scrollObj=jQuery(object).find("#frm_field_"+id+"_container");else scrollObj=id;newPos=scrollObj.offset().top;if(!newPos||frm_js.offset==="-1")return;newPos=newPos-frm_js.offset;m=jQuery("html").css("margin-top");b=jQuery("body").css("margin-top");if(m||b)newPos=newPos-parseInt(m)-parseInt(b);if(newPos&&window.innerHeight){screenTop=document.documentElement.scrollTop||document.body.scrollTop;
|
46 |
+
screenBottom=screenTop+window.innerHeight;if(newPos>screenBottom||newPos<screenTop){if(typeof animate==="undefined")jQuery(window).scrollTop(newPos);else jQuery("html,body").animate({scrollTop:newPos},500);return false}}},fieldValueChanged:function(e){var fieldId=frmFrontForm.getFieldId(this,false);if(!fieldId||typeof fieldId==="undefined")return;if(e.frmTriggered&&e.frmTriggered==fieldId)return;jQuery(document).trigger("frmFieldChanged",[this,fieldId,e]);if(e.selfTriggered!==true)maybeValidateChange(fieldId,
|
47 |
+
this)},savingDraft:function(object){console.warn("DEPRECATED: function frmFrontForm.savingDraft in v3.0 use frmProForm.savingDraft");if(typeof frmProForm!=="undefined")return frmProForm.savingDraft(object)},goingToPreviousPage:function(object){console.warn("DEPRECATED: function frmFrontForm.goingToPreviousPage in v3.0 use frmProForm.goingToPreviousPage");if(typeof frmProForm!=="undefined")return frmProForm.goingToPreviousPage(object)},hideOrShowFields:function(){console.warn("DEPRECATED: function frmFrontForm.hideOrShowFields in v3.0 use frmProForm.hideOrShowFields");
|
48 |
if(typeof frmProForm!=="undefined")frmProForm.hideOrShowFields()},hidePreviouslyHiddenFields:function(){console.warn("DEPRECATED: function frmFrontForm.hidePreviouslyHiddenFields in v3.0 use frmProForm.hidePreviouslyHiddenFields");if(typeof frmProForm!=="undefined")frmProForm.hidePreviouslyHiddenFields()},checkDependentDynamicFields:function(ids){console.warn("DEPRECATED: function frmFrontForm.checkDependentDynamicFields in v3.0 use frmProForm.checkDependentDynamicFields");if(typeof frmProForm!==
|
49 |
+
"undefined")frmProForm.checkDependentDynamicFields(ids)},checkDependentLookupFields:function(ids){console.warn("DEPRECATED: function frmFrontForm.checkDependentLookupFields in v3.0 use frmProForm.checkDependentLookupFields");if(typeof frmProForm!=="undefined")frmProForm.checkDependentLookupFields(ids)},loadGoogle:function(){console.warn("DEPRECATED: function frmFrontForm.loadGoogle in v3.0 use frmProForm.loadGoogle");frmProForm.loadGoogle()},escapeHtml:function(text){return text.replace(/&/g,"&").replace(/</g,
|
50 |
+
"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")},invisible:function(classes){jQuery(classes).css("visibility","hidden")},visible:function(classes){jQuery(classes).css("visibility","visible")}}}frmFrontForm=frmFrontFormJS();jQuery(document).ready(function(){frmFrontForm.init()});function frmRecaptcha(){var c,cl,captchas=jQuery(".frm-g-recaptcha");for(c=0,cl=captchas.length;c<cl;c++)frmFrontForm.renderRecaptcha(captchas[c])}
|
51 |
+
function frmAfterRecaptcha(token){frmFrontForm.afterSingleRecaptcha(token)}
|
52 |
+
function frmUpdateField(entryId,fieldId,value,message,num){jQuery(document.getElementById("frm_update_field_"+entryId+"_"+fieldId+"_"+num)).html('<span class="frm-loading-img"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_update_field_ajax",entry_id:entryId,field_id:fieldId,value:value,nonce:frm_js.nonce},success:function(){if(message.replace(/^\s+|\s+$/g,"")==="")jQuery(document.getElementById("frm_update_field_"+entryId+"_"+fieldId+"_"+num)).fadeOut("slow");else jQuery(document.getElementById("frm_update_field_"+
|
53 |
+
entryId+"_"+fieldId+"_"+num)).replaceWith(message)}})}
|
54 |
+
function frmDeleteEntry(entryId,prefix){console.warn("DEPRECATED: function frmDeleteEntry in v2.0.13 use frmFrontForm.deleteEntry");jQuery(document.getElementById("frm_delete_"+entryId)).replaceWith('<span class="frm-loading-img" id="frm_delete_'+entryId+'"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_destroy",entry:entryId,nonce:frm_js.nonce},success:function(html){if(html.replace(/^\s+|\s+$/g,"")==="success")jQuery(document.getElementById(prefix+entryId)).fadeOut("slow");
|
55 |
+
else jQuery(document.getElementById("frm_delete_"+entryId)).replaceWith(html)}})}function frmOnSubmit(e){console.warn("DEPRECATED: function frmOnSubmit in v2.0 use frmFrontForm.submitForm");frmFrontForm.submitForm(e,this)}
|
56 |
+
function frm_resend_email(entryId,formId){var $link=jQuery(document.getElementById("frm_resend_email"));console.warn("DEPRECATED: function frm_resend_email in v2.0");$link.append('<span class="spinner" style="display:inline"></span>');jQuery.ajax({type:"POST",url:frm_js.ajax_url,data:{action:"frm_entries_send_email",entry_id:entryId,form_id:formId,nonce:frm_js.nonce},success:function(msg){$link.replaceWith(msg)}})};
|
js/formidable_admin.js
CHANGED
@@ -1,3 +1,7 @@
|
|
|
|
|
|
|
|
|
|
1 |
var FrmFormsConnect = window.FrmFormsConnect || ( function( document, window, $ ) {
|
2 |
|
3 |
/*global jQuery:false, frm_admin_js, frmGlobal, ajaxurl */
|
@@ -5,7 +9,7 @@ var FrmFormsConnect = window.FrmFormsConnect || ( function( document, window, $
|
|
5 |
var el = {
|
6 |
licenseBox: document.getElementById( 'frm_license_top' ),
|
7 |
messageBox: document.getElementsByClassName( 'frm_pro_license_msg' )[0],
|
8 |
-
btn: document.getElementById('frm-settings-connect-btn'),
|
9 |
reset: document.getElementById( 'frm_reconnect_link' )
|
10 |
};
|
11 |
|
@@ -30,22 +34,22 @@ var FrmFormsConnect = window.FrmFormsConnect || ( function( document, window, $
|
|
30 |
$( el.reset ).click( app.reauthorize );
|
31 |
}
|
32 |
|
33 |
-
$( el.btn ).on( 'click', function(e) {
|
34 |
e.preventDefault();
|
35 |
app.gotoUpgradeUrl();
|
36 |
-
}
|
37 |
|
38 |
-
window.addEventListener('message', function(msg) {
|
39 |
-
if ( msg.origin.replace(/\/$/, '') !== frmGlobal.app_url.replace(/\/$/, '') ) {
|
40 |
return;
|
41 |
}
|
42 |
|
43 |
if ( ! msg.data || 'object' !== typeof msg.data ) {
|
44 |
-
console.error('Messages from "' + frmGlobal.app_url + '" must contain an api key string.');
|
45 |
return;
|
46 |
}
|
47 |
|
48 |
-
app.updateForm(msg.data);
|
49 |
});
|
50 |
},
|
51 |
|
@@ -55,28 +59,28 @@ var FrmFormsConnect = window.FrmFormsConnect || ( function( document, window, $
|
|
55 |
* @since 4.03
|
56 |
*/
|
57 |
gotoUpgradeUrl: function() {
|
58 |
-
var w = window.open(frmGlobal.app_url + '/api-connect/', '_blank', 'location=no,width=500,height=730,scrollbars=0');
|
59 |
w.focus();
|
60 |
},
|
61 |
|
62 |
-
updateForm: function(response) {
|
63 |
|
64 |
// Start spinner.
|
65 |
var btn = el.btn;
|
66 |
-
btn.classList.add('frm_loading_button');
|
67 |
|
68 |
if ( response.url !== '' ) {
|
69 |
app.showProgress({
|
70 |
-
success:true,
|
71 |
-
message:'Installing...'
|
72 |
});
|
73 |
var fallback = setTimeout( function() {
|
74 |
app.showProgress({
|
75 |
-
success:true,
|
76 |
-
message:'Installing is taking longer than expected. <a class="frm-install-addon button button-primary frm-button-primary" rel="' + response.url + '" aria-label="Install">Install Now</a>'
|
77 |
});
|
78 |
}, 10000 );
|
79 |
-
$.ajax(
|
80 |
type: 'POST',
|
81 |
url: ajaxurl,
|
82 |
dataType: 'json',
|
@@ -89,11 +93,11 @@ var FrmFormsConnect = window.FrmFormsConnect || ( function( document, window, $
|
|
89 |
clearTimeout( fallback );
|
90 |
app.activateKey( response );
|
91 |
},
|
92 |
-
error: function(xhr, textStatus, e) {
|
93 |
clearTimeout( fallback );
|
94 |
-
btn.classList.remove('frm_loading_button');
|
95 |
app.showMessage({
|
96 |
-
success:false,
|
97 |
message: e
|
98 |
});
|
99 |
}
|
@@ -106,13 +110,13 @@ var FrmFormsConnect = window.FrmFormsConnect || ( function( document, window, $
|
|
106 |
activateKey: function( response ) {
|
107 |
var btn = el.btn;
|
108 |
if ( response.key === '' ) {
|
109 |
-
btn.classList.remove('frm_loading_button');
|
110 |
} else {
|
111 |
app.showProgress({
|
112 |
-
success:true,
|
113 |
-
message:'Activating...'
|
114 |
});
|
115 |
-
$.ajax(
|
116 |
type: 'POST',
|
117 |
url: ajaxurl,
|
118 |
dataType: 'json',
|
@@ -124,7 +128,7 @@ var FrmFormsConnect = window.FrmFormsConnect || ( function( document, window, $
|
|
124 |
nonce: frmGlobal.nonce
|
125 |
},
|
126 |
success: function( msg ) {
|
127 |
-
btn.classList.remove('frm_loading_button');
|
128 |
|
129 |
if ( msg.success === true ) {
|
130 |
el.licenseBox.classList.replace( 'frm_unauthorized_box', 'frm_authorized_box' );
|
@@ -132,10 +136,10 @@ var FrmFormsConnect = window.FrmFormsConnect || ( function( document, window, $
|
|
132 |
|
133 |
app.showMessage( msg );
|
134 |
},
|
135 |
-
error: function(xhr, textStatus, e) {
|
136 |
-
btn.classList.remove('frm_loading_button');
|
137 |
app.showMessage({
|
138 |
-
success:false,
|
139 |
message: e
|
140 |
});
|
141 |
}
|
@@ -147,7 +151,7 @@ var FrmFormsConnect = window.FrmFormsConnect || ( function( document, window, $
|
|
147 |
authorize: function() {
|
148 |
/*jshint validthis:true */
|
149 |
var button = this;
|
150 |
-
var pluginSlug = this.getAttribute('data-plugin');
|
151 |
var input = document.getElementById( 'edd_' + pluginSlug + '_license_key' );
|
152 |
var license = input.value;
|
153 |
var wpmu = document.getElementById( 'proplug-wpmu' );
|
@@ -160,7 +164,7 @@ var FrmFormsConnect = window.FrmFormsConnect || ( function( document, window, $
|
|
160 |
wpmu = 0;
|
161 |
}
|
162 |
|
163 |
-
$.ajax(
|
164 |
type: 'POST', url: ajaxurl, dataType: 'json',
|
165 |
data: {
|
166 |
action: 'frm_addon_activate',
|
@@ -173,7 +177,7 @@ var FrmFormsConnect = window.FrmFormsConnect || ( function( document, window, $
|
|
173 |
app.afterAuthorize( msg, input );
|
174 |
button.classList.remove( 'frm_loading_button' );
|
175 |
}
|
176 |
-
}
|
177 |
},
|
178 |
|
179 |
afterAuthorize: function( msg, input ) {
|
@@ -226,7 +230,7 @@ var FrmFormsConnect = window.FrmFormsConnect || ( function( document, window, $
|
|
226 |
/*jshint validthis:true */
|
227 |
this.innerHTML = '<span class="frm-wait frm_spinner" style="visibility:visible;float:none"></span>';
|
228 |
|
229 |
-
$.ajax(
|
230 |
type: 'POST',
|
231 |
url: ajaxurl,
|
232 |
dataType: 'json',
|
@@ -241,23 +245,23 @@ var FrmFormsConnect = window.FrmFormsConnect || ( function( document, window, $
|
|
241 |
window.location.reload();
|
242 |
}
|
243 |
}
|
244 |
-
}
|
245 |
return false;
|
246 |
},
|
247 |
|
248 |
deauthorize: function() {
|
249 |
/*jshint validthis:true */
|
250 |
-
if ( !confirm( frmGlobal.deauthorize ) ) {
|
251 |
return false;
|
252 |
}
|
253 |
-
var pluginSlug = this.getAttribute('data-plugin'),
|
254 |
input = document.getElementById( 'edd_' + pluginSlug + '_license_key' ),
|
255 |
license = input.value,
|
256 |
link = this;
|
257 |
|
258 |
this.innerHTML = '<span class="frm-wait frm_spinner" style="visibility:visible;"></span>';
|
259 |
|
260 |
-
$.ajax(
|
261 |
type: 'POST',
|
262 |
url: ajaxurl,
|
263 |
data: {
|
@@ -266,12 +270,12 @@ var FrmFormsConnect = window.FrmFormsConnect || ( function( document, window, $
|
|
266 |
plugin: pluginSlug,
|
267 |
nonce: frmGlobal.nonce
|
268 |
},
|
269 |
-
success: function(
|
270 |
el.licenseBox.className = el.licenseBox.className.replace( 'frm_authorized_box', 'frm_unauthorized_box' );
|
271 |
input.value = '';
|
272 |
link.innerHTML = '';
|
273 |
}
|
274 |
-
}
|
275 |
return false;
|
276 |
}
|
277 |
};
|
@@ -292,9 +296,9 @@ function frmAdminBuildJS() {
|
|
292 |
var cancelSort = false;
|
293 |
var copyHelper = false;
|
294 |
|
295 |
-
var
|
296 |
if ( thisForm !== null ) {
|
297 |
-
|
298 |
}
|
299 |
|
300 |
// Global settings
|
@@ -350,10 +354,10 @@ function frmAdminBuildJS() {
|
|
350 |
return false;
|
351 |
}
|
352 |
|
353 |
-
var caution = link.getAttribute('data-frmcaution');
|
354 |
var cautionHtml = caution ? '<span class="frm-caution">' + caution + '</span> ' : '';
|
355 |
|
356 |
-
jQuery('.frm-confirm-msg').html( cautionHtml + link.getAttribute( 'data-frmverify' ) );
|
357 |
|
358 |
removeAtts = continueButton.dataset;
|
359 |
for ( i in dataAtts ) {
|
@@ -363,11 +367,11 @@ function frmAdminBuildJS() {
|
|
363 |
dataAtts = link.dataset;
|
364 |
for ( i in dataAtts ) {
|
365 |
if ( i !== 'frmverify' ) {
|
366 |
-
continueButton.setAttribute( 'data-' + i, dataAtts[
|
367 |
}
|
368 |
}
|
369 |
|
370 |
-
$info.dialog('open');
|
371 |
continueButton.setAttribute( 'href', link.getAttribute( 'href' ) );
|
372 |
return false;
|
373 |
}
|
@@ -497,19 +501,20 @@ function frmAdminBuildJS() {
|
|
497 |
wrapClass.on( 'click', 'a[data-frmhide], a[data-frmshow]', hideShowItem );
|
498 |
wrapClass.on( 'click', '.widget-top,a.widget-action', clickWidget );
|
499 |
|
500 |
-
wrapClass.on( 'mouseenter.frm', '.frm_bstooltip, .frm_help', function
|
501 |
jQuery( this ).off( 'mouseenter.frm' );
|
502 |
|
503 |
jQuery( '.frm_bstooltip, .frm_help' ).tooltip( );
|
504 |
jQuery( this ).tooltip( 'show' );
|
505 |
-
}
|
506 |
|
507 |
jQuery( '.frm_bstooltip, .frm_help' ).tooltip( );
|
508 |
}
|
509 |
|
510 |
function removeThisTag() {
|
511 |
/*jshint validthis:true */
|
512 |
-
var show, hide,
|
|
|
513 |
deleteButton = jQuery( this ),
|
514 |
continueRemove = confirmLinkClick( this );
|
515 |
|
@@ -562,13 +567,13 @@ function frmAdminBuildJS() {
|
|
562 |
var type = jQuery( this ).closest( '.frm_form_action_settings' ).find( '.frm_action_name' ).val();
|
563 |
checkActiveAction( type );
|
564 |
}
|
565 |
-
}
|
566 |
|
567 |
if ( typeof removeMore !== 'undefined' ) {
|
568 |
removeMore = jQuery( removeMore );
|
569 |
removeMore.fadeOut( 400, function() {
|
570 |
removeMore.remove();
|
571 |
-
}
|
572 |
}
|
573 |
|
574 |
if ( show !== '' ) {
|
@@ -597,26 +602,26 @@ function frmAdminBuildJS() {
|
|
597 |
var inside = cont.children( '.widget-inside' );
|
598 |
|
599 |
if ( cont.length && inside.find( 'p, div, table' ).length < 1 ) {
|
600 |
-
var
|
601 |
-
var
|
602 |
-
if (
|
603 |
inside.html( '<span class="frm-wait frm_spinner"></span>' );
|
604 |
cont.find( '.spinner' ).fadeIn( 'slow' );
|
605 |
-
jQuery.ajax(
|
606 |
type: 'POST',
|
607 |
url: ajaxurl,
|
608 |
data: {
|
609 |
action: 'frm_form_action_fill',
|
610 |
-
action_id:
|
611 |
-
action_type:
|
612 |
nonce: frmGlobal.nonce
|
613 |
},
|
614 |
success: function( html ) {
|
615 |
inside.html( html );
|
616 |
initiateMultiselect();
|
617 |
-
showInputIcon( '#' + cont.attr('id') );
|
618 |
}
|
619 |
-
}
|
620 |
}
|
621 |
}
|
622 |
|
@@ -661,7 +666,7 @@ function frmAdminBuildJS() {
|
|
661 |
}
|
662 |
|
663 |
var c = t.replace( '#', '.' );
|
664 |
-
|
665 |
link.closest( 'li' ).addClass( 'frm-tabs active' ).siblings( 'li' ).removeClass( 'frm-tabs active starttab' );
|
666 |
if ( link.closest( 'div' ).find( '.tabs-panel' ).length ) {
|
667 |
link.closest( 'div' ).children( '.tabs-panel' ).not( t ).not( c ).hide();
|
@@ -715,10 +720,10 @@ function frmAdminBuildJS() {
|
|
715 |
forcePlaceholderSize: false,
|
716 |
tolerance: 'pointer',
|
717 |
handle: '.frm-move',
|
718 |
-
over
|
719 |
this.classList.add( 'drop-me' );
|
720 |
},
|
721 |
-
out
|
722 |
this.classList.remove( 'drop-me' );
|
723 |
},
|
724 |
receive: function( event, ui ) {
|
@@ -755,7 +760,7 @@ function frmAdminBuildJS() {
|
|
755 |
}
|
756 |
if ( ui.item[0].classList.contains( 'frm-page-collapsed' ) ) {
|
757 |
// If a page if collapsed, expand it before dragging since only the page break will move.
|
758 |
-
toggleCollapsePage( jQuery( ui.item[0]
|
759 |
}
|
760 |
},
|
761 |
helper: function( e, li ) {
|
@@ -769,7 +774,7 @@ function frmAdminBuildJS() {
|
|
769 |
toggleCollapsePage( jQuery( previous ) );
|
770 |
}
|
771 |
},
|
772 |
-
stop: function(
|
773 |
var moving = jQuery( this );
|
774 |
copyHelper && copyHelper.remove();
|
775 |
if ( cancelSort ) {
|
@@ -797,7 +802,7 @@ function frmAdminBuildJS() {
|
|
797 |
//scrolling up
|
798 |
return v - Math.abs( y * 0.1 );
|
799 |
}
|
800 |
-
}
|
801 |
}
|
802 |
};
|
803 |
|
@@ -839,22 +844,22 @@ function frmAdminBuildJS() {
|
|
839 |
|
840 |
// Get the form ID where a field is dropped
|
841 |
function getFormIdForFieldPlacement( section ) {
|
842 |
-
var
|
843 |
|
844 |
if ( typeof section[0] !== 'undefined' ) {
|
845 |
var sDivide = section.children( '.start_divider' );
|
846 |
sDivide.children( '.edit_field_type_end_divider' ).appendTo( sDivide );
|
847 |
if ( typeof section.attr( 'data-formid' ) !== 'undefined' ) {
|
848 |
var fieldId = section.attr( 'data-fid' );
|
849 |
-
|
850 |
}
|
851 |
}
|
852 |
|
853 |
-
if ( typeof
|
854 |
-
|
855 |
}
|
856 |
|
857 |
-
return
|
858 |
}
|
859 |
|
860 |
// Get the section ID where a field is dropped
|
@@ -878,7 +883,7 @@ function frmAdminBuildJS() {
|
|
878 |
var formId = getFormIdForFieldPlacement( section );
|
879 |
var sectionId = getSectionIdForFieldPlacement( section );
|
880 |
|
881 |
-
jQuery.ajax(
|
882 |
type: 'POST', url: ajaxurl,
|
883 |
data: {
|
884 |
action: 'frm_update_field_after_move',
|
@@ -891,7 +896,7 @@ function frmAdminBuildJS() {
|
|
891 |
toggleSectionHolder();
|
892 |
updateInSectionValue( fieldId, sectionId );
|
893 |
}
|
894 |
-
}
|
895 |
}
|
896 |
|
897 |
// Update the in_section field value
|
@@ -906,7 +911,7 @@ function frmAdminBuildJS() {
|
|
906 |
* @param {object} fieldButton
|
907 |
* @param {object} opts
|
908 |
*/
|
909 |
-
function insertNewFieldByDragging( selectedItem, fieldButton
|
910 |
var fieldType = fieldButton.attr( 'id' );
|
911 |
|
912 |
// We'll optimistically disable the button now. We'll re-enable if AJAX fails
|
@@ -929,7 +934,7 @@ function frmAdminBuildJS() {
|
|
929 |
hasBreak = jQuery( '.frmbutton_loadingnow#' + loadingID ).prevAll( 'li[data-type="break"]:first' ).length > 0 ? 1 : 0;
|
930 |
}
|
931 |
|
932 |
-
jQuery.ajax(
|
933 |
type: 'POST', url: ajaxurl,
|
934 |
data: {
|
935 |
action: 'frm_insert_field',
|
@@ -937,7 +942,7 @@ function frmAdminBuildJS() {
|
|
937 |
field_type: fieldType,
|
938 |
section_id: sectionId,
|
939 |
nonce: frmGlobal.nonce,
|
940 |
-
has_break: hasBreak
|
941 |
},
|
942 |
success: function( msg ) {
|
943 |
document.getElementById( 'frm_form_editor_container' ).classList.add( 'frm-has-fields' );
|
@@ -948,8 +953,8 @@ function frmAdminBuildJS() {
|
|
948 |
},
|
949 |
error: function( jqXHR, textStatus, errorThrown ) {
|
950 |
maybeReenableSummaryBtnAfterAJAX( fieldType, addBtn, fieldButton, errorThrown );
|
951 |
-
}
|
952 |
-
}
|
953 |
}
|
954 |
|
955 |
// don't allow page break, embed form, captcha, summary, or section inside section field
|
@@ -971,24 +976,29 @@ function frmAdminBuildJS() {
|
|
971 |
ui.item.hasClass( 'edit_field_type_divider' ) );
|
972 |
}
|
973 |
|
974 |
-
function loadFields(
|
975 |
-
var $thisField = jQuery( document.getElementById(
|
976 |
var fields;
|
977 |
if ( jQuery.isFunction( jQuery.fn.addBack ) ) {
|
978 |
-
fields = $thisField.nextAll(
|
979 |
} else {
|
980 |
-
fields = $thisField.nextAll(
|
981 |
}
|
982 |
fields.addClass( 'frm_load_now' );
|
983 |
|
984 |
var h = [];
|
985 |
jQuery.each( fields, function( k, v ) {
|
986 |
h.push( jQuery( v ).find( '.frm_hidden_fdata' ).html() );
|
987 |
-
}
|
988 |
|
989 |
-
jQuery.ajax(
|
990 |
type: 'POST', url: ajaxurl,
|
991 |
-
data: {
|
|
|
|
|
|
|
|
|
|
|
992 |
success: function( html ) {
|
993 |
html = html.replace( /^\s+|\s+$/g, '' );
|
994 |
if ( html.indexOf( '{' ) !== 0 ) {
|
@@ -998,7 +1008,7 @@ function frmAdminBuildJS() {
|
|
998 |
html = jQuery.parseJSON( html );
|
999 |
|
1000 |
for ( var key in html ) {
|
1001 |
-
jQuery( '#frm_field_id_' + key ).replaceWith( html[key]
|
1002 |
setupSortable( '#frm_field_id_' + key + '.edit_field_type_divider ul.frm_sorting' );
|
1003 |
}
|
1004 |
|
@@ -1016,8 +1026,8 @@ function frmAdminBuildJS() {
|
|
1016 |
initiateMultiselect();
|
1017 |
renumberPageBreaks();
|
1018 |
maybeHideQuantityProductFieldOption();
|
1019 |
-
}
|
1020 |
-
}
|
1021 |
}
|
1022 |
|
1023 |
function addFieldClick() {
|
@@ -1039,18 +1049,18 @@ function frmAdminBuildJS() {
|
|
1039 |
hasBreak = $newFields.children( 'li[data-type="break"]' ).length > 0 ? 1 : 0;
|
1040 |
}
|
1041 |
|
1042 |
-
var
|
1043 |
|
1044 |
-
jQuery.ajax(
|
1045 |
type: 'POST',
|
1046 |
url: ajaxurl,
|
1047 |
data: {
|
1048 |
action: 'frm_insert_field',
|
1049 |
-
form_id:
|
1050 |
field_type: fieldType,
|
1051 |
section_id: 0,
|
1052 |
nonce: frmGlobal.nonce,
|
1053 |
-
has_break: hasBreak
|
1054 |
},
|
1055 |
success: function( msg ) {
|
1056 |
document.getElementById( 'frm_form_editor_container' ).classList.add( 'frm-has-fields' );
|
@@ -1059,8 +1069,8 @@ function frmAdminBuildJS() {
|
|
1059 |
},
|
1060 |
error: function( jqXHR, textStatus, errorThrown ) {
|
1061 |
maybeReenableSummaryBtnAfterAJAX( fieldType, $thisObj, $button, errorThrown );
|
1062 |
-
}
|
1063 |
-
}
|
1064 |
return false;
|
1065 |
}
|
1066 |
|
@@ -1122,35 +1132,36 @@ function frmAdminBuildJS() {
|
|
1122 |
function duplicateField() {
|
1123 |
/*jshint validthis:true */
|
1124 |
var thisField = jQuery( this ).closest( 'li' );
|
1125 |
-
var
|
1126 |
-
var children = fieldsInSection(
|
1127 |
|
1128 |
if ( thisField.hasClass( 'frm-section-collapsed' ) || thisField.hasClass( 'frm-page-collapsed' ) ) {
|
1129 |
return false;
|
1130 |
}
|
1131 |
|
1132 |
-
jQuery.ajax(
|
1133 |
-
type: 'POST',
|
|
|
1134 |
data: {
|
1135 |
action: 'frm_duplicate_field',
|
1136 |
-
field_id:
|
1137 |
-
form_id:
|
1138 |
children: children,
|
1139 |
-
nonce: frmGlobal.nonce
|
1140 |
},
|
1141 |
success: function( msg ) {
|
1142 |
thisField.after( msg );
|
1143 |
updateFieldOrder();
|
1144 |
afterAddField( msg, false );
|
1145 |
-
}
|
1146 |
-
}
|
1147 |
return false;
|
1148 |
}
|
1149 |
|
1150 |
function afterAddField( msg, addFocus ) {
|
1151 |
var regex = /id="(\S+)"/,
|
1152 |
match = regex.exec( msg ),
|
1153 |
-
field = document.getElementById( match[1]
|
1154 |
section = '#' + match[1] + '.edit_field_type_divider ul.frm_sorting',
|
1155 |
$thisSection = jQuery( section ),
|
1156 |
type = field.getAttribute( 'data-type' ),
|
@@ -1198,11 +1209,11 @@ function frmAdminBuildJS() {
|
|
1198 |
);
|
1199 |
|
1200 |
if ( ! inView ) {
|
1201 |
-
container.scroll(
|
1202 |
top: container.scrollHeight,
|
1203 |
left: 0,
|
1204 |
-
behavior: 'smooth'
|
1205 |
-
}
|
1206 |
}
|
1207 |
|
1208 |
if ( toggled === false ) {
|
@@ -1226,15 +1237,13 @@ function frmAdminBuildJS() {
|
|
1226 |
|
1227 |
function scrollToField( field ) {
|
1228 |
var newPos = field.getBoundingClientRect().top,
|
1229 |
-
container = document.getElementById( 'post-body-content' )
|
1230 |
-
pos = container.getBoundingClientRect(),
|
1231 |
-
screenTop = pos.top;
|
1232 |
|
1233 |
if ( typeof animate === 'undefined' ) {
|
1234 |
-
jQuery( container ).scrollTop(newPos);
|
1235 |
} else {
|
1236 |
// TODO: smooth scroll
|
1237 |
-
jQuery( container ).animate({scrollTop: newPos}, 500);
|
1238 |
}
|
1239 |
}
|
1240 |
|
@@ -1244,7 +1253,7 @@ function frmAdminBuildJS() {
|
|
1244 |
warningMessage += checkShortcodes( calculation, this );
|
1245 |
|
1246 |
if ( warningMessage !== '' ) {
|
1247 |
-
infoModal( calculation +
|
1248 |
}
|
1249 |
}
|
1250 |
|
@@ -1259,7 +1268,7 @@ function frmAdminBuildJS() {
|
|
1259 |
msg = frm_admin_js.slug_is_reserved;
|
1260 |
msg = msg.replace( '****', addHtmlTags( slug, 'strong' ) );
|
1261 |
msg += '<br /><br />';
|
1262 |
-
msg += addHtmlTags( '<a href="https://codex.wordpress.org/WordPress_Query_Vars" target="_blank" class="frm-standard-link">' + frm_admin_js.reserved_words + '</a>', 'div');
|
1263 |
infoModal( msg );
|
1264 |
}
|
1265 |
}
|
@@ -1273,8 +1282,8 @@ function frmAdminBuildJS() {
|
|
1273 |
match = regEx.exec( filterValue ),
|
1274 |
unsafeParams = '';
|
1275 |
|
1276 |
-
while ( match
|
1277 |
-
if ( Array.isArray( frm_admin_js.unsafe_params ) && frm_admin_js.unsafe_params.includes( match[
|
1278 |
if ( unsafeParams !== '' ) {
|
1279 |
unsafeParams += '", "' + match[ 1 ];
|
1280 |
} else {
|
@@ -1294,7 +1303,7 @@ function frmAdminBuildJS() {
|
|
1294 |
}
|
1295 |
}
|
1296 |
|
1297 |
-
function addHtmlTags( text, tag ){
|
1298 |
tag = tag ? tag : 'p';
|
1299 |
return '<' + tag + '>' + text + '</' + tag + '>';
|
1300 |
}
|
@@ -1307,33 +1316,33 @@ function frmAdminBuildJS() {
|
|
1307 |
function checkMatchingParens( formula ) {
|
1308 |
|
1309 |
var stack = [],
|
1310 |
-
|
1311 |
-
length =
|
1312 |
-
opening = [
|
1313 |
closing = {
|
1314 |
-
|
1315 |
-
|
1316 |
-
|
1317 |
},
|
1318 |
unmatchedClosing = [],
|
1319 |
msg = '',
|
1320 |
-
i,
|
1321 |
|
1322 |
for ( i = 0; i < length; i++ ) {
|
1323 |
-
if ( opening.includes(
|
1324 |
-
stack.push(
|
1325 |
continue;
|
1326 |
}
|
1327 |
-
if ( closing.hasOwnProperty(
|
1328 |
top = stack.pop();
|
1329 |
-
if ( top !== closing[
|
1330 |
-
unmatchedClosing.push(
|
1331 |
}
|
1332 |
}
|
1333 |
}
|
1334 |
|
1335 |
if ( stack.length > 0 || unmatchedClosing.length > 0 ) {
|
1336 |
-
msg = frm_admin_js.unmatched_parens +
|
1337 |
return msg;
|
1338 |
}
|
1339 |
|
@@ -1371,7 +1380,7 @@ function frmAdminBuildJS() {
|
|
1371 |
var nonNumericShortcodes = getNonNumericShortcodes();
|
1372 |
|
1373 |
if ( nonNumericShortcodes.test( calculation ) ) {
|
1374 |
-
msg = frm_admin_js.text_shortcodes +
|
1375 |
}
|
1376 |
|
1377 |
return msg;
|
@@ -1383,7 +1392,7 @@ function frmAdminBuildJS() {
|
|
1383 |
* @param inputElement
|
1384 |
*/
|
1385 |
function isTextCalculation( inputElement ) {
|
1386 |
-
return jQuery( inputElement ).siblings(
|
1387 |
}
|
1388 |
|
1389 |
/**
|
@@ -1404,7 +1413,7 @@ function frmAdminBuildJS() {
|
|
1404 |
msg = '';
|
1405 |
|
1406 |
if ( nonFormShortcodes.test( formula ) ) {
|
1407 |
-
msg += frm_admin_js.view_shortcodes +
|
1408 |
}
|
1409 |
|
1410 |
return msg;
|
@@ -1433,7 +1442,7 @@ function frmAdminBuildJS() {
|
|
1433 |
|
1434 |
for ( var i = 0; i < exclude.length; i++ ) {
|
1435 |
if ( exclude[ i ].startsWith( '[' ) ) {
|
1436 |
-
opts.push( exclude[ i ]
|
1437 |
// remove it
|
1438 |
exclude.splice( i, 1 );
|
1439 |
// https://love2dev.com/blog/javascript-remove-from-array/#remove-from-array-splice-value
|
@@ -1449,7 +1458,7 @@ function frmAdminBuildJS() {
|
|
1449 |
for ( var i = 0; i < excludedOpts.length; i++ ) {
|
1450 |
var inputs = document.getElementsByName( getFieldOptionInputName( excludedOpts[ i ], field.fieldId ) );
|
1451 |
// 2nd condition checks that there's at least one non-empty value
|
1452 |
-
if ( inputs.length && jQuery( inputs[0]
|
1453 |
hasOption = true;
|
1454 |
break;
|
1455 |
}
|
@@ -1473,7 +1482,6 @@ function frmAdminBuildJS() {
|
|
1473 |
|
1474 |
var isSummary = isCalcBoxType( v, 'frm_js_summary_list' );
|
1475 |
|
1476 |
-
var form_id = jQuery( 'input[name="id"]' ).val();
|
1477 |
var fieldId = p.find( 'input[name="frm_fields_submitted[]"]' ).val();
|
1478 |
|
1479 |
if ( force ) {
|
@@ -1522,7 +1530,7 @@ function frmAdminBuildJS() {
|
|
1522 |
var includedExtras = getIncludedExtras();
|
1523 |
if ( includedExtras.length ) {
|
1524 |
for ( var i = 0; i < exclude.length; i++ ) {
|
1525 |
-
if ( includedExtras.includes( exclude[ i ]
|
1526 |
// remove it
|
1527 |
exclude.splice( i, 1 );
|
1528 |
// https://love2dev.com/blog/javascript-remove-from-array/#remove-from-array-splice-value
|
@@ -1553,7 +1561,8 @@ function frmAdminBuildJS() {
|
|
1553 |
}
|
1554 |
|
1555 |
function getFieldList( fieldType ) {
|
1556 |
-
var i,
|
|
|
1557 |
allFields = document.querySelectorAll( 'li.frm_field_box' ),
|
1558 |
checkType = 'undefined' !== typeof fieldType;
|
1559 |
|
@@ -1565,12 +1574,12 @@ function frmAdminBuildJS() {
|
|
1565 |
|
1566 |
var fieldId = allFields[ i ].getAttribute( 'data-fid' );
|
1567 |
if ( typeof fieldId !== 'undefined' && fieldId ) {
|
1568 |
-
fields.push(
|
1569 |
'fieldId': fieldId,
|
1570 |
'fieldName': getPossibleValue( 'frm_name_' + fieldId ),
|
1571 |
'fieldType': getPossibleValue( 'field_options_type_' + fieldId ),
|
1572 |
'fieldKey': getPossibleValue( 'field_options_field_key_' + fieldId )
|
1573 |
-
}
|
1574 |
}
|
1575 |
}
|
1576 |
|
@@ -1600,11 +1609,11 @@ function frmAdminBuildJS() {
|
|
1600 |
if ( isSelect ) {
|
1601 |
// This fallback can be removed after 4.05.
|
1602 |
checked = checked ? ' selected' : '';
|
1603 |
-
options.push( '<option value="'+ id +'"' + checked + '>'+ products[ i ].fieldName +'</option>' );
|
1604 |
} else {
|
1605 |
checked = checked ? ' checked' : '';
|
1606 |
options.push( '<label class="frm6">' );
|
1607 |
-
options.push( '<input type="checkbox" name="'+ fName +'" value="'+ id +'"' + checked + '> ' + products[ i ].fieldName );
|
1608 |
options.push( '</label>' );
|
1609 |
}
|
1610 |
}
|
@@ -1626,7 +1635,7 @@ function frmAdminBuildJS() {
|
|
1626 |
function popAllProductFields() {
|
1627 |
var opts = document.querySelectorAll( '.frmjs_prod_field_opt' );
|
1628 |
for ( var i = 0; i < opts.length; i++ ) {
|
1629 |
-
popProductFields( opts[ i ]
|
1630 |
}
|
1631 |
}
|
1632 |
|
@@ -1739,16 +1748,16 @@ function frmAdminBuildJS() {
|
|
1739 |
|
1740 |
function markUnique() {
|
1741 |
/*jshint validthis:true */
|
1742 |
-
var
|
1743 |
-
var $thisField = jQuery( '.frm_unique_details' +
|
1744 |
if ( this.checked ) {
|
1745 |
$thisField.fadeIn( 'fast' ).closest( '.frm_validation_msg' ).fadeIn( 'fast' );
|
1746 |
-
$unqDetail = jQuery( '.frm_unique_details' +
|
1747 |
if ( $unqDetail.val() === '' ) {
|
1748 |
$unqDetail.val( frm_admin_js.default_unique );
|
1749 |
}
|
1750 |
} else {
|
1751 |
-
var v = $thisField.fadeOut( 'fast' ).closest( '.frm_validation_box' ).children( ':not(.frm_unique_details' +
|
1752 |
if ( v === 0 ) {
|
1753 |
$thisField.closest( '.frm_validation_msg' ).fadeOut( 'fast' );
|
1754 |
}
|
@@ -1758,20 +1767,20 @@ function frmAdminBuildJS() {
|
|
1758 |
//Fade confirmation field and validation option in or out
|
1759 |
function addConf() {
|
1760 |
/*jshint validthis:true */
|
1761 |
-
var
|
1762 |
var val = jQuery( this ).val();
|
1763 |
-
var $thisField = jQuery( document.getElementById( 'frm_field_id_' +
|
1764 |
|
1765 |
-
toggleValidationBox( val !== '', '.frm_conf_details' +
|
1766 |
|
1767 |
if ( val !== '' ) {
|
1768 |
//Add default validation message if empty
|
1769 |
-
var valMsg = jQuery( '.frm_validation_box .frm_conf_details' +
|
1770 |
if ( valMsg.val() === '' ) {
|
1771 |
valMsg.val( frm_admin_js.default_conf );
|
1772 |
}
|
1773 |
|
1774 |
-
setConfirmationFieldDescriptions(
|
1775 |
|
1776 |
//Add or remove class for confirmation field styling
|
1777 |
if ( val === 'inline' ) {
|
@@ -1779,25 +1788,25 @@ function frmAdminBuildJS() {
|
|
1779 |
} else if ( val === 'below' ) {
|
1780 |
$thisField.removeClass( 'frm_conf_inline' ).addClass( 'frm_conf_below' );
|
1781 |
}
|
1782 |
-
jQuery( '.frm-conf-box-' +
|
1783 |
} else {
|
1784 |
-
jQuery( '.frm-conf-box-' +
|
1785 |
setTimeout( function() {
|
1786 |
$thisField.removeClass( 'frm_conf_inline frm_conf_below' );
|
1787 |
}, 200 );
|
1788 |
}
|
1789 |
}
|
1790 |
|
1791 |
-
function setConfirmationFieldDescriptions(
|
1792 |
-
var fieldType = document.getElementsByName( 'field_options[type_' +
|
1793 |
|
1794 |
-
var fieldDescription = document.getElementById( 'field_description_' +
|
1795 |
-
var hiddenDescName = 'field_options[description_' +
|
1796 |
var newValue = frm_admin_js['enter_' + fieldType];
|
1797 |
maybeSetNewDescription( fieldDescription, hiddenDescName, newValue );
|
1798 |
|
1799 |
-
var confFieldDescription = document.getElementById( 'conf_field_description_' +
|
1800 |
-
var hiddenConfName = 'field_options[conf_desc_' +
|
1801 |
var newConfValue = frm_admin_js['confirm_' + fieldType];
|
1802 |
maybeSetNewDescription( confFieldDescription, hiddenConfName, newConfValue );
|
1803 |
}
|
@@ -1822,7 +1831,8 @@ function frmAdminBuildJS() {
|
|
1822 |
|
1823 |
jQuery( builderForm ).on( 'click', 'a.frm-bulk-edit-link', function( event ) {
|
1824 |
event.preventDefault();
|
1825 |
-
var i, key, label,
|
|
|
1826 |
fieldId = jQuery( this ).closest( '[data-fid]' ).data( 'fid' ),
|
1827 |
separate = usingSeparateValues( fieldId ),
|
1828 |
optList = document.getElementById( 'frm_field_' + fieldId + '_opts' ),
|
@@ -1843,7 +1853,7 @@ function frmAdminBuildJS() {
|
|
1843 |
if ( product ) {
|
1844 |
content += '|' + document.getElementsByName( 'field_options[options_' + fieldId + '][' + key + '][price]' )[0].value;
|
1845 |
}
|
1846 |
-
content +=
|
1847 |
}
|
1848 |
}
|
1849 |
|
@@ -1852,23 +1862,23 @@ function frmAdminBuildJS() {
|
|
1852 |
}
|
1853 |
}
|
1854 |
|
1855 |
-
$info.dialog('open');
|
1856 |
|
1857 |
return false;
|
1858 |
-
}
|
1859 |
|
1860 |
jQuery( '#frm-update-bulk-opts' ).click( function() {
|
1861 |
var fieldId = document.getElementById( 'bulk-field-id' ).value;
|
1862 |
this.classList.add( 'frm_loading_button' );
|
1863 |
frmAdminBuild.updateOpts( fieldId, document.getElementById( 'frm_bulk_options' ).value, $info );
|
1864 |
-
}
|
1865 |
}
|
1866 |
|
1867 |
function insertBulkPreset( event ) {
|
1868 |
/*jshint validthis:true */
|
1869 |
var opts = JSON.parse( this.getAttribute( 'data-opts' ) );
|
1870 |
event.preventDefault();
|
1871 |
-
document.getElementById( 'frm_bulk_options' ).value = opts.join(
|
1872 |
return false;
|
1873 |
}
|
1874 |
|
@@ -1876,8 +1886,8 @@ function frmAdminBuildJS() {
|
|
1876 |
function addFieldOption() {
|
1877 |
/*jshint validthis:true */
|
1878 |
var fieldId = jQuery( this ).closest( '.frm-single-settings' ).data( 'fid' ),
|
1879 |
-
newOption = jQuery( '#frm_field_' + fieldId + '_opts .frm_option_template' ).prop('outerHTML'),
|
1880 |
-
|
1881 |
optKey = 0,
|
1882 |
oldKey = '000',
|
1883 |
lastKey = getHighestOptKey( fieldId );
|
@@ -1887,7 +1897,7 @@ function frmAdminBuildJS() {
|
|
1887 |
}
|
1888 |
|
1889 |
//Update hidden field
|
1890 |
-
if (
|
1891 |
document.getElementById( 'other_input_' + fieldId ).value = 1;
|
1892 |
|
1893 |
//Hide "Add Other" option now if this is radio field
|
@@ -1900,13 +1910,13 @@ function frmAdminBuildJS() {
|
|
1900 |
action: 'frm_add_field_option',
|
1901 |
field_id: fieldId,
|
1902 |
opt_key: optKey,
|
1903 |
-
opt_type:
|
1904 |
nonce: frmGlobal.nonce
|
1905 |
};
|
1906 |
jQuery.post( ajaxurl, data, function( msg ) {
|
1907 |
jQuery( document.getElementById( 'frm_field_' + fieldId + '_opts' ) ).append( msg );
|
1908 |
resetDisplayedOpts( fieldId );
|
1909 |
-
}
|
1910 |
} else {
|
1911 |
newOption = newOption.replace( new RegExp( 'optkey="' + oldKey + '"', 'g' ), 'optkey="' + optKey + '"' );
|
1912 |
newOption = newOption.replace( new RegExp( '-' + oldKey + '_', 'g' ), '-' + optKey + '_' );
|
@@ -1924,14 +1934,14 @@ function frmAdminBuildJS() {
|
|
1924 |
opts = jQuery( '#frm_field_' + fieldId + '_opts li' ),
|
1925 |
lastKey = 0;
|
1926 |
|
1927 |
-
for ( i; i < opts.length; i
|
1928 |
optKey = opts[i].getAttribute( 'data-optkey' );
|
1929 |
if ( opts.length === 1 ) {
|
1930 |
return optKey;
|
1931 |
}
|
1932 |
-
if ( optKey
|
1933 |
optKey = optKey.replace( 'other_', '' );
|
1934 |
-
optKey = parseInt( optKey );
|
1935 |
}
|
1936 |
|
1937 |
if ( ! isNaN( lastKey ) && ( optKey > lastKey || lastKey === '000' ) ) {
|
@@ -1944,8 +1954,8 @@ function frmAdminBuildJS() {
|
|
1944 |
|
1945 |
function toggleMultSel() {
|
1946 |
/*jshint validthis:true */
|
1947 |
-
var
|
1948 |
-
toggleMultiSelect(
|
1949 |
}
|
1950 |
|
1951 |
function toggleMultiSelect( fieldId, value ) {
|
@@ -1959,9 +1969,9 @@ function frmAdminBuildJS() {
|
|
1959 |
|
1960 |
function toggleSepValues() {
|
1961 |
/*jshint validthis:true */
|
1962 |
-
var
|
1963 |
-
toggle( jQuery( '.field_' +
|
1964 |
-
jQuery( '.field_' +
|
1965 |
}
|
1966 |
|
1967 |
function toggleMultiselect() {
|
@@ -1998,32 +2008,34 @@ function frmAdminBuildJS() {
|
|
1998 |
var otherInput,
|
1999 |
parentLi = this.parentNode,
|
2000 |
parentUl = parentLi.parentNode,
|
2001 |
-
|
2002 |
|
2003 |
jQuery( parentLi ).fadeOut( 'slow', function() {
|
2004 |
jQuery( parentLi ).remove();
|
2005 |
|
2006 |
var hasOther = jQuery( parentUl ).find( '.frm_other_option' );
|
2007 |
if ( hasOther.length < 1 ) {
|
2008 |
-
otherInput = document.getElementById( 'other_input_' +
|
2009 |
if ( otherInput !== null ) {
|
2010 |
otherInput.value = 0;
|
2011 |
}
|
2012 |
-
jQuery( '#other_button_' +
|
2013 |
}
|
2014 |
-
}
|
2015 |
}
|
2016 |
|
2017 |
/**
|
2018 |
* If a radio button is set as default, allow a click to
|
2019 |
* deselect it.
|
2020 |
*/
|
2021 |
-
function maybeUncheckRadio(
|
2022 |
/*jshint validthis:true */
|
2023 |
var $self = jQuery( this );
|
2024 |
if ( $self.is( ':checked' ) ) {
|
2025 |
var uncheck = function() {
|
2026 |
-
setTimeout( function(){
|
|
|
|
|
2027 |
};
|
2028 |
var unbind = function() {
|
2029 |
$self.unbind( 'mouseup', up );
|
@@ -2049,7 +2061,7 @@ function frmAdminBuildJS() {
|
|
2049 |
|
2050 |
function clickDeleteField() {
|
2051 |
/*jshint validthis:true */
|
2052 |
-
var
|
2053 |
maybeDivider = this.parentNode.parentNode.parentNode,
|
2054 |
li = maybeDivider.parentNode,
|
2055 |
field = jQuery( this ).closest( 'li' ),
|
@@ -2061,11 +2073,11 @@ function frmAdminBuildJS() {
|
|
2061 |
|
2062 |
// If deleting a section, use a special message.
|
2063 |
if ( maybeDivider.className === 'divider_section_only' ) {
|
2064 |
-
|
2065 |
-
this.setAttribute('data-frmcaution', frm_admin_js.caution);
|
2066 |
}
|
2067 |
|
2068 |
-
this.setAttribute( 'data-frmverify',
|
2069 |
this.setAttribute( 'data-deletefield', fieldId );
|
2070 |
|
2071 |
confirmLinkClick( this );
|
@@ -2088,19 +2100,23 @@ function frmAdminBuildJS() {
|
|
2088 |
//if(n.hasClass('edit_field_type_end_divider')){
|
2089 |
deleteField( this.getAttribute( 'data-fid' ) );
|
2090 |
//}
|
2091 |
-
}
|
2092 |
}
|
2093 |
toggleSectionHolder();
|
2094 |
}
|
2095 |
|
2096 |
-
function deleteField(
|
2097 |
-
jQuery.ajax(
|
2098 |
type: 'POST',
|
2099 |
url: ajaxurl,
|
2100 |
-
data: {
|
2101 |
-
|
2102 |
-
|
2103 |
-
|
|
|
|
|
|
|
|
|
2104 |
|
2105 |
// Remove settings from sidebar.
|
2106 |
if ( settings.is( ':visible' ) ) {
|
@@ -2128,28 +2144,29 @@ function frmAdminBuildJS() {
|
|
2128 |
} else if ( $section.length ) {
|
2129 |
toggleOneSectionHolder( $section );
|
2130 |
}
|
2131 |
-
}
|
2132 |
}
|
2133 |
-
}
|
2134 |
}
|
2135 |
|
2136 |
function addFieldLogicRow() {
|
2137 |
/*jshint validthis:true */
|
2138 |
var id = jQuery( this ).closest( '.frm-single-settings' ).data( 'fid' ),
|
2139 |
-
|
2140 |
-
|
2141 |
|
2142 |
if ( jQuery( '#frm_logic_row_' + id + ' .frm_logic_row' ).length > 0 ) {
|
2143 |
-
|
2144 |
}
|
2145 |
-
jQuery.ajax(
|
2146 |
-
type: 'POST',
|
|
|
2147 |
data: {
|
2148 |
action: 'frm_add_logic_row',
|
2149 |
-
form_id:
|
2150 |
field_id: id,
|
2151 |
nonce: frmGlobal.nonce,
|
2152 |
-
meta_name:
|
2153 |
fields: getFieldList()
|
2154 |
},
|
2155 |
success: function( html ) {
|
@@ -2157,30 +2174,33 @@ function frmAdminBuildJS() {
|
|
2157 |
var logicRow = jQuery( document.getElementById( 'frm_logic_row_' + id ) );
|
2158 |
logicRow.append( html );
|
2159 |
logicRow.closest( '.frm_logic_rows' ).fadeIn( 'slow' );
|
2160 |
-
}
|
2161 |
}
|
2162 |
-
}
|
2163 |
return false;
|
2164 |
}
|
2165 |
|
2166 |
function addWatchLookupRow() {
|
2167 |
/*jshint validthis:true */
|
2168 |
-
var
|
2169 |
-
|
2170 |
-
|
2171 |
-
|
|
|
|
|
2172 |
if ( lookupBlockRows.length > 0 ) {
|
2173 |
-
|
2174 |
-
|
2175 |
}
|
2176 |
|
2177 |
-
jQuery.ajax(
|
2178 |
-
type: 'POST',
|
|
|
2179 |
data: {
|
2180 |
action: 'frm_add_watch_lookup_row',
|
2181 |
-
form_id:
|
2182 |
field_id: id,
|
2183 |
-
row_key:
|
2184 |
nonce: frmGlobal.nonce
|
2185 |
},
|
2186 |
success: function( newRow ) {
|
@@ -2188,7 +2208,7 @@ function frmAdminBuildJS() {
|
|
2188 |
watchRowBlock.append( newRow );
|
2189 |
watchRowBlock.fadeIn( 'slow' );
|
2190 |
}
|
2191 |
-
}
|
2192 |
return false;
|
2193 |
}
|
2194 |
|
@@ -2202,7 +2222,7 @@ function frmAdminBuildJS() {
|
|
2202 |
fieldSelect.options.length = 1;
|
2203 |
} else {
|
2204 |
var formID = this.value;
|
2205 |
-
jQuery.ajax(
|
2206 |
type: 'POST', url: ajaxurl,
|
2207 |
data: {
|
2208 |
action: 'frm_get_options_for_get_values_field',
|
@@ -2213,7 +2233,7 @@ function frmAdminBuildJS() {
|
|
2213 |
success: function( fields ) {
|
2214 |
fieldSelect.innerHTML = fields;
|
2215 |
}
|
2216 |
-
}
|
2217 |
}
|
2218 |
}
|
2219 |
|
@@ -2302,24 +2322,24 @@ function frmAdminBuildJS() {
|
|
2302 |
field.removeClass( 'frm-page-collapsed' );
|
2303 |
toCollapse.removeClass( 'frm-is-collapsed' );
|
2304 |
for ( i = 0; i < slide; i++ ) {
|
2305 |
-
if ( i
|
2306 |
-
jQuery( toCollapse[ i ]
|
2307 |
toCollapse.show();
|
2308 |
-
}
|
2309 |
} else {
|
2310 |
-
jQuery( toCollapse[ i ]
|
2311 |
}
|
2312 |
}
|
2313 |
} else {
|
2314 |
field.addClass( 'frm-page-collapsed' );
|
2315 |
toCollapse.addClass( 'frm-is-collapsed' );
|
2316 |
for ( i = 0; i < slide; i++ ) {
|
2317 |
-
if ( i
|
2318 |
-
jQuery( toCollapse[ i ]
|
2319 |
toCollapse.css( 'cssText', 'display:none !important;' );
|
2320 |
-
}
|
2321 |
} else {
|
2322 |
-
jQuery( toCollapse[ i ]
|
2323 |
}
|
2324 |
}
|
2325 |
}
|
@@ -2459,7 +2479,7 @@ function frmAdminBuildJS() {
|
|
2459 |
var children = [];
|
2460 |
jQuery( document.getElementById( 'frm_field_id_' + id ) ).find( 'li.frm_field_box:not(.no_repeat_section .edit_field_type_end_divider)' ).each( function() {
|
2461 |
children.push( jQuery( this ).data( 'fid' ) );
|
2462 |
-
}
|
2463 |
return children;
|
2464 |
}
|
2465 |
|
@@ -2547,7 +2567,7 @@ function frmAdminBuildJS() {
|
|
2547 |
}
|
2548 |
|
2549 |
function resetDisplayedOpts( fieldId ) {
|
2550 |
-
var i,
|
2551 |
input = jQuery( '[name^="item_meta[' + fieldId + ']"]' );
|
2552 |
|
2553 |
if ( input.length < 1 ) {
|
@@ -2557,12 +2577,12 @@ function frmAdminBuildJS() {
|
|
2557 |
if ( input.is( 'select' ) ) {
|
2558 |
placeholder = document.getElementById( 'frm_placeholder_' + fieldId );
|
2559 |
if ( placeholder !== null && placeholder.value === '' ) {
|
2560 |
-
fillDropdownOpts( input[0], { sourceID: fieldId }
|
2561 |
} else {
|
2562 |
fillDropdownOpts( input[0], {
|
2563 |
sourceID: fieldId,
|
2564 |
placeholder: placeholder.value
|
2565 |
-
}
|
2566 |
}
|
2567 |
} else {
|
2568 |
opts = getMultipleOpts( fieldId );
|
@@ -2648,7 +2668,8 @@ function frmAdminBuildJS() {
|
|
2648 |
}
|
2649 |
|
2650 |
function getMultipleOpts( fieldId ) {
|
2651 |
-
var i, saved, labelName, label, key,
|
|
|
2652 |
optVals = jQuery( 'input[name^="field_options[options_' + fieldId + ']"]' ),
|
2653 |
separateValues = usingSeparateValues( fieldId ),
|
2654 |
isProduct = isProductField( fieldId );
|
@@ -2712,11 +2733,11 @@ function frmAdminBuildJS() {
|
|
2712 |
var a = id.split( '-' );
|
2713 |
jQuery.each( jQuery( 'label[id^="' + a[0] + '"]' ), function( k, v ) {
|
2714 |
var c = false;
|
2715 |
-
if ( !c && jQuery( v ).attr( 'id' ) != id && jQuery( v ).html() == text ) {
|
2716 |
c = true;
|
2717 |
infoModal( 'Saved values cannot be identical.' );
|
2718 |
}
|
2719 |
-
}
|
2720 |
}
|
2721 |
}
|
2722 |
|
@@ -2750,7 +2771,7 @@ function frmAdminBuildJS() {
|
|
2750 |
min = document.getElementById( 'scale_minnum_' + fieldID ).value;
|
2751 |
}
|
2752 |
|
2753 |
-
updateScaleValues( parseInt( min ), parseInt( max ), fieldID );
|
2754 |
}
|
2755 |
|
2756 |
function updateScaleValues( min, max, fieldID ) {
|
@@ -2769,7 +2790,7 @@ function frmAdminBuildJS() {
|
|
2769 |
|
2770 |
function getFieldValues() {
|
2771 |
/*jshint validthis:true */
|
2772 |
-
var
|
2773 |
val = this.value;
|
2774 |
|
2775 |
if ( val ) {
|
@@ -2782,12 +2803,12 @@ function frmAdminBuildJS() {
|
|
2782 |
var optionName = 'field_options[hide_opt_' + fieldID + '][]';
|
2783 |
var optionID = 'frm_field_logic_opt_' + fieldID;
|
2784 |
var input = false;
|
2785 |
-
var showSelect = (valueFieldType
|
2786 |
-
var showText = ( valueFieldType
|
2787 |
|
2788 |
if ( showSelect ) {
|
2789 |
-
|
2790 |
-
if (
|
2791 |
// get the category options with ajax
|
2792 |
showSelect = false;
|
2793 |
}
|
@@ -2811,7 +2832,7 @@ function frmAdminBuildJS() {
|
|
2811 |
sourceID: val,
|
2812 |
placeholder: '',
|
2813 |
other: true
|
2814 |
-
}
|
2815 |
}
|
2816 |
} else {
|
2817 |
var thisType = this.getAttribute( 'data-type' );
|
@@ -2822,31 +2843,37 @@ function frmAdminBuildJS() {
|
|
2822 |
|
2823 |
function getFieldSelection() {
|
2824 |
/*jshint validthis:true */
|
2825 |
-
var
|
2826 |
-
if (
|
2827 |
-
var
|
2828 |
-
getTaxOrFieldSelection(
|
2829 |
}
|
2830 |
}
|
2831 |
|
2832 |
-
function getTaxOrFieldSelection(
|
2833 |
-
if (
|
2834 |
-
jQuery.ajax(
|
2835 |
-
type: 'POST',
|
2836 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
2837 |
success: function( msg ) {
|
2838 |
-
jQuery(
|
2839 |
}
|
2840 |
-
}
|
2841 |
}
|
2842 |
}
|
2843 |
|
2844 |
function updateFieldOrder() {
|
2845 |
-
|
2846 |
renumberPageBreaks();
|
2847 |
jQuery( '#frm-show-fields' ).each( function( i ) {
|
2848 |
var fields = jQuery( 'li.frm_field_box', this );
|
2849 |
-
for ( i = 0; i < fields.length; i
|
2850 |
var fieldId = fields[ i ].getAttribute( 'data-fid' ),
|
2851 |
field = jQuery( 'input[name="field_options[field_order_' + fieldId + ']"]' ),
|
2852 |
currentOrder = field.val(),
|
@@ -2859,13 +2886,13 @@ function frmAdminBuildJS() {
|
|
2859 |
moveFieldSettings( singleField );
|
2860 |
}
|
2861 |
}
|
2862 |
-
}
|
2863 |
}
|
2864 |
|
2865 |
function toggleSectionHolder() {
|
2866 |
jQuery( '.start_divider' ).each( function() {
|
2867 |
toggleOneSectionHolder( jQuery( this ) );
|
2868 |
-
}
|
2869 |
}
|
2870 |
|
2871 |
function toggleOneSectionHolder( $section ) {
|
@@ -2885,7 +2912,7 @@ function frmAdminBuildJS() {
|
|
2885 |
/*jshint validthis:true */
|
2886 |
var id = jQuery( this ).data( 'slidedown' );
|
2887 |
var $thisId = jQuery( document.getElementById( id ) );
|
2888 |
-
if ( $thisId.is(
|
2889 |
$thisId.slideDown( 'fast' );
|
2890 |
this.style.display = 'none';
|
2891 |
}
|
@@ -2906,9 +2933,9 @@ function frmAdminBuildJS() {
|
|
2906 |
*/
|
2907 |
function hideEmptyEle() {
|
2908 |
jQuery( '.frm-hide-empty' ).each( function() {
|
2909 |
-
|
2910 |
-
|
2911 |
-
|
2912 |
});
|
2913 |
}
|
2914 |
|
@@ -2954,8 +2981,6 @@ function frmAdminBuildJS() {
|
|
2954 |
function showInlineModal( icon, input ) {
|
2955 |
var box = document.getElementById( icon.getAttribute( 'data-open' ) ),
|
2956 |
container = jQuery( icon ).closest( 'p' ),
|
2957 |
-
pos = icon.getBoundingClientRect(),
|
2958 |
-
parentPos = box.parentNode.getBoundingClientRect(),
|
2959 |
inputTrigger = ( typeof input !== 'undefined' );
|
2960 |
|
2961 |
if ( container.hasClass( 'frm-open' ) ) {
|
@@ -2986,7 +3011,7 @@ function frmAdminBuildJS() {
|
|
2986 |
/*jshint validthis:true */
|
2987 |
e.preventDefault();
|
2988 |
this.parentNode.classList.add( 'frm_hidden' );
|
2989 |
-
jQuery('.frm-open [data-open="' + this.parentNode.id + '"]').closest( '.frm-open' ).removeClass( 'frm-open' );
|
2990 |
}
|
2991 |
|
2992 |
function changeInputtedValue() {
|
@@ -2994,10 +3019,10 @@ function frmAdminBuildJS() {
|
|
2994 |
var i,
|
2995 |
action = this.getAttribute( 'data-frmchange' ).split( ',' );
|
2996 |
|
2997 |
-
for ( i = 0; i < action.length; i
|
2998 |
-
if ( action[i]
|
2999 |
changeHiddenSeparateValue( this );
|
3000 |
-
} else if ( action[i]
|
3001 |
changeDefaultRadioValue( this );
|
3002 |
} else {
|
3003 |
this.value = this.value[ action[i] ]();
|
@@ -3061,7 +3086,7 @@ function frmAdminBuildJS() {
|
|
3061 |
var v = JSON.stringify( $form.serializeArray() );
|
3062 |
|
3063 |
jQuery( document.getElementById( 'frm_compact_fields' ) ).val( v );
|
3064 |
-
jQuery.ajax(
|
3065 |
type: 'POST',
|
3066 |
url: ajaxurl,
|
3067 |
data: {action: 'frm_save_form', 'frm_compact_fields': v, nonce: frmGlobal.nonce},
|
@@ -3074,10 +3099,10 @@ function frmAdminBuildJS() {
|
|
3074 |
$html.innerHTML = msg;
|
3075 |
$postStuff.insertBefore( $html, $postStuff.firstChild );
|
3076 |
},
|
3077 |
-
error: function(
|
3078 |
jQuery( document.getElementById( 'frm_js_build_form' ) ).submit();
|
3079 |
}
|
3080 |
-
}
|
3081 |
}
|
3082 |
|
3083 |
function submitNoAjax() {
|
@@ -3113,11 +3138,11 @@ function frmAdminBuildJS() {
|
|
3113 |
setTimeout( function() {
|
3114 |
jQuery( '.frm_updated_message' ).fadeOut( 'slow', function() {
|
3115 |
this.parentNode.removeChild( this );
|
3116 |
-
}
|
3117 |
$button.fadeOut( 'slow', function() {
|
3118 |
$button.html( buttonVal );
|
3119 |
$button.show();
|
3120 |
-
}
|
3121 |
}, 5000 );
|
3122 |
}
|
3123 |
|
@@ -3141,14 +3166,14 @@ function frmAdminBuildJS() {
|
|
3141 |
// If one click upgrade, hide other content
|
3142 |
addOneClickModal( this );
|
3143 |
|
3144 |
-
jQuery('.frm_feature_label').html( this.getAttribute( 'data-upgrade' ) );
|
3145 |
jQuery( '#frm_upgrade_modal h2' ).show();
|
3146 |
|
3147 |
-
$info.dialog('open');
|
3148 |
|
3149 |
// set the utm medium
|
3150 |
-
var button = $info.find('.button-primary:not(#frm-oneclick-button)');
|
3151 |
-
var link = button.attr('href').replace( /(medium=)[a-z_-]+/ig, '$1' + this.getAttribute( 'data-medium' ) );
|
3152 |
var content = this.getAttribute( 'data-content' );
|
3153 |
if ( content === undefined ) {
|
3154 |
content = '';
|
@@ -3156,7 +3181,7 @@ function frmAdminBuildJS() {
|
|
3156 |
link = link.replace( /(content=)[a-z_-]+/ig, '$1' + content );
|
3157 |
button.attr( 'href', link );
|
3158 |
return false;
|
3159 |
-
}
|
3160 |
}
|
3161 |
|
3162 |
/**
|
@@ -3168,7 +3193,7 @@ function frmAdminBuildJS() {
|
|
3168 |
customLink = link.getAttribute( 'data-link' ),
|
3169 |
showLink = document.getElementById( 'frm-upgrade-modal-link' ),
|
3170 |
upgradeMessage = document.getElementById( 'frm-upgrade-message' ),
|
3171 |
-
newMessage = link.getAttribute('data-message'),
|
3172 |
button = document.getElementById( 'frm-oneclick-button' ),
|
3173 |
showIt = 'block',
|
3174 |
hideIt = 'none';
|
@@ -3186,21 +3211,21 @@ function frmAdminBuildJS() {
|
|
3186 |
|
3187 |
// Use a custom message in the modal.
|
3188 |
if ( newMessage === null || typeof newMessage === 'undefined' || newMessage === '' ) {
|
3189 |
-
newMessage = upgradeMessage.getAttribute('data-default');
|
3190 |
}
|
3191 |
upgradeMessage.innerHTML = newMessage;
|
3192 |
|
3193 |
// Either set the link or use the default.
|
3194 |
if ( customLink === null || typeof customLink === 'undefined' || customLink === '' ) {
|
3195 |
-
customLink = showLink.getAttribute('data-default');
|
3196 |
}
|
3197 |
showLink.href = customLink;
|
3198 |
|
3199 |
document.getElementById( 'frm-addon-status' ).style.display = 'none';
|
3200 |
oneclickMessage.style.display = hideIt;
|
3201 |
-
button.style.display = hideIt
|
3202 |
upgradeMessage.style.display = showIt;
|
3203 |
-
showLink.style.display = showIt
|
3204 |
}
|
3205 |
|
3206 |
/* Form settings */
|
@@ -3218,8 +3243,9 @@ function frmAdminBuildJS() {
|
|
3218 |
* using the old sidebar.
|
3219 |
*/
|
3220 |
function maybeAddFieldSelection( parentClass ) {
|
3221 |
-
var i,
|
3222 |
-
|
|
|
3223 |
missingClass[i].parentNode.classList.add( 'frm_has_shortcodes' );
|
3224 |
}
|
3225 |
}
|
@@ -3253,11 +3279,11 @@ function frmAdminBuildJS() {
|
|
3253 |
// the .html() gets original values, so they need to be set
|
3254 |
action.find( 'input[type=text], textarea, input[type=number]' ).prop( 'defaultValue', function() {
|
3255 |
return this.value;
|
3256 |
-
}
|
3257 |
|
3258 |
action.find( 'input[type=checkbox], input[type=radio]' ).prop( 'defaultChecked', function() {
|
3259 |
return this.checked;
|
3260 |
-
}
|
3261 |
|
3262 |
var rename = new RegExp( '\\[' + currentID + '\\]', 'g' );
|
3263 |
var reid = new RegExp( '_' + currentID + '"', 'g' );
|
@@ -3273,7 +3299,7 @@ function frmAdminBuildJS() {
|
|
3273 |
}
|
3274 |
|
3275 |
function newActionId( currentID ) {
|
3276 |
-
var newID = parseInt( currentID ) + 11;
|
3277 |
var exists = document.getElementById( 'frm_form_action_' + newID );
|
3278 |
if ( exists !== null ) {
|
3279 |
newID++;
|
@@ -3286,9 +3312,9 @@ function frmAdminBuildJS() {
|
|
3286 |
/*jshint validthis:true */
|
3287 |
var actionId = getNewActionId();
|
3288 |
var type = jQuery( this ).data( 'actiontype' );
|
3289 |
-
var formId =
|
3290 |
|
3291 |
-
jQuery.ajax(
|
3292 |
type: 'POST', url: ajaxurl,
|
3293 |
data: {
|
3294 |
action: 'frm_add_form_action',
|
@@ -3307,18 +3333,18 @@ function frmAdminBuildJS() {
|
|
3307 |
var newAction = document.getElementById( 'frm_form_action_' + actionId );
|
3308 |
|
3309 |
newAction.classList.add( 'open' );
|
3310 |
-
document.getElementById( 'post-body-content' ).scroll(
|
3311 |
top: newAction.offsetTop + 10,
|
3312 |
left: 0,
|
3313 |
behavior: 'smooth'
|
3314 |
-
}
|
3315 |
|
3316 |
//check if icon should be active
|
3317 |
checkActiveAction( type );
|
3318 |
initiateMultiselect();
|
3319 |
showInputIcon( '#frm_form_action_' + actionId );
|
3320 |
}
|
3321 |
-
}
|
3322 |
}
|
3323 |
|
3324 |
function toggleActionGroups() {
|
@@ -3345,7 +3371,7 @@ function frmAdminBuildJS() {
|
|
3345 |
//Get number of previous action
|
3346 |
len = jQuery( '.frm_form_action_settings:last' ).attr( 'id' ).replace( 'frm_form_action_', '' );
|
3347 |
}
|
3348 |
-
len = parseInt( len ) + 1;
|
3349 |
if ( typeof document.getElementById( 'frm_form_action_' + len ) !== 'undefined' ) {
|
3350 |
len = len + 100;
|
3351 |
}
|
@@ -3385,7 +3411,7 @@ function frmAdminBuildJS() {
|
|
3385 |
moveFieldSettings( singleField );
|
3386 |
|
3387 |
if ( fieldType && 'quantity' === fieldType ) {
|
3388 |
-
popProductFields( jQuery( singleField ).find( '.frmjs_prod_field_opt' )[0]
|
3389 |
}
|
3390 |
|
3391 |
singleField.classList.remove( 'frm_hidden' );
|
@@ -3420,20 +3446,19 @@ function frmAdminBuildJS() {
|
|
3420 |
|
3421 |
function hideEmailRow() {
|
3422 |
/*jshint validthis:true */
|
3423 |
-
var
|
3424 |
-
|
3425 |
-
|
3426 |
-
|
3427 |
-
|
3428 |
-
|
3429 |
-
jQuery(
|
3430 |
-
|
3431 |
-
|
3432 |
-
} );
|
3433 |
}
|
3434 |
|
3435 |
function checkActiveAction( type ) {
|
3436 |
-
var limit = parseInt( jQuery( '.frm_' + type + '_action' ).data( 'limit' ) );
|
3437 |
var len = jQuery( '.frm_single_' + type + '_settings' ).length;
|
3438 |
var limitClass;
|
3439 |
if ( len >= limit ) {
|
@@ -3451,20 +3476,20 @@ function frmAdminBuildJS() {
|
|
3451 |
|
3452 |
function addFormLogicRow() {
|
3453 |
/*jshint validthis:true */
|
3454 |
-
var id = jQuery( this ).data( 'emailkey' )
|
3455 |
-
|
3456 |
-
|
3457 |
-
|
3458 |
if ( jQuery( '#frm_form_action_' + id + ' .frm_logic_row' ).length ) {
|
3459 |
-
|
3460 |
}
|
3461 |
-
jQuery.ajax(
|
3462 |
type: 'POST', url: ajaxurl,
|
3463 |
data: {
|
3464 |
action: 'frm_add_form_logic_row',
|
3465 |
email_id: id,
|
3466 |
-
form_id:
|
3467 |
-
meta_name:
|
3468 |
type: type,
|
3469 |
nonce: frmGlobal.nonce
|
3470 |
},
|
@@ -3473,9 +3498,9 @@ function frmAdminBuildJS() {
|
|
3473 |
var $logicRow = jQuery( document.getElementById( 'frm_logic_row_' + id ) );
|
3474 |
$logicRow.append( html );
|
3475 |
$logicRow.parent( '.frm_logic_rows' ).fadeIn( 'slow' );
|
3476 |
-
}
|
3477 |
}
|
3478 |
-
}
|
3479 |
return false;
|
3480 |
}
|
3481 |
|
@@ -3496,22 +3521,21 @@ function frmAdminBuildJS() {
|
|
3496 |
*/
|
3497 |
function addSubmitLogic() {
|
3498 |
/*jshint validthis:true */
|
3499 |
-
var
|
3500 |
-
|
|
|
3501 |
if ( jQuery( '#frm_submit_logic_row .frm_logic_row' ).length > 0 ) {
|
3502 |
-
|
3503 |
-
var submitRowID = last.attr( 'id' );
|
3504 |
-
var idFromSubmitRow = submitRowID.replace( 'frm_logic_submit_', '' );
|
3505 |
|
3506 |
-
|
3507 |
}
|
3508 |
-
jQuery.ajax(
|
3509 |
type: 'POST',
|
3510 |
url: ajaxurl,
|
3511 |
data: {
|
3512 |
action: 'frm_add_submit_logic_row',
|
3513 |
-
form_id:
|
3514 |
-
meta_name:
|
3515 |
nonce: frmGlobal.nonce
|
3516 |
},
|
3517 |
success: function( html ) {
|
@@ -3519,7 +3543,7 @@ function frmAdminBuildJS() {
|
|
3519 |
$logicRow.append( html );
|
3520 |
$logicRow.parent( '.frm_submit_logic_rows' ).fadeIn( 'slow' );
|
3521 |
}
|
3522 |
-
}
|
3523 |
return false;
|
3524 |
}
|
3525 |
|
@@ -3528,19 +3552,19 @@ function frmAdminBuildJS() {
|
|
3528 |
*/
|
3529 |
function addSubmitLogicOpts() {
|
3530 |
var fieldOpt = jQuery( this );
|
3531 |
-
var
|
3532 |
|
3533 |
-
if (
|
3534 |
var row = fieldOpt.data( 'row' );
|
3535 |
-
frmGetFieldValues(
|
3536 |
}
|
3537 |
}
|
3538 |
|
3539 |
function formatEmailSetting() {
|
3540 |
/*jshint validthis:true */
|
3541 |
-
var val = jQuery( this ).val();
|
3542 |
var email = val.match( /(\s[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi );
|
3543 |
-
|
3544 |
//has email
|
3545 |
//TODO: add < > if they aren't there
|
3546 |
}*/
|
@@ -3566,7 +3590,7 @@ function frmAdminBuildJS() {
|
|
3566 |
var editable = document.getElementById( 'editable' );
|
3567 |
if ( editable !== null ) {
|
3568 |
show = editable.checked && jQuery( document.getElementById( 'edit_action' ) ).val() === 'message';
|
3569 |
-
if ( !show ) {
|
3570 |
show = document.getElementById( 'save_draft' ).checked;
|
3571 |
}
|
3572 |
}
|
@@ -3589,7 +3613,7 @@ function frmAdminBuildJS() {
|
|
3589 |
infoModal( 'Oops. You have already used that field.' );
|
3590 |
return false;
|
3591 |
}
|
3592 |
-
}
|
3593 |
}
|
3594 |
|
3595 |
function togglePostContent() {
|
@@ -3616,52 +3640,56 @@ function frmAdminBuildJS() {
|
|
3616 |
$dyn.val( '' );
|
3617 |
jQuery( '.frm_dyncontent_opt' ).show();
|
3618 |
} else {
|
3619 |
-
jQuery.ajax(
|
3620 |
type: 'POST', url: ajaxurl,
|
3621 |
data: {action: 'frm_display_get_content', id: v, nonce: frmGlobal.nonce},
|
3622 |
success: function( val ) {
|
3623 |
$dyn.val( val );
|
3624 |
jQuery( '.frm_dyncontent_opt' ).show();
|
3625 |
}
|
3626 |
-
}
|
3627 |
}
|
3628 |
}
|
3629 |
|
3630 |
function switchPostType() {
|
3631 |
/*jshint validthis:true */
|
3632 |
// update all rows of categories/taxonomies
|
3633 |
-
var
|
3634 |
-
|
3635 |
-
|
3636 |
-
var new_select;
|
3637 |
|
3638 |
// Get new category/taxonomy options
|
3639 |
-
jQuery.ajax(
|
3640 |
-
type: 'POST',
|
3641 |
-
|
|
|
|
|
|
|
|
|
|
|
3642 |
success: function( html ) {
|
3643 |
|
3644 |
// Loop through each category row, and replace the first dropdown
|
3645 |
-
for ( i = 0; i <
|
3646 |
// Check if current element is a div
|
3647 |
-
if (
|
3648 |
continue;
|
3649 |
}
|
3650 |
|
3651 |
// Get current category select
|
3652 |
-
|
3653 |
|
3654 |
// Set up new select
|
3655 |
-
|
3656 |
-
|
3657 |
-
|
3658 |
-
|
3659 |
|
3660 |
// Replace the old select with the new select
|
3661 |
-
|
3662 |
}
|
3663 |
}
|
3664 |
-
}
|
3665 |
}
|
3666 |
|
3667 |
function addPosttaxRow() {
|
@@ -3675,26 +3703,30 @@ function frmAdminBuildJS() {
|
|
3675 |
}
|
3676 |
|
3677 |
function addPostRow( type, button ) {
|
3678 |
-
var id = jQuery( 'input[name="id"]' ).val()
|
3679 |
-
|
3680 |
-
|
3681 |
-
|
|
|
3682 |
|
3683 |
-
var meta_name = 0;
|
3684 |
if ( jQuery( '.frm_post' + type + '_row' ).length ) {
|
3685 |
var name = jQuery( '.frm_post' + type + '_row:last' ).attr( 'id' ).replace( 'frm_post' + type + '_', '' );
|
3686 |
if ( jQuery.isNumeric( name ) ) {
|
3687 |
-
|
3688 |
} else {
|
3689 |
-
|
3690 |
}
|
3691 |
}
|
3692 |
-
jQuery.ajax(
|
3693 |
type: 'POST', url: ajaxurl,
|
3694 |
data: {
|
3695 |
-
action: 'frm_add_post' + type + '_row',
|
3696 |
-
|
3697 |
-
|
|
|
|
|
|
|
|
|
3698 |
},
|
3699 |
success: function( html ) {
|
3700 |
jQuery( document.getElementById( 'frm_post' + type + '_rows' ) ).append( html );
|
@@ -3707,51 +3739,52 @@ function frmAdminBuildJS() {
|
|
3707 |
jQuery( '.frm_posttax_labels' ).show();
|
3708 |
}
|
3709 |
}
|
3710 |
-
}
|
3711 |
}
|
3712 |
|
3713 |
-
function getMetaValue( id,
|
3714 |
-
var
|
3715 |
-
if ( jQuery( document.getElementById( id +
|
3716 |
-
|
3717 |
}
|
3718 |
-
return
|
3719 |
}
|
3720 |
|
3721 |
function changePosttaxRow() {
|
3722 |
/*jshint validthis:true */
|
3723 |
-
if ( !jQuery( this ).closest( '.frm_posttax_row' ).find( '.frm_posttax_opt_list' ).length ) {
|
3724 |
return;
|
3725 |
}
|
3726 |
|
3727 |
jQuery( this ).closest( '.frm_posttax_row' ).find( '.frm_posttax_opt_list' ).html( '<div class="spinner frm_spinner" style="display:block"></div>' );
|
3728 |
|
3729 |
-
var
|
3730 |
-
|
3731 |
-
|
3732 |
-
|
3733 |
-
|
3734 |
-
|
3735 |
-
|
3736 |
|
3737 |
-
jQuery.ajax(
|
3738 |
-
type: 'POST',
|
|
|
3739 |
data: {
|
3740 |
action: 'frm_add_posttax_row',
|
3741 |
form_id: id,
|
3742 |
-
post_type:
|
3743 |
-
tax_key:
|
3744 |
-
action_key:
|
3745 |
-
meta_name:
|
3746 |
-
field_id:
|
3747 |
-
show_exclude:
|
3748 |
nonce: frmGlobal.nonce
|
3749 |
},
|
3750 |
success: function( html ) {
|
3751 |
-
var $tax = jQuery( document.getElementById( 'frm_posttax_' +
|
3752 |
$tax.replaceWith( html );
|
3753 |
}
|
3754 |
-
}
|
3755 |
}
|
3756 |
|
3757 |
function toggleCfOpts() {
|
@@ -3826,27 +3859,37 @@ function frmAdminBuildJS() {
|
|
3826 |
|
3827 |
function displayFormSelected() {
|
3828 |
/*jshint validthis:true */
|
3829 |
-
var
|
3830 |
-
|
3831 |
-
if (
|
3832 |
return;
|
3833 |
}
|
3834 |
|
3835 |
-
jQuery.ajax(
|
3836 |
-
type: 'POST',
|
3837 |
-
|
|
|
|
|
|
|
|
|
|
|
3838 |
success: function( html ) {
|
3839 |
jQuery( '#frm_adv_info .categorydiv' ).html( html );
|
3840 |
}
|
3841 |
-
}
|
3842 |
|
3843 |
-
jQuery.ajax(
|
3844 |
-
type: 'POST',
|
3845 |
-
|
|
|
|
|
|
|
|
|
|
|
3846 |
success: function( html ) {
|
3847 |
jQuery( document.getElementById( 'date_select_container' ) ).html( html );
|
3848 |
}
|
3849 |
-
}
|
3850 |
}
|
3851 |
|
3852 |
function clickTabsAfterAjax() {
|
@@ -3879,18 +3922,18 @@ function frmAdminBuildJS() {
|
|
3879 |
if ( jQuery( '#frm_order_options .frm_logic_rows div:last' ).length > 0 ) {
|
3880 |
l = jQuery( '#frm_order_options .frm_logic_rows div:last' ).attr( 'id' ).replace( 'frm_order_field_', '' );
|
3881 |
}
|
3882 |
-
jQuery.ajax(
|
3883 |
type: 'POST', url: ajaxurl,
|
3884 |
data: {
|
3885 |
action: 'frm_add_order_row',
|
3886 |
-
form_id:
|
3887 |
-
order_key: (parseInt( l ) + 1),
|
3888 |
nonce: frmGlobal.nonce
|
3889 |
},
|
3890 |
success: function( html ) {
|
3891 |
jQuery( '#frm_order_options .frm_logic_rows' ).append( html ).show().prev( '.frm_add_order_row' ).hide();
|
3892 |
}
|
3893 |
-
}
|
3894 |
}
|
3895 |
|
3896 |
function addWhereRow() {
|
@@ -3898,48 +3941,56 @@ function frmAdminBuildJS() {
|
|
3898 |
if ( jQuery( '#frm_where_options .frm_logic_rows div:last' ).length ) {
|
3899 |
l = jQuery( '#frm_where_options .frm_logic_rows div:last' ).attr( 'id' ).replace( 'frm_where_field_', '' );
|
3900 |
}
|
3901 |
-
jQuery.ajax(
|
3902 |
type: 'POST', url: ajaxurl,
|
3903 |
data: {
|
3904 |
action: 'frm_add_where_row',
|
3905 |
-
form_id:
|
3906 |
-
where_key: (parseInt( l ) + 1),
|
3907 |
nonce: frmGlobal.nonce
|
3908 |
},
|
3909 |
success: function( html ) {
|
3910 |
jQuery( '#frm_where_options .frm_logic_rows' ).append( html ).show().prev( '.frm_add_where_row' ).hide();
|
3911 |
}
|
3912 |
-
}
|
3913 |
}
|
3914 |
|
3915 |
function insertWhereOptions() {
|
3916 |
/*jshint validthis:true */
|
3917 |
-
var value = this.value
|
3918 |
-
|
3919 |
-
|
3920 |
-
|
3921 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3922 |
success: function( html ) {
|
3923 |
-
jQuery( document.getElementById( 'where_field_options_' +
|
3924 |
}
|
3925 |
-
}
|
3926 |
}
|
3927 |
|
3928 |
function hideWhereOptions() {
|
3929 |
/*jshint validthis:true */
|
3930 |
-
var value = this.value
|
3931 |
-
|
|
|
3932 |
if ( value === 'group_by' || value === 'group_by_newest' ) {
|
3933 |
-
document.getElementById( 'where_field_options_' +
|
3934 |
} else {
|
3935 |
-
document.getElementById( 'where_field_options_' +
|
3936 |
}
|
3937 |
}
|
3938 |
|
3939 |
function setDefaultPostStatus() {
|
3940 |
var urlQuery = window.location.search.substring( 1 );
|
3941 |
if ( urlQuery.indexOf( 'action=edit' ) === -1 ) {
|
3942 |
-
document.getElementById( 'post-visibility-display' ).innerHTML = frm_admin_js.
|
3943 |
document.getElementById( 'hidden-post-visibility' ).value = 'private';
|
3944 |
document.getElementById( 'visibility-radio-private' ).checked = true;
|
3945 |
}
|
@@ -3955,41 +4006,41 @@ function frmAdminBuildJS() {
|
|
3955 |
|
3956 |
function insertFieldCode( element, variable ) {
|
3957 |
var rich = false,
|
3958 |
-
|
3959 |
if ( typeof element === 'object' ) {
|
3960 |
if ( element.hasClass( 'frm_noallow' ) ) {
|
3961 |
return;
|
3962 |
}
|
3963 |
|
3964 |
-
|
3965 |
-
if ( typeof
|
3966 |
-
|
3967 |
-
if ( typeof
|
3968 |
-
|
3969 |
}
|
3970 |
}
|
3971 |
}
|
3972 |
|
3973 |
-
if ( typeof
|
3974 |
var active = document.activeElement;
|
3975 |
if ( active.type === 'search' ) {
|
3976 |
// If the search field has focus, find the correct field.
|
3977 |
-
|
3978 |
-
if (
|
3979 |
-
active = jQuery( '.frm-single-settings:visible .' +
|
3980 |
-
|
3981 |
}
|
3982 |
} else {
|
3983 |
-
|
3984 |
}
|
3985 |
}
|
3986 |
|
3987 |
-
if (
|
3988 |
-
rich = jQuery( '#wp-' +
|
3989 |
}
|
3990 |
|
3991 |
-
var
|
3992 |
-
if ( typeof element.attr('data-shortcode') === 'undefined' && ( !
|
3993 |
// this helps to exclude those that don't want shortcode-like inserted content e.g. frm-pro's summary field
|
3994 |
var doShortcode = element.parents( 'ul.frm_code_list' ).attr( 'data-shortcode' );
|
3995 |
if ( doShortcode === 'undefined' || doShortcode !== 'no' ) {
|
@@ -3998,12 +4049,12 @@ function frmAdminBuildJS() {
|
|
3998 |
}
|
3999 |
|
4000 |
if ( rich ) {
|
4001 |
-
wpActiveEditor =
|
4002 |
send_to_editor( variable );
|
4003 |
return;
|
4004 |
}
|
4005 |
|
4006 |
-
if ( !
|
4007 |
return false;
|
4008 |
}
|
4009 |
|
@@ -4012,7 +4063,7 @@ function frmAdminBuildJS() {
|
|
4012 |
if ( variable === '[default-plain]' ) {
|
4013 |
p = 1;
|
4014 |
}
|
4015 |
-
jQuery.ajax(
|
4016 |
type: 'POST', url: ajaxurl,
|
4017 |
data: {
|
4018 |
action: 'frm_get_default_html',
|
@@ -4021,31 +4072,31 @@ function frmAdminBuildJS() {
|
|
4021 |
nonce: frmGlobal.nonce
|
4022 |
},
|
4023 |
success: function( msg ) {
|
4024 |
-
insertContent(
|
4025 |
}
|
4026 |
-
}
|
4027 |
} else {
|
4028 |
-
insertContent(
|
4029 |
}
|
4030 |
return false;
|
4031 |
}
|
4032 |
|
4033 |
-
function insertContent(
|
4034 |
if ( document.selection ) {
|
4035 |
-
|
4036 |
document.selection.createRange().text = variable;
|
4037 |
} else {
|
4038 |
-
obj =
|
4039 |
var e = obj.selectionEnd;
|
4040 |
|
4041 |
-
variable = maybeFormatInsertedContent(
|
4042 |
|
4043 |
obj.value = obj.value.substr( 0, obj.selectionStart ) + variable + obj.value.substr( obj.selectionEnd, obj.value.length );
|
4044 |
var s = e + variable.length;
|
4045 |
obj.focus();
|
4046 |
obj.setSelectionRange( s, s );
|
4047 |
}
|
4048 |
-
|
4049 |
}
|
4050 |
|
4051 |
function maybeFormatInsertedContent( input, textToInsert, selectionStart, selectionEnd ) {
|
@@ -4060,8 +4111,8 @@ function frmAdminBuildJS() {
|
|
4060 |
return textToInsert;
|
4061 |
}
|
4062 |
|
4063 |
-
var startPattern = new RegExp( separator +
|
4064 |
-
var endPattern = new RegExp(
|
4065 |
|
4066 |
if ( value.substr( 0, selectionStart ).trim().length && false === startPattern.test( value.substr( 0, selectionStart ) ) ) {
|
4067 |
textToInsert = separator + textToInsert;
|
@@ -4104,7 +4155,7 @@ function frmAdminBuildJS() {
|
|
4104 |
result.innerHTML = '[' + code + '[/if ' + field + ']';
|
4105 |
}
|
4106 |
|
4107 |
-
function showBuilderModal(
|
4108 |
/*jshint validthis:true */
|
4109 |
var moreIcon = getIconForInput( this );
|
4110 |
showInlineModal( moreIcon, this );
|
@@ -4235,38 +4286,38 @@ function frmAdminBuildJS() {
|
|
4235 |
}
|
4236 |
|
4237 |
DOM = tinymce.DOM;
|
4238 |
-
if ( typeof
|
4239 |
-
DOM.events.add( DOM.select( '.wp-editor-wrap' ), 'mouseover', function(
|
4240 |
if ( jQuery( '*:focus' ).length > 0 ) {
|
4241 |
return;
|
4242 |
}
|
4243 |
if ( this.id ) {
|
4244 |
toggleAllowedShortcodes( this.id.slice( 3, -5 ), 'focusin' );
|
4245 |
}
|
4246 |
-
}
|
4247 |
-
DOM.events.add( DOM.select( '.wp-editor-wrap' ), 'mouseout', function(
|
4248 |
if ( jQuery( '*:focus' ).length > 0 ) {
|
4249 |
return;
|
4250 |
}
|
4251 |
if ( this.id ) {
|
4252 |
toggleAllowedShortcodes( this.id.slice( 3, -5 ), 'focusin' );
|
4253 |
}
|
4254 |
-
}
|
4255 |
} else {
|
4256 |
-
jQuery( '#frm_dyncontent' ).on( 'mouseover mouseout', '.wp-editor-wrap', function(
|
4257 |
if ( jQuery( '*:focus' ).length > 0 ) {
|
4258 |
return;
|
4259 |
}
|
4260 |
if ( this.id ) {
|
4261 |
toggleAllowedShortcodes( this.id.slice( 3, -5 ), 'focusin' );
|
4262 |
}
|
4263 |
-
}
|
4264 |
}
|
4265 |
}
|
4266 |
|
4267 |
-
function toggleAllowedShortcodes( id
|
4268 |
var c, clickedID;
|
4269 |
-
if ( typeof
|
4270 |
id = '';
|
4271 |
}
|
4272 |
c = id;
|
@@ -4297,7 +4348,7 @@ function frmAdminBuildJS() {
|
|
4297 |
];
|
4298 |
var b = [
|
4299 |
'before_content', 'after_content', 'frm_not_email_to',
|
4300 |
-
'dyn_default_value'
|
4301 |
];
|
4302 |
|
4303 |
if ( jQuery.inArray( id, a ) >= 0 ) {
|
@@ -4305,7 +4356,7 @@ function frmAdminBuildJS() {
|
|
4305 |
jQuery( '.frm_code_list a.hide_' + id ).addClass( 'frm_noallow' ).removeClass( 'frm_allow' );
|
4306 |
} else if ( jQuery.inArray( id, b ) >= 0 ) {
|
4307 |
jQuery( '.frm_code_list:not(.frm-dropdown-menu) a:not(.show_' + id + ')' ).addClass( 'frm_noallow' ).removeClass( 'frm_allow' );
|
4308 |
-
jQuery( '.frm_code_list a.show_' + id ).removeClass('frm_noallow').addClass( 'frm_allow' );
|
4309 |
} else {
|
4310 |
jQuery( '.frm_code_list:not(.frm-dropdown-menu) a' ).addClass( 'frm_noallow' ).removeClass( 'frm_allow' );
|
4311 |
}
|
@@ -4319,8 +4370,9 @@ function frmAdminBuildJS() {
|
|
4319 |
}
|
4320 |
}
|
4321 |
|
4322 |
-
function toggleAllowedHTML( input
|
4323 |
-
var b,
|
|
|
4324 |
if ( typeof id === 'undefined' || id.indexOf( '-search-input' ) !== -1 ) {
|
4325 |
return;
|
4326 |
}
|
@@ -4337,12 +4389,12 @@ function frmAdminBuildJS() {
|
|
4337 |
}
|
4338 |
}
|
4339 |
|
4340 |
-
function toggleKeyID(
|
4341 |
e.stopPropagation();
|
4342 |
jQuery( '.frm_code_list .frmids, .frm_code_list .frmkeys' ).addClass( 'frm_hidden' );
|
4343 |
-
jQuery( '.frm_code_list .' +
|
4344 |
jQuery( '.frmids, .frmkeys' ).removeClass( 'current' );
|
4345 |
-
jQuery( '.' +
|
4346 |
}
|
4347 |
|
4348 |
/* Styling */
|
@@ -4406,7 +4458,7 @@ function frmAdminBuildJS() {
|
|
4406 |
var holder = anchor.replace( '#', '' );
|
4407 |
var holderContainer = jQuery( '.frm_' + holder + '_ajax' );
|
4408 |
if ( holderContainer.length ) {
|
4409 |
-
jQuery.ajax(
|
4410 |
type: 'POST', url: ajaxurl,
|
4411 |
data: {
|
4412 |
'action': 'frm_settings_tab',
|
@@ -4416,7 +4468,7 @@ function frmAdminBuildJS() {
|
|
4416 |
success: function( html ) {
|
4417 |
holderContainer.replaceWith( html );
|
4418 |
}
|
4419 |
-
}
|
4420 |
}
|
4421 |
}
|
4422 |
|
@@ -4424,7 +4476,7 @@ function frmAdminBuildJS() {
|
|
4424 |
/*jshint validthis:true */
|
4425 |
if ( confirmLinkClick( this ) === true ) {
|
4426 |
jQuery( '.frm_uninstall .frm-wait' ).css( 'visibility', 'visible' );
|
4427 |
-
jQuery.ajax(
|
4428 |
type: 'POST',
|
4429 |
url: ajaxurl,
|
4430 |
data: 'action=frm_uninstall&nonce=' + frmGlobal.nonce,
|
@@ -4432,7 +4484,7 @@ function frmAdminBuildJS() {
|
|
4432 |
jQuery( '.frm_uninstall' ).fadeOut( 'slow' );
|
4433 |
window.location = msg;
|
4434 |
}
|
4435 |
-
}
|
4436 |
}
|
4437 |
return false;
|
4438 |
}
|
@@ -4444,7 +4496,7 @@ function frmAdminBuildJS() {
|
|
4444 |
var pluginSlug = this.getAttribute( 'data-plugin' );
|
4445 |
var action = buttonName.replace( 'edd_' + pluginSlug + '_license_', '' );
|
4446 |
var license = document.getElementById( 'edd_' + pluginSlug + '_license_key' ).value;
|
4447 |
-
jQuery.ajax(
|
4448 |
type: 'POST', url: ajaxurl, dataType: 'json',
|
4449 |
data: {action: 'frm_addon_' + action, license: license, plugin: pluginSlug, nonce: frmGlobal.nonce},
|
4450 |
success: function( msg ) {
|
@@ -4467,7 +4519,7 @@ function frmAdminBuildJS() {
|
|
4467 |
}, 15000 );
|
4468 |
}
|
4469 |
}
|
4470 |
-
}
|
4471 |
}
|
4472 |
|
4473 |
/* Import/Export page */
|
@@ -4483,7 +4535,7 @@ function frmAdminBuildJS() {
|
|
4483 |
var ids = [];
|
4484 |
checkedBoxes.each( function( i ) {
|
4485 |
ids[i] = this.value;
|
4486 |
-
}
|
4487 |
|
4488 |
// Begin the import process.
|
4489 |
importForms( ids, event.target );
|
@@ -4547,7 +4599,7 @@ function frmAdminBuildJS() {
|
|
4547 |
// Remove this form ID from the queue.
|
4548 |
s.importQueue = jQuery.grep( s.importQueue, function( value ) {
|
4549 |
return value != formID;
|
4550 |
-
}
|
4551 |
s.imported++;
|
4552 |
|
4553 |
if ( s.importQueue.length === 0 ) {
|
@@ -4560,7 +4612,7 @@ function frmAdminBuildJS() {
|
|
4560 |
importForm( $processSettings );
|
4561 |
}
|
4562 |
}
|
4563 |
-
}
|
4564 |
}
|
4565 |
|
4566 |
function validateExport( e ) {
|
@@ -4592,7 +4644,7 @@ function frmAdminBuildJS() {
|
|
4592 |
function removeExportError() {
|
4593 |
/*jshint validthis:true */
|
4594 |
var t = jQuery( this ).closest( '.frm_blank_field' );
|
4595 |
-
if ( typeof
|
4596 |
return;
|
4597 |
}
|
4598 |
|
@@ -4627,13 +4679,13 @@ function frmAdminBuildJS() {
|
|
4627 |
this.checked = false;
|
4628 |
if ( s.indexOf( this.value ) >= 0 ) {
|
4629 |
this.disabled = false;
|
4630 |
-
if ( multiple
|
4631 |
this.checked = true;
|
4632 |
}
|
4633 |
} else {
|
4634 |
this.disabled = true;
|
4635 |
}
|
4636 |
-
}
|
4637 |
|
4638 |
if ( $dropdown.val() === 'csv' ) {
|
4639 |
jQuery( '.csv_opts' ).show();
|
@@ -4674,10 +4726,10 @@ function frmAdminBuildJS() {
|
|
4674 |
}
|
4675 |
|
4676 |
function initiateMultiselect() {
|
4677 |
-
jQuery( '.frm_multiselect' ).multiselect(
|
4678 |
templates: {ul: '<ul class="multiselect-container frm-dropdown-menu"></ul>'},
|
4679 |
buttonContainer: '<div class="btn-group frm-btn-group dropdown" />',
|
4680 |
-
nonSelectedText: frm_admin_js
|
4681 |
onDropdownShown: function( event ) {
|
4682 |
var action = jQuery( event.currentTarget.closest( '.frm_form_action_settings, #frm-show-fields' ) );
|
4683 |
if ( action.length ) {
|
@@ -4685,10 +4737,10 @@ function frmAdminBuildJS() {
|
|
4685 |
if ( jQuery( '.multiselect-container.frm-dropdown-menu' ).is( ':visible' ) ) {
|
4686 |
jQuery( event.currentTarget ).removeClass( 'open' );
|
4687 |
}
|
4688 |
-
}
|
4689 |
}
|
4690 |
}
|
4691 |
-
}
|
4692 |
}
|
4693 |
|
4694 |
/* Addons page */
|
@@ -4710,10 +4762,10 @@ function frmAdminBuildJS() {
|
|
4710 |
var el = button.parent();
|
4711 |
var message = el.parent().find( '.addon-status-label' );
|
4712 |
|
4713 |
-
button.addClass('frm_loading_button');
|
4714 |
|
4715 |
// Process the Ajax to perform the activation.
|
4716 |
-
jQuery.ajax(
|
4717 |
url: ajaxurl,
|
4718 |
type: 'POST',
|
4719 |
async: true,
|
@@ -4721,7 +4773,7 @@ function frmAdminBuildJS() {
|
|
4721 |
dataType: 'json',
|
4722 |
data: {
|
4723 |
action: action,
|
4724 |
-
nonce:
|
4725 |
plugin: plugin
|
4726 |
},
|
4727 |
success: function( response ) {
|
@@ -4749,10 +4801,10 @@ function frmAdminBuildJS() {
|
|
4749 |
|
4750 |
afterAddonInstall( response, button, message, el );
|
4751 |
},
|
4752 |
-
error: function(
|
4753 |
-
button.removeClass('frm_loading_button');
|
4754 |
}
|
4755 |
-
}
|
4756 |
}
|
4757 |
|
4758 |
function installAddonWithCreds( e ) {
|
@@ -4765,7 +4817,7 @@ function frmAdminBuildJS() {
|
|
4765 |
|
4766 |
proceed.addClass( 'frm_loading_button' );
|
4767 |
|
4768 |
-
jQuery.ajax(
|
4769 |
url: ajaxurl,
|
4770 |
type: 'POST',
|
4771 |
async: true,
|
@@ -4790,16 +4842,16 @@ function frmAdminBuildJS() {
|
|
4790 |
loader.hide();
|
4791 |
jQuery( '.frm-inline-error' ).remove();
|
4792 |
//proceed.val(admin.proceed);
|
4793 |
-
//proceed.after('<span class="frm-inline-error">' + admin.connect_error + '</span>');
|
4794 |
return;
|
4795 |
}
|
4796 |
|
4797 |
afterAddonInstall( response, proceed, message, el );
|
4798 |
},
|
4799 |
-
error: function(
|
4800 |
proceed.removeClass( 'frm_loading_button' );
|
4801 |
}
|
4802 |
-
}
|
4803 |
}
|
4804 |
|
4805 |
function afterAddonInstall( response, button, message, el ) {
|
@@ -4813,8 +4865,8 @@ function frmAdminBuildJS() {
|
|
4813 |
jQuery( '#frm_upgrade_modal .frm_lock_icon use' ).attr( 'xlink:href', '#frm_lock_open_icon' );
|
4814 |
|
4815 |
// Proceed with CSS changes
|
4816 |
-
el.parent().removeClass('frm-addon-not-installed frm-addon-installed').addClass('frm-addon-active');
|
4817 |
-
button.removeClass('frm_loading_button');
|
4818 |
|
4819 |
// Maybe refresh import and SMTP pages
|
4820 |
var refreshPage = document.querySelectorAll( '.frm-admin-page-import, #frm-admin-smtp' );
|
@@ -4840,7 +4892,7 @@ function frmAdminBuildJS() {
|
|
4840 |
jQuery( '.frm-new-form-button' ).click( function( event ) {
|
4841 |
event.preventDefault();
|
4842 |
$info.dialog( 'open' );
|
4843 |
-
}
|
4844 |
|
4845 |
jQuery( document ).on( 'submit', '#frm-new-form', installTemplate );
|
4846 |
}
|
@@ -4864,7 +4916,7 @@ function frmAdminBuildJS() {
|
|
4864 |
frmApiPreview( cont, link );
|
4865 |
}
|
4866 |
$preview.dialog( 'open' );
|
4867 |
-
}
|
4868 |
}
|
4869 |
|
4870 |
var $info = initModal( '#frm_template_modal', '650px' );
|
@@ -4884,7 +4936,7 @@ function frmAdminBuildJS() {
|
|
4884 |
nameLabel.innerHTML = nameLabel.getAttribute( 'data-form' );
|
4885 |
descLabel.innerHTML = descLabel.getAttribute( 'data-form' );
|
4886 |
$info.dialog( 'open' );
|
4887 |
-
}
|
4888 |
|
4889 |
jQuery( '.frm-build-template' ).click( function( event ) {
|
4890 |
event.preventDefault();
|
@@ -4897,7 +4949,7 @@ function frmAdminBuildJS() {
|
|
4897 |
document.getElementById( 'frm_link' ).value = this.getAttribute( 'data-formid' );
|
4898 |
document.getElementById( 'frm_action_type' ).value = 'frm_build_template';
|
4899 |
$info.dialog( 'open' );
|
4900 |
-
}
|
4901 |
|
4902 |
jQuery( '.frm-new-form-button' ).click( function( event ) {
|
4903 |
event.preventDefault();
|
@@ -4910,7 +4962,7 @@ function frmAdminBuildJS() {
|
|
4910 |
document.getElementById( 'frm_link' ).value = '';
|
4911 |
document.getElementById( 'frm_action_type' ).value = 'frm_install_form';
|
4912 |
$info.dialog( 'open' );
|
4913 |
-
}
|
4914 |
|
4915 |
jQuery( document ).on( 'submit', '#frm-new-template', installTemplate );
|
4916 |
}
|
@@ -4927,7 +4979,7 @@ function frmAdminBuildJS() {
|
|
4927 |
return;
|
4928 |
}
|
4929 |
|
4930 |
-
jQuery( '.frm-' + type + '-search' ).autocomplete(
|
4931 |
delay: 100,
|
4932 |
minLength: 0,
|
4933 |
source: ajaxurl + '?action=frm_' + type + '_search&nonce=' + frmGlobal.nonce,
|
@@ -4939,12 +4991,12 @@ function frmAdminBuildJS() {
|
|
4939 |
collision: 'flip'
|
4940 |
},
|
4941 |
response: function( event, ui ) {
|
4942 |
-
if ( !ui.content.length ) {
|
4943 |
var noResult = { value: '', label: frm_admin_js.no_items_found };
|
4944 |
ui.content.push( noResult );
|
4945 |
}
|
4946 |
},
|
4947 |
-
create: function(
|
4948 |
var $container = jQuery( this ).parent();
|
4949 |
|
4950 |
if ( $container.length === 0 ) {
|
@@ -4953,19 +5005,19 @@ function frmAdminBuildJS() {
|
|
4953 |
|
4954 |
jQuery( this ).autocomplete( 'option', 'appendTo', $container );
|
4955 |
}
|
4956 |
-
}
|
4957 |
-
.focus( function(){
|
4958 |
// Show options on click to make it work more like a dropdown.
|
4959 |
if ( this.value === '' || this.nextElementSibling.value < 1 ) {
|
4960 |
jQuery( this ).autocomplete( 'search', this.value );
|
4961 |
}
|
4962 |
-
}
|
4963 |
}
|
4964 |
|
4965 |
/**
|
4966 |
* Prevent the value from changing when using keyboard to scroll.
|
4967 |
*/
|
4968 |
-
function autoCompleteFocus(
|
4969 |
return false;
|
4970 |
}
|
4971 |
|
@@ -4983,7 +5035,7 @@ function frmAdminBuildJS() {
|
|
4983 |
|
4984 |
function frmApiPreview( cont, link ) {
|
4985 |
cont.innerHTML = '<div class="frm-wait"></div>';
|
4986 |
-
jQuery.ajax(
|
4987 |
dataType: 'json',
|
4988 |
url: link,
|
4989 |
success: function( json ) {
|
@@ -4994,17 +5046,17 @@ function frmAdminBuildJS() {
|
|
4994 |
form = form.replace( '<form ', '<form onsubmit="event.preventDefault();" ' );
|
4995 |
cont.innerHTML = '<div class="frm-wait" id="frm-remove-me"></div><div class="frm-fade" id="frm-show-me">' +
|
4996 |
form + '</div>';
|
4997 |
-
setTimeout( function(){
|
4998 |
document.getElementById( 'frm-remove-me' ).style.display = 'none';
|
4999 |
document.getElementById( 'frm-show-me' ).style.opacity = '1';
|
5000 |
}, 300 );
|
5001 |
}
|
5002 |
-
}
|
5003 |
}
|
5004 |
|
5005 |
function installTemplate( e ) {
|
5006 |
/*jshint validthis:true */
|
5007 |
-
var action = this.elements
|
5008 |
button = this.querySelector( 'button' );
|
5009 |
e.preventDefault();
|
5010 |
button.classList.add( 'frm_loading_button' );
|
@@ -5031,7 +5083,7 @@ function frmAdminBuildJS() {
|
|
5031 |
jQuery( '.spinner' ).css( 'visibility', 'hidden' );
|
5032 |
// TODO: show response.message
|
5033 |
}
|
5034 |
-
}
|
5035 |
}
|
5036 |
|
5037 |
function trashTemplate( e ) {
|
@@ -5048,8 +5100,8 @@ function frmAdminBuildJS() {
|
|
5048 |
var card = document.getElementById( 'frm-template-custom-' + id );
|
5049 |
fadeOut( card, function() {
|
5050 |
card.parentNode.removeChild( card );
|
5051 |
-
}
|
5052 |
-
}
|
5053 |
}
|
5054 |
|
5055 |
function searchContent() {
|
@@ -5062,7 +5114,7 @@ function frmAdminBuildJS() {
|
|
5062 |
|
5063 |
if ( this.tagName === 'SELECT' ) {
|
5064 |
searchText = selectedOptions( this );
|
5065 |
-
searchText = searchText.join('|').toLowerCase();
|
5066 |
regEx = true;
|
5067 |
}
|
5068 |
|
@@ -5116,9 +5168,9 @@ function frmAdminBuildJS() {
|
|
5116 |
|
5117 |
function postAjax( data, success ) {
|
5118 |
var xmlHttp = new XMLHttpRequest();
|
5119 |
-
var params = typeof data
|
5120 |
function( k ) {
|
5121 |
-
return encodeURIComponent( k ) + '=' + encodeURIComponent( data[k]
|
5122 |
}
|
5123 |
).join( '&' );
|
5124 |
|
@@ -5143,12 +5195,12 @@ function frmAdminBuildJS() {
|
|
5143 |
setTimeout( success, 1000 );
|
5144 |
}
|
5145 |
|
5146 |
-
function invisible(classes) {
|
5147 |
-
jQuery(classes).css('visibility', 'hidden');
|
5148 |
}
|
5149 |
|
5150 |
-
function visible(classes) {
|
5151 |
-
jQuery(classes).css('visibility', 'visible');
|
5152 |
}
|
5153 |
|
5154 |
function initModal( id, width ) {
|
@@ -5160,7 +5212,7 @@ function frmAdminBuildJS() {
|
|
5160 |
if ( typeof width === 'undefined' ) {
|
5161 |
width = '550px';
|
5162 |
}
|
5163 |
-
$info.dialog(
|
5164 |
dialogClass: 'frm-dialog',
|
5165 |
modal: true,
|
5166 |
autoOpen: false,
|
@@ -5168,7 +5220,7 @@ function frmAdminBuildJS() {
|
|
5168 |
width: width,
|
5169 |
resizable: false,
|
5170 |
draggable: false,
|
5171 |
-
open: function(
|
5172 |
jQuery( '.ui-dialog-titlebar' ).addClass( 'frm_hidden' ).removeClass( 'ui-helper-clearfix' );
|
5173 |
jQuery( '#wpwrap' ).addClass( 'frm_overlay' );
|
5174 |
jQuery( '.frm-dialog' ).removeClass( 'ui-widget ui-widget-content ui-corner-all' );
|
@@ -5177,13 +5229,13 @@ function frmAdminBuildJS() {
|
|
5177 |
// close dialog by clicking the overlay behind it
|
5178 |
jQuery( '.ui-widget-overlay, a.dismiss' ).bind( 'click', function() {
|
5179 |
$info.dialog( 'close' );
|
5180 |
-
}
|
5181 |
},
|
5182 |
close: function() {
|
5183 |
jQuery( '#wpwrap' ).removeClass( 'frm_overlay' );
|
5184 |
jQuery( '.spinner' ).css( 'visibility', 'hidden' );
|
5185 |
}
|
5186 |
-
}
|
5187 |
|
5188 |
return $info;
|
5189 |
}
|
@@ -5217,7 +5269,7 @@ function frmAdminBuildJS() {
|
|
5217 |
function maybeChangeEmbedFormMsg() {
|
5218 |
var fieldId = jQuery( this ).closest( '.frm-single-settings' ).data( 'fid' );
|
5219 |
var fieldItem = document.getElementById( 'frm_field_id_' + fieldId );
|
5220 |
-
if ( null === fieldItem || 'form' !== fieldItem.dataset
|
5221 |
return;
|
5222 |
}
|
5223 |
|
@@ -5268,14 +5320,14 @@ function frmAdminBuildJS() {
|
|
5268 |
jQuery( '.wp-admin' ).click( function( e ) {
|
5269 |
var t = jQuery( e.target );
|
5270 |
var $openDrop = jQuery( '.dropdown.open' );
|
5271 |
-
if ( $openDrop.length && ! t.hasClass( 'dropdown' ) && !t.closest( '.dropdown' ).length ) {
|
5272 |
$openDrop.removeClass( 'open' );
|
5273 |
}
|
5274 |
-
}
|
5275 |
jQuery( '#frm_bs_dropdown:not(.open) a' ).click( focusSearchBox );
|
5276 |
|
5277 |
-
if ( typeof
|
5278 |
-
|
5279 |
}
|
5280 |
|
5281 |
if ( $newFields.length > 0 ) {
|
@@ -5309,7 +5361,7 @@ function frmAdminBuildJS() {
|
|
5309 |
jQuery( '[data-frmprint]' ).click( function() {
|
5310 |
window.print();
|
5311 |
return false;
|
5312 |
-
}
|
5313 |
}
|
5314 |
|
5315 |
var $advInfo = jQuery( document.getElementById( 'frm_adv_info' ) );
|
@@ -5330,13 +5382,13 @@ function frmAdminBuildJS() {
|
|
5330 |
this.style.display = 'none';
|
5331 |
}
|
5332 |
return false;
|
5333 |
-
}
|
5334 |
|
5335 |
jQuery( '.cancel-frm_shortcode', '#frm_shortcodediv' ).click( function() {
|
5336 |
$shortCodeDiv.slideUp( 'fast' );
|
5337 |
$shortCodeDiv.siblings( 'a.edit-frm_shortcode' ).show();
|
5338 |
return false;
|
5339 |
-
}
|
5340 |
}
|
5341 |
|
5342 |
// tabs
|
@@ -5346,7 +5398,7 @@ function frmAdminBuildJS() {
|
|
5346 |
clickTab( this );
|
5347 |
return false;
|
5348 |
}
|
5349 |
-
}
|
5350 |
clickTab( jQuery( '.starttab a' ), 'auto' );
|
5351 |
|
5352 |
// submit the search form with dropdown
|
@@ -5355,11 +5407,11 @@ function frmAdminBuildJS() {
|
|
5355 |
jQuery( 'select[name="fid"]' ).val( val );
|
5356 |
jQuery( document.getElementById( 'posts-filter' ) ).submit();
|
5357 |
return false;
|
5358 |
-
}
|
5359 |
|
5360 |
jQuery( '.frm_select_box' ).on( 'click focus', function() {
|
5361 |
this.select();
|
5362 |
-
}
|
5363 |
|
5364 |
jQuery( document ).on( 'input search change', '.frm-auto-search', searchContent );
|
5365 |
jQuery( document ).on( 'focusin click', '.frm-auto-search', stopPropagation );
|
@@ -5380,27 +5432,27 @@ function frmAdminBuildJS() {
|
|
5380 |
|
5381 |
buildInit: function() {
|
5382 |
if ( jQuery( '.frm_field_loading' ).length ) {
|
5383 |
-
var
|
5384 |
-
loadFields(
|
5385 |
}
|
5386 |
|
5387 |
setupSortable( 'ul.frm_sorting' );
|
5388 |
|
5389 |
// Show message if section has no fields inside
|
5390 |
-
var
|
5391 |
-
for ( i = 0; i <
|
5392 |
-
if (
|
5393 |
-
jQuery(
|
5394 |
}
|
5395 |
}
|
5396 |
|
5397 |
-
jQuery( '.field_type_list > li:not(.frm_noallow)' ).draggable(
|
5398 |
connectToSortable: '#frm-show-fields',
|
5399 |
helper: 'clone',
|
5400 |
revert: 'invalid',
|
5401 |
delay: 10,
|
5402 |
cancel: '.frm-dropdown-menu'
|
5403 |
-
}
|
5404 |
jQuery( 'ul.field_type_list, .field_type_list li, ul.frm_code_list, .frm_code_list li, .frm_code_list li a, #frm_adv_info #category-tabs li, #frm_adv_info #category-tabs li a' ).disableSelection();
|
5405 |
|
5406 |
jQuery( '.frm_submit_ajax' ).click( submitBuild );
|
@@ -5414,11 +5466,11 @@ function frmAdminBuildJS() {
|
|
5414 |
jQuery( document.getElementById( 'form-status-display' ) ).html( newStatus );
|
5415 |
jQuery( '.cancel-form-status' ).click();
|
5416 |
return false;
|
5417 |
-
}
|
5418 |
|
5419 |
jQuery( '.frm_form_builder form:first' ).submit( function() {
|
5420 |
jQuery( '.inplace_field' ).blur();
|
5421 |
-
}
|
5422 |
|
5423 |
initiateMultiselect();
|
5424 |
renumberPageBreaks();
|
@@ -5445,10 +5497,10 @@ function frmAdminBuildJS() {
|
|
5445 |
$builderForm.on( 'change', '.frm_js_checkbox_limit', checkCheckboxSelectionsLimit );
|
5446 |
$builderForm.on( 'input', 'input[name^="field_options[add_label_"]', function() {
|
5447 |
updateRepeatText( this, 'add' );
|
5448 |
-
}
|
5449 |
$builderForm.on( 'input', 'input[name^="field_options[remove_label_"]', function() {
|
5450 |
updateRepeatText( this, 'remove' );
|
5451 |
-
}
|
5452 |
$builderForm.on( 'change', 'select[name^="field_options[data_type_"]', maybeClearWatchFields );
|
5453 |
jQuery( builderArea ).on( 'click', '.frm-collapse-page', maybeCollapsePage );
|
5454 |
jQuery( builderArea ).on( 'click', '.frm-collapse-section', maybeCollapseSection );
|
@@ -5495,7 +5547,8 @@ function frmAdminBuildJS() {
|
|
5495 |
},
|
5496 |
|
5497 |
settingsInit: function() {
|
5498 |
-
var $
|
|
|
5499 |
//BCC, CC, and Reply To button functionality
|
5500 |
$formActions.on( 'click', '.frm_email_buttons', showEmailRow );
|
5501 |
$formActions.on( 'click', '.frm_remove_field', hideEmailRow );
|
@@ -5510,7 +5563,7 @@ function frmAdminBuildJS() {
|
|
5510 |
$formActions.on( 'click', '.frm_duplicate_form_action', copyFormAction );
|
5511 |
jQuery( 'select[data-toggleclass], input[data-toggleclass]' ).change( toggleFormOpts );
|
5512 |
jQuery( '.frm_actions_list' ).on( 'click', '.frm_active_action', addFormAction );
|
5513 |
-
jQuery( '#frm-show-groups, #frm-hide-groups').click( toggleActionGroups );
|
5514 |
initiateMultiselect();
|
5515 |
|
5516 |
//set actions icons to inactive
|
@@ -5519,14 +5572,14 @@ function frmAdminBuildJS() {
|
|
5519 |
|
5520 |
// If the icon is a background image, don't add BG color.
|
5521 |
var icon = jQuery( this ).find( 'i' );
|
5522 |
-
if ( icon.css('background-image') !== 'none' ) {
|
5523 |
icon.addClass( 'frm-inverse' );
|
5524 |
}
|
5525 |
-
}
|
5526 |
|
5527 |
jQuery( '.frm_submit_settings_btn' ).click( submitSettings );
|
5528 |
|
5529 |
-
|
5530 |
formSettings.on( 'click', '.frm_add_form_logic', addFormLogicRow );
|
5531 |
formSettings.on( 'blur', '.frm_email_blur', formatEmailSetting );
|
5532 |
formSettings.on( 'click', '.frm_already_used', onlyOneActionMessage );
|
@@ -5552,7 +5605,7 @@ function frmAdminBuildJS() {
|
|
5552 |
if ( sidebar !== null && ! isChild && sidebar.display !== 'none' ) {
|
5553 |
hideShortcodes( sidebar );
|
5554 |
}
|
5555 |
-
}
|
5556 |
|
5557 |
//Warning when user selects "Do not store entries ..."
|
5558 |
jQuery( document.getElementById( 'no_save' ) ).change( function() {
|
@@ -5562,31 +5615,31 @@ function frmAdminBuildJS() {
|
|
5562 |
jQuery( this ).attr( 'checked', false );
|
5563 |
}
|
5564 |
}
|
5565 |
-
}
|
5566 |
|
5567 |
//Show/hide Messages header
|
5568 |
jQuery( '#editable, #edit_action, #save_draft, #success_action' ).change( function() {
|
5569 |
maybeShowFormMessages();
|
5570 |
-
}
|
5571 |
-
jQuery(
|
5572 |
|
5573 |
-
|
5574 |
jQuery( $loggedIn ).change( function() {
|
5575 |
if ( this.checked ) {
|
5576 |
visible( '.hide_logged_in' );
|
5577 |
} else {
|
5578 |
invisible( '.hide_logged_in' );
|
5579 |
}
|
5580 |
-
}
|
5581 |
|
5582 |
-
|
5583 |
jQuery( document.getElementById( 'frm_single_entry_type' ) ).change( function() {
|
5584 |
if ( this.value === 'cookie' ) {
|
5585 |
$cookieExp.fadeIn( 'slow' );
|
5586 |
} else {
|
5587 |
$cookieExp.fadeOut( 'slow' );
|
5588 |
}
|
5589 |
-
}
|
5590 |
|
5591 |
var $singleEntry = document.getElementById( 'single_entry' );
|
5592 |
jQuery( $singleEntry ).change( function() {
|
@@ -5601,7 +5654,7 @@ function frmAdminBuildJS() {
|
|
5601 |
} else {
|
5602 |
$cookieExp.fadeOut( 'slow' );
|
5603 |
}
|
5604 |
-
}
|
5605 |
|
5606 |
jQuery( '.hide_save_draft' ).hide();
|
5607 |
|
@@ -5612,11 +5665,11 @@ function frmAdminBuildJS() {
|
|
5612 |
} else {
|
5613 |
jQuery( '.hide_save_draft' ).fadeOut( 'slow' );
|
5614 |
}
|
5615 |
-
}
|
5616 |
$saveDraft.change();
|
5617 |
|
5618 |
//If Allow editing is checked/unchecked
|
5619 |
-
|
5620 |
jQuery( $editable ).change( function() {
|
5621 |
if ( this.checked ) {
|
5622 |
jQuery( '.hide_editable' ).fadeIn( 'slow' );
|
@@ -5625,18 +5678,20 @@ function frmAdminBuildJS() {
|
|
5625 |
jQuery( '.hide_editable' ).fadeOut( 'slow' );
|
5626 |
jQuery( '.edit_action_message_box' ).fadeOut( 'slow' );//Hide On Update message box
|
5627 |
}
|
5628 |
-
}
|
5629 |
|
5630 |
// Page Selection Autocomplete
|
5631 |
initSelectionAutocomplete();
|
5632 |
},
|
5633 |
|
5634 |
panelInit: function() {
|
|
|
|
|
5635 |
jQuery( '.frm_wrap, #postbox-container-1' ).on( 'click', '.frm_insert_code', insertCode );
|
5636 |
jQuery( document ).on( 'change', '.frm_insert_val', function() {
|
5637 |
insertFieldCode( jQuery( this ).data( 'target' ), jQuery( this ).val() );
|
5638 |
jQuery( this ).val( '' );
|
5639 |
-
}
|
5640 |
|
5641 |
jQuery( document ).on( 'click change', '#frm-id-key-condition', resetLogicBuilder );
|
5642 |
jQuery( document ).on( 'keyup change', '.frm-build-logic', setLogicExample );
|
@@ -5648,13 +5703,13 @@ function frmAdminBuildJS() {
|
|
5648 |
});
|
5649 |
jQuery( document ).on( 'mousedown', '.frm-show-box', showShortcodes );
|
5650 |
|
5651 |
-
|
5652 |
-
|
5653 |
-
|
5654 |
-
insertFieldsTab = document.getElementById( 'frm_insert_fields_tab' );
|
5655 |
|
5656 |
if ( settingsPage !== null || viewPage ) {
|
5657 |
jQuery( document ).on( 'focusin', 'form input, form textarea', function( e ) {
|
|
|
5658 |
e.stopPropagation();
|
5659 |
maybeShowModal( this );
|
5660 |
|
@@ -5666,7 +5721,7 @@ function frmAdminBuildJS() {
|
|
5666 |
|
5667 |
if ( settingsPage !== null ) {
|
5668 |
/* form settings page */
|
5669 |
-
|
5670 |
if ( jQuery( this ).closest( '#html_settings' ).length > 0 ) {
|
5671 |
htmlTab.show();
|
5672 |
htmlTab.siblings().hide();
|
@@ -5683,20 +5738,20 @@ function frmAdminBuildJS() {
|
|
5683 |
toggleAllowedShortcodes( this.id, e.type );
|
5684 |
}
|
5685 |
}
|
5686 |
-
}
|
5687 |
}
|
5688 |
|
5689 |
jQuery( '.frm_wrap, #postbox-container-1' ).on( 'mousedown', '#frm_adv_info a, .frm_field_list a', function( e ) {
|
5690 |
e.preventDefault();
|
5691 |
-
}
|
5692 |
|
5693 |
-
|
5694 |
customPanel.on( 'click', '.subsubsub a.frmids', function( e ) {
|
5695 |
toggleKeyID( 'frmids', e );
|
5696 |
-
}
|
5697 |
customPanel.on( 'click', '.subsubsub a.frmkeys', function( e ) {
|
5698 |
toggleKeyID( 'frmkeys', e );
|
5699 |
-
}
|
5700 |
},
|
5701 |
|
5702 |
templateInit: function() {
|
@@ -5705,7 +5760,8 @@ function frmAdminBuildJS() {
|
|
5705 |
},
|
5706 |
|
5707 |
viewInit: function() {
|
5708 |
-
var $
|
|
|
5709 |
$advInfo.before( '<div id="frm_position_ele"></div>' );
|
5710 |
setupMenuOffset();
|
5711 |
|
@@ -5733,7 +5789,7 @@ function frmAdminBuildJS() {
|
|
5733 |
|
5734 |
jQuery( document.getElementById( 'form_id' ) ).change( displayFormSelected );
|
5735 |
|
5736 |
-
|
5737 |
$addRemove.on( 'click', '.frm_add_order_row', addOrderRow );
|
5738 |
$addRemove.on( 'click', '.frm_add_where_row', addWhereRow );
|
5739 |
$addRemove.on( 'change', '.frm_insert_where_options', insertWhereOptions );
|
@@ -5749,36 +5805,36 @@ function frmAdminBuildJS() {
|
|
5749 |
document.getElementById( 'frm_field_font_size' ).addEventListener( 'change', textSquishCheck );
|
5750 |
document.getElementById( 'frm_field_pad' ).addEventListener( 'change', textSquishCheck );
|
5751 |
|
5752 |
-
jQuery( 'input.hex' ).wpColorPicker(
|
5753 |
-
change: function( event
|
5754 |
var hexcolor = jQuery( this ).wpColorPicker( 'color' );
|
5755 |
jQuery( event.target ).val( hexcolor ).change();
|
5756 |
}
|
5757 |
-
}
|
5758 |
jQuery( '.wp-color-result-text' ).text( function( i, oldText ) {
|
5759 |
return oldText === 'Select Color' ? 'Select' : oldText;
|
5760 |
-
}
|
5761 |
|
5762 |
// update styling on change
|
5763 |
jQuery( '#frm_styling_form .styling_settings' ).change( function() {
|
5764 |
var locStr = jQuery( 'input[name^="frm_style_setting[post_content]"], select[name^="frm_style_setting[post_content]"], textarea[name^="frm_style_setting[post_content]"], input[name="style_name"]' ).serializeArray();
|
5765 |
locStr = JSON.stringify( locStr );
|
5766 |
-
jQuery.ajax(
|
5767 |
type: 'POST', url: ajaxurl,
|
5768 |
data: {
|
5769 |
action: 'frm_change_styling',
|
5770 |
nonce: frmGlobal.nonce,
|
5771 |
-
frm_style_setting: locStr
|
5772 |
},
|
5773 |
success: function( css ) {
|
5774 |
document.getElementById( 'this_css' ).innerHTML = css;
|
5775 |
}
|
5776 |
-
}
|
5777 |
-
}
|
5778 |
|
5779 |
// menu tabs
|
5780 |
jQuery( '#menu-settings-column' ).bind( 'click', function( e ) {
|
5781 |
-
var
|
5782 |
target = jQuery( e.target );
|
5783 |
|
5784 |
if ( e.target.className.indexOf( 'nav-tab-link' ) !== -1 ) {
|
@@ -5799,7 +5855,7 @@ function frmAdminBuildJS() {
|
|
5799 |
|
5800 |
e.preventDefault();
|
5801 |
}
|
5802 |
-
}
|
5803 |
|
5804 |
jQuery( '.multiselect-container.frm-dropdown-menu li a' ).click( function() {
|
5805 |
var radio = this.children[0].children[0];
|
@@ -5811,7 +5867,7 @@ function frmAdminBuildJS() {
|
|
5811 |
// set active class
|
5812 |
btnGrp.find( 'li.active' ).removeClass( 'active' );
|
5813 |
jQuery( this ).closest( 'li' ).addClass( 'active' );
|
5814 |
-
}
|
5815 |
|
5816 |
jQuery( '#frm_confirm_modal' ).on( 'click', '[data-resetstyle]', function( e ) {
|
5817 |
var button = document.getElementById( 'frm_reset_style' );
|
@@ -5819,31 +5875,31 @@ function frmAdminBuildJS() {
|
|
5819 |
button.classList.add( 'frm_loading_button' );
|
5820 |
e.stopPropagation();
|
5821 |
|
5822 |
-
jQuery.ajax(
|
5823 |
type: 'POST', url: ajaxurl,
|
5824 |
data: {action: 'frm_settings_reset', nonce: frmGlobal.nonce},
|
5825 |
success: function( errObj ) {
|
|
|
5826 |
errObj = errObj.replace( /^\s+|\s+$/g, '' );
|
5827 |
if ( errObj.indexOf( '{' ) === 0 ) {
|
5828 |
errObj = jQuery.parseJSON( errObj );
|
5829 |
}
|
5830 |
-
for (
|
5831 |
-
jQuery( 'input[name$="[' + key + ']"], select[name$="[' + key + ']"]' ).val( errObj[key]
|
5832 |
}
|
5833 |
jQuery( '#frm_submit_style, #frm_auto_width' ).prop( 'checked', false );
|
5834 |
jQuery( document.getElementById( 'frm_fieldset' ) ).change();
|
5835 |
button.classList.remove( 'frm_loading_button' );
|
5836 |
}
|
5837 |
-
}
|
5838 |
-
}
|
5839 |
|
5840 |
-
jQuery( '.frm_pro_form #datepicker_sample' ).datepicker(
|
5841 |
|
5842 |
jQuery( document.getElementById( 'frm_position' ) ).change( setPosClass );
|
5843 |
|
5844 |
jQuery( 'select[name$="[theme_selector]"]' ).change( function() {
|
5845 |
var themeVal = jQuery( this ).val();
|
5846 |
-
var themeName = themeVal;
|
5847 |
var css = themeVal;
|
5848 |
if ( themeVal !== -1 ) {
|
5849 |
if ( themeVal === 'ui-lightness' && frm_admin_js.pro_url !== '' ) {
|
@@ -5858,26 +5914,28 @@ function frmAdminBuildJS() {
|
|
5858 |
updateUICSS( css );
|
5859 |
document.getElementById( 'frm_theme_css' ).value = themeVal;
|
5860 |
return false;
|
5861 |
-
}
|
5862 |
},
|
5863 |
|
5864 |
customCSSInit: function() {
|
5865 |
/* deprecated since WP 4.9 */
|
5866 |
var customCSS = document.getElementById( 'frm_custom_css_box' );
|
5867 |
if ( customCSS !== null ) {
|
5868 |
-
|
5869 |
lineNumbers: true
|
5870 |
-
}
|
5871 |
}
|
5872 |
},
|
5873 |
|
5874 |
globalSettingsInit: function() {
|
5875 |
-
|
|
|
|
|
5876 |
|
5877 |
initiateMultiselect();
|
5878 |
|
5879 |
// activate addon licenses
|
5880 |
-
|
5881 |
if ( licenseTab !== null ) {
|
5882 |
jQuery( licenseTab ).on( 'click', '.edd_frm_save_license', saveAddonLicense );
|
5883 |
}
|
@@ -5886,9 +5944,9 @@ function frmAdminBuildJS() {
|
|
5886 |
event.preventDefault();
|
5887 |
jQuery.post( ajaxurl, {
|
5888 |
action: 'frm_lite_settings_upgrade'
|
5889 |
-
}
|
5890 |
jQuery( '.settings-lite-cta' ).remove();
|
5891 |
-
}
|
5892 |
},
|
5893 |
|
5894 |
exportInit: function() {
|
@@ -5906,35 +5964,34 @@ function frmAdminBuildJS() {
|
|
5906 |
action: 'frm_dismiss_migrator',
|
5907 |
plugin: this.id,
|
5908 |
nonce: frmGlobal.nonce
|
5909 |
-
}
|
5910 |
this.parentElement.remove();
|
5911 |
-
}
|
5912 |
},
|
5913 |
|
5914 |
-
updateOpts: function(
|
5915 |
-
var separate = usingSeparateValues(
|
5916 |
-
|
5917 |
-
|
5918 |
-
jQuery.ajax( {
|
5919 |
type: 'POST',
|
5920 |
url: ajaxurl,
|
5921 |
data: {
|
5922 |
action: action,
|
5923 |
-
field_id:
|
5924 |
opts: opts,
|
5925 |
separate: separate,
|
5926 |
nonce: frmGlobal.nonce
|
5927 |
},
|
5928 |
success: function( html ) {
|
5929 |
-
document.getElementById( 'frm_field_' +
|
5930 |
-
resetDisplayedOpts(
|
5931 |
|
5932 |
if ( typeof modal !== 'undefined' ) {
|
5933 |
modal.dialog( 'close' );
|
5934 |
document.getElementById( 'frm-update-bulk-opts' ).classList.remove( 'frm_loading_button' );
|
5935 |
}
|
5936 |
}
|
5937 |
-
}
|
5938 |
},
|
5939 |
|
5940 |
/* remove conditional logic if the field doesn't exist */
|
@@ -5952,49 +6009,50 @@ function frmAdminBuildJS() {
|
|
5952 |
};
|
5953 |
}
|
5954 |
|
5955 |
-
|
5956 |
|
5957 |
jQuery( document ).ready( function( $ ) {
|
5958 |
frmAdminBuild.init();
|
5959 |
-
}
|
5960 |
|
5961 |
-
function frm_remove_tag(
|
5962 |
console.warn( 'DEPRECATED: function frm_remove_tag in v2.0' );
|
5963 |
-
jQuery(
|
5964 |
}
|
5965 |
|
5966 |
-
function frm_show_div( div, value,
|
5967 |
-
if ( value ==
|
5968 |
-
jQuery(
|
5969 |
} else {
|
5970 |
-
jQuery(
|
5971 |
}
|
5972 |
}
|
5973 |
|
5974 |
function frmCheckAll( checked, n ) {
|
5975 |
if ( checked ) {
|
5976 |
-
jQuery(
|
5977 |
} else {
|
5978 |
-
jQuery(
|
5979 |
}
|
5980 |
}
|
5981 |
|
5982 |
function frmCheckAllLevel( checked, n, level ) {
|
5983 |
-
var $kids = jQuery(
|
5984 |
if ( checked ) {
|
5985 |
-
$kids.children(
|
5986 |
} else {
|
5987 |
-
$kids.children(
|
5988 |
}
|
5989 |
}
|
5990 |
|
5991 |
-
function frm_add_logic_row( id,
|
5992 |
console.warn( 'DEPRECATED: function frm_add_logic_row in v2.0' );
|
5993 |
-
jQuery.ajax(
|
5994 |
-
type:
|
|
|
5995 |
data: {
|
5996 |
action: 'frm_add_logic_row',
|
5997 |
-
form_id:
|
5998 |
field_id: id,
|
5999 |
meta_name: jQuery( '#frm_logic_row_' + id + ' > div' ).size(),
|
6000 |
nonce: frmGlobal.nonce
|
@@ -6002,39 +6060,39 @@ function frm_add_logic_row( id, form_id ) {
|
|
6002 |
success: function( html ) {
|
6003 |
jQuery( '#frm_logic_row_' + id ).append( html );
|
6004 |
}
|
6005 |
-
}
|
6006 |
return false;
|
6007 |
}
|
6008 |
|
6009 |
-
function frmGetFieldValues(
|
6010 |
|
6011 |
-
if (
|
6012 |
-
jQuery.ajax(
|
6013 |
type: 'POST', url: ajaxurl,
|
6014 |
-
data: 'action=frm_get_field_values¤t_field=' + cur + '&field_id=' +
|
6015 |
success: function( msg ) {
|
6016 |
-
document.getElementById( 'frm_show_selected_values_' + cur + '_' +
|
6017 |
}
|
6018 |
-
}
|
6019 |
}
|
6020 |
}
|
6021 |
|
6022 |
function frmImportCsv( formID ) {
|
6023 |
var urlVars = '';
|
6024 |
-
if ( typeof __FRMURLVARS
|
6025 |
urlVars = __FRMURLVARS;
|
6026 |
}
|
6027 |
|
6028 |
-
jQuery.ajax(
|
6029 |
-
type:
|
6030 |
data: 'action=frm_import_csv&nonce=' + frmGlobal.nonce + '&frm_skip_cookie=1' + urlVars,
|
6031 |
success: function( count ) {
|
6032 |
var max = jQuery( '.frm_admin_progress_bar' ).attr( 'aria-valuemax' );
|
6033 |
var imported = max - count;
|
6034 |
-
var percent = (imported / max) * 100;
|
6035 |
jQuery( '.frm_admin_progress_bar' ).css( 'width', percent + '%' ).attr( 'aria-valuenow', imported );
|
6036 |
|
6037 |
-
if ( parseInt( count ) > 0 ) {
|
6038 |
jQuery( '.frm_csv_remaining' ).html( count );
|
6039 |
frmImportCsv( formID );
|
6040 |
} else {
|
@@ -6044,21 +6102,21 @@ function frmImportCsv( formID ) {
|
|
6044 |
}, 2000 );
|
6045 |
}
|
6046 |
}
|
6047 |
-
}
|
6048 |
}
|
6049 |
|
6050 |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
|
6051 |
if ( ! String.prototype.trim ) {
|
6052 |
-
String.prototype.trim = function
|
6053 |
return this.replace( /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '' );
|
6054 |
};
|
6055 |
}
|
6056 |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith#Polyfill
|
6057 |
-
if (!String.prototype.startsWith) {
|
6058 |
-
Object.defineProperty(String.prototype, 'startsWith', {
|
6059 |
-
value: function(search, pos) {
|
6060 |
-
pos = !pos || pos < 0 ? 0 : +pos;
|
6061 |
-
return this.substring(pos, pos + search.length) === search;
|
6062 |
}
|
6063 |
});
|
6064 |
}
|
1 |
+
/* exported frm_add_logic_row, frm_remove_tag, frm_show_div, frmCheckAll, frmCheckAllLevel */
|
2 |
+
|
3 |
+
var frmAdminBuild;
|
4 |
+
|
5 |
var FrmFormsConnect = window.FrmFormsConnect || ( function( document, window, $ ) {
|
6 |
|
7 |
/*global jQuery:false, frm_admin_js, frmGlobal, ajaxurl */
|
9 |
var el = {
|
10 |
licenseBox: document.getElementById( 'frm_license_top' ),
|
11 |
messageBox: document.getElementsByClassName( 'frm_pro_license_msg' )[0],
|
12 |
+
btn: document.getElementById( 'frm-settings-connect-btn' ),
|
13 |
reset: document.getElementById( 'frm_reconnect_link' )
|
14 |
};
|
15 |
|
34 |
$( el.reset ).click( app.reauthorize );
|
35 |
}
|
36 |
|
37 |
+
$( el.btn ).on( 'click', function( e ) {
|
38 |
e.preventDefault();
|
39 |
app.gotoUpgradeUrl();
|
40 |
+
});
|
41 |
|
42 |
+
window.addEventListener( 'message', function( msg ) {
|
43 |
+
if ( msg.origin.replace( /\/$/, '' ) !== frmGlobal.app_url.replace( /\/$/, '' ) ) {
|
44 |
return;
|
45 |
}
|
46 |
|
47 |
if ( ! msg.data || 'object' !== typeof msg.data ) {
|
48 |
+
console.error( 'Messages from "' + frmGlobal.app_url + '" must contain an api key string.' );
|
49 |
return;
|
50 |
}
|
51 |
|
52 |
+
app.updateForm( msg.data );
|
53 |
});
|
54 |
},
|
55 |
|
59 |
* @since 4.03
|
60 |
*/
|
61 |
gotoUpgradeUrl: function() {
|
62 |
+
var w = window.open( frmGlobal.app_url + '/api-connect/', '_blank', 'location=no,width=500,height=730,scrollbars=0' );
|
63 |
w.focus();
|
64 |
},
|
65 |
|
66 |
+
updateForm: function( response ) {
|
67 |
|
68 |
// Start spinner.
|
69 |
var btn = el.btn;
|
70 |
+
btn.classList.add( 'frm_loading_button' );
|
71 |
|
72 |
if ( response.url !== '' ) {
|
73 |
app.showProgress({
|
74 |
+
success: true,
|
75 |
+
message: 'Installing...'
|
76 |
});
|
77 |
var fallback = setTimeout( function() {
|
78 |
app.showProgress({
|
79 |
+
success: true,
|
80 |
+
message: 'Installing is taking longer than expected. <a class="frm-install-addon button button-primary frm-button-primary" rel="' + response.url + '" aria-label="Install">Install Now</a>'
|
81 |
});
|
82 |
}, 10000 );
|
83 |
+
$.ajax({
|
84 |
type: 'POST',
|
85 |
url: ajaxurl,
|
86 |
dataType: 'json',
|
93 |
clearTimeout( fallback );
|
94 |
app.activateKey( response );
|
95 |
},
|
96 |
+
error: function( xhr, textStatus, e ) {
|
97 |
clearTimeout( fallback );
|
98 |
+
btn.classList.remove( 'frm_loading_button' );
|
99 |
app.showMessage({
|
100 |
+
success: false,
|
101 |
message: e
|
102 |
});
|
103 |
}
|
110 |
activateKey: function( response ) {
|
111 |
var btn = el.btn;
|
112 |
if ( response.key === '' ) {
|
113 |
+
btn.classList.remove( 'frm_loading_button' );
|
114 |
} else {
|
115 |
app.showProgress({
|
116 |
+
success: true,
|
117 |
+
message: 'Activating...'
|
118 |
});
|
119 |
+
$.ajax({
|
120 |
type: 'POST',
|
121 |
url: ajaxurl,
|
122 |
dataType: 'json',
|
128 |
nonce: frmGlobal.nonce
|
129 |
},
|
130 |
success: function( msg ) {
|
131 |
+
btn.classList.remove( 'frm_loading_button' );
|
132 |
|
133 |
if ( msg.success === true ) {
|
134 |
el.licenseBox.classList.replace( 'frm_unauthorized_box', 'frm_authorized_box' );
|
136 |
|
137 |
app.showMessage( msg );
|
138 |
},
|
139 |
+
error: function( xhr, textStatus, e ) {
|
140 |
+
btn.classList.remove( 'frm_loading_button' );
|
141 |
app.showMessage({
|
142 |
+
success: false,
|
143 |
message: e
|
144 |
});
|
145 |
}
|
151 |
authorize: function() {
|
152 |
/*jshint validthis:true */
|
153 |
var button = this;
|
154 |
+
var pluginSlug = this.getAttribute( 'data-plugin' );
|
155 |
var input = document.getElementById( 'edd_' + pluginSlug + '_license_key' );
|
156 |
var license = input.value;
|
157 |
var wpmu = document.getElementById( 'proplug-wpmu' );
|
164 |
wpmu = 0;
|
165 |
}
|
166 |
|
167 |
+
$.ajax({
|
168 |
type: 'POST', url: ajaxurl, dataType: 'json',
|
169 |
data: {
|
170 |
action: 'frm_addon_activate',
|
177 |
app.afterAuthorize( msg, input );
|
178 |
button.classList.remove( 'frm_loading_button' );
|
179 |
}
|
180 |
+
});
|
181 |
},
|
182 |
|
183 |
afterAuthorize: function( msg, input ) {
|
230 |
/*jshint validthis:true */
|
231 |
this.innerHTML = '<span class="frm-wait frm_spinner" style="visibility:visible;float:none"></span>';
|
232 |
|
233 |
+
$.ajax({
|
234 |
type: 'POST',
|
235 |
url: ajaxurl,
|
236 |
dataType: 'json',
|
245 |
window.location.reload();
|
246 |
}
|
247 |
}
|
248 |
+
});
|
249 |
return false;
|
250 |
},
|
251 |
|
252 |
deauthorize: function() {
|
253 |
/*jshint validthis:true */
|
254 |
+
if ( ! confirm( frmGlobal.deauthorize ) ) {
|
255 |
return false;
|
256 |
}
|
257 |
+
var pluginSlug = this.getAttribute( 'data-plugin' ),
|
258 |
input = document.getElementById( 'edd_' + pluginSlug + '_license_key' ),
|
259 |
license = input.value,
|
260 |
link = this;
|
261 |
|
262 |
this.innerHTML = '<span class="frm-wait frm_spinner" style="visibility:visible;"></span>';
|
263 |
|
264 |
+
$.ajax({
|
265 |
type: 'POST',
|
266 |
url: ajaxurl,
|
267 |
data: {
|
270 |
plugin: pluginSlug,
|
271 |
nonce: frmGlobal.nonce
|
272 |
},
|
273 |
+
success: function() {
|
274 |
el.licenseBox.className = el.licenseBox.className.replace( 'frm_authorized_box', 'frm_unauthorized_box' );
|
275 |
input.value = '';
|
276 |
link.innerHTML = '';
|
277 |
}
|
278 |
+
});
|
279 |
return false;
|
280 |
}
|
281 |
};
|
296 |
var cancelSort = false;
|
297 |
var copyHelper = false;
|
298 |
|
299 |
+
var thisFormId = 0;
|
300 |
if ( thisForm !== null ) {
|
301 |
+
thisFormId = thisForm.value;
|
302 |
}
|
303 |
|
304 |
// Global settings
|
354 |
return false;
|
355 |
}
|
356 |
|
357 |
+
var caution = link.getAttribute( 'data-frmcaution' );
|
358 |
var cautionHtml = caution ? '<span class="frm-caution">' + caution + '</span> ' : '';
|
359 |
|
360 |
+
jQuery( '.frm-confirm-msg' ).html( cautionHtml + link.getAttribute( 'data-frmverify' ) );
|
361 |
|
362 |
removeAtts = continueButton.dataset;
|
363 |
for ( i in dataAtts ) {
|
367 |
dataAtts = link.dataset;
|
368 |
for ( i in dataAtts ) {
|
369 |
if ( i !== 'frmverify' ) {
|
370 |
+
continueButton.setAttribute( 'data-' + i, dataAtts[i]);
|
371 |
}
|
372 |
}
|
373 |
|
374 |
+
$info.dialog( 'open' );
|
375 |
continueButton.setAttribute( 'href', link.getAttribute( 'href' ) );
|
376 |
return false;
|
377 |
}
|
501 |
wrapClass.on( 'click', 'a[data-frmhide], a[data-frmshow]', hideShowItem );
|
502 |
wrapClass.on( 'click', '.widget-top,a.widget-action', clickWidget );
|
503 |
|
504 |
+
wrapClass.on( 'mouseenter.frm', '.frm_bstooltip, .frm_help', function() {
|
505 |
jQuery( this ).off( 'mouseenter.frm' );
|
506 |
|
507 |
jQuery( '.frm_bstooltip, .frm_help' ).tooltip( );
|
508 |
jQuery( this ).tooltip( 'show' );
|
509 |
+
});
|
510 |
|
511 |
jQuery( '.frm_bstooltip, .frm_help' ).tooltip( );
|
512 |
}
|
513 |
|
514 |
function removeThisTag() {
|
515 |
/*jshint validthis:true */
|
516 |
+
var show, hide, removeMore,
|
517 |
+
id = '',
|
518 |
deleteButton = jQuery( this ),
|
519 |
continueRemove = confirmLinkClick( this );
|
520 |
|
567 |
var type = jQuery( this ).closest( '.frm_form_action_settings' ).find( '.frm_action_name' ).val();
|
568 |
checkActiveAction( type );
|
569 |
}
|
570 |
+
});
|
571 |
|
572 |
if ( typeof removeMore !== 'undefined' ) {
|
573 |
removeMore = jQuery( removeMore );
|
574 |
removeMore.fadeOut( 400, function() {
|
575 |
removeMore.remove();
|
576 |
+
});
|
577 |
}
|
578 |
|
579 |
if ( show !== '' ) {
|
602 |
var inside = cont.children( '.widget-inside' );
|
603 |
|
604 |
if ( cont.length && inside.find( 'p, div, table' ).length < 1 ) {
|
605 |
+
var actionId = cont.find( 'input[name$="[ID]"]' ).val();
|
606 |
+
var actionType = cont.find( 'input[name$="[post_excerpt]"]' ).val();
|
607 |
+
if ( actionType ) {
|
608 |
inside.html( '<span class="frm-wait frm_spinner"></span>' );
|
609 |
cont.find( '.spinner' ).fadeIn( 'slow' );
|
610 |
+
jQuery.ajax({
|
611 |
type: 'POST',
|
612 |
url: ajaxurl,
|
613 |
data: {
|
614 |
action: 'frm_form_action_fill',
|
615 |
+
action_id: actionId,
|
616 |
+
action_type: actionType,
|
617 |
nonce: frmGlobal.nonce
|
618 |
},
|
619 |
success: function( html ) {
|
620 |
inside.html( html );
|
621 |
initiateMultiselect();
|
622 |
+
showInputIcon( '#' + cont.attr( 'id' ) );
|
623 |
}
|
624 |
+
});
|
625 |
}
|
626 |
}
|
627 |
|
666 |
}
|
667 |
|
668 |
var c = t.replace( '#', '.' );
|
669 |
+
|
670 |
link.closest( 'li' ).addClass( 'frm-tabs active' ).siblings( 'li' ).removeClass( 'frm-tabs active starttab' );
|
671 |
if ( link.closest( 'div' ).find( '.tabs-panel' ).length ) {
|
672 |
link.closest( 'div' ).children( '.tabs-panel' ).not( t ).not( c ).hide();
|
720 |
forcePlaceholderSize: false,
|
721 |
tolerance: 'pointer',
|
722 |
handle: '.frm-move',
|
723 |
+
over: function() {
|
724 |
this.classList.add( 'drop-me' );
|
725 |
},
|
726 |
+
out: function() {
|
727 |
this.classList.remove( 'drop-me' );
|
728 |
},
|
729 |
receive: function( event, ui ) {
|
760 |
}
|
761 |
if ( ui.item[0].classList.contains( 'frm-page-collapsed' ) ) {
|
762 |
// If a page if collapsed, expand it before dragging since only the page break will move.
|
763 |
+
toggleCollapsePage( jQuery( ui.item[0]) );
|
764 |
}
|
765 |
},
|
766 |
helper: function( e, li ) {
|
774 |
toggleCollapsePage( jQuery( previous ) );
|
775 |
}
|
776 |
},
|
777 |
+
stop: function() {
|
778 |
var moving = jQuery( this );
|
779 |
copyHelper && copyHelper.remove();
|
780 |
if ( cancelSort ) {
|
802 |
//scrolling up
|
803 |
return v - Math.abs( y * 0.1 );
|
804 |
}
|
805 |
+
});
|
806 |
}
|
807 |
};
|
808 |
|
844 |
|
845 |
// Get the form ID where a field is dropped
|
846 |
function getFormIdForFieldPlacement( section ) {
|
847 |
+
var formId = '';
|
848 |
|
849 |
if ( typeof section[0] !== 'undefined' ) {
|
850 |
var sDivide = section.children( '.start_divider' );
|
851 |
sDivide.children( '.edit_field_type_end_divider' ).appendTo( sDivide );
|
852 |
if ( typeof section.attr( 'data-formid' ) !== 'undefined' ) {
|
853 |
var fieldId = section.attr( 'data-fid' );
|
854 |
+
formId = jQuery( 'input[name="field_options[form_select_' + fieldId + ']"]' ).val();
|
855 |
}
|
856 |
}
|
857 |
|
858 |
+
if ( typeof formId === 'undefined' || formId === '' ) {
|
859 |
+
formId = thisFormId;
|
860 |
}
|
861 |
|
862 |
+
return formId;
|
863 |
}
|
864 |
|
865 |
// Get the section ID where a field is dropped
|
883 |
var formId = getFormIdForFieldPlacement( section );
|
884 |
var sectionId = getSectionIdForFieldPlacement( section );
|
885 |
|
886 |
+
jQuery.ajax({
|
887 |
type: 'POST', url: ajaxurl,
|
888 |
data: {
|
889 |
action: 'frm_update_field_after_move',
|
896 |
toggleSectionHolder();
|
897 |
updateInSectionValue( fieldId, sectionId );
|
898 |
}
|
899 |
+
});
|
900 |
}
|
901 |
|
902 |
// Update the in_section field value
|
911 |
* @param {object} fieldButton
|
912 |
* @param {object} opts
|
913 |
*/
|
914 |
+
function insertNewFieldByDragging( selectedItem, fieldButton ) {
|
915 |
var fieldType = fieldButton.attr( 'id' );
|
916 |
|
917 |
// We'll optimistically disable the button now. We'll re-enable if AJAX fails
|
934 |
hasBreak = jQuery( '.frmbutton_loadingnow#' + loadingID ).prevAll( 'li[data-type="break"]:first' ).length > 0 ? 1 : 0;
|
935 |
}
|
936 |
|
937 |
+
jQuery.ajax({
|
938 |
type: 'POST', url: ajaxurl,
|
939 |
data: {
|
940 |
action: 'frm_insert_field',
|
942 |
field_type: fieldType,
|
943 |
section_id: sectionId,
|
944 |
nonce: frmGlobal.nonce,
|
945 |
+
has_break: hasBreak
|
946 |
},
|
947 |
success: function( msg ) {
|
948 |
document.getElementById( 'frm_form_editor_container' ).classList.add( 'frm-has-fields' );
|
953 |
},
|
954 |
error: function( jqXHR, textStatus, errorThrown ) {
|
955 |
maybeReenableSummaryBtnAfterAJAX( fieldType, addBtn, fieldButton, errorThrown );
|
956 |
+
}
|
957 |
+
});
|
958 |
}
|
959 |
|
960 |
// don't allow page break, embed form, captcha, summary, or section inside section field
|
976 |
ui.item.hasClass( 'edit_field_type_divider' ) );
|
977 |
}
|
978 |
|
979 |
+
function loadFields( fieldId ) {
|
980 |
+
var $thisField = jQuery( document.getElementById( fieldId ) );
|
981 |
var fields;
|
982 |
if ( jQuery.isFunction( jQuery.fn.addBack ) ) {
|
983 |
+
fields = $thisField.nextAll( '*:lt(14)' ).addBack();
|
984 |
} else {
|
985 |
+
fields = $thisField.nextAll( '*:lt(14)' ).andSelf();
|
986 |
}
|
987 |
fields.addClass( 'frm_load_now' );
|
988 |
|
989 |
var h = [];
|
990 |
jQuery.each( fields, function( k, v ) {
|
991 |
h.push( jQuery( v ).find( '.frm_hidden_fdata' ).html() );
|
992 |
+
});
|
993 |
|
994 |
+
jQuery.ajax({
|
995 |
type: 'POST', url: ajaxurl,
|
996 |
+
data: {
|
997 |
+
action: 'frm_load_field',
|
998 |
+
field: h,
|
999 |
+
form_id: thisFormId,
|
1000 |
+
nonce: frmGlobal.nonce
|
1001 |
+
},
|
1002 |
success: function( html ) {
|
1003 |
html = html.replace( /^\s+|\s+$/g, '' );
|
1004 |
if ( html.indexOf( '{' ) !== 0 ) {
|
1008 |
html = jQuery.parseJSON( html );
|
1009 |
|
1010 |
for ( var key in html ) {
|
1011 |
+
jQuery( '#frm_field_id_' + key ).replaceWith( html[key]);
|
1012 |
setupSortable( '#frm_field_id_' + key + '.edit_field_type_divider ul.frm_sorting' );
|
1013 |
}
|
1014 |
|
1026 |
initiateMultiselect();
|
1027 |
renumberPageBreaks();
|
1028 |
maybeHideQuantityProductFieldOption();
|
1029 |
+
}
|
1030 |
+
});
|
1031 |
}
|
1032 |
|
1033 |
function addFieldClick() {
|
1049 |
hasBreak = $newFields.children( 'li[data-type="break"]' ).length > 0 ? 1 : 0;
|
1050 |
}
|
1051 |
|
1052 |
+
var formId = thisFormId;
|
1053 |
|
1054 |
+
jQuery.ajax({
|
1055 |
type: 'POST',
|
1056 |
url: ajaxurl,
|
1057 |
data: {
|
1058 |
action: 'frm_insert_field',
|
1059 |
+
form_id: formId,
|
1060 |
field_type: fieldType,
|
1061 |
section_id: 0,
|
1062 |
nonce: frmGlobal.nonce,
|
1063 |
+
has_break: hasBreak
|
1064 |
},
|
1065 |
success: function( msg ) {
|
1066 |
document.getElementById( 'frm_form_editor_container' ).classList.add( 'frm-has-fields' );
|
1069 |
},
|
1070 |
error: function( jqXHR, textStatus, errorThrown ) {
|
1071 |
maybeReenableSummaryBtnAfterAJAX( fieldType, $thisObj, $button, errorThrown );
|
1072 |
+
}
|
1073 |
+
});
|
1074 |
return false;
|
1075 |
}
|
1076 |
|
1132 |
function duplicateField() {
|
1133 |
/*jshint validthis:true */
|
1134 |
var thisField = jQuery( this ).closest( 'li' );
|
1135 |
+
var fieldId = thisField.data( 'fid' );
|
1136 |
+
var children = fieldsInSection( fieldId );
|
1137 |
|
1138 |
if ( thisField.hasClass( 'frm-section-collapsed' ) || thisField.hasClass( 'frm-page-collapsed' ) ) {
|
1139 |
return false;
|
1140 |
}
|
1141 |
|
1142 |
+
jQuery.ajax({
|
1143 |
+
type: 'POST',
|
1144 |
+
url: ajaxurl,
|
1145 |
data: {
|
1146 |
action: 'frm_duplicate_field',
|
1147 |
+
field_id: fieldId,
|
1148 |
+
form_id: thisFormId,
|
1149 |
children: children,
|
1150 |
+
nonce: frmGlobal.nonce
|
1151 |
},
|
1152 |
success: function( msg ) {
|
1153 |
thisField.after( msg );
|
1154 |
updateFieldOrder();
|
1155 |
afterAddField( msg, false );
|
1156 |
+
}
|
1157 |
+
});
|
1158 |
return false;
|
1159 |
}
|
1160 |
|
1161 |
function afterAddField( msg, addFocus ) {
|
1162 |
var regex = /id="(\S+)"/,
|
1163 |
match = regex.exec( msg ),
|
1164 |
+
field = document.getElementById( match[1]),
|
1165 |
section = '#' + match[1] + '.edit_field_type_divider ul.frm_sorting',
|
1166 |
$thisSection = jQuery( section ),
|
1167 |
type = field.getAttribute( 'data-type' ),
|
1209 |
);
|
1210 |
|
1211 |
if ( ! inView ) {
|
1212 |
+
container.scroll({
|
1213 |
top: container.scrollHeight,
|
1214 |
left: 0,
|
1215 |
+
behavior: 'smooth'
|
1216 |
+
});
|
1217 |
}
|
1218 |
|
1219 |
if ( toggled === false ) {
|
1237 |
|
1238 |
function scrollToField( field ) {
|
1239 |
var newPos = field.getBoundingClientRect().top,
|
1240 |
+
container = document.getElementById( 'post-body-content' );
|
|
|
|
|
1241 |
|
1242 |
if ( typeof animate === 'undefined' ) {
|
1243 |
+
jQuery( container ).scrollTop( newPos );
|
1244 |
} else {
|
1245 |
// TODO: smooth scroll
|
1246 |
+
jQuery( container ).animate({ scrollTop: newPos }, 500 );
|
1247 |
}
|
1248 |
}
|
1249 |
|
1253 |
warningMessage += checkShortcodes( calculation, this );
|
1254 |
|
1255 |
if ( warningMessage !== '' ) {
|
1256 |
+
infoModal( calculation + '\n\n' + warningMessage );
|
1257 |
}
|
1258 |
}
|
1259 |
|
1268 |
msg = frm_admin_js.slug_is_reserved;
|
1269 |
msg = msg.replace( '****', addHtmlTags( slug, 'strong' ) );
|
1270 |
msg += '<br /><br />';
|
1271 |
+
msg += addHtmlTags( '<a href="https://codex.wordpress.org/WordPress_Query_Vars" target="_blank" class="frm-standard-link">' + frm_admin_js.reserved_words + '</a>', 'div' );
|
1272 |
infoModal( msg );
|
1273 |
}
|
1274 |
}
|
1282 |
match = regEx.exec( filterValue ),
|
1283 |
unsafeParams = '';
|
1284 |
|
1285 |
+
while ( match !== null ) {
|
1286 |
+
if ( Array.isArray( frm_admin_js.unsafe_params ) && frm_admin_js.unsafe_params.includes( match[1]) ) {
|
1287 |
if ( unsafeParams !== '' ) {
|
1288 |
unsafeParams += '", "' + match[ 1 ];
|
1289 |
} else {
|
1303 |
}
|
1304 |
}
|
1305 |
|
1306 |
+
function addHtmlTags( text, tag ) {
|
1307 |
tag = tag ? tag : 'p';
|
1308 |
return '<' + tag + '>' + text + '</' + tag + '>';
|
1309 |
}
|
1316 |
function checkMatchingParens( formula ) {
|
1317 |
|
1318 |
var stack = [],
|
1319 |
+
formulaArray = formula.split( '' ),
|
1320 |
+
length = formulaArray.length,
|
1321 |
+
opening = [ '{', '[', '(' ],
|
1322 |
closing = {
|
1323 |
+
'}': '{',
|
1324 |
+
')': '(',
|
1325 |
+
']': '['
|
1326 |
},
|
1327 |
unmatchedClosing = [],
|
1328 |
msg = '',
|
1329 |
+
i, top;
|
1330 |
|
1331 |
for ( i = 0; i < length; i++ ) {
|
1332 |
+
if ( opening.includes( formulaArray[i]) ) {
|
1333 |
+
stack.push( formulaArray[i]);
|
1334 |
continue;
|
1335 |
}
|
1336 |
+
if ( closing.hasOwnProperty( formulaArray[i]) ) {
|
1337 |
top = stack.pop();
|
1338 |
+
if ( top !== closing[formulaArray[i]]) {
|
1339 |
+
unmatchedClosing.push( formulaArray[i]);
|
1340 |
}
|
1341 |
}
|
1342 |
}
|
1343 |
|
1344 |
if ( stack.length > 0 || unmatchedClosing.length > 0 ) {
|
1345 |
+
msg = frm_admin_js.unmatched_parens + '\n\n';
|
1346 |
return msg;
|
1347 |
}
|
1348 |
|
1380 |
var nonNumericShortcodes = getNonNumericShortcodes();
|
1381 |
|
1382 |
if ( nonNumericShortcodes.test( calculation ) ) {
|
1383 |
+
msg = frm_admin_js.text_shortcodes + '\n\n';
|
1384 |
}
|
1385 |
|
1386 |
return msg;
|
1392 |
* @param inputElement
|
1393 |
*/
|
1394 |
function isTextCalculation( inputElement ) {
|
1395 |
+
return jQuery( inputElement ).siblings( 'label[for^="calc_type"]' ).children( 'input' ).prop( 'checked' );
|
1396 |
}
|
1397 |
|
1398 |
/**
|
1413 |
msg = '';
|
1414 |
|
1415 |
if ( nonFormShortcodes.test( formula ) ) {
|
1416 |
+
msg += frm_admin_js.view_shortcodes + '\n\n';
|
1417 |
}
|
1418 |
|
1419 |
return msg;
|
1442 |
|
1443 |
for ( var i = 0; i < exclude.length; i++ ) {
|
1444 |
if ( exclude[ i ].startsWith( '[' ) ) {
|
1445 |
+
opts.push( exclude[ i ]);
|
1446 |
// remove it
|
1447 |
exclude.splice( i, 1 );
|
1448 |
// https://love2dev.com/blog/javascript-remove-from-array/#remove-from-array-splice-value
|
1458 |
for ( var i = 0; i < excludedOpts.length; i++ ) {
|
1459 |
var inputs = document.getElementsByName( getFieldOptionInputName( excludedOpts[ i ], field.fieldId ) );
|
1460 |
// 2nd condition checks that there's at least one non-empty value
|
1461 |
+
if ( inputs.length && jQuery( inputs[0]).val() ) {
|
1462 |
hasOption = true;
|
1463 |
break;
|
1464 |
}
|
1482 |
|
1483 |
var isSummary = isCalcBoxType( v, 'frm_js_summary_list' );
|
1484 |
|
|
|
1485 |
var fieldId = p.find( 'input[name="frm_fields_submitted[]"]' ).val();
|
1486 |
|
1487 |
if ( force ) {
|
1530 |
var includedExtras = getIncludedExtras();
|
1531 |
if ( includedExtras.length ) {
|
1532 |
for ( var i = 0; i < exclude.length; i++ ) {
|
1533 |
+
if ( includedExtras.includes( exclude[ i ]) ) {
|
1534 |
// remove it
|
1535 |
exclude.splice( i, 1 );
|
1536 |
// https://love2dev.com/blog/javascript-remove-from-array/#remove-from-array-splice-value
|
1561 |
}
|
1562 |
|
1563 |
function getFieldList( fieldType ) {
|
1564 |
+
var i,
|
1565 |
+
fields = [],
|
1566 |
allFields = document.querySelectorAll( 'li.frm_field_box' ),
|
1567 |
checkType = 'undefined' !== typeof fieldType;
|
1568 |
|
1574 |
|
1575 |
var fieldId = allFields[ i ].getAttribute( 'data-fid' );
|
1576 |
if ( typeof fieldId !== 'undefined' && fieldId ) {
|
1577 |
+
fields.push({
|
1578 |
'fieldId': fieldId,
|
1579 |
'fieldName': getPossibleValue( 'frm_name_' + fieldId ),
|
1580 |
'fieldType': getPossibleValue( 'field_options_type_' + fieldId ),
|
1581 |
'fieldKey': getPossibleValue( 'field_options_field_key_' + fieldId )
|
1582 |
+
});
|
1583 |
}
|
1584 |
}
|
1585 |
|
1609 |
if ( isSelect ) {
|
1610 |
// This fallback can be removed after 4.05.
|
1611 |
checked = checked ? ' selected' : '';
|
1612 |
+
options.push( '<option value="' + id + '"' + checked + '>' + products[ i ].fieldName + '</option>' );
|
1613 |
} else {
|
1614 |
checked = checked ? ' checked' : '';
|
1615 |
options.push( '<label class="frm6">' );
|
1616 |
+
options.push( '<input type="checkbox" name="' + fName + '" value="' + id + '"' + checked + '> ' + products[ i ].fieldName );
|
1617 |
options.push( '</label>' );
|
1618 |
}
|
1619 |
}
|
1635 |
function popAllProductFields() {
|
1636 |
var opts = document.querySelectorAll( '.frmjs_prod_field_opt' );
|
1637 |
for ( var i = 0; i < opts.length; i++ ) {
|
1638 |
+
popProductFields( opts[ i ]);
|
1639 |
}
|
1640 |
}
|
1641 |
|
1748 |
|
1749 |
function markUnique() {
|
1750 |
/*jshint validthis:true */
|
1751 |
+
var fieldId = jQuery( this ).closest( '.frm-single-settings' ).data( 'fid' );
|
1752 |
+
var $thisField = jQuery( '.frm_unique_details' + fieldId );
|
1753 |
if ( this.checked ) {
|
1754 |
$thisField.fadeIn( 'fast' ).closest( '.frm_validation_msg' ).fadeIn( 'fast' );
|
1755 |
+
$unqDetail = jQuery( '.frm_unique_details' + fieldId + ' input' );
|
1756 |
if ( $unqDetail.val() === '' ) {
|
1757 |
$unqDetail.val( frm_admin_js.default_unique );
|
1758 |
}
|
1759 |
} else {
|
1760 |
+
var v = $thisField.fadeOut( 'fast' ).closest( '.frm_validation_box' ).children( ':not(.frm_unique_details' + fieldId + '):visible' ).length;
|
1761 |
if ( v === 0 ) {
|
1762 |
$thisField.closest( '.frm_validation_msg' ).fadeOut( 'fast' );
|
1763 |
}
|
1767 |
//Fade confirmation field and validation option in or out
|
1768 |
function addConf() {
|
1769 |
/*jshint validthis:true */
|
1770 |
+
var fieldId = jQuery( this ).closest( '.frm-single-settings' ).data( 'fid' );
|
1771 |
var val = jQuery( this ).val();
|
1772 |
+
var $thisField = jQuery( document.getElementById( 'frm_field_id_' + fieldId ) );
|
1773 |
|
1774 |
+
toggleValidationBox( val !== '', '.frm_conf_details' + fieldId );
|
1775 |
|
1776 |
if ( val !== '' ) {
|
1777 |
//Add default validation message if empty
|
1778 |
+
var valMsg = jQuery( '.frm_validation_box .frm_conf_details' + fieldId + ' input' );
|
1779 |
if ( valMsg.val() === '' ) {
|
1780 |
valMsg.val( frm_admin_js.default_conf );
|
1781 |
}
|
1782 |
|
1783 |
+
setConfirmationFieldDescriptions( fieldId );
|
1784 |
|
1785 |
//Add or remove class for confirmation field styling
|
1786 |
if ( val === 'inline' ) {
|
1788 |
} else if ( val === 'below' ) {
|
1789 |
$thisField.removeClass( 'frm_conf_inline' ).addClass( 'frm_conf_below' );
|
1790 |
}
|
1791 |
+
jQuery( '.frm-conf-box-' + fieldId ).removeClass( 'frm_hidden' );
|
1792 |
} else {
|
1793 |
+
jQuery( '.frm-conf-box-' + fieldId ).addClass( 'frm_hidden' );
|
1794 |
setTimeout( function() {
|
1795 |
$thisField.removeClass( 'frm_conf_inline frm_conf_below' );
|
1796 |
}, 200 );
|
1797 |
}
|
1798 |
}
|
1799 |
|
1800 |
+
function setConfirmationFieldDescriptions( fieldId ) {
|
1801 |
+
var fieldType = document.getElementsByName( 'field_options[type_' + fieldId + ']' )[0].value;
|
1802 |
|
1803 |
+
var fieldDescription = document.getElementById( 'field_description_' + fieldId );
|
1804 |
+
var hiddenDescName = 'field_options[description_' + fieldId + ']';
|
1805 |
var newValue = frm_admin_js['enter_' + fieldType];
|
1806 |
maybeSetNewDescription( fieldDescription, hiddenDescName, newValue );
|
1807 |
|
1808 |
+
var confFieldDescription = document.getElementById( 'conf_field_description_' + fieldId );
|
1809 |
+
var hiddenConfName = 'field_options[conf_desc_' + fieldId + ']';
|
1810 |
var newConfValue = frm_admin_js['confirm_' + fieldType];
|
1811 |
maybeSetNewDescription( confFieldDescription, hiddenConfName, newConfValue );
|
1812 |
}
|
1831 |
|
1832 |
jQuery( builderForm ).on( 'click', 'a.frm-bulk-edit-link', function( event ) {
|
1833 |
event.preventDefault();
|
1834 |
+
var i, key, label,
|
1835 |
+
content = '',
|
1836 |
fieldId = jQuery( this ).closest( '[data-fid]' ).data( 'fid' ),
|
1837 |
separate = usingSeparateValues( fieldId ),
|
1838 |
optList = document.getElementById( 'frm_field_' + fieldId + '_opts' ),
|
1853 |
if ( product ) {
|
1854 |
content += '|' + document.getElementsByName( 'field_options[options_' + fieldId + '][' + key + '][price]' )[0].value;
|
1855 |
}
|
1856 |
+
content += '\r\n';
|
1857 |
}
|
1858 |
}
|
1859 |
|
1862 |
}
|
1863 |
}
|
1864 |
|
1865 |
+
$info.dialog( 'open' );
|
1866 |
|
1867 |
return false;
|
1868 |
+
});
|
1869 |
|
1870 |
jQuery( '#frm-update-bulk-opts' ).click( function() {
|
1871 |
var fieldId = document.getElementById( 'bulk-field-id' ).value;
|
1872 |
this.classList.add( 'frm_loading_button' );
|
1873 |
frmAdminBuild.updateOpts( fieldId, document.getElementById( 'frm_bulk_options' ).value, $info );
|
1874 |
+
});
|
1875 |
}
|
1876 |
|
1877 |
function insertBulkPreset( event ) {
|
1878 |
/*jshint validthis:true */
|
1879 |
var opts = JSON.parse( this.getAttribute( 'data-opts' ) );
|
1880 |
event.preventDefault();
|
1881 |
+
document.getElementById( 'frm_bulk_options' ).value = opts.join( '\n' );
|
1882 |
return false;
|
1883 |
}
|
1884 |
|
1886 |
function addFieldOption() {
|
1887 |
/*jshint validthis:true */
|
1888 |
var fieldId = jQuery( this ).closest( '.frm-single-settings' ).data( 'fid' ),
|
1889 |
+
newOption = jQuery( '#frm_field_' + fieldId + '_opts .frm_option_template' ).prop( 'outerHTML' ),
|
1890 |
+
optType = jQuery( this ).data( 'opttype' ),
|
1891 |
optKey = 0,
|
1892 |
oldKey = '000',
|
1893 |
lastKey = getHighestOptKey( fieldId );
|
1897 |
}
|
1898 |
|
1899 |
//Update hidden field
|
1900 |
+
if ( optType === 'other' ) {
|
1901 |
document.getElementById( 'other_input_' + fieldId ).value = 1;
|
1902 |
|
1903 |
//Hide "Add Other" option now if this is radio field
|
1910 |
action: 'frm_add_field_option',
|
1911 |
field_id: fieldId,
|
1912 |
opt_key: optKey,
|
1913 |
+
opt_type: optType,
|
1914 |
nonce: frmGlobal.nonce
|
1915 |
};
|
1916 |
jQuery.post( ajaxurl, data, function( msg ) {
|
1917 |
jQuery( document.getElementById( 'frm_field_' + fieldId + '_opts' ) ).append( msg );
|
1918 |
resetDisplayedOpts( fieldId );
|
1919 |
+
});
|
1920 |
} else {
|
1921 |
newOption = newOption.replace( new RegExp( 'optkey="' + oldKey + '"', 'g' ), 'optkey="' + optKey + '"' );
|
1922 |
newOption = newOption.replace( new RegExp( '-' + oldKey + '_', 'g' ), '-' + optKey + '_' );
|
1934 |
opts = jQuery( '#frm_field_' + fieldId + '_opts li' ),
|
1935 |
lastKey = 0;
|
1936 |
|
1937 |
+
for ( i; i < opts.length; i++ ) {
|
1938 |
optKey = opts[i].getAttribute( 'data-optkey' );
|
1939 |
if ( opts.length === 1 ) {
|
1940 |
return optKey;
|
1941 |
}
|
1942 |
+
if ( optKey !== '000' ) {
|
1943 |
optKey = optKey.replace( 'other_', '' );
|
1944 |
+
optKey = parseInt( optKey, 10 );
|
1945 |
}
|
1946 |
|
1947 |
if ( ! isNaN( lastKey ) && ( optKey > lastKey || lastKey === '000' ) ) {
|
1954 |
|
1955 |
function toggleMultSel() {
|
1956 |
/*jshint validthis:true */
|
1957 |
+
var fieldId = jQuery( this ).closest( '.frm-single-settings' ).data( 'fid' );
|
1958 |
+
toggleMultiSelect( fieldId, this.value );
|
1959 |
}
|
1960 |
|
1961 |
function toggleMultiSelect( fieldId, value ) {
|
1969 |
|
1970 |
function toggleSepValues() {
|
1971 |
/*jshint validthis:true */
|
1972 |
+
var fieldId = jQuery( this ).closest( '.frm-single-settings' ).data( 'fid' );
|
1973 |
+
toggle( jQuery( '.field_' + fieldId + '_option_key' ) );
|
1974 |
+
jQuery( '.field_' + fieldId + '_option' ).toggleClass( 'frm_with_key' );
|
1975 |
}
|
1976 |
|
1977 |
function toggleMultiselect() {
|
2008 |
var otherInput,
|
2009 |
parentLi = this.parentNode,
|
2010 |
parentUl = parentLi.parentNode,
|
2011 |
+
fieldId = this.getAttribute( 'data-fid' );
|
2012 |
|
2013 |
jQuery( parentLi ).fadeOut( 'slow', function() {
|
2014 |
jQuery( parentLi ).remove();
|
2015 |
|
2016 |
var hasOther = jQuery( parentUl ).find( '.frm_other_option' );
|
2017 |
if ( hasOther.length < 1 ) {
|
2018 |
+
otherInput = document.getElementById( 'other_input_' + fieldId );
|
2019 |
if ( otherInput !== null ) {
|
2020 |
otherInput.value = 0;
|
2021 |
}
|
2022 |
+
jQuery( '#other_button_' + fieldId ).fadeIn( 'slow' );
|
2023 |
}
|
2024 |
+
});
|
2025 |
}
|
2026 |
|
2027 |
/**
|
2028 |
* If a radio button is set as default, allow a click to
|
2029 |
* deselect it.
|
2030 |
*/
|
2031 |
+
function maybeUncheckRadio() {
|
2032 |
/*jshint validthis:true */
|
2033 |
var $self = jQuery( this );
|
2034 |
if ( $self.is( ':checked' ) ) {
|
2035 |
var uncheck = function() {
|
2036 |
+
setTimeout( function() {
|
2037 |
+
$self.removeAttr( 'checked' );
|
2038 |
+
}, 0 );
|
2039 |
};
|
2040 |
var unbind = function() {
|
2041 |
$self.unbind( 'mouseup', up );
|
2061 |
|
2062 |
function clickDeleteField() {
|
2063 |
/*jshint validthis:true */
|
2064 |
+
var confirmMsg = frm_admin_js.conf_delete,
|
2065 |
maybeDivider = this.parentNode.parentNode.parentNode,
|
2066 |
li = maybeDivider.parentNode,
|
2067 |
field = jQuery( this ).closest( 'li' ),
|
2073 |
|
2074 |
// If deleting a section, use a special message.
|
2075 |
if ( maybeDivider.className === 'divider_section_only' ) {
|
2076 |
+
confirmMsg = frm_admin_js.conf_delete_sec;
|
2077 |
+
this.setAttribute( 'data-frmcaution', frm_admin_js.caution );
|
2078 |
}
|
2079 |
|
2080 |
+
this.setAttribute( 'data-frmverify', confirmMsg );
|
2081 |
this.setAttribute( 'data-deletefield', fieldId );
|
2082 |
|
2083 |
confirmLinkClick( this );
|
2100 |
//if(n.hasClass('edit_field_type_end_divider')){
|
2101 |
deleteField( this.getAttribute( 'data-fid' ) );
|
2102 |
//}
|
2103 |
+
});
|
2104 |
}
|
2105 |
toggleSectionHolder();
|
2106 |
}
|
2107 |
|
2108 |
+
function deleteField( fieldId ) {
|
2109 |
+
jQuery.ajax({
|
2110 |
type: 'POST',
|
2111 |
url: ajaxurl,
|
2112 |
+
data: {
|
2113 |
+
action: 'frm_delete_field',
|
2114 |
+
field_id: fieldId,
|
2115 |
+
nonce: frmGlobal.nonce
|
2116 |
+
},
|
2117 |
+
success: function() {
|
2118 |
+
var $thisField = jQuery( document.getElementById( 'frm_field_id_' + fieldId ) ),
|
2119 |
+
settings = jQuery( '#frm-single-settings-' + fieldId );
|
2120 |
|
2121 |
// Remove settings from sidebar.
|
2122 |
if ( settings.is( ':visible' ) ) {
|
2144 |
} else if ( $section.length ) {
|
2145 |
toggleOneSectionHolder( $section );
|
2146 |
}
|
2147 |
+
});
|
2148 |
}
|
2149 |
+
});
|
2150 |
}
|
2151 |
|
2152 |
function addFieldLogicRow() {
|
2153 |
/*jshint validthis:true */
|
2154 |
var id = jQuery( this ).closest( '.frm-single-settings' ).data( 'fid' ),
|
2155 |
+
formId = thisFormId,
|
2156 |
+
metaName = 0;
|
2157 |
|
2158 |
if ( jQuery( '#frm_logic_row_' + id + ' .frm_logic_row' ).length > 0 ) {
|
2159 |
+
metaName = 1 + parseInt( jQuery( '#frm_logic_row_' + id + ' .frm_logic_row:last' ).attr( 'id' ).replace( 'frm_logic_' + id + '_', '' ), 10 );
|
2160 |
}
|
2161 |
+
jQuery.ajax({
|
2162 |
+
type: 'POST',
|
2163 |
+
url: ajaxurl,
|
2164 |
data: {
|
2165 |
action: 'frm_add_logic_row',
|
2166 |
+
form_id: formId,
|
2167 |
field_id: id,
|
2168 |
nonce: frmGlobal.nonce,
|
2169 |
+
meta_name: metaName,
|
2170 |
fields: getFieldList()
|
2171 |
},
|
2172 |
success: function( html ) {
|
2174 |
var logicRow = jQuery( document.getElementById( 'frm_logic_row_' + id ) );
|
2175 |
logicRow.append( html );
|
2176 |
logicRow.closest( '.frm_logic_rows' ).fadeIn( 'slow' );
|
2177 |
+
});
|
2178 |
}
|
2179 |
+
});
|
2180 |
return false;
|
2181 |
}
|
2182 |
|
2183 |
function addWatchLookupRow() {
|
2184 |
/*jshint validthis:true */
|
2185 |
+
var lastRowId,
|
2186 |
+
id = jQuery( this ).closest( '.frm-single-settings' ).data( 'fid' ),
|
2187 |
+
formId = thisFormId,
|
2188 |
+
rowKey = 0,
|
2189 |
+
lookupBlockRows = document.getElementById( 'frm_watch_lookup_block_' + id ).children;
|
2190 |
+
|
2191 |
if ( lookupBlockRows.length > 0 ) {
|
2192 |
+
lastRowId = lookupBlockRows[lookupBlockRows.length - 1].id;
|
2193 |
+
rowKey = 1 + parseInt( lastRowId.replace( 'frm_watch_lookup_' + id + '_', '' ), 10 );
|
2194 |
}
|
2195 |
|
2196 |
+
jQuery.ajax({
|
2197 |
+
type: 'POST',
|
2198 |
+
url: ajaxurl,
|
2199 |
data: {
|
2200 |
action: 'frm_add_watch_lookup_row',
|
2201 |
+
form_id: formId,
|
2202 |
field_id: id,
|
2203 |
+
row_key: rowKey,
|
2204 |
nonce: frmGlobal.nonce
|
2205 |
},
|
2206 |
success: function( newRow ) {
|
2208 |
watchRowBlock.append( newRow );
|
2209 |
watchRowBlock.fadeIn( 'slow' );
|
2210 |
}
|
2211 |
+
});
|
2212 |
return false;
|
2213 |
}
|
2214 |
|
2222 |
fieldSelect.options.length = 1;
|
2223 |
} else {
|
2224 |
var formID = this.value;
|
2225 |
+
jQuery.ajax({
|
2226 |
type: 'POST', url: ajaxurl,
|
2227 |
data: {
|
2228 |
action: 'frm_get_options_for_get_values_field',
|
2233 |
success: function( fields ) {
|
2234 |
fieldSelect.innerHTML = fields;
|
2235 |
}
|
2236 |
+
});
|
2237 |
}
|
2238 |
}
|
2239 |
|
2322 |
field.removeClass( 'frm-page-collapsed' );
|
2323 |
toCollapse.removeClass( 'frm-is-collapsed' );
|
2324 |
for ( i = 0; i < slide; i++ ) {
|
2325 |
+
if ( i === slide - 1 ) {
|
2326 |
+
jQuery( toCollapse[ i ]).slideDown( 150, function() {
|
2327 |
toCollapse.show();
|
2328 |
+
});
|
2329 |
} else {
|
2330 |
+
jQuery( toCollapse[ i ]).slideDown( 150 );
|
2331 |
}
|
2332 |
}
|
2333 |
} else {
|
2334 |
field.addClass( 'frm-page-collapsed' );
|
2335 |
toCollapse.addClass( 'frm-is-collapsed' );
|
2336 |
for ( i = 0; i < slide; i++ ) {
|
2337 |
+
if ( i === slide - 1 ) {
|
2338 |
+
jQuery( toCollapse[ i ]).slideUp( 150, function() {
|
2339 |
toCollapse.css( 'cssText', 'display:none !important;' );
|
2340 |
+
});
|
2341 |
} else {
|
2342 |
+
jQuery( toCollapse[ i ]).slideUp( 150 );
|
2343 |
}
|
2344 |
}
|
2345 |
}
|
2479 |
var children = [];
|
2480 |
jQuery( document.getElementById( 'frm_field_id_' + id ) ).find( 'li.frm_field_box:not(.no_repeat_section .edit_field_type_end_divider)' ).each( function() {
|
2481 |
children.push( jQuery( this ).data( 'fid' ) );
|
2482 |
+
});
|
2483 |
return children;
|
2484 |
}
|
2485 |
|
2567 |
}
|
2568 |
|
2569 |
function resetDisplayedOpts( fieldId ) {
|
2570 |
+
var i, opts, type, placeholder, fieldInfo,
|
2571 |
input = jQuery( '[name^="item_meta[' + fieldId + ']"]' );
|
2572 |
|
2573 |
if ( input.length < 1 ) {
|
2577 |
if ( input.is( 'select' ) ) {
|
2578 |
placeholder = document.getElementById( 'frm_placeholder_' + fieldId );
|
2579 |
if ( placeholder !== null && placeholder.value === '' ) {
|
2580 |
+
fillDropdownOpts( input[0], { sourceID: fieldId });
|
2581 |
} else {
|
2582 |
fillDropdownOpts( input[0], {
|
2583 |
sourceID: fieldId,
|
2584 |
placeholder: placeholder.value
|
2585 |
+
});
|
2586 |
}
|
2587 |
} else {
|
2588 |
opts = getMultipleOpts( fieldId );
|
2668 |
}
|
2669 |
|
2670 |
function getMultipleOpts( fieldId ) {
|
2671 |
+
var i, saved, labelName, label, key, optObj,
|
2672 |
+
opts = [],
|
2673 |
optVals = jQuery( 'input[name^="field_options[options_' + fieldId + ']"]' ),
|
2674 |
separateValues = usingSeparateValues( fieldId ),
|
2675 |
isProduct = isProductField( fieldId );
|
2733 |
var a = id.split( '-' );
|
2734 |
jQuery.each( jQuery( 'label[id^="' + a[0] + '"]' ), function( k, v ) {
|
2735 |
var c = false;
|
2736 |
+
if ( ! c && jQuery( v ).attr( 'id' ) != id && jQuery( v ).html() == text ) {
|
2737 |
c = true;
|
2738 |
infoModal( 'Saved values cannot be identical.' );
|
2739 |
}
|
2740 |
+
});
|
2741 |
}
|
2742 |
}
|
2743 |
|
2771 |
min = document.getElementById( 'scale_minnum_' + fieldID ).value;
|
2772 |
}
|
2773 |
|
2774 |
+
updateScaleValues( parseInt( min, 10 ), parseInt( max, 10 ), fieldID );
|
2775 |
}
|
2776 |
|
2777 |
function updateScaleValues( min, max, fieldID ) {
|
2790 |
|
2791 |
function getFieldValues() {
|
2792 |
/*jshint validthis:true */
|
2793 |
+
var isTaxonomy,
|
2794 |
val = this.value;
|
2795 |
|
2796 |
if ( val ) {
|
2803 |
var optionName = 'field_options[hide_opt_' + fieldID + '][]';
|
2804 |
var optionID = 'frm_field_logic_opt_' + fieldID;
|
2805 |
var input = false;
|
2806 |
+
var showSelect = ( valueFieldType === 'select' || valueFieldType === 'checkbox' || valueFieldType === 'radio' );
|
2807 |
+
var showText = ( valueFieldType === 'text' || valueFieldType === 'email' || valueFieldType === 'phone' || valueFieldType === 'url' || valueFieldType === 'number' );
|
2808 |
|
2809 |
if ( showSelect ) {
|
2810 |
+
isTaxonomy = document.getElementById( 'frm_has_hidden_options_' + val );
|
2811 |
+
if ( isTaxonomy !== null ) {
|
2812 |
// get the category options with ajax
|
2813 |
showSelect = false;
|
2814 |
}
|
2832 |
sourceID: val,
|
2833 |
placeholder: '',
|
2834 |
other: true
|
2835 |
+
});
|
2836 |
}
|
2837 |
} else {
|
2838 |
var thisType = this.getAttribute( 'data-type' );
|
2843 |
|
2844 |
function getFieldSelection() {
|
2845 |
/*jshint validthis:true */
|
2846 |
+
var formId = this.value;
|
2847 |
+
if ( formId ) {
|
2848 |
+
var fieldId = jQuery( this ).closest( '.frm-single-settings' ).data( 'fid' );
|
2849 |
+
getTaxOrFieldSelection( formId, fieldId );
|
2850 |
}
|
2851 |
}
|
2852 |
|
2853 |
+
function getTaxOrFieldSelection( formId, fieldId ) {
|
2854 |
+
if ( formId ) {
|
2855 |
+
jQuery.ajax({
|
2856 |
+
type: 'POST',
|
2857 |
+
url: ajaxurl,
|
2858 |
+
data: {
|
2859 |
+
action: 'frm_get_field_selection',
|
2860 |
+
field_id: fieldId,
|
2861 |
+
form_id: formId,
|
2862 |
+
nonce: frmGlobal.nonce
|
2863 |
+
},
|
2864 |
success: function( msg ) {
|
2865 |
+
jQuery( '#frm_show_selected_fields_' + fieldId ).html( msg ).show();
|
2866 |
}
|
2867 |
+
});
|
2868 |
}
|
2869 |
}
|
2870 |
|
2871 |
function updateFieldOrder() {
|
2872 |
+
|
2873 |
renumberPageBreaks();
|
2874 |
jQuery( '#frm-show-fields' ).each( function( i ) {
|
2875 |
var fields = jQuery( 'li.frm_field_box', this );
|
2876 |
+
for ( i = 0; i < fields.length; i++ ) {
|
2877 |
var fieldId = fields[ i ].getAttribute( 'data-fid' ),
|
2878 |
field = jQuery( 'input[name="field_options[field_order_' + fieldId + ']"]' ),
|
2879 |
currentOrder = field.val(),
|
2886 |
moveFieldSettings( singleField );
|
2887 |
}
|
2888 |
}
|
2889 |
+
});
|
2890 |
}
|
2891 |
|
2892 |
function toggleSectionHolder() {
|
2893 |
jQuery( '.start_divider' ).each( function() {
|
2894 |
toggleOneSectionHolder( jQuery( this ) );
|
2895 |
+
});
|
2896 |
}
|
2897 |
|
2898 |
function toggleOneSectionHolder( $section ) {
|
2912 |
/*jshint validthis:true */
|
2913 |
var id = jQuery( this ).data( 'slidedown' );
|
2914 |
var $thisId = jQuery( document.getElementById( id ) );
|
2915 |
+
if ( $thisId.is( ':hidden' ) ) {
|
2916 |
$thisId.slideDown( 'fast' );
|
2917 |
this.style.display = 'none';
|
2918 |
}
|
2933 |
*/
|
2934 |
function hideEmptyEle() {
|
2935 |
jQuery( '.frm-hide-empty' ).each( function() {
|
2936 |
+
if ( jQuery( this ).text().trim().length === 0 ) {
|
2937 |
+
jQuery( this ).remove();
|
2938 |
+
}
|
2939 |
});
|
2940 |
}
|
2941 |
|
2981 |
function showInlineModal( icon, input ) {
|
2982 |
var box = document.getElementById( icon.getAttribute( 'data-open' ) ),
|
2983 |
container = jQuery( icon ).closest( 'p' ),
|
|
|
|
|
2984 |
inputTrigger = ( typeof input !== 'undefined' );
|
2985 |
|
2986 |
if ( container.hasClass( 'frm-open' ) ) {
|
3011 |
/*jshint validthis:true */
|
3012 |
e.preventDefault();
|
3013 |
this.parentNode.classList.add( 'frm_hidden' );
|
3014 |
+
jQuery( '.frm-open [data-open="' + this.parentNode.id + '"]' ).closest( '.frm-open' ).removeClass( 'frm-open' );
|
3015 |
}
|
3016 |
|
3017 |
function changeInputtedValue() {
|
3019 |
var i,
|
3020 |
action = this.getAttribute( 'data-frmchange' ).split( ',' );
|
3021 |
|
3022 |
+
for ( i = 0; i < action.length; i++ ) {
|
3023 |
+
if ( action[i] === 'updateOption' ) {
|
3024 |
changeHiddenSeparateValue( this );
|
3025 |
+
} else if ( action[i] === 'updateDefault' ) {
|
3026 |
changeDefaultRadioValue( this );
|
3027 |
} else {
|
3028 |
this.value = this.value[ action[i] ]();
|
3086 |
var v = JSON.stringify( $form.serializeArray() );
|
3087 |
|
3088 |
jQuery( document.getElementById( 'frm_compact_fields' ) ).val( v );
|
3089 |
+
jQuery.ajax({
|
3090 |
type: 'POST',
|
3091 |
url: ajaxurl,
|
3092 |
data: {action: 'frm_save_form', 'frm_compact_fields': v, nonce: frmGlobal.nonce},
|
3099 |
$html.innerHTML = msg;
|
3100 |
$postStuff.insertBefore( $html, $postStuff.firstChild );
|
3101 |
},
|
3102 |
+
error: function() {
|
3103 |
jQuery( document.getElementById( 'frm_js_build_form' ) ).submit();
|
3104 |
}
|
3105 |
+
});
|
3106 |
}
|
3107 |
|
3108 |
function submitNoAjax() {
|
3138 |
setTimeout( function() {
|
3139 |
jQuery( '.frm_updated_message' ).fadeOut( 'slow', function() {
|
3140 |
this.parentNode.removeChild( this );
|
3141 |
+
});
|
3142 |
$button.fadeOut( 'slow', function() {
|
3143 |
$button.html( buttonVal );
|
3144 |
$button.show();
|
3145 |
+
});
|
3146 |
}, 5000 );
|
3147 |
}
|
3148 |
|
3166 |
// If one click upgrade, hide other content
|
3167 |
addOneClickModal( this );
|
3168 |
|
3169 |
+
jQuery( '.frm_feature_label' ).html( this.getAttribute( 'data-upgrade' ) );
|
3170 |
jQuery( '#frm_upgrade_modal h2' ).show();
|
3171 |
|
3172 |
+
$info.dialog( 'open' );
|
3173 |
|
3174 |
// set the utm medium
|
3175 |
+
var button = $info.find( '.button-primary:not(#frm-oneclick-button)' );
|
3176 |
+
var link = button.attr( 'href' ).replace( /(medium=)[a-z_-]+/ig, '$1' + this.getAttribute( 'data-medium' ) );
|
3177 |
var content = this.getAttribute( 'data-content' );
|
3178 |
if ( content === undefined ) {
|
3179 |
content = '';
|
3181 |
link = link.replace( /(content=)[a-z_-]+/ig, '$1' + content );
|
3182 |
button.attr( 'href', link );
|
3183 |
return false;
|
3184 |
+
});
|
3185 |
}
|
3186 |
|
3187 |
/**
|
3193 |
customLink = link.getAttribute( 'data-link' ),
|
3194 |
showLink = document.getElementById( 'frm-upgrade-modal-link' ),
|
3195 |
upgradeMessage = document.getElementById( 'frm-upgrade-message' ),
|
3196 |
+
newMessage = link.getAttribute( 'data-message' ),
|
3197 |
button = document.getElementById( 'frm-oneclick-button' ),
|
3198 |
showIt = 'block',
|
3199 |
hideIt = 'none';
|
3211 |
|
3212 |
// Use a custom message in the modal.
|
3213 |
if ( newMessage === null || typeof newMessage === 'undefined' || newMessage === '' ) {
|
3214 |
+
newMessage = upgradeMessage.getAttribute( 'data-default' );
|
3215 |
}
|
3216 |
upgradeMessage.innerHTML = newMessage;
|
3217 |
|
3218 |
// Either set the link or use the default.
|
3219 |
if ( customLink === null || typeof customLink === 'undefined' || customLink === '' ) {
|
3220 |
+
customLink = showLink.getAttribute( 'data-default' );
|
3221 |
}
|
3222 |
showLink.href = customLink;
|
3223 |
|
3224 |
document.getElementById( 'frm-addon-status' ).style.display = 'none';
|
3225 |
oneclickMessage.style.display = hideIt;
|
3226 |
+
button.style.display = hideIt === 'block' ? 'inline-block' : hideIt;
|
3227 |
upgradeMessage.style.display = showIt;
|
3228 |
+
showLink.style.display = showIt === 'block' ? 'inline-block' : showIt;
|
3229 |
}
|
3230 |
|
3231 |
/* Form settings */
|
3243 |
* using the old sidebar.
|
3244 |
*/
|
3245 |
function maybeAddFieldSelection( parentClass ) {
|
3246 |
+
var i,
|
3247 |
+
missingClass = jQuery( parentClass + ' :not(.frm_has_shortcodes) .frm_not_email_message, ' + parentClass + ' :not(.frm_has_shortcodes) .frm_not_email_to, ' + parentClass + ' :not(.frm_has_shortcodes) .frm_not_email_subject' );
|
3248 |
+
for ( i = 0; i < missingClass.length; i++ ) {
|
3249 |
missingClass[i].parentNode.classList.add( 'frm_has_shortcodes' );
|
3250 |
}
|
3251 |
}
|
3279 |
// the .html() gets original values, so they need to be set
|
3280 |
action.find( 'input[type=text], textarea, input[type=number]' ).prop( 'defaultValue', function() {
|
3281 |
return this.value;
|
3282 |
+
});
|
3283 |
|
3284 |
action.find( 'input[type=checkbox], input[type=radio]' ).prop( 'defaultChecked', function() {
|
3285 |
return this.checked;
|
3286 |
+
});
|
3287 |
|
3288 |
var rename = new RegExp( '\\[' + currentID + '\\]', 'g' );
|
3289 |
var reid = new RegExp( '_' + currentID + '"', 'g' );
|
3299 |
}
|
3300 |
|
3301 |
function newActionId( currentID ) {
|
3302 |
+
var newID = parseInt( currentID, 10 ) + 11;
|
3303 |
var exists = document.getElementById( 'frm_form_action_' + newID );
|
3304 |
if ( exists !== null ) {
|
3305 |
newID++;
|
3312 |
/*jshint validthis:true */
|
3313 |
var actionId = getNewActionId();
|
3314 |
var type = jQuery( this ).data( 'actiontype' );
|
3315 |
+
var formId = thisFormId;
|
3316 |
|
3317 |
+
jQuery.ajax({
|
3318 |
type: 'POST', url: ajaxurl,
|
3319 |
data: {
|
3320 |
action: 'frm_add_form_action',
|
3333 |
var newAction = document.getElementById( 'frm_form_action_' + actionId );
|
3334 |
|
3335 |
newAction.classList.add( 'open' );
|
3336 |
+
document.getElementById( 'post-body-content' ).scroll({
|
3337 |
top: newAction.offsetTop + 10,
|
3338 |
left: 0,
|
3339 |
behavior: 'smooth'
|
3340 |
+
});
|
3341 |
|
3342 |
//check if icon should be active
|
3343 |
checkActiveAction( type );
|
3344 |
initiateMultiselect();
|
3345 |
showInputIcon( '#frm_form_action_' + actionId );
|
3346 |
}
|
3347 |
+
});
|
3348 |
}
|
3349 |
|
3350 |
function toggleActionGroups() {
|
3371 |
//Get number of previous action
|
3372 |
len = jQuery( '.frm_form_action_settings:last' ).attr( 'id' ).replace( 'frm_form_action_', '' );
|
3373 |
}
|
3374 |
+
len = parseInt( len, 10 ) + 1;
|
3375 |
if ( typeof document.getElementById( 'frm_form_action_' + len ) !== 'undefined' ) {
|
3376 |
len = len + 100;
|
3377 |
}
|
3411 |
moveFieldSettings( singleField );
|
3412 |
|
3413 |
if ( fieldType && 'quantity' === fieldType ) {
|
3414 |
+
popProductFields( jQuery( singleField ).find( '.frmjs_prod_field_opt' )[0]);
|
3415 |
}
|
3416 |
|
3417 |
singleField.classList.remove( 'frm_hidden' );
|
3446 |
|
3447 |
function hideEmailRow() {
|
3448 |
/*jshint validthis:true */
|
3449 |
+
var actionBox = jQuery( this ).closest( '.frm_form_action_settings' ),
|
3450 |
+
rowType = this.getAttribute( 'data-emailrow' ),
|
3451 |
+
emailRowSelector = '.frm_' + rowType + '_row',
|
3452 |
+
emailButtonSelector = '.frm_' + rowType + '_button';
|
3453 |
+
|
3454 |
+
jQuery( actionBox ).find( emailButtonSelector ).fadeIn( 'slow' );
|
3455 |
+
jQuery( actionBox ).find( emailRowSelector ).fadeOut( 'slow', function() {
|
3456 |
+
jQuery( actionBox ).find( emailRowSelector + ' input' ).val( '' );
|
3457 |
+
});
|
|
|
3458 |
}
|
3459 |
|
3460 |
function checkActiveAction( type ) {
|
3461 |
+
var limit = parseInt( jQuery( '.frm_' + type + '_action' ).data( 'limit' ), 10 );
|
3462 |
var len = jQuery( '.frm_single_' + type + '_settings' ).length;
|
3463 |
var limitClass;
|
3464 |
if ( len >= limit ) {
|
3476 |
|
3477 |
function addFormLogicRow() {
|
3478 |
/*jshint validthis:true */
|
3479 |
+
var id = jQuery( this ).data( 'emailkey' ),
|
3480 |
+
type = jQuery( this ).closest( '.frm_form_action_settings' ).find( '.frm_action_name' ).val(),
|
3481 |
+
metaName = 0,
|
3482 |
+
formId = document.getElementById( 'form_id' ).value;
|
3483 |
if ( jQuery( '#frm_form_action_' + id + ' .frm_logic_row' ).length ) {
|
3484 |
+
metaName = 1 + parseInt( jQuery( '#frm_form_action_' + id + ' .frm_logic_row:last' ).attr( 'id' ).replace( 'frm_logic_' + id + '_', '' ), 10 );
|
3485 |
}
|
3486 |
+
jQuery.ajax({
|
3487 |
type: 'POST', url: ajaxurl,
|
3488 |
data: {
|
3489 |
action: 'frm_add_form_logic_row',
|
3490 |
email_id: id,
|
3491 |
+
form_id: formId,
|
3492 |
+
meta_name: metaName,
|
3493 |
type: type,
|
3494 |
nonce: frmGlobal.nonce
|
3495 |
},
|
3498 |
var $logicRow = jQuery( document.getElementById( 'frm_logic_row_' + id ) );
|
3499 |
$logicRow.append( html );
|
3500 |
$logicRow.parent( '.frm_logic_rows' ).fadeIn( 'slow' );
|
3501 |
+
});
|
3502 |
}
|
3503 |
+
});
|
3504 |
return false;
|
3505 |
}
|
3506 |
|
3521 |
*/
|
3522 |
function addSubmitLogic() {
|
3523 |
/*jshint validthis:true */
|
3524 |
+
var last,
|
3525 |
+
formId = thisFormId,
|
3526 |
+
metaName = 0;
|
3527 |
if ( jQuery( '#frm_submit_logic_row .frm_logic_row' ).length > 0 ) {
|
3528 |
+
last = jQuery( '#frm_submit_logic_row .frm_logic_row:last' );
|
|
|
|
|
3529 |
|
3530 |
+
metaName = 1 + parseInt( last.attr( 'id' ).replace( 'frm_logic_submit_', '' ), 10 );
|
3531 |
}
|
3532 |
+
jQuery.ajax({
|
3533 |
type: 'POST',
|
3534 |
url: ajaxurl,
|
3535 |
data: {
|
3536 |
action: 'frm_add_submit_logic_row',
|
3537 |
+
form_id: formId,
|
3538 |
+
meta_name: metaName,
|
3539 |
nonce: frmGlobal.nonce
|
3540 |
},
|
3541 |
success: function( html ) {
|
3543 |
$logicRow.append( html );
|
3544 |
$logicRow.parent( '.frm_submit_logic_rows' ).fadeIn( 'slow' );
|
3545 |
}
|
3546 |
+
});
|
3547 |
return false;
|
3548 |
}
|
3549 |
|
3552 |
*/
|
3553 |
function addSubmitLogicOpts() {
|
3554 |
var fieldOpt = jQuery( this );
|
3555 |
+
var fieldId = fieldOpt.find( ':selected' ).val();
|
3556 |
|
3557 |
+
if ( fieldId ) {
|
3558 |
var row = fieldOpt.data( 'row' );
|
3559 |
+
frmGetFieldValues( fieldId, 'submit', row, '', 'options[submit_conditions][hide_opt][]' );
|
3560 |
}
|
3561 |
}
|
3562 |
|
3563 |
function formatEmailSetting() {
|
3564 |
/*jshint validthis:true */
|
3565 |
+
/*var val = jQuery( this ).val();
|
3566 |
var email = val.match( /(\s[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi );
|
3567 |
+
if(email !== null && email.length) {
|
3568 |
//has email
|
3569 |
//TODO: add < > if they aren't there
|
3570 |
}*/
|
3590 |
var editable = document.getElementById( 'editable' );
|
3591 |
if ( editable !== null ) {
|
3592 |
show = editable.checked && jQuery( document.getElementById( 'edit_action' ) ).val() === 'message';
|
3593 |
+
if ( ! show ) {
|
3594 |
show = document.getElementById( 'save_draft' ).checked;
|
3595 |
}
|
3596 |
}
|
3613 |
infoModal( 'Oops. You have already used that field.' );
|
3614 |
return false;
|
3615 |
}
|
3616 |
+
});
|
3617 |
}
|
3618 |
|
3619 |
function togglePostContent() {
|
3640 |
$dyn.val( '' );
|
3641 |
jQuery( '.frm_dyncontent_opt' ).show();
|
3642 |
} else {
|
3643 |
+
jQuery.ajax({
|
3644 |
type: 'POST', url: ajaxurl,
|
3645 |
data: {action: 'frm_display_get_content', id: v, nonce: frmGlobal.nonce},
|
3646 |
success: function( val ) {
|
3647 |
$dyn.val( val );
|
3648 |
jQuery( '.frm_dyncontent_opt' ).show();
|
3649 |
}
|
3650 |
+
});
|
3651 |
}
|
3652 |
}
|
3653 |
|
3654 |
function switchPostType() {
|
3655 |
/*jshint validthis:true */
|
3656 |
// update all rows of categories/taxonomies
|
3657 |
+
var curSelect, newSelect,
|
3658 |
+
catRows = document.getElementById( 'frm_posttax_rows' ).childNodes,
|
3659 |
+
postType = this.value;
|
|
|
3660 |
|
3661 |
// Get new category/taxonomy options
|
3662 |
+
jQuery.ajax({
|
3663 |
+
type: 'POST',
|
3664 |
+
url: ajaxurl,
|
3665 |
+
data: {
|
3666 |
+
action: 'frm_replace_posttax_options',
|
3667 |
+
post_type: postType,
|
3668 |
+
nonce: frmGlobal.nonce
|
3669 |
+
},
|
3670 |
success: function( html ) {
|
3671 |
|
3672 |
// Loop through each category row, and replace the first dropdown
|
3673 |
+
for ( i = 0; i < catRows.length; i++ ) {
|
3674 |
// Check if current element is a div
|
3675 |
+
if ( catRows[i].tagName !== 'DIV' ) {
|
3676 |
continue;
|
3677 |
}
|
3678 |
|
3679 |
// Get current category select
|
3680 |
+
curSelect = catRows[i].getElementsByTagName( 'select' )[0];
|
3681 |
|
3682 |
// Set up new select
|
3683 |
+
newSelect = document.createElement( 'select' );
|
3684 |
+
newSelect.innerHTML = html;
|
3685 |
+
newSelect.className = curSelect.className;
|
3686 |
+
newSelect.name = curSelect.name;
|
3687 |
|
3688 |
// Replace the old select with the new select
|
3689 |
+
catRows[i].replaceChild( newSelect, curSelect );
|
3690 |
}
|
3691 |
}
|
3692 |
+
});
|
3693 |
}
|
3694 |
|
3695 |
function addPosttaxRow() {
|
3703 |
}
|
3704 |
|
3705 |
function addPostRow( type, button ) {
|
3706 |
+
var id = jQuery( 'input[name="id"]' ).val(),
|
3707 |
+
settings = jQuery( button ).closest( '.frm_form_action_settings' ),
|
3708 |
+
key = settings.data( 'actionkey' ),
|
3709 |
+
postType = settings.find( '.frm_post_type' ).val(),
|
3710 |
+
metaName = 0;
|
3711 |
|
|
|
3712 |
if ( jQuery( '.frm_post' + type + '_row' ).length ) {
|
3713 |
var name = jQuery( '.frm_post' + type + '_row:last' ).attr( 'id' ).replace( 'frm_post' + type + '_', '' );
|
3714 |
if ( jQuery.isNumeric( name ) ) {
|
3715 |
+
metaName = 1 + parseInt( name, 10 );
|
3716 |
} else {
|
3717 |
+
metaName = 1;
|
3718 |
}
|
3719 |
}
|
3720 |
+
jQuery.ajax({
|
3721 |
type: 'POST', url: ajaxurl,
|
3722 |
data: {
|
3723 |
+
action: 'frm_add_post' + type + '_row',
|
3724 |
+
form_id: id,
|
3725 |
+
meta_name: metaName,
|
3726 |
+
tax_key: metaName,
|
3727 |
+
post_type: postType,
|
3728 |
+
action_key: key,
|
3729 |
+
nonce: frmGlobal.nonce
|
3730 |
},
|
3731 |
success: function( html ) {
|
3732 |
jQuery( document.getElementById( 'frm_post' + type + '_rows' ) ).append( html );
|
3739 |
jQuery( '.frm_posttax_labels' ).show();
|
3740 |
}
|
3741 |
}
|
3742 |
+
});
|
3743 |
}
|
3744 |
|
3745 |
+
function getMetaValue( id, metaName ) {
|
3746 |
+
var newMeta = metaName;
|
3747 |
+
if ( jQuery( document.getElementById( id + metaName ) ).length > 0 ) {
|
3748 |
+
newMeta = getMetaValue( id, metaName + 1 );
|
3749 |
}
|
3750 |
+
return newMeta;
|
3751 |
}
|
3752 |
|
3753 |
function changePosttaxRow() {
|
3754 |
/*jshint validthis:true */
|
3755 |
+
if ( ! jQuery( this ).closest( '.frm_posttax_row' ).find( '.frm_posttax_opt_list' ).length ) {
|
3756 |
return;
|
3757 |
}
|
3758 |
|
3759 |
jQuery( this ).closest( '.frm_posttax_row' ).find( '.frm_posttax_opt_list' ).html( '<div class="spinner frm_spinner" style="display:block"></div>' );
|
3760 |
|
3761 |
+
var postType = jQuery( this ).closest( '.frm_form_action_settings' ).find( 'select[name$="[post_content][post_type]"]' ).val(),
|
3762 |
+
actionKey = jQuery( this ).closest( '.frm_form_action_settings' ).data( 'actionkey' ),
|
3763 |
+
taxKey = jQuery( this ).closest( '.frm_posttax_row' ).attr( 'id' ).replace( 'frm_posttax_', '' ),
|
3764 |
+
metaName = jQuery( this ).val(),
|
3765 |
+
showExclude = jQuery( document.getElementById( taxKey + '_show_exclude' ) ).is( ':checked' ) ? 1 : 0,
|
3766 |
+
fieldId = jQuery( 'select[name$="[post_category][' + taxKey + '][field_id]"]' ).val(),
|
3767 |
+
id = jQuery( 'input[name="id"]' ).val();
|
3768 |
|
3769 |
+
jQuery.ajax({
|
3770 |
+
type: 'POST',
|
3771 |
+
url: ajaxurl,
|
3772 |
data: {
|
3773 |
action: 'frm_add_posttax_row',
|
3774 |
form_id: id,
|
3775 |
+
post_type: postType,
|
3776 |
+
tax_key: taxKey,
|
3777 |
+
action_key: actionKey,
|
3778 |
+
meta_name: metaName,
|
3779 |
+
field_id: fieldId,
|
3780 |
+
show_exclude: showExclude,
|
3781 |
nonce: frmGlobal.nonce
|
3782 |
},
|
3783 |
success: function( html ) {
|
3784 |
+
var $tax = jQuery( document.getElementById( 'frm_posttax_' + taxKey ) );
|
3785 |
$tax.replaceWith( html );
|
3786 |
}
|
3787 |
+
});
|
3788 |
}
|
3789 |
|
3790 |
function toggleCfOpts() {
|
3859 |
|
3860 |
function displayFormSelected() {
|
3861 |
/*jshint validthis:true */
|
3862 |
+
var formId = jQuery( this ).val();
|
3863 |
+
thisFormId = formId; // set the global form id
|
3864 |
+
if ( formId === '' ) {
|
3865 |
return;
|
3866 |
}
|
3867 |
|
3868 |
+
jQuery.ajax({
|
3869 |
+
type: 'POST',
|
3870 |
+
url: ajaxurl,
|
3871 |
+
data: {
|
3872 |
+
action: 'frm_get_cd_tags_box',
|
3873 |
+
form_id: formId,
|
3874 |
+
nonce: frmGlobal.nonce
|
3875 |
+
},
|
3876 |
success: function( html ) {
|
3877 |
jQuery( '#frm_adv_info .categorydiv' ).html( html );
|
3878 |
}
|
3879 |
+
});
|
3880 |
|
3881 |
+
jQuery.ajax({
|
3882 |
+
type: 'POST',
|
3883 |
+
url: ajaxurl,
|
3884 |
+
data: {
|
3885 |
+
action: 'frm_get_date_field_select',
|
3886 |
+
form_id: formId,
|
3887 |
+
nonce: frmGlobal.nonce
|
3888 |
+
},
|
3889 |
success: function( html ) {
|
3890 |
jQuery( document.getElementById( 'date_select_container' ) ).html( html );
|
3891 |
}
|
3892 |
+
});
|
3893 |
}
|
3894 |
|
3895 |
function clickTabsAfterAjax() {
|
3922 |
if ( jQuery( '#frm_order_options .frm_logic_rows div:last' ).length > 0 ) {
|
3923 |
l = jQuery( '#frm_order_options .frm_logic_rows div:last' ).attr( 'id' ).replace( 'frm_order_field_', '' );
|
3924 |
}
|
3925 |
+
jQuery.ajax({
|
3926 |
type: 'POST', url: ajaxurl,
|
3927 |
data: {
|
3928 |
action: 'frm_add_order_row',
|
3929 |
+
form_id: thisFormId,
|
3930 |
+
order_key: ( parseInt( l, 10 ) + 1 ),
|
3931 |
nonce: frmGlobal.nonce
|
3932 |
},
|
3933 |
success: function( html ) {
|
3934 |
jQuery( '#frm_order_options .frm_logic_rows' ).append( html ).show().prev( '.frm_add_order_row' ).hide();
|
3935 |
}
|
3936 |
+
});
|
3937 |
}
|
3938 |
|
3939 |
function addWhereRow() {
|
3941 |
if ( jQuery( '#frm_where_options .frm_logic_rows div:last' ).length ) {
|
3942 |
l = jQuery( '#frm_where_options .frm_logic_rows div:last' ).attr( 'id' ).replace( 'frm_where_field_', '' );
|
3943 |
}
|
3944 |
+
jQuery.ajax({
|
3945 |
type: 'POST', url: ajaxurl,
|
3946 |
data: {
|
3947 |
action: 'frm_add_where_row',
|
3948 |
+
form_id: thisFormId,
|
3949 |
+
where_key: ( parseInt( l, 10 ) + 1 ),
|
3950 |
nonce: frmGlobal.nonce
|
3951 |
},
|
3952 |
success: function( html ) {
|
3953 |
jQuery( '#frm_where_options .frm_logic_rows' ).append( html ).show().prev( '.frm_add_where_row' ).hide();
|
3954 |
}
|
3955 |
+
});
|
3956 |
}
|
3957 |
|
3958 |
function insertWhereOptions() {
|
3959 |
/*jshint validthis:true */
|
3960 |
+
var value = this.value,
|
3961 |
+
whereKey = jQuery( this ).closest( '.frm_where_row' ).attr( 'id' ).replace( 'frm_where_field_', '' );
|
3962 |
+
|
3963 |
+
jQuery.ajax({
|
3964 |
+
type: 'POST',
|
3965 |
+
url: ajaxurl,
|
3966 |
+
data: {
|
3967 |
+
action: 'frm_add_where_options',
|
3968 |
+
where_key: whereKey,
|
3969 |
+
field_id: value,
|
3970 |
+
nonce: frmGlobal.nonce
|
3971 |
+
},
|
3972 |
success: function( html ) {
|
3973 |
+
jQuery( document.getElementById( 'where_field_options_' + whereKey ) ).html( html );
|
3974 |
}
|
3975 |
+
});
|
3976 |
}
|
3977 |
|
3978 |
function hideWhereOptions() {
|
3979 |
/*jshint validthis:true */
|
3980 |
+
var value = this.value,
|
3981 |
+
whereKey = jQuery( this ).closest( '.frm_where_row' ).attr( 'id' ).replace( 'frm_where_field_', '' );
|
3982 |
+
|
3983 |
if ( value === 'group_by' || value === 'group_by_newest' ) {
|
3984 |
+
document.getElementById( 'where_field_options_' + whereKey ).style.display = 'none';
|
3985 |
} else {
|
3986 |
+
document.getElementById( 'where_field_options_' + whereKey ).style.display = 'inline-block';
|
3987 |
}
|
3988 |
}
|
3989 |
|
3990 |
function setDefaultPostStatus() {
|
3991 |
var urlQuery = window.location.search.substring( 1 );
|
3992 |
if ( urlQuery.indexOf( 'action=edit' ) === -1 ) {
|
3993 |
+
document.getElementById( 'post-visibility-display' ).innerHTML = frm_admin_js.private_label;
|
3994 |
document.getElementById( 'hidden-post-visibility' ).value = 'private';
|
3995 |
document.getElementById( 'visibility-radio-private' ).checked = true;
|
3996 |
}
|
4006 |
|
4007 |
function insertFieldCode( element, variable ) {
|
4008 |
var rich = false,
|
4009 |
+
elementId = element;
|
4010 |
if ( typeof element === 'object' ) {
|
4011 |
if ( element.hasClass( 'frm_noallow' ) ) {
|
4012 |
return;
|
4013 |
}
|
4014 |
|
4015 |
+
elementId = jQuery( element ).closest( '[data-fills]' ).attr( 'data-fills' );
|
4016 |
+
if ( typeof elementId === 'undefined' ) {
|
4017 |
+
elementId = element.closest( 'div' ).attr( 'class' );
|
4018 |
+
if ( typeof elementId !== 'undefined' ) {
|
4019 |
+
elementId = elementId.split( ' ' )[1];
|
4020 |
}
|
4021 |
}
|
4022 |
}
|
4023 |
|
4024 |
+
if ( typeof elementId === 'undefined' ) {
|
4025 |
var active = document.activeElement;
|
4026 |
if ( active.type === 'search' ) {
|
4027 |
// If the search field has focus, find the correct field.
|
4028 |
+
elementId = active.id.replace( '-search-input', '' );
|
4029 |
+
if ( elementId.match( /\d/gi ) === null ) {
|
4030 |
+
active = jQuery( '.frm-single-settings:visible .' + elementId );
|
4031 |
+
elementId = active.attr( 'id' );
|
4032 |
}
|
4033 |
} else {
|
4034 |
+
elementId = active.id;
|
4035 |
}
|
4036 |
}
|
4037 |
|
4038 |
+
if ( elementId ) {
|
4039 |
+
rich = jQuery( '#wp-' + elementId + '-wrap.wp-editor-wrap' ).length > 0;
|
4040 |
}
|
4041 |
|
4042 |
+
var contentBox = jQuery( document.getElementById( elementId ) );
|
4043 |
+
if ( typeof element.attr( 'data-shortcode' ) === 'undefined' && ( ! contentBox.length || typeof contentBox.attr( 'data-shortcode' ) === 'undefined' ) ) {
|
4044 |
// this helps to exclude those that don't want shortcode-like inserted content e.g. frm-pro's summary field
|
4045 |
var doShortcode = element.parents( 'ul.frm_code_list' ).attr( 'data-shortcode' );
|
4046 |
if ( doShortcode === 'undefined' || doShortcode !== 'no' ) {
|
4049 |
}
|
4050 |
|
4051 |
if ( rich ) {
|
4052 |
+
wpActiveEditor = elementId;
|
4053 |
send_to_editor( variable );
|
4054 |
return;
|
4055 |
}
|
4056 |
|
4057 |
+
if ( ! contentBox.length ) {
|
4058 |
return false;
|
4059 |
}
|
4060 |
|
4063 |
if ( variable === '[default-plain]' ) {
|
4064 |
p = 1;
|
4065 |
}
|
4066 |
+
jQuery.ajax({
|
4067 |
type: 'POST', url: ajaxurl,
|
4068 |
data: {
|
4069 |
action: 'frm_get_default_html',
|
4072 |
nonce: frmGlobal.nonce
|
4073 |
},
|
4074 |
success: function( msg ) {
|
4075 |
+
insertContent( contentBox, msg );
|
4076 |
}
|
4077 |
+
});
|
4078 |
} else {
|
4079 |
+
insertContent( contentBox, variable );
|
4080 |
}
|
4081 |
return false;
|
4082 |
}
|
4083 |
|
4084 |
+
function insertContent( contentBox, variable ) {
|
4085 |
if ( document.selection ) {
|
4086 |
+
contentBox[0].focus();
|
4087 |
document.selection.createRange().text = variable;
|
4088 |
} else {
|
4089 |
+
obj = contentBox[0];
|
4090 |
var e = obj.selectionEnd;
|
4091 |
|
4092 |
+
variable = maybeFormatInsertedContent( contentBox, variable, obj.selectionStart, e );
|
4093 |
|
4094 |
obj.value = obj.value.substr( 0, obj.selectionStart ) + variable + obj.value.substr( obj.selectionEnd, obj.value.length );
|
4095 |
var s = e + variable.length;
|
4096 |
obj.focus();
|
4097 |
obj.setSelectionRange( s, s );
|
4098 |
}
|
4099 |
+
contentBox.change(); //trigger change
|
4100 |
}
|
4101 |
|
4102 |
function maybeFormatInsertedContent( input, textToInsert, selectionStart, selectionEnd ) {
|
4111 |
return textToInsert;
|
4112 |
}
|
4113 |
|
4114 |
+
var startPattern = new RegExp( separator + '\\s*$' );
|
4115 |
+
var endPattern = new RegExp( '^\\s*' + separator );
|
4116 |
|
4117 |
if ( value.substr( 0, selectionStart ).trim().length && false === startPattern.test( value.substr( 0, selectionStart ) ) ) {
|
4118 |
textToInsert = separator + textToInsert;
|
4155 |
result.innerHTML = '[' + code + '[/if ' + field + ']';
|
4156 |
}
|
4157 |
|
4158 |
+
function showBuilderModal() {
|
4159 |
/*jshint validthis:true */
|
4160 |
var moreIcon = getIconForInput( this );
|
4161 |
showInlineModal( moreIcon, this );
|
4286 |
}
|
4287 |
|
4288 |
DOM = tinymce.DOM;
|
4289 |
+
if ( typeof DOM.events !== 'undefined' && typeof DOM.events.add !== 'undefined' ) {
|
4290 |
+
DOM.events.add( DOM.select( '.wp-editor-wrap' ), 'mouseover', function() {
|
4291 |
if ( jQuery( '*:focus' ).length > 0 ) {
|
4292 |
return;
|
4293 |
}
|
4294 |
if ( this.id ) {
|
4295 |
toggleAllowedShortcodes( this.id.slice( 3, -5 ), 'focusin' );
|
4296 |
}
|
4297 |
+
});
|
4298 |
+
DOM.events.add( DOM.select( '.wp-editor-wrap' ), 'mouseout', function() {
|
4299 |
if ( jQuery( '*:focus' ).length > 0 ) {
|
4300 |
return;
|
4301 |
}
|
4302 |
if ( this.id ) {
|
4303 |
toggleAllowedShortcodes( this.id.slice( 3, -5 ), 'focusin' );
|
4304 |
}
|
4305 |
+
});
|
4306 |
} else {
|
4307 |
+
jQuery( '#frm_dyncontent' ).on( 'mouseover mouseout', '.wp-editor-wrap', function() {
|
4308 |
if ( jQuery( '*:focus' ).length > 0 ) {
|
4309 |
return;
|
4310 |
}
|
4311 |
if ( this.id ) {
|
4312 |
toggleAllowedShortcodes( this.id.slice( 3, -5 ), 'focusin' );
|
4313 |
}
|
4314 |
+
});
|
4315 |
}
|
4316 |
}
|
4317 |
|
4318 |
+
function toggleAllowedShortcodes( id ) {
|
4319 |
var c, clickedID;
|
4320 |
+
if ( typeof id === 'undefined' ) {
|
4321 |
id = '';
|
4322 |
}
|
4323 |
c = id;
|
4348 |
];
|
4349 |
var b = [
|
4350 |
'before_content', 'after_content', 'frm_not_email_to',
|
4351 |
+
'dyn_default_value'
|
4352 |
];
|
4353 |
|
4354 |
if ( jQuery.inArray( id, a ) >= 0 ) {
|
4356 |
jQuery( '.frm_code_list a.hide_' + id ).addClass( 'frm_noallow' ).removeClass( 'frm_allow' );
|
4357 |
} else if ( jQuery.inArray( id, b ) >= 0 ) {
|
4358 |
jQuery( '.frm_code_list:not(.frm-dropdown-menu) a:not(.show_' + id + ')' ).addClass( 'frm_noallow' ).removeClass( 'frm_allow' );
|
4359 |
+
jQuery( '.frm_code_list a.show_' + id ).removeClass( 'frm_noallow' ).addClass( 'frm_allow' );
|
4360 |
} else {
|
4361 |
jQuery( '.frm_code_list:not(.frm-dropdown-menu) a' ).addClass( 'frm_noallow' ).removeClass( 'frm_allow' );
|
4362 |
}
|
4370 |
}
|
4371 |
}
|
4372 |
|
4373 |
+
function toggleAllowedHTML( input ) {
|
4374 |
+
var b,
|
4375 |
+
id = input.id;
|
4376 |
if ( typeof id === 'undefined' || id.indexOf( '-search-input' ) !== -1 ) {
|
4377 |
return;
|
4378 |
}
|
4389 |
}
|
4390 |
}
|
4391 |
|
4392 |
+
function toggleKeyID( switchTo, e ) {
|
4393 |
e.stopPropagation();
|
4394 |
jQuery( '.frm_code_list .frmids, .frm_code_list .frmkeys' ).addClass( 'frm_hidden' );
|
4395 |
+
jQuery( '.frm_code_list .' + switchTo ).removeClass( 'frm_hidden' );
|
4396 |
jQuery( '.frmids, .frmkeys' ).removeClass( 'current' );
|
4397 |
+
jQuery( '.' + switchTo ).addClass( 'current' );
|
4398 |
}
|
4399 |
|
4400 |
/* Styling */
|
4458 |
var holder = anchor.replace( '#', '' );
|
4459 |
var holderContainer = jQuery( '.frm_' + holder + '_ajax' );
|
4460 |
if ( holderContainer.length ) {
|
4461 |
+
jQuery.ajax({
|
4462 |
type: 'POST', url: ajaxurl,
|
4463 |
data: {
|
4464 |
'action': 'frm_settings_tab',
|
4468 |
success: function( html ) {
|
4469 |
holderContainer.replaceWith( html );
|
4470 |
}
|
4471 |
+
});
|
4472 |
}
|
4473 |
}
|
4474 |
|
4476 |
/*jshint validthis:true */
|
4477 |
if ( confirmLinkClick( this ) === true ) {
|
4478 |
jQuery( '.frm_uninstall .frm-wait' ).css( 'visibility', 'visible' );
|
4479 |
+
jQuery.ajax({
|
4480 |
type: 'POST',
|
4481 |
url: ajaxurl,
|
4482 |
data: 'action=frm_uninstall&nonce=' + frmGlobal.nonce,
|
4484 |
jQuery( '.frm_uninstall' ).fadeOut( 'slow' );
|
4485 |
window.location = msg;
|
4486 |
}
|
4487 |
+
});
|
4488 |
}
|
4489 |
return false;
|
4490 |
}
|
4496 |
var pluginSlug = this.getAttribute( 'data-plugin' );
|
4497 |
var action = buttonName.replace( 'edd_' + pluginSlug + '_license_', '' );
|
4498 |
var license = document.getElementById( 'edd_' + pluginSlug + '_license_key' ).value;
|
4499 |
+
jQuery.ajax({
|
4500 |
type: 'POST', url: ajaxurl, dataType: 'json',
|
4501 |
data: {action: 'frm_addon_' + action, license: license, plugin: pluginSlug, nonce: frmGlobal.nonce},
|
4502 |
success: function( msg ) {
|
4519 |
}, 15000 );
|
4520 |
}
|
4521 |
}
|
4522 |
+
});
|
4523 |
}
|
4524 |
|
4525 |
/* Import/Export page */
|
4535 |
var ids = [];
|
4536 |
checkedBoxes.each( function( i ) {
|
4537 |
ids[i] = this.value;
|
4538 |
+
});
|
4539 |
|
4540 |
// Begin the import process.
|
4541 |
importForms( ids, event.target );
|
4599 |
// Remove this form ID from the queue.
|
4600 |
s.importQueue = jQuery.grep( s.importQueue, function( value ) {
|
4601 |
return value != formID;
|
4602 |
+
});
|
4603 |
s.imported++;
|
4604 |
|
4605 |
if ( s.importQueue.length === 0 ) {
|
4612 |
importForm( $processSettings );
|
4613 |
}
|
4614 |
}
|
4615 |
+
});
|
4616 |
}
|
4617 |
|
4618 |
function validateExport( e ) {
|
4644 |
function removeExportError() {
|
4645 |
/*jshint validthis:true */
|
4646 |
var t = jQuery( this ).closest( '.frm_blank_field' );
|
4647 |
+
if ( typeof t === 'undefined' ) {
|
4648 |
return;
|
4649 |
}
|
4650 |
|
4679 |
this.checked = false;
|
4680 |
if ( s.indexOf( this.value ) >= 0 ) {
|
4681 |
this.disabled = false;
|
4682 |
+
if ( multiple === -1 ) {
|
4683 |
this.checked = true;
|
4684 |
}
|
4685 |
} else {
|
4686 |
this.disabled = true;
|
4687 |
}
|
4688 |
+
});
|
4689 |
|
4690 |
if ( $dropdown.val() === 'csv' ) {
|
4691 |
jQuery( '.csv_opts' ).show();
|
4726 |
}
|
4727 |
|
4728 |
function initiateMultiselect() {
|
4729 |
+
jQuery( '.frm_multiselect' ).multiselect({
|
4730 |
templates: {ul: '<ul class="multiselect-container frm-dropdown-menu"></ul>'},
|
4731 |
buttonContainer: '<div class="btn-group frm-btn-group dropdown" />',
|
4732 |
+
nonSelectedText: frm_admin_js.default_label,
|
4733 |
onDropdownShown: function( event ) {
|
4734 |
var action = jQuery( event.currentTarget.closest( '.frm_form_action_settings, #frm-show-fields' ) );
|
4735 |
if ( action.length ) {
|
4737 |
if ( jQuery( '.multiselect-container.frm-dropdown-menu' ).is( ':visible' ) ) {
|
4738 |
jQuery( event.currentTarget ).removeClass( 'open' );
|
4739 |
}
|
4740 |
+
});
|
4741 |
}
|
4742 |
}
|
4743 |
+
});
|
4744 |
}
|
4745 |
|
4746 |
/* Addons page */
|
4762 |
var el = button.parent();
|
4763 |
var message = el.parent().find( '.addon-status-label' );
|
4764 |
|
4765 |
+
button.addClass( 'frm_loading_button' );
|
4766 |
|
4767 |
// Process the Ajax to perform the activation.
|
4768 |
+
jQuery.ajax({
|
4769 |
url: ajaxurl,
|
4770 |
type: 'POST',
|
4771 |
async: true,
|
4773 |
dataType: 'json',
|
4774 |
data: {
|
4775 |
action: action,
|
4776 |
+
nonce: frmGlobal.nonce,
|
4777 |
plugin: plugin
|
4778 |
},
|
4779 |
success: function( response ) {
|
4801 |
|
4802 |
afterAddonInstall( response, button, message, el );
|
4803 |
},
|
4804 |
+
error: function() {
|
4805 |
+
button.removeClass( 'frm_loading_button' );
|
4806 |
}
|
4807 |
+
});
|
4808 |
}
|
4809 |
|
4810 |
function installAddonWithCreds( e ) {
|
4817 |
|
4818 |
proceed.addClass( 'frm_loading_button' );
|
4819 |
|
4820 |
+
jQuery.ajax({
|
4821 |
url: ajaxurl,
|
4822 |
type: 'POST',
|
4823 |
async: true,
|
4842 |
loader.hide();
|
4843 |
jQuery( '.frm-inline-error' ).remove();
|
4844 |
//proceed.val(admin.proceed);
|
4845 |
+
//proceed.after('<span class="frm-inline-error">' + admin.connect_error + '</span>' );
|
4846 |
return;
|
4847 |
}
|
4848 |
|
4849 |
afterAddonInstall( response, proceed, message, el );
|
4850 |
},
|
4851 |
+
error: function() {
|
4852 |
proceed.removeClass( 'frm_loading_button' );
|
4853 |
}
|
4854 |
+
});
|
4855 |
}
|
4856 |
|
4857 |
function afterAddonInstall( response, button, message, el ) {
|
4865 |
jQuery( '#frm_upgrade_modal .frm_lock_icon use' ).attr( 'xlink:href', '#frm_lock_open_icon' );
|
4866 |
|
4867 |
// Proceed with CSS changes
|
4868 |
+
el.parent().removeClass( 'frm-addon-not-installed frm-addon-installed' ).addClass( 'frm-addon-active' );
|
4869 |
+
button.removeClass( 'frm_loading_button' );
|
4870 |
|
4871 |
// Maybe refresh import and SMTP pages
|
4872 |
var refreshPage = document.querySelectorAll( '.frm-admin-page-import, #frm-admin-smtp' );
|
4892 |
jQuery( '.frm-new-form-button' ).click( function( event ) {
|
4893 |
event.preventDefault();
|
4894 |
$info.dialog( 'open' );
|
4895 |
+
});
|
4896 |
|
4897 |
jQuery( document ).on( 'submit', '#frm-new-form', installTemplate );
|
4898 |
}
|
4916 |
frmApiPreview( cont, link );
|
4917 |
}
|
4918 |
$preview.dialog( 'open' );
|
4919 |
+
});
|
4920 |
}
|
4921 |
|
4922 |
var $info = initModal( '#frm_template_modal', '650px' );
|
4936 |
nameLabel.innerHTML = nameLabel.getAttribute( 'data-form' );
|
4937 |
descLabel.innerHTML = descLabel.getAttribute( 'data-form' );
|
4938 |
$info.dialog( 'open' );
|
4939 |
+
});
|
4940 |
|
4941 |
jQuery( '.frm-build-template' ).click( function( event ) {
|
4942 |
event.preventDefault();
|
4949 |
document.getElementById( 'frm_link' ).value = this.getAttribute( 'data-formid' );
|
4950 |
document.getElementById( 'frm_action_type' ).value = 'frm_build_template';
|
4951 |
$info.dialog( 'open' );
|
4952 |
+
});
|
4953 |
|
4954 |
jQuery( '.frm-new-form-button' ).click( function( event ) {
|
4955 |
event.preventDefault();
|
4962 |
document.getElementById( 'frm_link' ).value = '';
|
4963 |
document.getElementById( 'frm_action_type' ).value = 'frm_install_form';
|
4964 |
$info.dialog( 'open' );
|
4965 |
+
});
|
4966 |
|
4967 |
jQuery( document ).on( 'submit', '#frm-new-template', installTemplate );
|
4968 |
}
|
4979 |
return;
|
4980 |
}
|
4981 |
|
4982 |
+
jQuery( '.frm-' + type + '-search' ).autocomplete({
|
4983 |
delay: 100,
|
4984 |
minLength: 0,
|
4985 |
source: ajaxurl + '?action=frm_' + type + '_search&nonce=' + frmGlobal.nonce,
|
4991 |
collision: 'flip'
|
4992 |
},
|
4993 |
response: function( event, ui ) {
|
4994 |
+
if ( ! ui.content.length ) {
|
4995 |
var noResult = { value: '', label: frm_admin_js.no_items_found };
|
4996 |
ui.content.push( noResult );
|
4997 |
}
|
4998 |
},
|
4999 |
+
create: function() {
|
5000 |
var $container = jQuery( this ).parent();
|
5001 |
|
5002 |
if ( $container.length === 0 ) {
|
5005 |
|
5006 |
jQuery( this ).autocomplete( 'option', 'appendTo', $container );
|
5007 |
}
|
5008 |
+
})
|
5009 |
+
.focus( function() {
|
5010 |
// Show options on click to make it work more like a dropdown.
|
5011 |
if ( this.value === '' || this.nextElementSibling.value < 1 ) {
|
5012 |
jQuery( this ).autocomplete( 'search', this.value );
|
5013 |
}
|
5014 |
+
});
|
5015 |
}
|
5016 |
|
5017 |
/**
|
5018 |
* Prevent the value from changing when using keyboard to scroll.
|
5019 |
*/
|
5020 |
+
function autoCompleteFocus() {
|
5021 |
return false;
|
5022 |
}
|
5023 |
|
5035 |
|
5036 |
function frmApiPreview( cont, link ) {
|
5037 |
cont.innerHTML = '<div class="frm-wait"></div>';
|
5038 |
+
jQuery.ajax({
|
5039 |
dataType: 'json',
|
5040 |
url: link,
|
5041 |
success: function( json ) {
|
5046 |
form = form.replace( '<form ', '<form onsubmit="event.preventDefault();" ' );
|
5047 |
cont.innerHTML = '<div class="frm-wait" id="frm-remove-me"></div><div class="frm-fade" id="frm-show-me">' +
|
5048 |
form + '</div>';
|
5049 |
+
setTimeout( function() {
|
5050 |
document.getElementById( 'frm-remove-me' ).style.display = 'none';
|
5051 |
document.getElementById( 'frm-show-me' ).style.opacity = '1';
|
5052 |
}, 300 );
|
5053 |
}
|
5054 |
+
});
|
5055 |
}
|
5056 |
|
5057 |
function installTemplate( e ) {
|
5058 |
/*jshint validthis:true */
|
5059 |
+
var action = this.elements.type.value,
|
5060 |
button = this.querySelector( 'button' );
|
5061 |
e.preventDefault();
|
5062 |
button.classList.add( 'frm_loading_button' );
|
5083 |
jQuery( '.spinner' ).css( 'visibility', 'hidden' );
|
5084 |
// TODO: show response.message
|
5085 |
}
|
5086 |
+
});
|
5087 |
}
|
5088 |
|
5089 |
function trashTemplate( e ) {
|
5100 |
var card = document.getElementById( 'frm-template-custom-' + id );
|
5101 |
fadeOut( card, function() {
|
5102 |
card.parentNode.removeChild( card );
|
5103 |
+
});
|
5104 |
+
});
|
5105 |
}
|
5106 |
|
5107 |
function searchContent() {
|
5114 |
|
5115 |
if ( this.tagName === 'SELECT' ) {
|
5116 |
searchText = selectedOptions( this );
|
5117 |
+
searchText = searchText.join( '|' ).toLowerCase();
|
5118 |
regEx = true;
|
5119 |
}
|
5120 |
|
5168 |
|
5169 |
function postAjax( data, success ) {
|
5170 |
var xmlHttp = new XMLHttpRequest();
|
5171 |
+
var params = typeof data === 'string' ? data : Object.keys( data ).map(
|
5172 |
function( k ) {
|
5173 |
+
return encodeURIComponent( k ) + '=' + encodeURIComponent( data[k]);
|
5174 |
}
|
5175 |
).join( '&' );
|
5176 |
|
5195 |
setTimeout( success, 1000 );
|
5196 |
}
|
5197 |
|
5198 |
+
function invisible( classes ) {
|
5199 |
+
jQuery( classes ).css( 'visibility', 'hidden' );
|
5200 |
}
|
5201 |
|
5202 |
+
function visible( classes ) {
|
5203 |
+
jQuery( classes ).css( 'visibility', 'visible' );
|
5204 |
}
|
5205 |
|
5206 |
function initModal( id, width ) {
|
5212 |
if ( typeof width === 'undefined' ) {
|
5213 |
width = '550px';
|
5214 |
}
|
5215 |
+
$info.dialog({
|
5216 |
dialogClass: 'frm-dialog',
|
5217 |
modal: true,
|
5218 |
autoOpen: false,
|
5220 |
width: width,
|
5221 |
resizable: false,
|
5222 |
draggable: false,
|
5223 |
+
open: function() {
|
5224 |
jQuery( '.ui-dialog-titlebar' ).addClass( 'frm_hidden' ).removeClass( 'ui-helper-clearfix' );
|
5225 |
jQuery( '#wpwrap' ).addClass( 'frm_overlay' );
|
5226 |
jQuery( '.frm-dialog' ).removeClass( 'ui-widget ui-widget-content ui-corner-all' );
|
5229 |
// close dialog by clicking the overlay behind it
|
5230 |
jQuery( '.ui-widget-overlay, a.dismiss' ).bind( 'click', function() {
|
5231 |
$info.dialog( 'close' );
|
5232 |
+
});
|
5233 |
},
|
5234 |
close: function() {
|
5235 |
jQuery( '#wpwrap' ).removeClass( 'frm_overlay' );
|
5236 |
jQuery( '.spinner' ).css( 'visibility', 'hidden' );
|
5237 |
}
|
5238 |
+
});
|
5239 |
|
5240 |
return $info;
|
5241 |
}
|
5269 |
function maybeChangeEmbedFormMsg() {
|
5270 |
var fieldId = jQuery( this ).closest( '.frm-single-settings' ).data( 'fid' );
|
5271 |
var fieldItem = document.getElementById( 'frm_field_id_' + fieldId );
|
5272 |
+
if ( null === fieldItem || 'form' !== fieldItem.dataset.type ) {
|
5273 |
return;
|
5274 |
}
|
5275 |
|
5320 |
jQuery( '.wp-admin' ).click( function( e ) {
|
5321 |
var t = jQuery( e.target );
|
5322 |
var $openDrop = jQuery( '.dropdown.open' );
|
5323 |
+
if ( $openDrop.length && ! t.hasClass( 'dropdown' ) && ! t.closest( '.dropdown' ).length ) {
|
5324 |
$openDrop.removeClass( 'open' );
|
5325 |
}
|
5326 |
+
});
|
5327 |
jQuery( '#frm_bs_dropdown:not(.open) a' ).click( focusSearchBox );
|
5328 |
|
5329 |
+
if ( typeof thisFormId === 'undefined' ) {
|
5330 |
+
thisFormId = jQuery( document.getElementById( 'form_id' ) ).val();
|
5331 |
}
|
5332 |
|
5333 |
if ( $newFields.length > 0 ) {
|
5361 |
jQuery( '[data-frmprint]' ).click( function() {
|
5362 |
window.print();
|
5363 |
return false;
|
5364 |
+
});
|
5365 |
}
|
5366 |
|
5367 |
var $advInfo = jQuery( document.getElementById( 'frm_adv_info' ) );
|
5382 |
this.style.display = 'none';
|
5383 |
}
|
5384 |
return false;
|
5385 |
+
});
|
5386 |
|
5387 |
jQuery( '.cancel-frm_shortcode', '#frm_shortcodediv' ).click( function() {
|
5388 |
$shortCodeDiv.slideUp( 'fast' );
|
5389 |
$shortCodeDiv.siblings( 'a.edit-frm_shortcode' ).show();
|
5390 |
return false;
|
5391 |
+
});
|
5392 |
}
|
5393 |
|
5394 |
// tabs
|
5398 |
clickTab( this );
|
5399 |
return false;
|
5400 |
}
|
5401 |
+
});
|
5402 |
clickTab( jQuery( '.starttab a' ), 'auto' );
|
5403 |
|
5404 |
// submit the search form with dropdown
|
5407 |
jQuery( 'select[name="fid"]' ).val( val );
|
5408 |
jQuery( document.getElementById( 'posts-filter' ) ).submit();
|
5409 |
return false;
|
5410 |
+
});
|
5411 |
|
5412 |
jQuery( '.frm_select_box' ).on( 'click focus', function() {
|
5413 |
this.select();
|
5414 |
+
});
|
5415 |
|
5416 |
jQuery( document ).on( 'input search change', '.frm-auto-search', searchContent );
|
5417 |
jQuery( document ).on( 'focusin click', '.frm-auto-search', stopPropagation );
|
5432 |
|
5433 |
buildInit: function() {
|
5434 |
if ( jQuery( '.frm_field_loading' ).length ) {
|
5435 |
+
var loadFieldId = jQuery( '.frm_field_loading' ).first().attr( 'id' );
|
5436 |
+
loadFields( loadFieldId );
|
5437 |
}
|
5438 |
|
5439 |
setupSortable( 'ul.frm_sorting' );
|
5440 |
|
5441 |
// Show message if section has no fields inside
|
5442 |
+
var frmSorting = jQuery( '.start_divider.frm_sorting' );
|
5443 |
+
for ( i = 0; i < frmSorting.length; i++ ) {
|
5444 |
+
if ( frmSorting[i].children.length < 2 ) {
|
5445 |
+
jQuery( frmSorting[i]).parent().children( '.frm_no_section_fields' ).addClass( 'frm_block' );
|
5446 |
}
|
5447 |
}
|
5448 |
|
5449 |
+
jQuery( '.field_type_list > li:not(.frm_noallow)' ).draggable({
|
5450 |
connectToSortable: '#frm-show-fields',
|
5451 |
helper: 'clone',
|
5452 |
revert: 'invalid',
|
5453 |
delay: 10,
|
5454 |
cancel: '.frm-dropdown-menu'
|
5455 |
+
});
|
5456 |
jQuery( 'ul.field_type_list, .field_type_list li, ul.frm_code_list, .frm_code_list li, .frm_code_list li a, #frm_adv_info #category-tabs li, #frm_adv_info #category-tabs li a' ).disableSelection();
|
5457 |
|
5458 |
jQuery( '.frm_submit_ajax' ).click( submitBuild );
|
5466 |
jQuery( document.getElementById( 'form-status-display' ) ).html( newStatus );
|
5467 |
jQuery( '.cancel-form-status' ).click();
|
5468 |
return false;
|
5469 |
+
});
|
5470 |
|
5471 |
jQuery( '.frm_form_builder form:first' ).submit( function() {
|
5472 |
jQuery( '.inplace_field' ).blur();
|
5473 |
+
});
|
5474 |
|
5475 |
initiateMultiselect();
|
5476 |
renumberPageBreaks();
|
5497 |
$builderForm.on( 'change', '.frm_js_checkbox_limit', checkCheckboxSelectionsLimit );
|
5498 |
$builderForm.on( 'input', 'input[name^="field_options[add_label_"]', function() {
|
5499 |
updateRepeatText( this, 'add' );
|
5500 |
+
});
|
5501 |
$builderForm.on( 'input', 'input[name^="field_options[remove_label_"]', function() {
|
5502 |
updateRepeatText( this, 'remove' );
|
5503 |
+
});
|
5504 |
$builderForm.on( 'change', 'select[name^="field_options[data_type_"]', maybeClearWatchFields );
|
5505 |
jQuery( builderArea ).on( 'click', '.frm-collapse-page', maybeCollapsePage );
|
5506 |
jQuery( builderArea ).on( 'click', '.frm-collapse-section', maybeCollapseSection );
|
5547 |
},
|
5548 |
|
5549 |
settingsInit: function() {
|
5550 |
+
var formSettings, $loggedIn, $cookieExp, $editable,
|
5551 |
+
$formActions = jQuery( document.getElementById( 'frm_notification_settings' ) );
|
5552 |
//BCC, CC, and Reply To button functionality
|
5553 |
$formActions.on( 'click', '.frm_email_buttons', showEmailRow );
|
5554 |
$formActions.on( 'click', '.frm_remove_field', hideEmailRow );
|
5563 |
$formActions.on( 'click', '.frm_duplicate_form_action', copyFormAction );
|
5564 |
jQuery( 'select[data-toggleclass], input[data-toggleclass]' ).change( toggleFormOpts );
|
5565 |
jQuery( '.frm_actions_list' ).on( 'click', '.frm_active_action', addFormAction );
|
5566 |
+
jQuery( '#frm-show-groups, #frm-hide-groups' ).click( toggleActionGroups );
|
5567 |
initiateMultiselect();
|
5568 |
|
5569 |
//set actions icons to inactive
|
5572 |
|
5573 |
// If the icon is a background image, don't add BG color.
|
5574 |
var icon = jQuery( this ).find( 'i' );
|
5575 |
+
if ( icon.css( 'background-image' ) !== 'none' ) {
|
5576 |
icon.addClass( 'frm-inverse' );
|
5577 |
}
|
5578 |
+
});
|
5579 |
|
5580 |
jQuery( '.frm_submit_settings_btn' ).click( submitSettings );
|
5581 |
|
5582 |
+
formSettings = jQuery( '.frm_form_settings' );
|
5583 |
formSettings.on( 'click', '.frm_add_form_logic', addFormLogicRow );
|
5584 |
formSettings.on( 'blur', '.frm_email_blur', formatEmailSetting );
|
5585 |
formSettings.on( 'click', '.frm_already_used', onlyOneActionMessage );
|
5605 |
if ( sidebar !== null && ! isChild && sidebar.display !== 'none' ) {
|
5606 |
hideShortcodes( sidebar );
|
5607 |
}
|
5608 |
+
});
|
5609 |
|
5610 |
//Warning when user selects "Do not store entries ..."
|
5611 |
jQuery( document.getElementById( 'no_save' ) ).change( function() {
|
5615 |
jQuery( this ).attr( 'checked', false );
|
5616 |
}
|
5617 |
}
|
5618 |
+
});
|
5619 |
|
5620 |
//Show/hide Messages header
|
5621 |
jQuery( '#editable, #edit_action, #save_draft, #success_action' ).change( function() {
|
5622 |
maybeShowFormMessages();
|
5623 |
+
});
|
5624 |
+
jQuery( 'select[name="options[success_action]"], select[name="options[edit_action]"]' ).change( showSuccessOpt );
|
5625 |
|
5626 |
+
$loggedIn = document.getElementById( 'logged_in' );
|
5627 |
jQuery( $loggedIn ).change( function() {
|
5628 |
if ( this.checked ) {
|
5629 |
visible( '.hide_logged_in' );
|
5630 |
} else {
|
5631 |
invisible( '.hide_logged_in' );
|
5632 |
}
|
5633 |
+
});
|
5634 |
|
5635 |
+
$cookieExp = jQuery( document.getElementById( 'frm_cookie_expiration' ) );
|
5636 |
jQuery( document.getElementById( 'frm_single_entry_type' ) ).change( function() {
|
5637 |
if ( this.value === 'cookie' ) {
|
5638 |
$cookieExp.fadeIn( 'slow' );
|
5639 |
} else {
|
5640 |
$cookieExp.fadeOut( 'slow' );
|
5641 |
}
|
5642 |
+
});
|
5643 |
|
5644 |
var $singleEntry = document.getElementById( 'single_entry' );
|
5645 |
jQuery( $singleEntry ).change( function() {
|
5654 |
} else {
|
5655 |
$cookieExp.fadeOut( 'slow' );
|
5656 |
}
|
5657 |
+
});
|
5658 |
|
5659 |
jQuery( '.hide_save_draft' ).hide();
|
5660 |
|
5665 |
} else {
|
5666 |
jQuery( '.hide_save_draft' ).fadeOut( 'slow' );
|
5667 |
}
|
5668 |
+
});
|
5669 |
$saveDraft.change();
|
5670 |
|
5671 |
//If Allow editing is checked/unchecked
|
5672 |
+
$editable = document.getElementById( 'editable' );
|
5673 |
jQuery( $editable ).change( function() {
|
5674 |
if ( this.checked ) {
|
5675 |
jQuery( '.hide_editable' ).fadeIn( 'slow' );
|
5678 |
jQuery( '.hide_editable' ).fadeOut( 'slow' );
|
5679 |
jQuery( '.edit_action_message_box' ).fadeOut( 'slow' );//Hide On Update message box
|
5680 |
}
|
5681 |
+
});
|
5682 |
|
5683 |
// Page Selection Autocomplete
|
5684 |
initSelectionAutocomplete();
|
5685 |
},
|
5686 |
|
5687 |
panelInit: function() {
|
5688 |
+
var customPanel, settingsPage, viewPage, insertFieldsTab;
|
5689 |
+
|
5690 |
jQuery( '.frm_wrap, #postbox-container-1' ).on( 'click', '.frm_insert_code', insertCode );
|
5691 |
jQuery( document ).on( 'change', '.frm_insert_val', function() {
|
5692 |
insertFieldCode( jQuery( this ).data( 'target' ), jQuery( this ).val() );
|
5693 |
jQuery( this ).val( '' );
|
5694 |
+
});
|
5695 |
|
5696 |
jQuery( document ).on( 'click change', '#frm-id-key-condition', resetLogicBuilder );
|
5697 |
jQuery( document ).on( 'keyup change', '.frm-build-logic', setLogicExample );
|
5703 |
});
|
5704 |
jQuery( document ).on( 'mousedown', '.frm-show-box', showShortcodes );
|
5705 |
|
5706 |
+
settingsPage = document.getElementById( 'form_settings_page' );
|
5707 |
+
viewPage = document.body.classList.contains( 'post-type-frm_display' );
|
5708 |
+
insertFieldsTab = document.getElementById( 'frm_insert_fields_tab' );
|
|
|
5709 |
|
5710 |
if ( settingsPage !== null || viewPage ) {
|
5711 |
jQuery( document ).on( 'focusin', 'form input, form textarea', function( e ) {
|
5712 |
+
var htmlTab;
|
5713 |
e.stopPropagation();
|
5714 |
maybeShowModal( this );
|
5715 |
|
5721 |
|
5722 |
if ( settingsPage !== null ) {
|
5723 |
/* form settings page */
|
5724 |
+
htmlTab = jQuery( '#frm_html_tab' );
|
5725 |
if ( jQuery( this ).closest( '#html_settings' ).length > 0 ) {
|
5726 |
htmlTab.show();
|
5727 |
htmlTab.siblings().hide();
|
5738 |
toggleAllowedShortcodes( this.id, e.type );
|
5739 |
}
|
5740 |
}
|
5741 |
+
});
|
5742 |
}
|
5743 |
|
5744 |
jQuery( '.frm_wrap, #postbox-container-1' ).on( 'mousedown', '#frm_adv_info a, .frm_field_list a', function( e ) {
|
5745 |
e.preventDefault();
|
5746 |
+
});
|
5747 |
|
5748 |
+
customPanel = jQuery( '#frm_adv_info' );
|
5749 |
customPanel.on( 'click', '.subsubsub a.frmids', function( e ) {
|
5750 |
toggleKeyID( 'frmids', e );
|
5751 |
+
});
|
5752 |
customPanel.on( 'click', '.subsubsub a.frmkeys', function( e ) {
|
5753 |
toggleKeyID( 'frmkeys', e );
|
5754 |
+
});
|
5755 |
},
|
5756 |
|
5757 |
templateInit: function() {
|
5760 |
},
|
5761 |
|
5762 |
viewInit: function() {
|
5763 |
+
var $addRemove,
|
5764 |
+
$advInfo = jQuery( document.getElementById( 'frm_adv_info' ) );
|
5765 |
$advInfo.before( '<div id="frm_position_ele"></div>' );
|
5766 |
setupMenuOffset();
|
5767 |
|
5789 |
|
5790 |
jQuery( document.getElementById( 'form_id' ) ).change( displayFormSelected );
|
5791 |
|
5792 |
+
$addRemove = jQuery( '.frm_repeat_rows' );
|
5793 |
$addRemove.on( 'click', '.frm_add_order_row', addOrderRow );
|
5794 |
$addRemove.on( 'click', '.frm_add_where_row', addWhereRow );
|
5795 |
$addRemove.on( 'change', '.frm_insert_where_options', insertWhereOptions );
|
5805 |
document.getElementById( 'frm_field_font_size' ).addEventListener( 'change', textSquishCheck );
|
5806 |
document.getElementById( 'frm_field_pad' ).addEventListener( 'change', textSquishCheck );
|
5807 |
|
5808 |
+
jQuery( 'input.hex' ).wpColorPicker({
|
5809 |
+
change: function( event ) {
|
5810 |
var hexcolor = jQuery( this ).wpColorPicker( 'color' );
|
5811 |
jQuery( event.target ).val( hexcolor ).change();
|
5812 |
}
|
5813 |
+
});
|
5814 |
jQuery( '.wp-color-result-text' ).text( function( i, oldText ) {
|
5815 |
return oldText === 'Select Color' ? 'Select' : oldText;
|
5816 |
+
});
|
5817 |
|
5818 |
// update styling on change
|
5819 |
jQuery( '#frm_styling_form .styling_settings' ).change( function() {
|
5820 |
var locStr = jQuery( 'input[name^="frm_style_setting[post_content]"], select[name^="frm_style_setting[post_content]"], textarea[name^="frm_style_setting[post_content]"], input[name="style_name"]' ).serializeArray();
|
5821 |
locStr = JSON.stringify( locStr );
|
5822 |
+
jQuery.ajax({
|
5823 |
type: 'POST', url: ajaxurl,
|
5824 |
data: {
|
5825 |
action: 'frm_change_styling',
|
5826 |
nonce: frmGlobal.nonce,
|
5827 |
+
frm_style_setting: locStr
|
5828 |
},
|
5829 |
success: function( css ) {
|
5830 |
document.getElementById( 'this_css' ).innerHTML = css;
|
5831 |
}
|
5832 |
+
});
|
5833 |
+
});
|
5834 |
|
5835 |
// menu tabs
|
5836 |
jQuery( '#menu-settings-column' ).bind( 'click', function( e ) {
|
5837 |
+
var panelId, wrapper,
|
5838 |
target = jQuery( e.target );
|
5839 |
|
5840 |
if ( e.target.className.indexOf( 'nav-tab-link' ) !== -1 ) {
|
5855 |
|
5856 |
e.preventDefault();
|
5857 |
}
|
5858 |
+
});
|
5859 |
|
5860 |
jQuery( '.multiselect-container.frm-dropdown-menu li a' ).click( function() {
|
5861 |
var radio = this.children[0].children[0];
|
5867 |
// set active class
|
5868 |
btnGrp.find( 'li.active' ).removeClass( 'active' );
|
5869 |
jQuery( this ).closest( 'li' ).addClass( 'active' );
|
5870 |
+
});
|
5871 |
|
5872 |
jQuery( '#frm_confirm_modal' ).on( 'click', '[data-resetstyle]', function( e ) {
|
5873 |
var button = document.getElementById( 'frm_reset_style' );
|
5875 |
button.classList.add( 'frm_loading_button' );
|
5876 |
e.stopPropagation();
|
5877 |
|
5878 |
+
jQuery.ajax({
|
5879 |
type: 'POST', url: ajaxurl,
|
5880 |
data: {action: 'frm_settings_reset', nonce: frmGlobal.nonce},
|
5881 |
success: function( errObj ) {
|
5882 |
+
var key;
|
5883 |
errObj = errObj.replace( /^\s+|\s+$/g, '' );
|
5884 |
if ( errObj.indexOf( '{' ) === 0 ) {
|
5885 |
errObj = jQuery.parseJSON( errObj );
|
5886 |
}
|
5887 |
+
for ( key in errObj ) {
|
5888 |
+
jQuery( 'input[name$="[' + key + ']"], select[name$="[' + key + ']"]' ).val( errObj[key]);
|
5889 |
}
|
5890 |
jQuery( '#frm_submit_style, #frm_auto_width' ).prop( 'checked', false );
|
5891 |
jQuery( document.getElementById( 'frm_fieldset' ) ).change();
|
5892 |
button.classList.remove( 'frm_loading_button' );
|
5893 |
}
|
5894 |
+
});
|
5895 |
+
});
|
5896 |
|
5897 |
+
jQuery( '.frm_pro_form #datepicker_sample' ).datepicker({ changeMonth: true, changeYear: true });
|
5898 |
|
5899 |
jQuery( document.getElementById( 'frm_position' ) ).change( setPosClass );
|
5900 |
|
5901 |
jQuery( 'select[name$="[theme_selector]"]' ).change( function() {
|
5902 |
var themeVal = jQuery( this ).val();
|
|
|
5903 |
var css = themeVal;
|
5904 |
if ( themeVal !== -1 ) {
|
5905 |
if ( themeVal === 'ui-lightness' && frm_admin_js.pro_url !== '' ) {
|
5914 |
updateUICSS( css );
|
5915 |
document.getElementById( 'frm_theme_css' ).value = themeVal;
|
5916 |
return false;
|
5917 |
+
}).change();
|
5918 |
},
|
5919 |
|
5920 |
customCSSInit: function() {
|
5921 |
/* deprecated since WP 4.9 */
|
5922 |
var customCSS = document.getElementById( 'frm_custom_css_box' );
|
5923 |
if ( customCSS !== null ) {
|
5924 |
+
CodeMirror.fromTextArea( customCSS, {
|
5925 |
lineNumbers: true
|
5926 |
+
});
|
5927 |
}
|
5928 |
},
|
5929 |
|
5930 |
globalSettingsInit: function() {
|
5931 |
+
var licenseTab;
|
5932 |
+
|
5933 |
+
jQuery( document ).on( 'click', '[data-frmuninstall]', uninstallNow );
|
5934 |
|
5935 |
initiateMultiselect();
|
5936 |
|
5937 |
// activate addon licenses
|
5938 |
+
licenseTab = document.getElementById( 'licenses_settings' );
|
5939 |
if ( licenseTab !== null ) {
|
5940 |
jQuery( licenseTab ).on( 'click', '.edd_frm_save_license', saveAddonLicense );
|
5941 |
}
|
5944 |
event.preventDefault();
|
5945 |
jQuery.post( ajaxurl, {
|
5946 |
action: 'frm_lite_settings_upgrade'
|
5947 |
+
});
|
5948 |
jQuery( '.settings-lite-cta' ).remove();
|
5949 |
+
});
|
5950 |
},
|
5951 |
|
5952 |
exportInit: function() {
|
5964 |
action: 'frm_dismiss_migrator',
|
5965 |
plugin: this.id,
|
5966 |
nonce: frmGlobal.nonce
|
5967 |
+
});
|
5968 |
this.parentElement.remove();
|
5969 |
+
});
|
5970 |
},
|
5971 |
|
5972 |
+
updateOpts: function( fieldId, opts, modal ) {
|
5973 |
+
var separate = usingSeparateValues( fieldId ),
|
5974 |
+
action = isProductField( fieldId ) ? 'frm_bulk_products' : 'frm_import_options';
|
5975 |
+
jQuery.ajax({
|
|
|
5976 |
type: 'POST',
|
5977 |
url: ajaxurl,
|
5978 |
data: {
|
5979 |
action: action,
|
5980 |
+
field_id: fieldId,
|
5981 |
opts: opts,
|
5982 |
separate: separate,
|
5983 |
nonce: frmGlobal.nonce
|
5984 |
},
|
5985 |
success: function( html ) {
|
5986 |
+
document.getElementById( 'frm_field_' + fieldId + '_opts' ).innerHTML = html;
|
5987 |
+
resetDisplayedOpts( fieldId );
|
5988 |
|
5989 |
if ( typeof modal !== 'undefined' ) {
|
5990 |
modal.dialog( 'close' );
|
5991 |
document.getElementById( 'frm-update-bulk-opts' ).classList.remove( 'frm_loading_button' );
|
5992 |
}
|
5993 |
}
|
5994 |
+
});
|
5995 |
},
|
5996 |
|
5997 |
/* remove conditional logic if the field doesn't exist */
|
6009 |
};
|
6010 |
}
|
6011 |
|
6012 |
+
frmAdminBuild = frmAdminBuildJS();
|
6013 |
|
6014 |
jQuery( document ).ready( function( $ ) {
|
6015 |
frmAdminBuild.init();
|
6016 |
+
});
|
6017 |
|
6018 |
+
function frm_remove_tag( htmlTag ) { // eslint-disable-line camelcase
|
6019 |
console.warn( 'DEPRECATED: function frm_remove_tag in v2.0' );
|
6020 |
+
jQuery( htmlTag ).remove();
|
6021 |
}
|
6022 |
|
6023 |
+
function frm_show_div( div, value, showIf, classId ) { // eslint-disable-line camelcase
|
6024 |
+
if ( value == showIf ) {
|
6025 |
+
jQuery( classId + div ).fadeIn( 'slow' ).css( 'visibility', 'visible' );
|
6026 |
} else {
|
6027 |
+
jQuery( classId + div ).fadeOut( 'slow' );
|
6028 |
}
|
6029 |
}
|
6030 |
|
6031 |
function frmCheckAll( checked, n ) {
|
6032 |
if ( checked ) {
|
6033 |
+
jQuery( 'input[name^="' + n + '"]' ).attr( 'checked', 'checked' );
|
6034 |
} else {
|
6035 |
+
jQuery( 'input[name^="' + n + '"]' ).removeAttr( 'checked' );
|
6036 |
}
|
6037 |
}
|
6038 |
|
6039 |
function frmCheckAllLevel( checked, n, level ) {
|
6040 |
+
var $kids = jQuery( '.frm_catlevel_' + level ).children( '.frm_checkbox' ).children( 'label' );
|
6041 |
if ( checked ) {
|
6042 |
+
$kids.children( 'input[name^="' + n + '"]' ).attr( 'checked', 'checked' );
|
6043 |
} else {
|
6044 |
+
$kids.children( 'input[name^="' + n + '"]' ).removeAttr( 'checked' );
|
6045 |
}
|
6046 |
}
|
6047 |
|
6048 |
+
function frm_add_logic_row( id, formId ) { // eslint-disable-line camelcase
|
6049 |
console.warn( 'DEPRECATED: function frm_add_logic_row in v2.0' );
|
6050 |
+
jQuery.ajax({
|
6051 |
+
type: 'POST',
|
6052 |
+
url: ajaxurl,
|
6053 |
data: {
|
6054 |
action: 'frm_add_logic_row',
|
6055 |
+
form_id: formId,
|
6056 |
field_id: id,
|
6057 |
meta_name: jQuery( '#frm_logic_row_' + id + ' > div' ).size(),
|
6058 |
nonce: frmGlobal.nonce
|
6060 |
success: function( html ) {
|
6061 |
jQuery( '#frm_logic_row_' + id ).append( html );
|
6062 |
}
|
6063 |
+
});
|
6064 |
return false;
|
6065 |
}
|
6066 |
|
6067 |
+
function frmGetFieldValues( fieldId, cur, rowNumber, fieldType, htmlName ) {
|
6068 |
|
6069 |
+
if ( fieldId ) {
|
6070 |
+
jQuery.ajax({
|
6071 |
type: 'POST', url: ajaxurl,
|
6072 |
+
data: 'action=frm_get_field_values¤t_field=' + cur + '&field_id=' + fieldId + '&name=' + htmlName + '&t=' + fieldType + '&form_action=' + jQuery( 'input[name="frm_action"]' ).val() + '&nonce=' + frmGlobal.nonce,
|
6073 |
success: function( msg ) {
|
6074 |
+
document.getElementById( 'frm_show_selected_values_' + cur + '_' + rowNumber ).innerHTML = msg;
|
6075 |
}
|
6076 |
+
});
|
6077 |
}
|
6078 |
}
|
6079 |
|
6080 |
function frmImportCsv( formID ) {
|
6081 |
var urlVars = '';
|
6082 |
+
if ( typeof __FRMURLVARS !== 'undefined' ) {
|
6083 |
urlVars = __FRMURLVARS;
|
6084 |
}
|
6085 |
|
6086 |
+
jQuery.ajax({
|
6087 |
+
type: 'POST', url: ajaxurl,
|
6088 |
data: 'action=frm_import_csv&nonce=' + frmGlobal.nonce + '&frm_skip_cookie=1' + urlVars,
|
6089 |
success: function( count ) {
|
6090 |
var max = jQuery( '.frm_admin_progress_bar' ).attr( 'aria-valuemax' );
|
6091 |
var imported = max - count;
|
6092 |
+
var percent = ( imported / max ) * 100;
|
6093 |
jQuery( '.frm_admin_progress_bar' ).css( 'width', percent + '%' ).attr( 'aria-valuenow', imported );
|
6094 |
|
6095 |
+
if ( parseInt( count, 10 ) > 0 ) {
|
6096 |
jQuery( '.frm_csv_remaining' ).html( count );
|
6097 |
frmImportCsv( formID );
|
6098 |
} else {
|
6102 |
}, 2000 );
|
6103 |
}
|
6104 |
}
|
6105 |
+
});
|
6106 |
}
|
6107 |
|
6108 |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill
|
6109 |
if ( ! String.prototype.trim ) {
|
6110 |
+
String.prototype.trim = function() {
|
6111 |
return this.replace( /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '' );
|
6112 |
};
|
6113 |
}
|
6114 |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith#Polyfill
|
6115 |
+
if ( ! String.prototype.startsWith ) {
|
6116 |
+
Object.defineProperty( String.prototype, 'startsWith', {
|
6117 |
+
value: function( search, pos ) {
|
6118 |
+
pos = ! pos || pos < 0 ? 0 : +pos;
|
6119 |
+
return this.substring( pos, pos + search.length ) === search;
|
6120 |
}
|
6121 |
});
|
6122 |
}
|
js/formidable_admin_global.js
CHANGED
@@ -1,41 +1,55 @@
|
|
1 |
-
jQuery
|
2 |
-
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
}
|
6 |
|
7 |
-
|
8 |
-
if(deauthLink.length){
|
9 |
-
deauthLink.click(frmDeauthorizeNow);
|
10 |
}
|
11 |
|
12 |
-
if(typeof tb_remove
|
13 |
frmAdminPopup.init();
|
14 |
}
|
15 |
});
|
16 |
|
17 |
-
function frm_install_now(){
|
18 |
-
var $msg = jQuery(document.getElementById('frm_install_message'));
|
19 |
-
$msg.html('<div class="frm_plugin_updating">'+frmGlobal.updating_msg+'<div class="spinner frm_spinner"></div></div>');
|
20 |
jQuery.ajax({
|
21 |
-
type:'POST',
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
});
|
25 |
return false;
|
26 |
}
|
27 |
|
28 |
-
function frmInstallPro( e ){
|
29 |
-
var
|
|
|
30 |
if ( plugin === '' ) {
|
31 |
return true;
|
32 |
}
|
33 |
|
34 |
e.preventDefault();
|
35 |
|
36 |
-
|
37 |
-
$msg.html('<div class="frm_plugin_updating">'+frmGlobal.updating_msg+'<div class="spinner frm_spinner"></div></div>');
|
38 |
-
$msg.fadeIn('slow');
|
39 |
|
40 |
jQuery.ajax({
|
41 |
url: ajaxurl,
|
@@ -45,198 +59,235 @@ function frmInstallPro( e ){
|
|
45 |
dataType: 'json',
|
46 |
data: {
|
47 |
action: 'frm_install_addon',
|
48 |
-
nonce:
|
49 |
plugin: plugin
|
50 |
},
|
51 |
success: function() {
|
52 |
-
$msg.fadeOut('slow');
|
53 |
-
$msg.parent().fadeOut('slow');
|
54 |
},
|
55 |
-
error: function(
|
56 |
-
$msg.fadeOut('slow');
|
57 |
}
|
58 |
});
|
59 |
return false;
|
60 |
}
|
61 |
|
62 |
-
function frmDeauthorizeNow(){
|
63 |
-
if(!confirm(frmGlobal.deauthorize)){
|
64 |
-
|
65 |
}
|
66 |
-
jQuery(this).html('<span class="spinner"></span>');
|
67 |
jQuery.ajax({
|
68 |
-
type:'POST',
|
69 |
-
|
70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
});
|
72 |
return false;
|
73 |
}
|
74 |
|
75 |
-
function frmSelectSubnav(){
|
76 |
-
var frmMenu = document.getElementById('toplevel_page_formidable');
|
77 |
-
jQuery(frmMenu).removeClass('wp-not-current-submenu').addClass('wp-has-current-submenu wp-menu-open');
|
78 |
-
jQuery('#toplevel_page_formidable a.wp-has-submenu').removeClass('wp-not-current-submenu').addClass('wp-has-current-submenu wp-menu-open');
|
79 |
}
|
80 |
|
81 |
-
function frmCreatePostEntry(id,
|
82 |
-
jQuery('#frm_create_entry p').replaceWith('<img src="'+ frmGlobal.url +'/images/wpspin_light.gif" alt="'+ frmGlobal.loading +'" />');
|
83 |
jQuery.ajax({
|
84 |
-
|
85 |
-
|
86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
});
|
88 |
}
|
89 |
|
90 |
-
function frmAdminPopupJS(){
|
91 |
-
function switchSc(){
|
92 |
-
|
93 |
-
jQuery(
|
|
|
94 |
toggleMenu();
|
95 |
-
jQuery('#frm_popup_content .media-frame-title h1').html(jQuery(this).children('.howto').text() +' <span class="spinner" style="float:left;"></span>');
|
96 |
-
|
97 |
-
populateOpts(val);
|
98 |
return false;
|
99 |
}
|
100 |
|
101 |
-
function populateOpts(val){
|
102 |
-
var
|
103 |
-
|
104 |
-
|
|
|
105 |
}
|
106 |
-
jQuery('.frm_shortcode_option').hide();
|
107 |
|
108 |
-
|
109 |
-
if($settings !== null){
|
110 |
$settings.style.display = '';
|
111 |
-
jQuery(document.getElementById('sc-'+ val)).click();
|
112 |
-
}else{
|
113 |
-
|
114 |
-
|
115 |
$spinner.show();
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
var output = '['+sc;
|
132 |
-
inputs.each(function(){
|
133 |
-
var $thisInput = jQuery(this);
|
134 |
-
var attrId = this.id;
|
135 |
-
if ( attrId.indexOf('frmsc_') === 0){
|
136 |
-
var attrName = attrId.replace('frmsc_'+ sc +'_', '');
|
137 |
-
var attrVal = $thisInput.val();
|
138 |
-
|
139 |
-
if(($thisInput.attr('type') == 'checkbox' && !this.checked) || (($thisInput.attr('type') == 'text' || $thisInput.is('select')) && attrVal === '')){
|
140 |
-
}else{
|
141 |
-
output += ' '+ attrName +'="'+ attrVal +'"';
|
142 |
}
|
143 |
}
|
144 |
});
|
145 |
output += ']';
|
146 |
-
document.getElementById('frm_complete_shortcode').value = output;
|
147 |
}
|
148 |
|
149 |
-
function insertShortcode(){
|
150 |
var win = window.dialogArguments || opener || parent || top;
|
151 |
-
win.send_to_editor(document.getElementById('frm_complete_shortcode').value);
|
152 |
}
|
153 |
|
154 |
-
function getFieldSelection(){
|
155 |
-
|
156 |
-
|
157 |
-
|
|
|
158 |
jQuery.ajax({
|
159 |
-
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
var baseId = thisId.replace( '_form', '' );
|
163 |
-
msg = msg.replace('name="field_options[form_select_0]"', 'id="frmsc_' + baseId + '_fields"');
|
164 |
-
jQuery(document.getElementById(baseId+'_fields_container')).html(msg);
|
165 |
}
|
166 |
});
|
167 |
}
|
168 |
}
|
169 |
|
170 |
-
function toggleMenu(){
|
171 |
-
jQuery(document.getElementById('frm_popup_content')).find( '.media-menu' ).toggleClass( 'visible' );
|
172 |
}
|
173 |
|
174 |
return {
|
175 |
-
init: function(){
|
176 |
-
|
177 |
-
|
178 |
-
|
|
|
|
|
179 |
});
|
180 |
-
jQuery(document.getElementById('frm_insert_shortcode')).click(insertShortcode);
|
181 |
|
182 |
-
|
183 |
-
$scOptsDiv.on('change', 'select, input', addToShortcode);
|
184 |
-
$scOptsDiv.on('change', '.frm_get_field_selection', getFieldSelection);
|
185 |
|
186 |
-
jQuery('#frm_popup_content .media-modal-close').click(tb_remove);
|
187 |
-
jQuery('#frm_popup_content .media-frame-title h1').click(toggleMenu);
|
188 |
}
|
189 |
};
|
190 |
}
|
191 |
-
|
192 |
|
193 |
-
function frmWidgetsJS(){
|
194 |
-
function toggleCatOpt(){
|
195 |
-
var catOpts = jQuery(this).closest('.widget-content').children('.frm_list_items_hide_cat_opts');
|
196 |
-
if(this.checked){
|
197 |
catOpts.fadeIn();
|
198 |
-
}else{
|
199 |
catOpts.fadeOut();
|
200 |
}
|
201 |
}
|
202 |
|
203 |
-
function getFields(){
|
204 |
-
|
205 |
-
|
206 |
-
|
|
|
207 |
|
208 |
jQuery.ajax({
|
209 |
-
type:'POST',
|
|
|
210 |
dataType: 'json',
|
211 |
-
data:{
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
|
|
|
|
|
|
|
|
|
|
218 |
});
|
219 |
|
220 |
-
|
221 |
-
titleField.find('option').remove().end();
|
222 |
-
titleField.append(jQuery('<option></option>'));
|
223 |
-
jQuery.each(opts.titleValues, function(key, value) {
|
224 |
-
titleField.append(jQuery('<option></option>').attr('value', key).text(value));
|
225 |
});
|
226 |
}
|
227 |
});
|
228 |
}
|
229 |
}
|
230 |
-
|
231 |
return {
|
232 |
-
init: function(){
|
233 |
-
jQuery(document).on('click', '.frm_list_items_cat_list', toggleCatOpt);
|
234 |
-
jQuery(document).on('change', '.frm_list_items_display_id', getFields);
|
235 |
}
|
236 |
};
|
237 |
}
|
238 |
-
if(typeof adminpage
|
239 |
-
|
240 |
frmWidgets.init();
|
241 |
}
|
242 |
-
|
1 |
+
/*global jQuery:false, frmGlobal, tb_remove, ajaxurl, adminpage */
|
2 |
+
|
3 |
+
/* exported frm_install_now, frmSelectSubnav, frmCreatePostEntry */
|
4 |
+
|
5 |
+
var frmWidgets, frmAdminPopup;
|
6 |
+
|
7 |
+
jQuery( document ).ready( function() {
|
8 |
+
var deauthLink,
|
9 |
+
installLink = document.getElementById( 'frm_install_link' );
|
10 |
+
if ( installLink !== null ) {
|
11 |
+
jQuery( installLink ).click( frmInstallPro );
|
12 |
}
|
13 |
|
14 |
+
deauthLink = jQuery( '.frm_deauthorize_link' );
|
15 |
+
if ( deauthLink.length ) {
|
16 |
+
deauthLink.click( frmDeauthorizeNow );
|
17 |
}
|
18 |
|
19 |
+
if ( typeof tb_remove === 'function' ) { // eslint-disable-line camelcase
|
20 |
frmAdminPopup.init();
|
21 |
}
|
22 |
});
|
23 |
|
24 |
+
function frm_install_now() { // eslint-disable-line camelcase
|
25 |
+
var $msg = jQuery( document.getElementById( 'frm_install_message' ) );
|
26 |
+
$msg.html( '<div class="frm_plugin_updating">' + frmGlobal.updating_msg + '<div class="spinner frm_spinner"></div></div>' );
|
27 |
jQuery.ajax({
|
28 |
+
type: 'POST',
|
29 |
+
url: ajaxurl,
|
30 |
+
data: {
|
31 |
+
action: 'frm_install',
|
32 |
+
nonce: frmGlobal.nonce
|
33 |
+
},
|
34 |
+
success: function() {
|
35 |
+
$msg.fadeOut( 'slow' );
|
36 |
+
}
|
37 |
});
|
38 |
return false;
|
39 |
}
|
40 |
|
41 |
+
function frmInstallPro( e ) {
|
42 |
+
var $msg,
|
43 |
+
plugin = this.getAttribute( 'data-prourl' );
|
44 |
if ( plugin === '' ) {
|
45 |
return true;
|
46 |
}
|
47 |
|
48 |
e.preventDefault();
|
49 |
|
50 |
+
$msg = jQuery( document.getElementById( 'frm_install_message' ) );
|
51 |
+
$msg.html( '<div class="frm_plugin_updating">' + frmGlobal.updating_msg + '<div class="spinner frm_spinner"></div></div>' );
|
52 |
+
$msg.fadeIn( 'slow' );
|
53 |
|
54 |
jQuery.ajax({
|
55 |
url: ajaxurl,
|
59 |
dataType: 'json',
|
60 |
data: {
|
61 |
action: 'frm_install_addon',
|
62 |
+
nonce: frmGlobal.nonce,
|
63 |
plugin: plugin
|
64 |
},
|
65 |
success: function() {
|
66 |
+
$msg.fadeOut( 'slow' );
|
67 |
+
$msg.parent().fadeOut( 'slow' );
|
68 |
},
|
69 |
+
error: function() {
|
70 |
+
$msg.fadeOut( 'slow' );
|
71 |
}
|
72 |
});
|
73 |
return false;
|
74 |
}
|
75 |
|
76 |
+
function frmDeauthorizeNow() {
|
77 |
+
if ( ! confirm( frmGlobal.deauthorize ) ) {
|
78 |
+
return false;
|
79 |
}
|
80 |
+
jQuery( this ).html( '<span class="spinner"></span>' );
|
81 |
jQuery.ajax({
|
82 |
+
type: 'POST',
|
83 |
+
url: ajaxurl,
|
84 |
+
data: {
|
85 |
+
action: 'frm_deauthorize',
|
86 |
+
nonce: frmGlobal.nonce
|
87 |
+
},
|
88 |
+
success: function() {
|
89 |
+
jQuery( '.error' ).fadeOut( 'slow' );
|
90 |
+
}
|
91 |
});
|
92 |
return false;
|
93 |
}
|
94 |
|
95 |
+
function frmSelectSubnav() {
|
96 |
+
var frmMenu = document.getElementById( 'toplevel_page_formidable' );
|
97 |
+
jQuery( frmMenu ).removeClass( 'wp-not-current-submenu' ).addClass( 'wp-has-current-submenu wp-menu-open' );
|
98 |
+
jQuery( '#toplevel_page_formidable a.wp-has-submenu' ).removeClass( 'wp-not-current-submenu' ).addClass( 'wp-has-current-submenu wp-menu-open' );
|
99 |
}
|
100 |
|
101 |
+
function frmCreatePostEntry( id, postId ) {
|
102 |
+
jQuery( '#frm_create_entry p' ).replaceWith( '<img src="' + frmGlobal.url + '/images/wpspin_light.gif" alt="' + frmGlobal.loading + '" />' );
|
103 |
jQuery.ajax({
|
104 |
+
type: 'POST',
|
105 |
+
url: ajaxurl,
|
106 |
+
data: {
|
107 |
+
action: 'frm_create_post_entry',
|
108 |
+
id: id,
|
109 |
+
post_id: postId,
|
110 |
+
nonce: frmGlobal.nonce
|
111 |
+
},
|
112 |
+
success: function() {
|
113 |
+
jQuery( document.getElementById( 'frm_create_entry' ) ).fadeOut( 'slow' );
|
114 |
+
}
|
115 |
});
|
116 |
}
|
117 |
|
118 |
+
function frmAdminPopupJS() {
|
119 |
+
function switchSc() {
|
120 |
+
var val;
|
121 |
+
jQuery( '.frm_switch_sc' ).removeClass( 'active' );
|
122 |
+
jQuery( this ).addClass( 'active' );
|
123 |
toggleMenu();
|
124 |
+
jQuery( '#frm_popup_content .media-frame-title h1' ).html( jQuery( this ).children( '.howto' ).text() + ' <span class="spinner" style="float:left;"></span>' );
|
125 |
+
val = this.id.replace( 'sc-link-', '' );
|
126 |
+
populateOpts( val );
|
127 |
return false;
|
128 |
}
|
129 |
|
130 |
+
function populateOpts( val ) {
|
131 |
+
var $settings, $scOpts, $spinner,
|
132 |
+
sc = document.getElementById( 'frm_complete_shortcode' );
|
133 |
+
if ( sc !== null ) {
|
134 |
+
sc.value = '[' + val + ']';
|
135 |
}
|
136 |
+
jQuery( '.frm_shortcode_option' ).hide();
|
137 |
|
138 |
+
$settings = document.getElementById( 'sc-opts-' + val );
|
139 |
+
if ( $settings !== null ) {
|
140 |
$settings.style.display = '';
|
141 |
+
jQuery( document.getElementById( 'sc-' + val ) ).click();
|
142 |
+
} else {
|
143 |
+
$scOpts = jQuery( document.getElementById( 'frm_shortcode_options' ) );
|
144 |
+
$spinner = jQuery( '.media-frame-title .spinner' );
|
145 |
$spinner.show();
|
146 |
+
jQuery.ajax({
|
147 |
+
type: 'POST',
|
148 |
+
url: ajaxurl,
|
149 |
+
data: {
|
150 |
+
action: 'frm_get_shortcode_opts',
|
151 |
+
shortcode: val,
|
152 |
+
nonce: frmGlobal.nonce
|
153 |
+
},
|
154 |
+
success: function( html ) {
|
155 |
+
$spinner.hide();
|
156 |
+
$scOpts.append( html );
|
157 |
+
jQuery( document.getElementById( 'sc-' + val ) ).click();
|
158 |
+
}
|
159 |
+
});
|
160 |
+
}
|
161 |
+
}
|
162 |
+
|
163 |
+
function addToShortcode() {
|
164 |
+
var sc = jQuery( 'input[name=frmsc]:checked' ).val();
|
165 |
+
var inputs = jQuery( document.getElementById( 'sc-opts-' + sc ) ).find( 'input, select' );
|
166 |
+
var output = '[' + sc;
|
167 |
+
inputs.each( function() {
|
168 |
+
var attrName, attrVal,
|
169 |
+
$thisInput = jQuery( this ),
|
170 |
+
attrId = this.id;
|
171 |
+
if ( attrId.indexOf( 'frmsc_' ) === 0 ) {
|
172 |
+
attrName = attrId.replace( 'frmsc_' + sc + '_', '' );
|
173 |
+
attrVal = $thisInput.val();
|
174 |
|
175 |
+
if ( ( $thisInput.attr( 'type' ) === 'checkbox' && ! this.checked ) || ( ( $thisInput.attr( 'type' ) === 'text' || $thisInput.is( 'select' ) ) && attrVal === '' ) ) {
|
176 |
+
} else {
|
177 |
+
output += ' ' + attrName + '="' + attrVal + '"';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
}
|
179 |
}
|
180 |
});
|
181 |
output += ']';
|
182 |
+
document.getElementById( 'frm_complete_shortcode' ).value = output;
|
183 |
}
|
184 |
|
185 |
+
function insertShortcode() {
|
186 |
var win = window.dialogArguments || opener || parent || top;
|
187 |
+
win.send_to_editor( document.getElementById( 'frm_complete_shortcode' ).value );
|
188 |
}
|
189 |
|
190 |
+
function getFieldSelection() {
|
191 |
+
var thisId,
|
192 |
+
formId = this.value;
|
193 |
+
if ( formId ) {
|
194 |
+
thisId = this.id;
|
195 |
jQuery.ajax({
|
196 |
+
type: 'POST',
|
197 |
+
url: ajaxurl,
|
198 |
+
data: {
|
199 |
+
action: 'frm_get_field_selection',
|
200 |
+
field_id: 0,
|
201 |
+
form_id: formId,
|
202 |
+
nonce: frmGlobal.nonce
|
203 |
+
},
|
204 |
+
success: function( msg ) {
|
205 |
var baseId = thisId.replace( '_form', '' );
|
206 |
+
msg = msg.replace( 'name="field_options[form_select_0]"', 'id="frmsc_' + baseId + '_fields"' );
|
207 |
+
jQuery( document.getElementById( baseId + '_fields_container' ) ).html( msg );
|
208 |
}
|
209 |
});
|
210 |
}
|
211 |
}
|
212 |
|
213 |
+
function toggleMenu() {
|
214 |
+
jQuery( document.getElementById( 'frm_popup_content' ) ).find( '.media-menu' ).toggleClass( 'visible' );
|
215 |
}
|
216 |
|
217 |
return {
|
218 |
+
init: function() {
|
219 |
+
var $scOptsDiv;
|
220 |
+
|
221 |
+
jQuery( '.frm_switch_sc' ).click( switchSc );
|
222 |
+
jQuery( '.button.frm_insert_form' ).click( function() {
|
223 |
+
populateOpts( 'formidable' );
|
224 |
});
|
225 |
+
jQuery( document.getElementById( 'frm_insert_shortcode' ) ).click( insertShortcode );
|
226 |
|
227 |
+
$scOptsDiv = jQuery( document.getElementById( 'frm_shortcode_options' ) );
|
228 |
+
$scOptsDiv.on( 'change', 'select, input', addToShortcode );
|
229 |
+
$scOptsDiv.on( 'change', '.frm_get_field_selection', getFieldSelection );
|
230 |
|
231 |
+
jQuery( '#frm_popup_content .media-modal-close' ).click( tb_remove );
|
232 |
+
jQuery( '#frm_popup_content .media-frame-title h1' ).click( toggleMenu );
|
233 |
}
|
234 |
};
|
235 |
}
|
236 |
+
frmAdminPopup = frmAdminPopupJS();
|
237 |
|
238 |
+
function frmWidgetsJS() {
|
239 |
+
function toggleCatOpt() {
|
240 |
+
var catOpts = jQuery( this ).closest( '.widget-content' ).children( '.frm_list_items_hide_cat_opts' );
|
241 |
+
if ( this.checked ) {
|
242 |
catOpts.fadeIn();
|
243 |
+
} else {
|
244 |
catOpts.fadeOut();
|
245 |
}
|
246 |
}
|
247 |
|
248 |
+
function getFields() {
|
249 |
+
var widget,
|
250 |
+
displayId = this.value;
|
251 |
+
if ( displayId !== '' ) {
|
252 |
+
widget = jQuery( this ).closest( '.widget-content' );
|
253 |
|
254 |
jQuery.ajax({
|
255 |
+
type: 'POST',
|
256 |
+
url: ajaxurl,
|
257 |
dataType: 'json',
|
258 |
+
data: {
|
259 |
+
action: 'frm_get_dynamic_widget_opts',
|
260 |
+
display_id: displayId,
|
261 |
+
nonce: frmGlobal.nonce
|
262 |
+
},
|
263 |
+
success: function( opts ) {
|
264 |
+
var titleField,
|
265 |
+
catField = widget.find( '.frm_list_items_cat_id' );
|
266 |
+
catField.find( 'option' ).remove().end();
|
267 |
+
catField.append( jQuery( '<option></option>' ) );
|
268 |
+
jQuery.each( opts.catValues, function( key, value ) {
|
269 |
+
catField.append( jQuery( '<option></option>' ).attr( 'value', key ).text( value ) );
|
270 |
});
|
271 |
|
272 |
+
titleField = widget.find( '.frm_list_items_title_id' );
|
273 |
+
titleField.find( 'option' ).remove().end();
|
274 |
+
titleField.append( jQuery( '<option></option>' ) );
|
275 |
+
jQuery.each( opts.titleValues, function( key, value ) {
|
276 |
+
titleField.append( jQuery( '<option></option>' ).attr( 'value', key ).text( value ) );
|
277 |
});
|
278 |
}
|
279 |
});
|
280 |
}
|
281 |
}
|
282 |
+
|
283 |
return {
|
284 |
+
init: function() {
|
285 |
+
jQuery( document ).on( 'click', '.frm_list_items_cat_list', toggleCatOpt );
|
286 |
+
jQuery( document ).on( 'change', '.frm_list_items_display_id', getFields );
|
287 |
}
|
288 |
};
|
289 |
}
|
290 |
+
if ( typeof adminpage !== 'undefined' && adminpage === 'widgets-php' ) {
|
291 |
+
frmWidgets = frmWidgetsJS();
|
292 |
frmWidgets.init();
|
293 |
}
|
|
languages/formidable.pot
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
# This file is distributed under the same license as the Formidable Forms plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Formidable Forms 4.04.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/formidable\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2020-05-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.1.0\n"
|
15 |
"X-Domain: formidable\n"
|
@@ -512,23 +512,23 @@ msgstr ""
|
|
512 |
msgid "There are no options for this action."
|
513 |
msgstr ""
|
514 |
|
515 |
-
#: classes/models/FrmFormAction.php:
|
516 |
msgid "Draft is saved"
|
517 |
msgstr ""
|
518 |
|
519 |
-
#: classes/models/FrmFormAction.php:
|
520 |
msgid "Entry is created"
|
521 |
msgstr ""
|
522 |
|
523 |
-
#: classes/models/FrmFormAction.php:
|
524 |
msgid "Entry is updated"
|
525 |
msgstr ""
|
526 |
|
527 |
-
#: classes/models/FrmFormAction.php:
|
528 |
msgid "Entry is deleted"
|
529 |
msgstr ""
|
530 |
|
531 |
-
#: classes/models/FrmFormAction.php:
|
532 |
msgid "Entry is imported"
|
533 |
msgstr ""
|
534 |
|
@@ -545,13 +545,13 @@ msgstr ""
|
|
545 |
msgid "There was an error while creating a new form."
|
546 |
msgstr ""
|
547 |
|
548 |
-
#: classes/models/FrmFormMigrator.php:
|
549 |
msgid "Default Form"
|
550 |
msgstr ""
|
551 |
|
552 |
#. translators: %1$s - field type
|
553 |
#. translators: %1$s: Number of items
|
554 |
-
#: classes/models/FrmFormMigrator.php:
|
555 |
#: classes/helpers/FrmXMLHelper.php:981
|
556 |
msgid "%1$s Field"
|
557 |
msgid_plural "%1$s Fields"
|
2 |
# This file is distributed under the same license as the Formidable Forms plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Formidable Forms 4.04.05\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/formidable\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2020-05-28T00:31:36+02:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.1.0\n"
|
15 |
"X-Domain: formidable\n"
|
512 |
msgid "There are no options for this action."
|
513 |
msgstr ""
|
514 |
|
515 |
+
#: classes/models/FrmFormAction.php:818
|
516 |
msgid "Draft is saved"
|
517 |
msgstr ""
|
518 |
|
519 |
+
#: classes/models/FrmFormAction.php:819
|
520 |
msgid "Entry is created"
|
521 |
msgstr ""
|
522 |
|
523 |
+
#: classes/models/FrmFormAction.php:820
|
524 |
msgid "Entry is updated"
|
525 |
msgstr ""
|
526 |
|
527 |
+
#: classes/models/FrmFormAction.php:821
|
528 |
msgid "Entry is deleted"
|
529 |
msgstr ""
|
530 |
|
531 |
+
#: classes/models/FrmFormAction.php:822
|
532 |
msgid "Entry is imported"
|
533 |
msgstr ""
|
534 |
|
545 |
msgid "There was an error while creating a new form."
|
546 |
msgstr ""
|
547 |
|
548 |
+
#: classes/models/FrmFormMigrator.php:546
|
549 |
msgid "Default Form"
|
550 |
msgstr ""
|
551 |
|
552 |
#. translators: %1$s - field type
|
553 |
#. translators: %1$s: Number of items
|
554 |
+
#: classes/models/FrmFormMigrator.php:581
|
555 |
#: classes/helpers/FrmXMLHelper.php:981
|
556 |
msgid "%1$s Field"
|
557 |
msgid_plural "%1$s Fields"
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: forms, contact form, form builder, survey, form maker, form creator, paypa
|
|
5 |
Requires at least: 4.7
|
6 |
Tested up to: 5.4
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 4.04.
|
9 |
|
10 |
The most advanced WordPress forms plugin. Go beyond contact forms with our drag & drop form builder for surveys, quiz forms, and more.
|
11 |
|
@@ -444,6 +444,11 @@ Yes, Formidable is not your basic contact form plugin. You can use it to create
|
|
444 |
Our Stripe integration helps you quickly accept credit card payments online. Our PayPal form integration allows you to accept PayPal payments, subscriptions, and donations online.
|
445 |
|
446 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
447 |
= 4.04.04 =
|
448 |
* Increased WP version requirement to 4.7.
|
449 |
* Added more options on Import/Export page depending on what other plugins are installed.
|
@@ -451,10 +456,4 @@ Our Stripe integration helps you quickly accept credit card payments online. Our
|
|
451 |
* Fix: When a newly added option is set as the default value, save it correctly.
|
452 |
* Added an easy way to install and SMTP plugin for better email deliverability.
|
453 |
|
454 |
-
= 4.04.03 =
|
455 |
-
* Add option to Import forms on the listing page and in the new form process.
|
456 |
-
* Improve performance on the settings page when default values are used in fields.
|
457 |
-
* Update the base migrator class for more flexibility.
|
458 |
-
* Fix: Prevent a few PHP warnings.
|
459 |
-
|
460 |
<a href="https://raw.githubusercontent.com/Strategy11/formidable-forms/master/changelog.txt">See changelog for all versions</a>
|
5 |
Requires at least: 4.7
|
6 |
Tested up to: 5.4
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 4.04.05
|
9 |
|
10 |
The most advanced WordPress forms plugin. Go beyond contact forms with our drag & drop form builder for surveys, quiz forms, and more.
|
11 |
|
444 |
Our Stripe integration helps you quickly accept credit card payments online. Our PayPal form integration allows you to accept PayPal payments, subscriptions, and donations online.
|
445 |
|
446 |
== Changelog ==
|
447 |
+
= 4.04.05 =
|
448 |
+
* When some styling settings are blank, allow inheritance from theme styling.
|
449 |
+
* Allow a form action to be updated during form migration.
|
450 |
+
* Code: Update javascript codestyling.
|
451 |
+
|
452 |
= 4.04.04 =
|
453 |
* Increased WP version requirement to 4.7.
|
454 |
* Added more options on Import/Export page depending on what other plugins are installed.
|
456 |
* Fix: When a newly added option is set as the default value, save it correctly.
|
457 |
* Added an easy way to install and SMTP plugin for better email deliverability.
|
458 |
|
|
|
|
|
|
|
|
|
|
|
|
|
459 |
<a href="https://raw.githubusercontent.com/Strategy11/formidable-forms/master/changelog.txt">See changelog for all versions</a>
|