Version Description
- Added: New field type: Phone with flag
- Fixed: Bug on captcha reset
Download this release
Release Info
Developer | webdorado |
Plugin | Form Maker by WD – user-friendly drag & drop Form Builder plugin |
Version | 1.10.8 |
Comparing to | |
See all releases |
Code changes from version 1.10.7 to 1.10.8
- admin/controllers/FMControllerSubmissions_fm.php +2 -1
- admin/models/FMModelManage_fm.php +29 -1
- admin/views/FMViewManage_fm.php +11 -2
- admin/views/FMViewSubmissions_fm.php +40 -1
- css/form_maker_frontend.css +7 -0
- css/form_maker_tables.css +5 -7
- css/intlTelInput.css +1 -0
- css/style.css +1 -1
- form-maker.php +6 -2
- frontend/models/FMModelForm_maker.php +8 -4
- frontend/views/FMViewForm_maker.php +79 -7
- images/flags.png +0 -0
- js/form_maker_manage.js +2 -0
- js/formmaker_div_free.js +533 -2
- js/intlTelInput.js +1124 -0
- js/main_div_front_end.js +1 -1
- readme.txt +9 -5
admin/controllers/FMControllerSubmissions_fm.php
CHANGED
@@ -143,7 +143,8 @@ class FMControllerSubmissions_fm {
|
|
143 |
case "type_date":
|
144 |
case "type_own_select":
|
145 |
case "type_country":
|
146 |
-
case "type_number":
|
|
|
147 |
$value = (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL);
|
148 |
break;
|
149 |
}
|
143 |
case "type_date":
|
144 |
case "type_own_select":
|
145 |
case "type_country":
|
146 |
+
case "type_number":
|
147 |
+
case "type_phone_new": {
|
148 |
$value = (isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL);
|
149 |
break;
|
150 |
}
|
admin/models/FMModelManage_fm.php
CHANGED
@@ -351,7 +351,35 @@ class FMModelManage_fm {
|
|
351 |
$rep ='<div id="wdform_field'.$id.'" type="type_phone" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_phone" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_unique'].'" name="'.$id.'_uniqueform_id_temp" id="'.$id.'_uniqueform_id_temp"><div id="'.$id.'_table_name" style="display: table;"><div id="'.$id.'_tr_name1" style="display: table-row;"><div id="'.$id.'_td_name_input_first" style="display: table-cell;"><input type="text" class="'.$input_active.'" id="'.$id.'_element_firstform_id_temp" name="'.$id.'_element_firstform_id_temp" value="'.$w_first_val[0].'" title="'.$w_title[0].'" onfocus="delete_value("'.$id.'_element_firstform_id_temp")"onblur="return_value("'.$id.'_element_firstform_id_temp")"onchange="change_value("'.$id.'_element_firstform_id_temp")" onkeypress="return check_isnum(event)"style="width: 50px;" '.$param['attributes'].' disabled /><span class="wdform_line" style="margin: 0px 4px; padding: 0px;">-</span></div><div id="'.$id.'_td_name_input_last" style="display: table-cell;"><input type="text" class="'.$input_active.'" id="'.$id.'_element_lastform_id_temp" name="'.$id.'_element_lastform_id_temp" value="'.$w_first_val[1].'" title="'.$w_title[1].'" onfocus="delete_value("'.$id.'_element_lastform_id_temp")"onblur="return_value("'.$id.'_element_lastform_id_temp")" onchange="change_value("'.$id.'_element_lastform_id_temp")" onkeypress="return check_isnum(event)"style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled /></div></div><div id="'.$id.'_tr_name2" style="display: table-row;"><div id="'.$id.'_td_name_label_first" align="left" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_area_code">'.$w_mini_labels[0].'</label></div><div id="'.$id.'_td_name_label_last" align="left" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_phone_number">'.$w_mini_labels[1].'</label></div></div></div></div></div>';
|
352 |
break;
|
353 |
}
|
354 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
355 |
$params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class');
|
356 |
$temp = $params;
|
357 |
if(strpos($temp, 'w_name_fields') > -1)
|
351 |
$rep ='<div id="wdform_field'.$id.'" type="type_phone" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_phone" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_unique'].'" name="'.$id.'_uniqueform_id_temp" id="'.$id.'_uniqueform_id_temp"><div id="'.$id.'_table_name" style="display: table;"><div id="'.$id.'_tr_name1" style="display: table-row;"><div id="'.$id.'_td_name_input_first" style="display: table-cell;"><input type="text" class="'.$input_active.'" id="'.$id.'_element_firstform_id_temp" name="'.$id.'_element_firstform_id_temp" value="'.$w_first_val[0].'" title="'.$w_title[0].'" onfocus="delete_value("'.$id.'_element_firstform_id_temp")"onblur="return_value("'.$id.'_element_firstform_id_temp")"onchange="change_value("'.$id.'_element_firstform_id_temp")" onkeypress="return check_isnum(event)"style="width: 50px;" '.$param['attributes'].' disabled /><span class="wdform_line" style="margin: 0px 4px; padding: 0px;">-</span></div><div id="'.$id.'_td_name_input_last" style="display: table-cell;"><input type="text" class="'.$input_active.'" id="'.$id.'_element_lastform_id_temp" name="'.$id.'_element_lastform_id_temp" value="'.$w_first_val[1].'" title="'.$w_title[1].'" onfocus="delete_value("'.$id.'_element_lastform_id_temp")"onblur="return_value("'.$id.'_element_lastform_id_temp")" onchange="change_value("'.$id.'_element_lastform_id_temp")" onkeypress="return check_isnum(event)"style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled /></div></div><div id="'.$id.'_tr_name2" style="display: table-row;"><div id="'.$id.'_td_name_label_first" align="left" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_area_code">'.$w_mini_labels[0].'</label></div><div id="'.$id.'_td_name_label_last" align="left" style="display: table-cell;"><label class="mini_label" id="'.$id.'_mini_label_phone_number">'.$w_mini_labels[1].'</label></div></div></div></div></div>';
|
352 |
break;
|
353 |
}
|
354 |
+
|
355 |
+
case 'type_phone_new': {
|
356 |
+
$temp = $params;
|
357 |
+
$params_names = array('w_field_label_size','w_field_label_pos', 'w_hide_label', 'w_size','w_first_val', 'w_top_country','w_required','w_unique', 'w_class');
|
358 |
+
|
359 |
+
foreach ($params_names as $params_name) {
|
360 |
+
$temp = explode('*:*' . $params_name . '*:*', $temp);
|
361 |
+
$param[$params_name] = $temp[0];
|
362 |
+
$temp = $temp[1];
|
363 |
+
}
|
364 |
+
if ($temp) {
|
365 |
+
$temp = explode('*:*w_attr_name*:*', $temp);
|
366 |
+
$attrs = array_slice($temp, 0, count($temp) - 1);
|
367 |
+
foreach ($attrs as $attr) {
|
368 |
+
$param['attributes'] = $param['attributes'] . ' add_' . $attr;
|
369 |
+
}
|
370 |
+
}
|
371 |
+
|
372 |
+
$param['w_field_label_pos'] = ($param['w_field_label_pos'] == "left" ? "table-cell" : "block");
|
373 |
+
$param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
|
374 |
+
$display_label = $param['w_hide_label'] == "no" ? $param['w_field_label_pos'] : "none";
|
375 |
+
|
376 |
+
$required_sym = ($param['w_required'] == "yes" ? " *" : "");
|
377 |
+
|
378 |
+
$rep ='<div id="wdform_field'.$id.'" type="type_phone_new" class="wdform_field" style="display: table-cell;">'.$arrows.'<div align="left" id="'.$id.'_label_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$display_label.'; width: '.$param['w_field_label_size'].'px;"><span id="'.$id.'_element_labelform_id_temp" class="label" style="vertical-align: top;">'.$label.'</span><span id="'.$id.'_required_elementform_id_temp" class="required">'.$required_sym.'</span></div><div align="left" id="'.$id.'_element_sectionform_id_temp" class="'.$param['w_class'].'" style="display: '.$param['w_field_label_pos'].';"><input type="hidden" value="type_phone_new" name="'.$id.'_typeform_id_temp" id="'.$id.'_typeform_id_temp"><input type="hidden" value="'.$param['w_required'].'" name="'.$id.'_requiredform_id_temp" id="'.$id.'_requiredform_id_temp"><input type="hidden" value="'.$param['w_hide_label'].'" name="'.$id.'_hide_labelform_id_temp" id="'.$id.'_hide_labelform_id_temp"><input type="hidden" value="'.$param['w_unique'].'" name="'.$id.'_uniqueform_id_temp" id="'.$id.'_uniqueform_id_temp"><div id="'.$id.'_table_name" style="display: table;"><div id="'.$id.'_tr_name1" style="display: table-row;"><div id="'.$id.'_td_name_input_first" style="display: table-cell;"><input type="text" id="'.$id.'_elementform_id_temp" name="'.$id.'_elementform_id_temp" value="'.$param['w_first_val'].'" top-country = "'.$param['w_top_country'].'" onfocus="delete_value("'.$id.'_elementform_id_temp")" onblur="return_value("'.$id.'_elementform_id_temp")" onchange="change_value("'.$id.'_elementform_id_temp")" onkeypress="return check_isnum("'.$id.'_elementform_id_temp")" style="width: '.$param['w_size'].'px;" '.$param['attributes'].' disabled></div></div></div></div></div>';
|
379 |
+
break;
|
380 |
+
}
|
381 |
+
|
382 |
+
case 'type_name': {
|
383 |
$params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class');
|
384 |
$temp = $params;
|
385 |
if(strpos($temp, 'w_name_fields') > -1)
|
admin/views/FMViewManage_fm.php
CHANGED
@@ -807,7 +807,16 @@ class FMViewManage_fm {
|
|
807 |
|
808 |
|
809 |
}
|
810 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
811 |
else if (document.getElementById(t + "_typeform_id_temp").value == "type_name") {
|
812 |
var myu = t;
|
813 |
jQuery(document).ready(function () {
|
@@ -3886,7 +3895,7 @@ class FMViewManage_fm {
|
|
3886 |
$all_ids = array();
|
3887 |
$all_labels = array();
|
3888 |
|
3889 |
-
$select_and_input = array("type_text", "type_password", "type_textarea", "type_name", "type_number", "type_phone", "type_submitter_mail", "type_address", "type_spinner", "type_checkbox", "type_radio", "type_own_select", "type_paypal_price", "type_paypal_select", "type_paypal_checkbox", "type_paypal_radio", "type_paypal_shipping", "type_date_new");
|
3890 |
|
3891 |
$select_type_fields = array("type_address", "type_checkbox", "type_radio", "type_own_select", "type_paypal_select", "type_paypal_checkbox", "type_paypal_radio", "type_paypal_shipping");
|
3892 |
|
807 |
|
808 |
|
809 |
}
|
810 |
+
else if (document.getElementById(t + "_typeform_id_temp").value == "type_phone_new") {
|
811 |
+
|
812 |
+
|
813 |
+
jQuery("#"+t+"_elementform_id_temp").intlTelInput({
|
814 |
+
nationalMode: false,
|
815 |
+
preferredCountries: [ jQuery("#"+t+"_elementform_id_temp").attr("top-country") ],
|
816 |
+
});
|
817 |
+
jQuery("#"+t+"_elementform_id_temp").intlTelInput("setNumber", jQuery("#"+t+"_elementform_id_temp").val());
|
818 |
+
|
819 |
+
}
|
820 |
else if (document.getElementById(t + "_typeform_id_temp").value == "type_name") {
|
821 |
var myu = t;
|
822 |
jQuery(document).ready(function () {
|
3895 |
$all_ids = array();
|
3896 |
$all_labels = array();
|
3897 |
|
3898 |
+
$select_and_input = array("type_text", "type_password", "type_textarea", "type_name", "type_number", "type_phone", "type_phone_new", "type_submitter_mail", "type_address", "type_spinner", "type_checkbox", "type_radio", "type_own_select", "type_paypal_price", "type_paypal_select", "type_paypal_checkbox", "type_paypal_radio", "type_paypal_shipping", "type_date_new");
|
3899 |
|
3900 |
$select_type_fields = array("type_address", "type_checkbox", "type_radio", "type_own_select", "type_paypal_select", "type_paypal_checkbox", "type_paypal_radio", "type_paypal_shipping");
|
3901 |
|
admin/views/FMViewSubmissions_fm.php
CHANGED
@@ -363,7 +363,7 @@ class FMViewSubmissions_fm {
|
|
363 |
<span></span>
|
364 |
Search
|
365 |
</button>
|
366 |
-
<button class="fm-button reset-button small" onclick="remove_all(); fm_form_submit(event, 'admin_form'); return false;" title="Reset">
|
367 |
<span></span>
|
368 |
Reset
|
369 |
</button>
|
@@ -1732,6 +1732,45 @@ class FMViewSubmissions_fm {
|
|
1732 |
break;
|
1733 |
}
|
1734 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1735 |
case 'type_name': {
|
1736 |
|
1737 |
if($element_value =='')
|
363 |
<span></span>
|
364 |
Search
|
365 |
</button>
|
366 |
+
<button class="fm-button reset-button small" onclick="remove_all(); fm_set_input_value('order_by', 'group_id'); fm_set_input_value('asc_or_desc', 'desc'); fm_form_submit(event, 'admin_form'); return false;" title="Reset">
|
367 |
<span></span>
|
368 |
Reset
|
369 |
</button>
|
1732 |
break;
|
1733 |
}
|
1734 |
|
1735 |
+
case 'type_phone_new': {
|
1736 |
+
$params_names = array('w_field_label_size','w_field_label_pos', 'w_hide_label', 'w_size','w_first_val','w_top_country','w_required','w_unique', 'w_class');
|
1737 |
+
$temp=$params;
|
1738 |
+
foreach($params_names as $params_name ) {
|
1739 |
+
$temp=explode('*:*'.$params_name.'*:*',$temp);
|
1740 |
+
$param[$params_name] = $temp[0];
|
1741 |
+
$temp=$temp[1];
|
1742 |
+
}
|
1743 |
+
if($temp) {
|
1744 |
+
$temp =explode('*:*w_attr_name*:*',$temp);
|
1745 |
+
$attrs = array_slice($temp,0, count($temp)-1);
|
1746 |
+
foreach($attrs as $attr) {
|
1747 |
+
$param['attributes'] = $param['attributes'].' '.$attr;
|
1748 |
+
}
|
1749 |
+
}
|
1750 |
+
$param['w_first_val']=(isset($_POST['wdform_'.$id1.'_element'.$form_id]) ? esc_html(stripslashes($_POST['wdform_'.$id1.'_element'.$form_id])) : $param['w_first_val']);
|
1751 |
+
|
1752 |
+
$wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$param['w_size'] + 10) : max($param['w_field_label_size'],($param['w_size'])));
|
1753 |
+
$param['w_field_label_pos1'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "");
|
1754 |
+
$param['w_field_label_pos2'] = ($param['w_field_label_pos']=="left" ? "" : "display:block;");
|
1755 |
+
$param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
|
1756 |
+
if($param['w_hide_label'] == "yes")
|
1757 |
+
$param['w_field_label_pos1'] = "display:none;";
|
1758 |
+
|
1759 |
+
$required = ($param['w_required']=="yes" ? true : false);
|
1760 |
+
|
1761 |
+
$rep ='<div type="type_phone_new" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos1'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label" >'.$label.'</span>';
|
1762 |
+
if($required) {
|
1763 |
+
$rep.='<span class="wdform-required">'.$required_sym.'</span>';
|
1764 |
+
}
|
1765 |
+
$rep.='
|
1766 |
+
</div>
|
1767 |
+
<div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos2'].' width: '.$param['w_size'].'px;">
|
1768 |
+
<input type="text" class="input_active" id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$element_value.'" style="width: 100%;" placeholder="" '.$param['attributes'].'>
|
1769 |
+
</div>
|
1770 |
+
</div>';
|
1771 |
+
break;
|
1772 |
+
}
|
1773 |
+
|
1774 |
case 'type_name': {
|
1775 |
|
1776 |
if($element_value =='')
|
css/form_maker_frontend.css
CHANGED
@@ -85,3 +85,10 @@ color: #FFFFFF !important;
|
|
85 |
color:#ff0000;
|
86 |
font-size: 13px;
|
87 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
color:#ff0000;
|
86 |
font-size: 13px;
|
87 |
}
|
88 |
+
div[type="type_phone_new"] input[type="text"]{
|
89 |
+
padding-right: 6px !important;
|
90 |
+
padding-left: 52px !important;
|
91 |
+
}
|
92 |
+
.other_input{
|
93 |
+
width : 150px !important;
|
94 |
+
}
|
css/form_maker_tables.css
CHANGED
@@ -37,13 +37,11 @@ fieldset input[type="password"],
|
|
37 |
fieldset input[type="number"],
|
38 |
fieldset select {
|
39 |
height: 27px !important;
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
box-shadow: none;
|
46 |
-
vertical-align: middle;
|
47 |
}
|
48 |
|
49 |
#when_edit {
|
37 |
fieldset input[type="number"],
|
38 |
fieldset select {
|
39 |
height: 27px !important;
|
40 |
+
border-radius: 0;
|
41 |
+
width: 250px;
|
42 |
+
border: 1px solid #ccc;
|
43 |
+
box-shadow: none;
|
44 |
+
vertical-align: middle;
|
|
|
|
|
45 |
}
|
46 |
|
47 |
#when_edit {
|
css/intlTelInput.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.intl-tel-input{position:relative;display:inline-block}.intl-tel-input *{box-sizing:border-box;-moz-box-sizing:border-box}.intl-tel-input .hide{display:none}.intl-tel-input .v-hide{visibility:hidden}.intl-tel-input input,.intl-tel-input input[type=text],.intl-tel-input input[type=tel]{position:relative;z-index:0;margin-top:0 !important;margin-bottom:0 !important;padding-right:36px;margin-right:0}.intl-tel-input .flag-container{position:absolute;top:0;bottom:0;right:0;padding:1px}.intl-tel-input .selected-flag{z-index:1;position:relative;width:36px;height:100%;padding:0 0 0 8px}.intl-tel-input .selected-flag .iti-flag{position:absolute;top:0;bottom:0;margin:auto}.intl-tel-input .selected-flag .iti-arrow{position:absolute;top:50%;margin-top:-2px;right:6px;width:0;height:0;border-left:3px solid transparent;border-right:3px solid transparent;border-top:4px solid #555}.intl-tel-input .selected-flag .iti-arrow.up{border-top:none;border-bottom:4px solid #555}.intl-tel-input .country-list{position:absolute;z-index:2;list-style:none;text-align:left;padding:0;margin:0 0 0 -1px;box-shadow:1px 1px 4px rgba(0,0,0,0.2);background-color:white;border:1px solid #CCC;white-space:nowrap;max-height:200px;overflow-y:scroll}.intl-tel-input .country-list.dropup{bottom:100%;margin-bottom:-1px}.intl-tel-input .country-list .flag-box{display:inline-block;width:20px}@media (max-width: 500px){.intl-tel-input .country-list{white-space:normal}}.intl-tel-input .country-list .divider{padding-bottom:5px;margin-bottom:5px;border-bottom:1px solid #CCC}.intl-tel-input .country-list .country{padding:5px 10px}.intl-tel-input .country-list .country .dial-code{color:#999}.intl-tel-input .country-list .country.highlight{background-color:rgba(0,0,0,0.05)}.intl-tel-input .country-list .flag-box,.intl-tel-input .country-list .country-name,.intl-tel-input .country-list .dial-code{vertical-align:middle}.intl-tel-input .country-list .flag-box,.intl-tel-input .country-list .country-name{margin-right:6px}.intl-tel-input.allow-dropdown input,.intl-tel-input.allow-dropdown input[type=text],.intl-tel-input.allow-dropdown input[type=tel],.intl-tel-input.separate-dial-code input,.intl-tel-input.separate-dial-code input[type=text],.intl-tel-input.separate-dial-code input[type=tel]{padding-right:6px;padding-left:52px;margin-left:0}.intl-tel-input.allow-dropdown .flag-container,.intl-tel-input.separate-dial-code .flag-container{right:auto;left:0}.intl-tel-input.allow-dropdown .selected-flag,.intl-tel-input.separate-dial-code .selected-flag{width:46px}.intl-tel-input.allow-dropdown .flag-container:hover{cursor:pointer}.intl-tel-input.allow-dropdown .flag-container:hover .selected-flag{background-color:rgba(0,0,0,0.05)}.intl-tel-input.allow-dropdown input[disabled]+.flag-container:hover,.intl-tel-input.allow-dropdown input[readonly]+.flag-container:hover{cursor:default}.intl-tel-input.allow-dropdown input[disabled]+.flag-container:hover .selected-flag,.intl-tel-input.allow-dropdown input[readonly]+.flag-container:hover .selected-flag{background-color:transparent}.intl-tel-input.separate-dial-code .selected-flag{background-color:rgba(0,0,0,0.05);display:table}.intl-tel-input.separate-dial-code .selected-dial-code{display:table-cell;vertical-align:middle;padding-left:28px}.intl-tel-input.separate-dial-code.iti-sdc-2 input,.intl-tel-input.separate-dial-code.iti-sdc-2 input[type=text],.intl-tel-input.separate-dial-code.iti-sdc-2 input[type=tel]{padding-left:66px}.intl-tel-input.separate-dial-code.iti-sdc-2 .selected-flag{width:60px}.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-2 input,.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-2 input[type=text],.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-2 input[type=tel]{padding-left:76px}.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-2 .selected-flag{width:70px}.intl-tel-input.separate-dial-code.iti-sdc-3 input,.intl-tel-input.separate-dial-code.iti-sdc-3 input[type=text],.intl-tel-input.separate-dial-code.iti-sdc-3 input[type=tel]{padding-left:74px}.intl-tel-input.separate-dial-code.iti-sdc-3 .selected-flag{width:68px}.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-3 input,.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-3 input[type=text],.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-3 input[type=tel]{padding-left:84px}.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-3 .selected-flag{width:78px}.intl-tel-input.separate-dial-code.iti-sdc-4 input,.intl-tel-input.separate-dial-code.iti-sdc-4 input[type=text],.intl-tel-input.separate-dial-code.iti-sdc-4 input[type=tel]{padding-left:82px}.intl-tel-input.separate-dial-code.iti-sdc-4 .selected-flag{width:76px}.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-4 input,.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-4 input[type=text],.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-4 input[type=tel]{padding-left:92px}.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-4 .selected-flag{width:86px}.intl-tel-input.separate-dial-code.iti-sdc-5 input,.intl-tel-input.separate-dial-code.iti-sdc-5 input[type=text],.intl-tel-input.separate-dial-code.iti-sdc-5 input[type=tel]{padding-left:90px}.intl-tel-input.separate-dial-code.iti-sdc-5 .selected-flag{width:84px}.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-5 input,.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-5 input[type=text],.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-5 input[type=tel]{padding-left:100px}.intl-tel-input.separate-dial-code.allow-dropdown.iti-sdc-5 .selected-flag{width:94px}.intl-tel-input.iti-container{position:absolute;top:-1000px;left:-1000px;z-index:1060;padding:1px}.intl-tel-input.iti-container:hover{cursor:pointer}.iti-mobile .intl-tel-input.iti-container{top:30px;bottom:30px;left:30px;right:30px;position:fixed}.iti-mobile .intl-tel-input .country-list{max-height:100%;width:100%}.iti-mobile .intl-tel-input .country-list .country{padding:10px 10px;line-height:1.5em}.iti-flag{width:20px}.iti-flag.be{width:18px}.iti-flag.ch{width:15px}.iti-flag.mc{width:19px}.iti-flag.ne{width:18px}.iti-flag.np{width:13px}.iti-flag.va{width:15px}@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2 / 1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx){.iti-flag{background-size:5630px 15px}}.iti-flag.ac{height:10px;background-position:0px 0px}.iti-flag.ad{height:14px;background-position:-22px 0px}.iti-flag.ae{height:10px;background-position:-44px 0px}.iti-flag.af{height:14px;background-position:-66px 0px}.iti-flag.ag{height:14px;background-position:-88px 0px}.iti-flag.ai{height:10px;background-position:-110px 0px}.iti-flag.al{height:15px;background-position:-132px 0px}.iti-flag.am{height:10px;background-position:-154px 0px}.iti-flag.ao{height:14px;background-position:-176px 0px}.iti-flag.aq{height:14px;background-position:-198px 0px}.iti-flag.ar{height:13px;background-position:-220px 0px}.iti-flag.as{height:10px;background-position:-242px 0px}.iti-flag.at{height:14px;background-position:-264px 0px}.iti-flag.au{height:10px;background-position:-286px 0px}.iti-flag.aw{height:14px;background-position:-308px 0px}.iti-flag.ax{height:13px;background-position:-330px 0px}.iti-flag.az{height:10px;background-position:-352px 0px}.iti-flag.ba{height:10px;background-position:-374px 0px}.iti-flag.bb{height:14px;background-position:-396px 0px}.iti-flag.bd{height:12px;background-position:-418px 0px}.iti-flag.be{height:15px;background-position:-440px 0px}.iti-flag.bf{height:14px;background-position:-460px 0px}.iti-flag.bg{height:12px;background-position:-482px 0px}.iti-flag.bh{height:12px;background-position:-504px 0px}.iti-flag.bi{height:12px;background-position:-526px 0px}.iti-flag.bj{height:14px;background-position:-548px 0px}.iti-flag.bl{height:14px;background-position:-570px 0px}.iti-flag.bm{height:10px;background-position:-592px 0px}.iti-flag.bn{height:10px;background-position:-614px 0px}.iti-flag.bo{height:14px;background-position:-636px 0px}.iti-flag.bq{height:14px;background-position:-658px 0px}.iti-flag.br{height:14px;background-position:-680px 0px}.iti-flag.bs{height:10px;background-position:-702px 0px}.iti-flag.bt{height:14px;background-position:-724px 0px}.iti-flag.bv{height:15px;background-position:-746px 0px}.iti-flag.bw{height:14px;background-position:-768px 0px}.iti-flag.by{height:10px;background-position:-790px 0px}.iti-flag.bz{height:14px;background-position:-812px 0px}.iti-flag.ca{height:10px;background-position:-834px 0px}.iti-flag.cc{height:10px;background-position:-856px 0px}.iti-flag.cd{height:15px;background-position:-878px 0px}.iti-flag.cf{height:14px;background-position:-900px 0px}.iti-flag.cg{height:14px;background-position:-922px 0px}.iti-flag.ch{height:15px;background-position:-944px 0px}.iti-flag.ci{height:14px;background-position:-961px 0px}.iti-flag.ck{height:10px;background-position:-983px 0px}.iti-flag.cl{height:14px;background-position:-1005px 0px}.iti-flag.cm{height:14px;background-position:-1027px 0px}.iti-flag.cn{height:14px;background-position:-1049px 0px}.iti-flag.co{height:14px;background-position:-1071px 0px}.iti-flag.cp{height:14px;background-position:-1093px 0px}.iti-flag.cr{height:12px;background-position:-1115px 0px}.iti-flag.cu{height:10px;background-position:-1137px 0px}.iti-flag.cv{height:12px;background-position:-1159px 0px}.iti-flag.cw{height:14px;background-position:-1181px 0px}.iti-flag.cx{height:10px;background-position:-1203px 0px}.iti-flag.cy{height:13px;background-position:-1225px 0px}.iti-flag.cz{height:14px;background-position:-1247px 0px}.iti-flag.de{height:12px;background-position:-1269px 0px}.iti-flag.dg{height:10px;background-position:-1291px 0px}.iti-flag.dj{height:14px;background-position:-1313px 0px}.iti-flag.dk{height:15px;background-position:-1335px 0px}.iti-flag.dm{height:10px;background-position:-1357px 0px}.iti-flag.do{height:13px;background-position:-1379px 0px}.iti-flag.dz{height:14px;background-position:-1401px 0px}.iti-flag.ea{height:14px;background-position:-1423px 0px}.iti-flag.ec{height:14px;background-position:-1445px 0px}.iti-flag.ee{height:13px;background-position:-1467px 0px}.iti-flag.eg{height:14px;background-position:-1489px 0px}.iti-flag.eh{height:10px;background-position:-1511px 0px}.iti-flag.er{height:10px;background-position:-1533px 0px}.iti-flag.es{height:14px;background-position:-1555px 0px}.iti-flag.et{height:10px;background-position:-1577px 0px}.iti-flag.eu{height:14px;background-position:-1599px 0px}.iti-flag.fi{height:12px;background-position:-1621px 0px}.iti-flag.fj{height:10px;background-position:-1643px 0px}.iti-flag.fk{height:10px;background-position:-1665px 0px}.iti-flag.fm{height:11px;background-position:-1687px 0px}.iti-flag.fo{height:15px;background-position:-1709px 0px}.iti-flag.fr{height:14px;background-position:-1731px 0px}.iti-flag.ga{height:15px;background-position:-1753px 0px}.iti-flag.gb{height:10px;background-position:-1775px 0px}.iti-flag.gd{height:12px;background-position:-1797px 0px}.iti-flag.ge{height:14px;background-position:-1819px 0px}.iti-flag.gf{height:14px;background-position:-1841px 0px}.iti-flag.gg{height:14px;background-position:-1863px 0px}.iti-flag.gh{height:14px;background-position:-1885px 0px}.iti-flag.gi{height:10px;background-position:-1907px 0px}.iti-flag.gl{height:14px;background-position:-1929px 0px}.iti-flag.gm{height:14px;background-position:-1951px 0px}.iti-flag.gn{height:14px;background-position:-1973px 0px}.iti-flag.gp{height:14px;background-position:-1995px 0px}.iti-flag.gq{height:14px;background-position:-2017px 0px}.iti-flag.gr{height:14px;background-position:-2039px 0px}.iti-flag.gs{height:10px;background-position:-2061px 0px}.iti-flag.gt{height:13px;background-position:-2083px 0px}.iti-flag.gu{height:11px;background-position:-2105px 0px}.iti-flag.gw{height:10px;background-position:-2127px 0px}.iti-flag.gy{height:12px;background-position:-2149px 0px}.iti-flag.hk{height:14px;background-position:-2171px 0px}.iti-flag.hm{height:10px;background-position:-2193px 0px}.iti-flag.hn{height:10px;background-position:-2215px 0px}.iti-flag.hr{height:10px;background-position:-2237px 0px}.iti-flag.ht{height:12px;background-position:-2259px 0px}.iti-flag.hu{height:10px;background-position:-2281px 0px}.iti-flag.ic{height:14px;background-position:-2303px 0px}.iti-flag.id{height:14px;background-position:-2325px 0px}.iti-flag.ie{height:10px;background-position:-2347px 0px}.iti-flag.il{height:15px;background-position:-2369px 0px}.iti-flag.im{height:10px;background-position:-2391px 0px}.iti-flag.in{height:14px;background-position:-2413px 0px}.iti-flag.io{height:10px;background-position:-2435px 0px}.iti-flag.iq{height:14px;background-position:-2457px 0px}.iti-flag.ir{height:12px;background-position:-2479px 0px}.iti-flag.is{height:15px;background-position:-2501px 0px}.iti-flag.it{height:14px;background-position:-2523px 0px}.iti-flag.je{height:12px;background-position:-2545px 0px}.iti-flag.jm{height:10px;background-position:-2567px 0px}.iti-flag.jo{height:10px;background-position:-2589px 0px}.iti-flag.jp{height:14px;background-position:-2611px 0px}.iti-flag.ke{height:14px;background-position:-2633px 0px}.iti-flag.kg{height:12px;background-position:-2655px 0px}.iti-flag.kh{height:13px;background-position:-2677px 0px}.iti-flag.ki{height:10px;background-position:-2699px 0px}.iti-flag.km{height:12px;background-position:-2721px 0px}.iti-flag.kn{height:14px;background-position:-2743px 0px}.iti-flag.kp{height:10px;background-position:-2765px 0px}.iti-flag.kr{height:14px;background-position:-2787px 0px}.iti-flag.kw{height:10px;background-position:-2809px 0px}.iti-flag.ky{height:10px;background-position:-2831px 0px}.iti-flag.kz{height:10px;background-position:-2853px 0px}.iti-flag.la{height:14px;background-position:-2875px 0px}.iti-flag.lb{height:14px;background-position:-2897px 0px}.iti-flag.lc{height:10px;background-position:-2919px 0px}.iti-flag.li{height:12px;background-position:-2941px 0px}.iti-flag.lk{height:10px;background-position:-2963px 0px}.iti-flag.lr{height:11px;background-position:-2985px 0px}.iti-flag.ls{height:14px;background-position:-3007px 0px}.iti-flag.lt{height:12px;background-position:-3029px 0px}.iti-flag.lu{height:12px;background-position:-3051px 0px}.iti-flag.lv{height:10px;background-position:-3073px 0px}.iti-flag.ly{height:10px;background-position:-3095px 0px}.iti-flag.ma{height:14px;background-position:-3117px 0px}.iti-flag.mc{height:15px;background-position:-3139px 0px}.iti-flag.md{height:10px;background-position:-3160px 0px}.iti-flag.me{height:10px;background-position:-3182px 0px}.iti-flag.mf{height:14px;background-position:-3204px 0px}.iti-flag.mg{height:14px;background-position:-3226px 0px}.iti-flag.mh{height:11px;background-position:-3248px 0px}.iti-flag.mk{height:10px;background-position:-3270px 0px}.iti-flag.ml{height:14px;background-position:-3292px 0px}.iti-flag.mm{height:14px;background-position:-3314px 0px}.iti-flag.mn{height:10px;background-position:-3336px 0px}.iti-flag.mo{height:14px;background-position:-3358px 0px}.iti-flag.mp{height:10px;background-position:-3380px 0px}.iti-flag.mq{height:14px;background-position:-3402px 0px}.iti-flag.mr{height:14px;background-position:-3424px 0px}.iti-flag.ms{height:10px;background-position:-3446px 0px}.iti-flag.mt{height:14px;background-position:-3468px 0px}.iti-flag.mu{height:14px;background-position:-3490px 0px}.iti-flag.mv{height:14px;background-position:-3512px 0px}.iti-flag.mw{height:14px;background-position:-3534px 0px}.iti-flag.mx{height:12px;background-position:-3556px 0px}.iti-flag.my{height:10px;background-position:-3578px 0px}.iti-flag.mz{height:14px;background-position:-3600px 0px}.iti-flag.na{height:14px;background-position:-3622px 0px}.iti-flag.nc{height:10px;background-position:-3644px 0px}.iti-flag.ne{height:15px;background-position:-3666px 0px}.iti-flag.nf{height:10px;background-position:-3686px 0px}.iti-flag.ng{height:10px;background-position:-3708px 0px}.iti-flag.ni{height:12px;background-position:-3730px 0px}.iti-flag.nl{height:14px;background-position:-3752px 0px}.iti-flag.no{height:15px;background-position:-3774px 0px}.iti-flag.np{height:15px;background-position:-3796px 0px}.iti-flag.nr{height:10px;background-position:-3811px 0px}.iti-flag.nu{height:10px;background-position:-3833px 0px}.iti-flag.nz{height:10px;background-position:-3855px 0px}.iti-flag.om{height:10px;background-position:-3877px 0px}.iti-flag.pa{height:14px;background-position:-3899px 0px}.iti-flag.pe{height:14px;background-position:-3921px 0px}.iti-flag.pf{height:14px;background-position:-3943px 0px}.iti-flag.pg{height:15px;background-position:-3965px 0px}.iti-flag.ph{height:10px;background-position:-3987px 0px}.iti-flag.pk{height:14px;background-position:-4009px 0px}.iti-flag.pl{height:13px;background-position:-4031px 0px}.iti-flag.pm{height:14px;background-position:-4053px 0px}.iti-flag.pn{height:10px;background-position:-4075px 0px}.iti-flag.pr{height:14px;background-position:-4097px 0px}.iti-flag.ps{height:10px;background-position:-4119px 0px}.iti-flag.pt{height:14px;background-position:-4141px 0px}.iti-flag.pw{height:13px;background-position:-4163px 0px}.iti-flag.py{height:11px;background-position:-4185px 0px}.iti-flag.qa{height:8px;background-position:-4207px 0px}.iti-flag.re{height:14px;background-position:-4229px 0px}.iti-flag.ro{height:14px;background-position:-4251px 0px}.iti-flag.rs{height:14px;background-position:-4273px 0px}.iti-flag.ru{height:14px;background-position:-4295px 0px}.iti-flag.rw{height:14px;background-position:-4317px 0px}.iti-flag.sa{height:14px;background-position:-4339px 0px}.iti-flag.sb{height:10px;background-position:-4361px 0px}.iti-flag.sc{height:10px;background-position:-4383px 0px}.iti-flag.sd{height:10px;background-position:-4405px 0px}.iti-flag.se{height:13px;background-position:-4427px 0px}.iti-flag.sg{height:14px;background-position:-4449px 0px}.iti-flag.sh{height:10px;background-position:-4471px 0px}.iti-flag.si{height:10px;background-position:-4493px 0px}.iti-flag.sj{height:15px;background-position:-4515px 0px}.iti-flag.sk{height:14px;background-position:-4537px 0px}.iti-flag.sl{height:14px;background-position:-4559px 0px}.iti-flag.sm{height:15px;background-position:-4581px 0px}.iti-flag.sn{height:14px;background-position:-4603px 0px}.iti-flag.so{height:14px;background-position:-4625px 0px}.iti-flag.sr{height:14px;background-position:-4647px 0px}.iti-flag.ss{height:10px;background-position:-4669px 0px}.iti-flag.st{height:10px;background-position:-4691px 0px}.iti-flag.sv{height:12px;background-position:-4713px 0px}.iti-flag.sx{height:14px;background-position:-4735px 0px}.iti-flag.sy{height:14px;background-position:-4757px 0px}.iti-flag.sz{height:14px;background-position:-4779px 0px}.iti-flag.ta{height:10px;background-position:-4801px 0px}.iti-flag.tc{height:10px;background-position:-4823px 0px}.iti-flag.td{height:14px;background-position:-4845px 0px}.iti-flag.tf{height:14px;background-position:-4867px 0px}.iti-flag.tg{height:13px;background-position:-4889px 0px}.iti-flag.th{height:14px;background-position:-4911px 0px}.iti-flag.tj{height:10px;background-position:-4933px 0px}.iti-flag.tk{height:10px;background-position:-4955px 0px}.iti-flag.tl{height:10px;background-position:-4977px 0px}.iti-flag.tm{height:14px;background-position:-4999px 0px}.iti-flag.tn{height:14px;background-position:-5021px 0px}.iti-flag.to{height:10px;background-position:-5043px 0px}.iti-flag.tr{height:14px;background-position:-5065px 0px}.iti-flag.tt{height:12px;background-position:-5087px 0px}.iti-flag.tv{height:10px;background-position:-5109px 0px}.iti-flag.tw{height:14px;background-position:-5131px 0px}.iti-flag.tz{height:14px;background-position:-5153px 0px}.iti-flag.ua{height:14px;background-position:-5175px 0px}.iti-flag.ug{height:14px;background-position:-5197px 0px}.iti-flag.um{height:11px;background-position:-5219px 0px}.iti-flag.us{height:11px;background-position:-5241px 0px}.iti-flag.uy{height:14px;background-position:-5263px 0px}.iti-flag.uz{height:10px;background-position:-5285px 0px}.iti-flag.va{height:15px;background-position:-5307px 0px}.iti-flag.vc{height:14px;background-position:-5324px 0px}.iti-flag.ve{height:14px;background-position:-5346px 0px}.iti-flag.vg{height:10px;background-position:-5368px 0px}.iti-flag.vi{height:14px;background-position:-5390px 0px}.iti-flag.vn{height:14px;background-position:-5412px 0px}.iti-flag.vu{height:12px;background-position:-5434px 0px}.iti-flag.wf{height:14px;background-position:-5456px 0px}.iti-flag.ws{height:10px;background-position:-5478px 0px}.iti-flag.xk{height:15px;background-position:-5500px 0px}.iti-flag.ye{height:14px;background-position:-5522px 0px}.iti-flag.yt{height:14px;background-position:-5544px 0px}.iti-flag.za{height:14px;background-position:-5566px 0px}.iti-flag.zm{height:14px;background-position:-5588px 0px}.iti-flag.zw{height:10px;background-position:-5610px 0px}.iti-flag{width:20px;height:15px;box-shadow:0px 0px 1px 0px #888;background-image:url("../images/flags.png");background-repeat:no-repeat;background-color:#DBDBDB;background-position:20px 0}@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2 / 1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx){.iti-flag{background-image:url("../img/flags@2x.png")}}.iti-flag.np{background-color:transparent}
|
css/style.css
CHANGED
@@ -260,7 +260,7 @@ textarea[readonly] {
|
|
260 |
background: #ccc;
|
261 |
}
|
262 |
|
263 |
-
.highlight
|
264 |
{
|
265 |
border: 2px dashed #DDCC7F !important;
|
266 |
visibility: visible !important;
|
260 |
background: #ccc;
|
261 |
}
|
262 |
|
263 |
+
.highlight:not(.country)
|
264 |
{
|
265 |
border: 2px dashed #DDCC7F !important;
|
266 |
visibility: visible !important;
|
form-maker.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Form Maker
|
4 |
* Plugin URI: https://web-dorado.com/products/form-maker-wordpress.html
|
5 |
* Description: This plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.
|
6 |
-
* Version: 1.10.
|
7 |
* Author: WebDorado
|
8 |
* Author URI: https://web-dorado.com/
|
9 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
@@ -279,7 +279,7 @@ function register_fmemailverification_cpt(){
|
|
279 |
// Activate plugin.
|
280 |
function form_maker_activate() {
|
281 |
$version = get_option("wd_form_maker_version");
|
282 |
-
$new_version = '1.10.
|
283 |
global $wpdb;
|
284 |
if (!$version) {
|
285 |
add_option("wd_form_maker_version", $new_version, '', 'no');
|
@@ -354,6 +354,7 @@ function form_maker_manage_styles() {
|
|
354 |
wp_enqueue_style('form_maker_tables', WD_FM_URL . '/css/form_maker_tables.css', array(), get_option("wd_form_maker_version"));
|
355 |
wp_enqueue_style('form_maker_first', WD_FM_URL . '/css/form_maker_first.css', array(), get_option("wd_form_maker_version"));
|
356 |
wp_enqueue_style('form_maker_calendar-jos', WD_FM_URL . '/css/calendar-jos.css');
|
|
|
357 |
wp_enqueue_style('jquery-ui', WD_FM_URL . '/css/jquery-ui-1.10.3.custom.css');
|
358 |
wp_enqueue_style('jquery-ui-spinner', WD_FM_URL . '/css/jquery-ui-spinner.css');
|
359 |
wp_enqueue_style('form_maker_style', WD_FM_URL . '/css/style.css', array(), get_option("wd_form_maker_version"));
|
@@ -385,6 +386,7 @@ function form_maker_manage_scripts() {
|
|
385 |
wp_enqueue_script('gmap_form_api', 'https://maps.google.com/maps/api/js?v=3.exp&key='.$map_key);
|
386 |
}
|
387 |
wp_enqueue_script('gmap_form', WD_FM_URL . '/js/if_gmap_back_end.js');
|
|
|
388 |
|
389 |
wp_enqueue_script('form_maker_admin', WD_FM_URL . '/js/form_maker_admin.js', array(), get_option("wd_form_maker_version"));
|
390 |
wp_enqueue_script('form_maker_manage', WD_FM_URL . '/js/form_maker_manage.js', array(), get_option("wd_form_maker_version"));
|
@@ -486,12 +488,14 @@ function form_maker_front_end_scripts() {
|
|
486 |
|
487 |
// wp_enqueue_script('mootools', WD_FM_URL . '/js/mootools.js', array(), '1.12');
|
488 |
wp_enqueue_script('gmap_form', WD_FM_URL . '/js/if_gmap_front_end.js');
|
|
|
489 |
// wp_enqueue_style('gmap_styles_', WD_FM_URL . '/css/style_for_map.css');
|
490 |
|
491 |
wp_enqueue_script('Calendar', WD_FM_URL . '/js/calendar/calendar.js');
|
492 |
wp_enqueue_script('calendar_function', WD_FM_URL . '/js/calendar/calendar_function.js');
|
493 |
// wp_enqueue_script('form_maker_calendar_setup', WD_FM_URL . '/js/calendar/calendar-setup.js');
|
494 |
wp_enqueue_style('form_maker_calendar-jos', WD_FM_URL . '/css/calendar-jos.css');
|
|
|
495 |
wp_enqueue_style('form_maker_frontend', WD_FM_URL . '/css/form_maker_frontend.css');
|
496 |
|
497 |
wp_register_script('main_div_front_end', WD_FM_URL . '/js/main_div_front_end.js', array(), get_option("wd_form_maker_version"));
|
3 |
* Plugin Name: Form Maker
|
4 |
* Plugin URI: https://web-dorado.com/products/form-maker-wordpress.html
|
5 |
* Description: This plugin is a modern and advanced tool for easy and fast creating of a WordPress Form. The backend interface is intuitive and user friendly which allows users far from scripting and programming to create WordPress Forms.
|
6 |
+
* Version: 1.10.8
|
7 |
* Author: WebDorado
|
8 |
* Author URI: https://web-dorado.com/
|
9 |
* License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
|
279 |
// Activate plugin.
|
280 |
function form_maker_activate() {
|
281 |
$version = get_option("wd_form_maker_version");
|
282 |
+
$new_version = '1.10.8';
|
283 |
global $wpdb;
|
284 |
if (!$version) {
|
285 |
add_option("wd_form_maker_version", $new_version, '', 'no');
|
354 |
wp_enqueue_style('form_maker_tables', WD_FM_URL . '/css/form_maker_tables.css', array(), get_option("wd_form_maker_version"));
|
355 |
wp_enqueue_style('form_maker_first', WD_FM_URL . '/css/form_maker_first.css', array(), get_option("wd_form_maker_version"));
|
356 |
wp_enqueue_style('form_maker_calendar-jos', WD_FM_URL . '/css/calendar-jos.css');
|
357 |
+
wp_enqueue_style('phone_field_css', WD_FM_URL . '/css/intlTelInput.css');
|
358 |
wp_enqueue_style('jquery-ui', WD_FM_URL . '/css/jquery-ui-1.10.3.custom.css');
|
359 |
wp_enqueue_style('jquery-ui-spinner', WD_FM_URL . '/css/jquery-ui-spinner.css');
|
360 |
wp_enqueue_style('form_maker_style', WD_FM_URL . '/css/style.css', array(), get_option("wd_form_maker_version"));
|
386 |
wp_enqueue_script('gmap_form_api', 'https://maps.google.com/maps/api/js?v=3.exp&key='.$map_key);
|
387 |
}
|
388 |
wp_enqueue_script('gmap_form', WD_FM_URL . '/js/if_gmap_back_end.js');
|
389 |
+
wp_enqueue_script('phone_field', WD_FM_URL . '/js/intlTelInput.js');
|
390 |
|
391 |
wp_enqueue_script('form_maker_admin', WD_FM_URL . '/js/form_maker_admin.js', array(), get_option("wd_form_maker_version"));
|
392 |
wp_enqueue_script('form_maker_manage', WD_FM_URL . '/js/form_maker_manage.js', array(), get_option("wd_form_maker_version"));
|
488 |
|
489 |
// wp_enqueue_script('mootools', WD_FM_URL . '/js/mootools.js', array(), '1.12');
|
490 |
wp_enqueue_script('gmap_form', WD_FM_URL . '/js/if_gmap_front_end.js');
|
491 |
+
wp_enqueue_script('phone_field', WD_FM_URL . '/js/intlTelInput.js');
|
492 |
// wp_enqueue_style('gmap_styles_', WD_FM_URL . '/css/style_for_map.css');
|
493 |
|
494 |
wp_enqueue_script('Calendar', WD_FM_URL . '/js/calendar/calendar.js');
|
495 |
wp_enqueue_script('calendar_function', WD_FM_URL . '/js/calendar/calendar_function.js');
|
496 |
// wp_enqueue_script('form_maker_calendar_setup', WD_FM_URL . '/js/calendar/calendar-setup.js');
|
497 |
wp_enqueue_style('form_maker_calendar-jos', WD_FM_URL . '/css/calendar-jos.css');
|
498 |
+
wp_enqueue_style('phone_field_css', WD_FM_URL . '/css/intlTelInput.css');
|
499 |
wp_enqueue_style('form_maker_frontend', WD_FM_URL . '/css/form_maker_frontend.css');
|
500 |
|
501 |
wp_register_script('main_div_front_end', WD_FM_URL . '/js/main_div_front_end.js', array(), get_option("wd_form_maker_version"));
|
frontend/models/FMModelForm_maker.php
CHANGED
@@ -291,7 +291,8 @@ class FMModelForm_maker {
|
|
291 |
case "type_submitter_mail":
|
292 |
case "type_own_select":
|
293 |
case "type_country":
|
294 |
-
case "type_number":
|
|
|
295 |
$value = isset($_POST['wdform_'.$i."_element".$id]) ? esc_html($_POST['wdform_'.$i."_element".$id]) : "";
|
296 |
break;
|
297 |
}
|
@@ -853,7 +854,7 @@ class FMModelForm_maker {
|
|
853 |
continue;
|
854 |
}
|
855 |
}
|
856 |
-
if($type == "type_text" or $type == "type_password" or $type == "type_textarea" or $type == "type_name" or $type == "type_submitter_mail" or $type == "type_number" or $type == "type_phone")
|
857 |
{
|
858 |
$untilupload = $form->form_fields;
|
859 |
$untilupload = substr($untilupload, strpos($untilupload, $i.'*:*id*:*'.$type), -1);
|
@@ -1782,7 +1783,8 @@ class FMModelForm_maker {
|
|
1782 |
case "type_date_new":
|
1783 |
case "type_own_select":
|
1784 |
case "type_country":
|
1785 |
-
case "type_number":
|
|
|
1786 |
$element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
|
1787 |
if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
|
1788 |
$list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>' . $element . '</td></tr>';
|
@@ -4380,7 +4382,9 @@ class FMModelForm_maker {
|
|
4380 |
case "type_date_new":
|
4381 |
case "type_own_select":
|
4382 |
case "type_country":
|
4383 |
-
case "type_number":
|
|
|
|
|
4384 |
$element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
|
4385 |
if(isset($element)) {
|
4386 |
$new_value = $element;
|
291 |
case "type_submitter_mail":
|
292 |
case "type_own_select":
|
293 |
case "type_country":
|
294 |
+
case "type_number":
|
295 |
+
case "type_phone_new": {
|
296 |
$value = isset($_POST['wdform_'.$i."_element".$id]) ? esc_html($_POST['wdform_'.$i."_element".$id]) : "";
|
297 |
break;
|
298 |
}
|
854 |
continue;
|
855 |
}
|
856 |
}
|
857 |
+
if($type == "type_text" or $type == "type_password" or $type == "type_textarea" or $type == "type_name" or $type == "type_submitter_mail" or $type == "type_number" or $type == "type_phone" or $type == "type_phone_new")
|
858 |
{
|
859 |
$untilupload = $form->form_fields;
|
860 |
$untilupload = substr($untilupload, strpos($untilupload, $i.'*:*id*:*'.$type), -1);
|
1783 |
case "type_date_new":
|
1784 |
case "type_own_select":
|
1785 |
case "type_country":
|
1786 |
+
case "type_number":
|
1787 |
+
case "type_phone_new": {
|
1788 |
$element = isset($_POST['wdform_'.$i."_element".$id]) ? $_POST['wdform_'.$i."_element".$id] : NULL;
|
1789 |
if(isset($element) && $this->empty_field($element, $row->mail_emptyfields)) {
|
1790 |
$list = $list . '<tr valign="top"><td >' . $element_label . '</td><td>' . $element . '</td></tr>';
|
4382 |
case "type_date_new":
|
4383 |
case "type_own_select":
|
4384 |
case "type_country":
|
4385 |
+
case "type_number":
|
4386 |
+
case "type_phone_new":
|
4387 |
+
{
|
4388 |
$element = isset($_POST['wdform_'.$key."_element".$id]) ? $_POST['wdform_'.$key."_element".$id] : NULL;
|
4389 |
if(isset($element)) {
|
4390 |
$new_value = $element;
|
frontend/views/FMViewForm_maker.php
CHANGED
@@ -228,6 +228,7 @@ class FMViewForm_maker {
|
|
228 |
$keyup = '';
|
229 |
$change = '';
|
230 |
$click = '';
|
|
|
231 |
|
232 |
for($m=0; $m<count($cond_params); $m++)
|
233 |
{
|
@@ -241,6 +242,7 @@ class FMViewForm_maker {
|
|
241 |
case "type_submitter_mail":
|
242 |
case "type_spinner":
|
243 |
case "type_date_new":
|
|
|
244 |
if($params_value[1] == "%" || $params_value[1] == "!%")
|
245 |
{
|
246 |
$like_or_not = ($params_value[1] == "%" ? ">" : "==");
|
@@ -261,6 +263,8 @@ class FMViewForm_maker {
|
|
261 |
$change .= '#wdform_'.$params_value[0].'_element'.$form_id.', ';
|
262 |
if($type_and_id[$params_value[0]] == "type_spinner")
|
263 |
$click .= '#wdform_'.$params_value[0].'_element'.$form_id.' ~ a, ';
|
|
|
|
|
264 |
break;
|
265 |
|
266 |
case "type_name":
|
@@ -984,6 +988,15 @@ class FMViewForm_maker {
|
|
984 |
else
|
985 |
jQuery("#form'.$form_id.' div[wdid='.$field_label[$k].']").'.$display_none .'; });';
|
986 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
987 |
if($click)
|
988 |
{
|
989 |
$condition_js .= '
|
@@ -1370,6 +1383,58 @@ class FMViewForm_maker {
|
|
1370 |
break;
|
1371 |
}
|
1372 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1373 |
case 'type_name': {
|
1374 |
$params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class');
|
1375 |
$temp = $params;
|
@@ -1878,7 +1943,7 @@ class FMViewForm_maker {
|
|
1878 |
if(isset($post_value)) {
|
1879 |
if($param['w_allow_other']=="yes") {
|
1880 |
$is_other=false;
|
1881 |
-
$other_element = isset($_POST['wdform_'.$id1."_other_input".$form_id]) ? esc_html(stripslashes($_POST['wdform_'.$id1."_other_input".$form_id])) :
|
1882 |
if(isset($other_element)) {
|
1883 |
$is_other=true;
|
1884 |
}
|
@@ -4172,6 +4237,8 @@ class FMViewForm_maker {
|
|
4172 |
var x = jQuery("#form" + form_id);
|
4173 |
var req_fields = field_id ? field_id.split() : window['required_fields'+form_id];
|
4174 |
var not_filled = {};
|
|
|
|
|
4175 |
jQuery(req_fields).each(function(index, wdid){
|
4176 |
if(x.find(jQuery("div[wdid='"+wdid+"']")).length != 0 && x.find(jQuery("div[wdid='"+wdid+"']")).css("display") != "none" ) {
|
4177 |
switch(window['labels_and_ids'+form_id][wdid]){
|
@@ -4179,6 +4246,7 @@ class FMViewForm_maker {
|
|
4179 |
case 'type_textarea':
|
4180 |
case 'type_spinner':
|
4181 |
case 'type_number':
|
|
|
4182 |
case 'type_submitter_mail':
|
4183 |
{
|
4184 |
var element = "#wdform_" + wdid + "_element" + form_id;
|
@@ -4292,8 +4360,8 @@ class FMViewForm_maker {
|
|
4292 |
}
|
4293 |
}
|
4294 |
if(!field_id && !window['check_submit'+form_id]){
|
4295 |
-
jQuery.each(jQuery("#form" + form_id + " div[wdid='"+ wdid +"'] input"), function( i, val ){
|
4296 |
-
jQuery(this).change
|
4297 |
if(x.find(jQuery("div[wdid='"+ wdid +"'] input:checked")).length == 0 || jQuery("#wdform_"+ wdid +"_other_input" + form_id).val() == ""){
|
4298 |
wd_is_filled(form_id, wdid);
|
4299 |
}
|
@@ -4632,10 +4700,8 @@ class FMViewForm_maker {
|
|
4632 |
var element_offset = jQuery(jQuery("#form" + form_id + " .fm-not-filled:first")).offset().top;
|
4633 |
var scrollChecker = function() {
|
4634 |
if(document.body.clientHeight !== body_hight ){
|
4635 |
-
|
4636 |
body_hight = document.body.clientHeight;
|
4637 |
element_offset = jQuery(jQuery("#form" + form_id + " .fm-not-filled:first")).offset().top;
|
4638 |
-
console.log(element_offset);
|
4639 |
jQuery('html body').stop();
|
4640 |
animateBodyToError();
|
4641 |
}
|
@@ -4821,6 +4887,7 @@ class FMViewForm_maker {
|
|
4821 |
case 'type_date':
|
4822 |
case 'type_date_new':
|
4823 |
case 'type_hidden':
|
|
|
4824 |
jQuery("#wdform_"+index+"_element"+form_id).val('');
|
4825 |
break;
|
4826 |
case 'type_submitter_mail':
|
@@ -4910,11 +4977,16 @@ class FMViewForm_maker {
|
|
4910 |
jQuery("#wdform_"+index+"_element"+form_id+" input[type='text']").val('');
|
4911 |
jQuery("#wdform_"+index+"_element"+form_id+" select").val('');
|
4912 |
break;
|
4913 |
-
|
4914 |
case 'type_paypal_total':
|
4915 |
jQuery("#wdform_"+index+"div_total"+form_id).html('$0');
|
4916 |
jQuery("#wdform_"+index+"paypal_products"+form_id).empty();
|
4917 |
-
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
4918 |
default:
|
4919 |
break;
|
4920 |
}
|
228 |
$keyup = '';
|
229 |
$change = '';
|
230 |
$click = '';
|
231 |
+
$blur = '';
|
232 |
|
233 |
for($m=0; $m<count($cond_params); $m++)
|
234 |
{
|
242 |
case "type_submitter_mail":
|
243 |
case "type_spinner":
|
244 |
case "type_date_new":
|
245 |
+
case "type_phone_new":
|
246 |
if($params_value[1] == "%" || $params_value[1] == "!%")
|
247 |
{
|
248 |
$like_or_not = ($params_value[1] == "%" ? ">" : "==");
|
263 |
$change .= '#wdform_'.$params_value[0].'_element'.$form_id.', ';
|
264 |
if($type_and_id[$params_value[0]] == "type_spinner")
|
265 |
$click .= '#wdform_'.$params_value[0].'_element'.$form_id.' ~ a, ';
|
266 |
+
if($type_and_id[$params_value[0]] == "type_phone_new")
|
267 |
+
$blur = '#wdform_'.$params_value[0].'_element'.$form_id.', ';
|
268 |
break;
|
269 |
|
270 |
case "type_name":
|
988 |
else
|
989 |
jQuery("#form'.$form_id.' div[wdid='.$field_label[$k].']").'.$display_none .'; });';
|
990 |
|
991 |
+
if($blur){
|
992 |
+
$condition_js .= '
|
993 |
+
jQuery("'.substr($blur,0,-2).'").blur(function() {
|
994 |
+
if('.$if.')
|
995 |
+
jQuery("#form'.$form_id.' div[wdid='.$field_label[$k].']").'.$display .';
|
996 |
+
else
|
997 |
+
jQuery("#form'.$form_id.' div[wdid='.$field_label[$k].']").'.$display_none .'; });';
|
998 |
+
}
|
999 |
+
|
1000 |
if($click)
|
1001 |
{
|
1002 |
$condition_js .= '
|
1383 |
break;
|
1384 |
}
|
1385 |
|
1386 |
+
case 'type_phone_new': {
|
1387 |
+
$params_names = array('w_field_label_size','w_field_label_pos', 'w_hide_label', 'w_size','w_first_val','w_top_country','w_required','w_unique', 'w_class');
|
1388 |
+
$temp=$params;
|
1389 |
+
foreach($params_names as $params_name ) {
|
1390 |
+
$temp=explode('*:*'.$params_name.'*:*',$temp);
|
1391 |
+
$param[$params_name] = $temp[0];
|
1392 |
+
$temp=$temp[1];
|
1393 |
+
}
|
1394 |
+
if($temp) {
|
1395 |
+
$temp =explode('*:*w_attr_name*:*',$temp);
|
1396 |
+
$attrs = array_slice($temp,0, count($temp)-1);
|
1397 |
+
foreach($attrs as $attr) {
|
1398 |
+
$param['attributes'] = $param['attributes'].' '.$attr;
|
1399 |
+
}
|
1400 |
+
}
|
1401 |
+
$param['w_first_val']=(isset($_POST['wdform_'.$id1.'_element'.$form_id]) ? esc_html(stripslashes($_POST['wdform_'.$id1.'_element'.$form_id])) : $param['w_first_val']);
|
1402 |
+
|
1403 |
+
$wdformfieldsize = ($param['w_field_label_pos']=="left" ? ($param['w_field_label_size']+$param['w_size'] + 10) : max($param['w_field_label_size'],($param['w_size'])));
|
1404 |
+
$param['w_field_label_pos1'] = ($param['w_field_label_pos']=="left" ? "float: left;" : "");
|
1405 |
+
$param['w_field_label_pos2'] = ($param['w_field_label_pos']=="left" ? "" : "display:block;");
|
1406 |
+
$param['w_hide_label'] = (isset($param['w_hide_label']) ? $param['w_hide_label'] : "no");
|
1407 |
+
if($param['w_hide_label'] == "yes")
|
1408 |
+
$param['w_field_label_pos1'] = "display:none;";
|
1409 |
+
|
1410 |
+
$required = ($param['w_required']=="yes" ? true : false);
|
1411 |
+
|
1412 |
+
$rep ='<div type="type_phone_new" class="wdform-field" style="width:'.$wdformfieldsize.'px"><div class="wdform-label-section '.$param['w_class'].'" style="'.$param['w_field_label_pos1'].'; width: '.$param['w_field_label_size'].'px;"><span class="wdform-label" >'.$label.'</span>';
|
1413 |
+
if($required) {
|
1414 |
+
$rep.='<span class="wdform-required">'.$required_sym.'</span>';
|
1415 |
+
}
|
1416 |
+
$rep.='
|
1417 |
+
</div>
|
1418 |
+
<div class="wdform-element-section '.$param['w_class'].'" style="'.$param['w_field_label_pos2'].' width: '.$param['w_size'].'px;">
|
1419 |
+
<input type="text" class="input_active" id="wdform_'.$id1.'_element'.$form_id.'" name="wdform_'.$id1.'_element'.$form_id.'" value="'.$param['w_first_val'].'" style="width: 100%;" placeholder="" '.$param['attributes'].'>
|
1420 |
+
</div>
|
1421 |
+
</div>';
|
1422 |
+
|
1423 |
+
if($required) {
|
1424 |
+
array_push($req_fields, $id1);
|
1425 |
+
}
|
1426 |
+
$onload_js .='
|
1427 |
+
|
1428 |
+
jQuery("#wdform_'.$id1.'_element'.$form_id.'").intlTelInput({
|
1429 |
+
nationalMode: false,
|
1430 |
+
preferredCountries: [ "'.$param["w_top_country"].'" ],
|
1431 |
+
customPlaceholder: "Phone",
|
1432 |
+
});
|
1433 |
+
';
|
1434 |
+
break;
|
1435 |
+
}
|
1436 |
+
|
1437 |
+
|
1438 |
case 'type_name': {
|
1439 |
$params_names = array('w_field_label_size', 'w_field_label_pos', 'w_first_val', 'w_title', 'w_mini_labels', 'w_size', 'w_name_format', 'w_required', 'w_unique', 'w_class');
|
1440 |
$temp = $params;
|
1943 |
if(isset($post_value)) {
|
1944 |
if($param['w_allow_other']=="yes") {
|
1945 |
$is_other=false;
|
1946 |
+
$other_element = isset($_POST['wdform_'.$id1."_other_input".$form_id]) ? esc_html(stripslashes($_POST['wdform_'.$id1."_other_input".$form_id])) : null;
|
1947 |
if(isset($other_element)) {
|
1948 |
$is_other=true;
|
1949 |
}
|
4237 |
var x = jQuery("#form" + form_id);
|
4238 |
var req_fields = field_id ? field_id.split() : window['required_fields'+form_id];
|
4239 |
var not_filled = {};
|
4240 |
+
|
4241 |
+
|
4242 |
jQuery(req_fields).each(function(index, wdid){
|
4243 |
if(x.find(jQuery("div[wdid='"+wdid+"']")).length != 0 && x.find(jQuery("div[wdid='"+wdid+"']")).css("display") != "none" ) {
|
4244 |
switch(window['labels_and_ids'+form_id][wdid]){
|
4246 |
case 'type_textarea':
|
4247 |
case 'type_spinner':
|
4248 |
case 'type_number':
|
4249 |
+
case 'type_phone_new':
|
4250 |
case 'type_submitter_mail':
|
4251 |
{
|
4252 |
var element = "#wdform_" + wdid + "_element" + form_id;
|
4360 |
}
|
4361 |
}
|
4362 |
if(!field_id && !window['check_submit'+form_id]){
|
4363 |
+
jQuery.each(jQuery("#form" + form_id + " div[wdid='"+ wdid +"'] input"), function( i, val ){
|
4364 |
+
jQuery(this).on('change', function(){
|
4365 |
if(x.find(jQuery("div[wdid='"+ wdid +"'] input:checked")).length == 0 || jQuery("#wdform_"+ wdid +"_other_input" + form_id).val() == ""){
|
4366 |
wd_is_filled(form_id, wdid);
|
4367 |
}
|
4700 |
var element_offset = jQuery(jQuery("#form" + form_id + " .fm-not-filled:first")).offset().top;
|
4701 |
var scrollChecker = function() {
|
4702 |
if(document.body.clientHeight !== body_hight ){
|
|
|
4703 |
body_hight = document.body.clientHeight;
|
4704 |
element_offset = jQuery(jQuery("#form" + form_id + " .fm-not-filled:first")).offset().top;
|
|
|
4705 |
jQuery('html body').stop();
|
4706 |
animateBodyToError();
|
4707 |
}
|
4887 |
case 'type_date':
|
4888 |
case 'type_date_new':
|
4889 |
case 'type_hidden':
|
4890 |
+
case 'type_phone_new':
|
4891 |
jQuery("#wdform_"+index+"_element"+form_id).val('');
|
4892 |
break;
|
4893 |
case 'type_submitter_mail':
|
4977 |
jQuery("#wdform_"+index+"_element"+form_id+" input[type='text']").val('');
|
4978 |
jQuery("#wdform_"+index+"_element"+form_id+" select").val('');
|
4979 |
break;
|
|
|
4980 |
case 'type_paypal_total':
|
4981 |
jQuery("#wdform_"+index+"div_total"+form_id).html('$0');
|
4982 |
jQuery("#wdform_"+index+"paypal_products"+form_id).empty();
|
4983 |
+
break;
|
4984 |
+
case 'type_captcha':
|
4985 |
+
jQuery("#wd_captcha_input"+form_id).val('');
|
4986 |
+
break;
|
4987 |
+
case 'type_arithmetic_captcha':
|
4988 |
+
jQuery("#wd_arithmetic_captcha_input"+form_id).val('');
|
4989 |
+
break;
|
4990 |
default:
|
4991 |
break;
|
4992 |
}
|
images/flags.png
ADDED
Binary file
|
js/form_maker_manage.js
CHANGED
@@ -653,6 +653,7 @@ function change_choices(value, ids, types, params) {
|
|
653 |
case "type_paypal_price":
|
654 |
case "type_spinner":
|
655 |
case "type_date_new":
|
|
|
656 |
if(types_array[id]=="type_number" || types_array[id]=="type_phone")
|
657 |
var keypress_function = "return check_isnum_space(event)";
|
658 |
else
|
@@ -883,6 +884,7 @@ function add_condition_fields(num, ids1, labels1, types1, params1) {
|
|
883 |
case "type_paypal_price":
|
884 |
case "type_spinner":
|
885 |
case "type_date_new":
|
|
|
886 |
if(types[index_of_field]=="type_number" || types[index_of_field]=="type_phone")
|
887 |
var keypress_function = "return check_isnum_space(event)";
|
888 |
else
|
653 |
case "type_paypal_price":
|
654 |
case "type_spinner":
|
655 |
case "type_date_new":
|
656 |
+
case "type_phone_new":
|
657 |
if(types_array[id]=="type_number" || types_array[id]=="type_phone")
|
658 |
var keypress_function = "return check_isnum_space(event)";
|
659 |
else
|
884 |
case "type_paypal_price":
|
885 |
case "type_spinner":
|
886 |
case "type_date_new":
|
887 |
+
case "type_phone_new":
|
888 |
if(types[index_of_field]=="type_number" || types[index_of_field]=="type_phone")
|
889 |
var keypress_function = "return check_isnum_space(event)";
|
890 |
else
|
js/formmaker_div_free.js
CHANGED
@@ -767,6 +767,7 @@ function set_fieldtype(type){
|
|
767 |
type_submitter_mail : 'Text Input -> E-mail',
|
768 |
type_send_copy : 'Text Input -> Send copy to submitter',
|
769 |
type_phone : 'Text Input -> Phone',
|
|
|
770 |
type_number : 'Text Input -> Number',
|
771 |
type_hidden : 'Text Input -> Hidden field',
|
772 |
type_checkbox : 'Multiple Choice',
|
@@ -1153,13 +1154,15 @@ function set_required(id, type)
|
|
1153 |
{
|
1154 |
document.getElementById(id+"form_id_temp").setAttribute("value", "no");
|
1155 |
document.getElementById(id+"_elementform_id_temp").innerHTML="";
|
1156 |
-
|
|
|
1157 |
}
|
1158 |
else
|
1159 |
{
|
1160 |
document.getElementById(id+"form_id_temp").setAttribute("value", "yes")
|
1161 |
document.getElementById(id+"_elementform_id_temp").innerHTML=" *";
|
1162 |
-
|
|
|
1163 |
}
|
1164 |
}
|
1165 |
|
@@ -8772,6 +8775,452 @@ jQuery(document).ready(function() {
|
|
8772 |
|
8773 |
}
|
8774 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8775 |
function change_input_range(type, id)
|
8776 |
{
|
8777 |
var s='';
|
@@ -24890,6 +25339,19 @@ function el_text()
|
|
24890 |
el_type_label_phone.innerHTML = 'Phone';
|
24891 |
|
24892 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24893 |
var el_type_radio_hidden = document.createElement('input');
|
24894 |
el_type_radio_hidden.setAttribute("id", "el_type_hidden");
|
24895 |
el_type_radio_hidden.setAttribute("type", "radio");
|
@@ -24942,6 +25404,7 @@ var el_type_radio_mark_map = document.createElement('input');
|
|
24942 |
var br10 = document.createElement('br');
|
24943 |
var br11 = document.createElement('br');
|
24944 |
var br12 = document.createElement('br');
|
|
|
24945 |
|
24946 |
|
24947 |
td.appendChild(br1);
|
@@ -24977,6 +25440,9 @@ var el_type_radio_mark_map = document.createElement('input');
|
|
24977 |
td.appendChild(br7);
|
24978 |
td.appendChild(el_type_radio_phone);
|
24979 |
td.appendChild(el_type_label_phone);
|
|
|
|
|
|
|
24980 |
td.appendChild(br8);
|
24981 |
td.appendChild(el_type_radio_hidden);
|
24982 |
td.appendChild(el_type_label_hidden);
|
@@ -25074,6 +25540,13 @@ function go_to_type_phone(new_id)
|
|
25074 |
type_phone(new_id,'Phone:', '100', 'left', '135', w_first_val, w_title, w_mini_labels, 'no', 'no', '',w_attr_name, w_attr_value)
|
25075 |
}
|
25076 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25077 |
function go_to_type_submitter_mail(new_id)
|
25078 |
{
|
25079 |
w_attr_name=[];
|
@@ -27694,6 +28167,19 @@ function edit(id)
|
|
27694 |
w_attr_value=atrs[1];
|
27695 |
type_phone(id, w_field_label, w_field_label_size, w_field_label_pos, w_size, w_first_val, w_title, w_mini_labels, w_required, w_unique, w_class, w_attr_name, w_attr_value); break;
|
27696 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27697 |
case 'type_name':
|
27698 |
{
|
27699 |
if(document.getElementById(id+"_enable_fieldsform_id_temp")) {
|
@@ -28620,6 +29106,18 @@ function duplicate(id) {
|
|
28620 |
w_attr_value=atrs[1];
|
28621 |
type_phone(gen, w_field_label, w_field_label_size, w_field_label_pos, w_size, w_first_val, w_title, w_mini_labels, w_required, w_unique, w_class, w_attr_name, w_attr_value); break;
|
28622 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28623 |
case 'type_name':
|
28624 |
{
|
28625 |
if(document.getElementById(id+"_enable_fieldsform_id_temp")) {
|
@@ -29566,6 +30064,39 @@ function gen_form_fields()
|
|
29566 |
form_fields+="*:*new_field*:*";
|
29567 |
break;
|
29568 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29569 |
case 'type_name':
|
29570 |
{
|
29571 |
if(document.getElementById(id+"_enable_fieldsform_id_temp")) {
|
767 |
type_submitter_mail : 'Text Input -> E-mail',
|
768 |
type_send_copy : 'Text Input -> Send copy to submitter',
|
769 |
type_phone : 'Text Input -> Phone',
|
770 |
+
type_phone_new : 'Text Input -> Phone with flag',
|
771 |
type_number : 'Text Input -> Number',
|
772 |
type_hidden : 'Text Input -> Hidden field',
|
773 |
type_checkbox : 'Multiple Choice',
|
1154 |
{
|
1155 |
document.getElementById(id+"form_id_temp").setAttribute("value", "no");
|
1156 |
document.getElementById(id+"_elementform_id_temp").innerHTML="";
|
1157 |
+
if(type)
|
1158 |
+
document.getElementById(type+"_elementform_id_temp").innerHTML="";
|
1159 |
}
|
1160 |
else
|
1161 |
{
|
1162 |
document.getElementById(id+"form_id_temp").setAttribute("value", "yes")
|
1163 |
document.getElementById(id+"_elementform_id_temp").innerHTML=" *";
|
1164 |
+
if(type)
|
1165 |
+
document.getElementById(type+"_elementform_id_temp").innerHTML=" *";
|
1166 |
}
|
1167 |
}
|
1168 |
|
8775 |
|
8776 |
}
|
8777 |
|
8778 |
+
function type_phone_new(i, w_field_label, w_field_label_size, w_field_label_pos, w_hide_label, w_size, w_first_val, w_top_country, w_required, w_unique, w_class, w_attr_name, w_attr_value) {
|
8779 |
+
|
8780 |
+
document.getElementById("element_type").value="type_phone_new";
|
8781 |
+
delete_last_child();
|
8782 |
+
|
8783 |
+
var edit_div = document.createElement('div');
|
8784 |
+
edit_div.setAttribute("id", "edit_div");
|
8785 |
+
|
8786 |
+
|
8787 |
+
var edit_main_table = document.createElement('table');
|
8788 |
+
edit_main_table.setAttribute("id", "edit_main_table");
|
8789 |
+
edit_main_table.setAttribute("cellpadding", "3");
|
8790 |
+
edit_main_table.setAttribute("cellspacing", "0");
|
8791 |
+
|
8792 |
+
var edit_main_tr1 = document.createElement('tr');
|
8793 |
+
var edit_main_tr2 = document.createElement('tr');
|
8794 |
+
var edit_main_tr3 = document.createElement('tr');
|
8795 |
+
var edit_main_tr4 = document.createElement('tr');
|
8796 |
+
var edit_main_tr5 = document.createElement('tr');
|
8797 |
+
var edit_main_tr6 = document.createElement('tr');
|
8798 |
+
var edit_main_tr7 = document.createElement('tr');
|
8799 |
+
var edit_main_tr8 = document.createElement('tr');
|
8800 |
+
var edit_main_tr_hide_label = document.createElement('tr');
|
8801 |
+
var edit_main_tr9 = document.createElement('tr');
|
8802 |
+
var edit_main_td1 = document.createElement('td');
|
8803 |
+
var edit_main_td1_1 = document.createElement('td');
|
8804 |
+
var edit_main_td2 = document.createElement('td');
|
8805 |
+
var edit_main_td2_1 = document.createElement('td');
|
8806 |
+
var edit_main_td3 = document.createElement('td');
|
8807 |
+
var edit_main_td3_1 = document.createElement('td');
|
8808 |
+
var edit_main_td4 = document.createElement('td');
|
8809 |
+
var edit_main_td4_1 = document.createElement('td');
|
8810 |
+
var edit_main_td5 = document.createElement('td');
|
8811 |
+
var edit_main_td5_1 = document.createElement('td');
|
8812 |
+
var edit_main_td6 = document.createElement('td');
|
8813 |
+
var edit_main_td6_1 = document.createElement('td');
|
8814 |
+
var edit_main_td7 = document.createElement('td');
|
8815 |
+
var edit_main_td7_1 = document.createElement('td');
|
8816 |
+
var edit_main_td8 = document.createElement('td');
|
8817 |
+
var edit_main_td8_1 = document.createElement('td');
|
8818 |
+
var edit_main_td9 = document.createElement('td');
|
8819 |
+
var edit_main_td9_1 = document.createElement('td');
|
8820 |
+
var edit_main_td_hide_label_1 = document.createElement('td');
|
8821 |
+
var edit_main_td_hide_label_2 = document.createElement('td');
|
8822 |
+
var el_label_label = document.createElement('label');
|
8823 |
+
el_label_label.setAttribute("class", "fm-field-label");
|
8824 |
+
el_label_label.setAttribute("for", "edit_for_label");
|
8825 |
+
el_label_label.innerHTML = "Field label";
|
8826 |
+
|
8827 |
+
var el_label_textarea = document.createElement('textarea');
|
8828 |
+
el_label_textarea.setAttribute("id", "edit_for_label");
|
8829 |
+
el_label_textarea.setAttribute("rows", "4");
|
8830 |
+
|
8831 |
+
el_label_textarea.setAttribute("onKeyUp", "change_label('"+i+"_element_labelform_id_temp', this.value)");
|
8832 |
+
el_label_textarea.innerHTML = w_field_label;
|
8833 |
+
|
8834 |
+
var el_label_size_label = document.createElement('label');
|
8835 |
+
el_label_size_label.setAttribute("class", "fm-field-label");
|
8836 |
+
el_label_size_label.setAttribute("for", "edit_for_label_size");
|
8837 |
+
el_label_size_label.innerHTML = "Field label size(px) ";
|
8838 |
+
|
8839 |
+
var el_label_size = document.createElement('input');
|
8840 |
+
el_label_size.setAttribute("id", "edit_for_label_size");
|
8841 |
+
el_label_size.setAttribute("type", "text");
|
8842 |
+
el_label_size.setAttribute("value", w_field_label_size);
|
8843 |
+
el_label_size.setAttribute("onKeyPress", "return check_isnum(event)");
|
8844 |
+
el_label_size.setAttribute("onKeyUp", "change_w_style('"+i+"_label_sectionform_id_temp', this.value)");
|
8845 |
+
|
8846 |
+
var el_label_position_label = document.createElement('label');
|
8847 |
+
el_label_position_label.setAttribute("class", "fm-field-label");
|
8848 |
+
el_label_position_label.innerHTML = "Field label position";
|
8849 |
+
|
8850 |
+
var el_label_position1 = document.createElement('input');
|
8851 |
+
el_label_position1.setAttribute("id", "edit_for_label_position_top");
|
8852 |
+
el_label_position1.setAttribute("type", "radio");
|
8853 |
+
el_label_position1.setAttribute("name", "edit_for_label_position");
|
8854 |
+
el_label_position1.setAttribute("onchange", "label_left("+i+")");
|
8855 |
+
|
8856 |
+
var el_label_left = document.createElement('label');
|
8857 |
+
el_label_left.setAttribute("for", "edit_for_label_position_top");
|
8858 |
+
el_label_left.innerHTML = "Left";
|
8859 |
+
|
8860 |
+
var el_label_position2 = document.createElement('input');
|
8861 |
+
el_label_position2.setAttribute("id", "edit_for_label_position_left");
|
8862 |
+
el_label_position2.setAttribute("type", "radio");
|
8863 |
+
el_label_position2.setAttribute("name", "edit_for_label_position");
|
8864 |
+
el_label_position2.setAttribute("onchange", "label_top("+i+")");
|
8865 |
+
|
8866 |
+
var el_label_top = document.createElement('label');
|
8867 |
+
el_label_top.setAttribute("for", "edit_for_label_position_left");
|
8868 |
+
el_label_top.innerHTML = "Top";
|
8869 |
+
|
8870 |
+
if(w_field_label_pos=="top")
|
8871 |
+
el_label_position2.setAttribute("checked", "checked");
|
8872 |
+
else
|
8873 |
+
el_label_position1.setAttribute("checked", "checked");
|
8874 |
+
|
8875 |
+
var el_hide_label_label = document.createElement('label');
|
8876 |
+
el_hide_label_label.setAttribute("class", "fm-field-label");
|
8877 |
+
el_hide_label_label.setAttribute("for", "el_hide_label");
|
8878 |
+
el_hide_label_label.innerHTML = "Hide label";
|
8879 |
+
|
8880 |
+
var el_hide_label = document.createElement('input');
|
8881 |
+
el_hide_label.setAttribute("id", "el_hide_label");
|
8882 |
+
el_hide_label.setAttribute("type", "checkbox");
|
8883 |
+
el_hide_label.setAttribute("onclick", "hide_label('"+i+"')");
|
8884 |
+
if(w_hide_label=="yes")
|
8885 |
+
el_hide_label.setAttribute("checked", "checked");
|
8886 |
+
|
8887 |
+
|
8888 |
+
var el_size_label = document.createElement('label');
|
8889 |
+
el_size_label.setAttribute("class", "fm-field-label");
|
8890 |
+
el_size_label.setAttribute("for", "edit_for_input_size");
|
8891 |
+
el_size_label.innerHTML = "Field size(px) ";
|
8892 |
+
var el_size = document.createElement('input');
|
8893 |
+
el_size.setAttribute("id", "edit_for_input_size");
|
8894 |
+
el_size.setAttribute("type", "text");
|
8895 |
+
el_size.setAttribute("value", w_size);
|
8896 |
+
el_size.setAttribute("onKeyPress", "return check_isnum(event)");
|
8897 |
+
el_size.setAttribute("onKeyUp", "change_w_style('"+i+"_elementform_id_temp', this.value);");
|
8898 |
+
|
8899 |
+
|
8900 |
+
|
8901 |
+
var el_first_value_label = document.createElement('label');
|
8902 |
+
el_first_value_label.setAttribute("class", "fm-field-label");
|
8903 |
+
el_first_value_label.setAttribute("for", "el_first_value_area");
|
8904 |
+
el_first_value_label.innerHTML = "Value if empty ";
|
8905 |
+
|
8906 |
+
var el_first_value_area = document.createElement('input');
|
8907 |
+
el_first_value_area.setAttribute("id", "el_first_value_area");
|
8908 |
+
el_first_value_area.setAttribute("type", "text");
|
8909 |
+
el_first_value_area.setAttribute("value", "");
|
8910 |
+
el_first_value_area.style.cssText = "width:200px;";
|
8911 |
+
el_first_value_area.setAttribute("onKeyUp", "change_input_value(this.value,'"+i+"_elementform_id_temp')");
|
8912 |
+
|
8913 |
+
var el_required_label = document.createElement('label');
|
8914 |
+
el_required_label.setAttribute("class", "fm-field-label");
|
8915 |
+
el_required_label.setAttribute("for", "el_required");
|
8916 |
+
el_required_label.innerHTML = "Required";
|
8917 |
+
|
8918 |
+
var el_required = document.createElement('input');
|
8919 |
+
el_required.setAttribute("id", "el_required");
|
8920 |
+
el_required.setAttribute("type", "checkbox");
|
8921 |
+
el_required.setAttribute("onclick", "set_required('"+i+"_required')");
|
8922 |
+
if(w_required=="yes")
|
8923 |
+
el_required.setAttribute("checked", "checked");
|
8924 |
+
|
8925 |
+
var el_unique_label = document.createElement('label');
|
8926 |
+
el_unique_label.setAttribute("class", "fm-field-label");
|
8927 |
+
el_unique_label.setAttribute("for", "el_unique");
|
8928 |
+
el_unique_label.innerHTML = "Allow only unique values";
|
8929 |
+
|
8930 |
+
var el_unique = document.createElement('input');
|
8931 |
+
el_unique.setAttribute("id", "el_unique");
|
8932 |
+
el_unique.setAttribute("type", "checkbox");
|
8933 |
+
el_unique.setAttribute("onclick", "set_unique('"+i+"_uniqueform_id_temp')");
|
8934 |
+
if(w_unique=="yes")
|
8935 |
+
el_unique.setAttribute("checked", "checked");
|
8936 |
+
|
8937 |
+
var el_style_label = document.createElement('label');
|
8938 |
+
el_style_label.setAttribute("class", "fm-field-label");
|
8939 |
+
el_style_label.setAttribute("for", "el_style_textarea");
|
8940 |
+
el_style_label.innerHTML = "Class name";
|
8941 |
+
|
8942 |
+
var el_style_textarea = document.createElement('input');
|
8943 |
+
el_style_textarea.setAttribute("id", "el_style_textarea");
|
8944 |
+
el_style_textarea.setAttribute("type", "text");
|
8945 |
+
el_style_textarea.setAttribute("value", w_class);
|
8946 |
+
|
8947 |
+
el_style_textarea.setAttribute("onChange", "change_class(this.value,'"+i+"')");
|
8948 |
+
|
8949 |
+
var el_attr_label = document.createElement('label');
|
8950 |
+
el_attr_label.setAttribute("class", "fm-field-label");
|
8951 |
+
el_attr_label.innerHTML = "Additional Attributes";
|
8952 |
+
var el_attr_add = document.createElement('img');
|
8953 |
+
el_attr_add.setAttribute("src", plugin_url + '/images/add.png?ver=1.8.0');
|
8954 |
+
el_attr_add.style.cssText = 'cursor:pointer; margin-left:68px';
|
8955 |
+
el_attr_add.setAttribute("title", 'add');
|
8956 |
+
el_attr_add.setAttribute("onClick", "add_attr("+i+", 'type_name')");
|
8957 |
+
var el_attr_table = document.createElement('table');
|
8958 |
+
el_attr_table.setAttribute("id", 'attributes');
|
8959 |
+
el_attr_table.setAttribute("border", '0');
|
8960 |
+
el_attr_table.style.cssText = 'margin-left:0px';
|
8961 |
+
var el_attr_tr_label = document.createElement('tr');
|
8962 |
+
el_attr_tr_label.setAttribute("idi", '0');
|
8963 |
+
var el_attr_td_name_label = document.createElement('th');
|
8964 |
+
el_attr_td_name_label.style.cssText = 'width:100px';
|
8965 |
+
var el_attr_td_value_label = document.createElement('th');
|
8966 |
+
el_attr_td_value_label.style.cssText = 'width:100px';
|
8967 |
+
var el_attr_td_X_label = document.createElement('th');
|
8968 |
+
el_attr_td_X_label.style.cssText = 'width:10px';
|
8969 |
+
var el_attr_name_label = document.createElement('label');
|
8970 |
+
el_attr_name_label.style.cssText ="color:#000; font-weight:bold; font-size: 11px";
|
8971 |
+
el_attr_name_label.innerHTML = "Name";
|
8972 |
+
var el_attr_value_label = document.createElement('label');
|
8973 |
+
el_attr_value_label.style.cssText ="color:#000; font-weight:bold; font-size: 11px";
|
8974 |
+
el_attr_value_label.innerHTML = "Value";
|
8975 |
+
|
8976 |
+
el_attr_table.appendChild(el_attr_tr_label);
|
8977 |
+
el_attr_tr_label.appendChild(el_attr_td_name_label);
|
8978 |
+
el_attr_tr_label.appendChild(el_attr_td_value_label);
|
8979 |
+
el_attr_tr_label.appendChild(el_attr_td_X_label);
|
8980 |
+
el_attr_td_name_label.appendChild(el_attr_name_label);
|
8981 |
+
el_attr_td_value_label.appendChild(el_attr_value_label);
|
8982 |
+
|
8983 |
+
n=w_attr_name.length;
|
8984 |
+
for(j=1; j<=n; j++)
|
8985 |
+
{
|
8986 |
+
var el_attr_tr = document.createElement('tr');
|
8987 |
+
el_attr_tr.setAttribute("id", "attr_row_"+j);
|
8988 |
+
el_attr_tr.setAttribute("idi", j);
|
8989 |
+
var el_attr_td_name = document.createElement('td');
|
8990 |
+
el_attr_td_name.style.cssText = 'width:100px';
|
8991 |
+
var el_attr_td_value = document.createElement('td');
|
8992 |
+
el_attr_td_value.style.cssText = 'width:100px';
|
8993 |
+
|
8994 |
+
var el_attr_td_X = document.createElement('td');
|
8995 |
+
var el_attr_name = document.createElement('input');
|
8996 |
+
el_attr_name.setAttribute("type", "text");
|
8997 |
+
el_attr_name.setAttribute("class", "fm-field-choice");
|
8998 |
+
el_attr_name.setAttribute("value", w_attr_name[j-1]);
|
8999 |
+
el_attr_name.setAttribute("id", "attr_name"+j);
|
9000 |
+
el_attr_name.setAttribute("onChange", "change_attribute_name("+i+", this, 'type_name')");
|
9001 |
+
|
9002 |
+
var el_attr_value = document.createElement('input');
|
9003 |
+
el_attr_value.setAttribute("type", "text");
|
9004 |
+
el_attr_value.setAttribute("class", "fm-field-choice");
|
9005 |
+
el_attr_value.setAttribute("value", w_attr_value[j-1]);
|
9006 |
+
el_attr_value.setAttribute("id", "attr_value"+j);
|
9007 |
+
el_attr_value.setAttribute("onChange", "change_attribute_value("+i+", "+j+", 'type_name')");
|
9008 |
+
|
9009 |
+
var el_attr_remove = document.createElement('img');
|
9010 |
+
el_attr_remove.setAttribute("id", "el_choices"+j+"_remove");
|
9011 |
+
el_attr_remove.setAttribute("src", plugin_url + '/images/delete.png?ver=1.8.0');
|
9012 |
+
el_attr_remove.style.cssText = 'cursor:pointer; vertical-align:middle; margin:2px';
|
9013 |
+
|
9014 |
+
el_attr_remove.setAttribute("onClick", "remove_attr("+j+", "+i+", 'type_name')");
|
9015 |
+
el_attr_table.appendChild(el_attr_tr);
|
9016 |
+
el_attr_tr.appendChild(el_attr_td_name);
|
9017 |
+
el_attr_tr.appendChild(el_attr_td_value);
|
9018 |
+
el_attr_tr.appendChild(el_attr_td_X);
|
9019 |
+
el_attr_td_name.appendChild(el_attr_name);
|
9020 |
+
el_attr_td_value.appendChild(el_attr_value);
|
9021 |
+
el_attr_td_X.appendChild(el_attr_remove);
|
9022 |
+
|
9023 |
+
}
|
9024 |
+
|
9025 |
+
|
9026 |
+
var t = document.getElementById('edit_table');
|
9027 |
+
|
9028 |
+
var br = document.createElement('br');
|
9029 |
+
var br1 = document.createElement('br');
|
9030 |
+
var br2 = document.createElement('br');
|
9031 |
+
var br3 = document.createElement('br');
|
9032 |
+
|
9033 |
+
edit_main_td1.appendChild(el_label_label);
|
9034 |
+
edit_main_td1_1.appendChild(el_label_textarea);
|
9035 |
+
|
9036 |
+
edit_main_td9.appendChild(el_label_size_label);
|
9037 |
+
edit_main_td9_1.appendChild(el_label_size);
|
9038 |
+
|
9039 |
+
edit_main_td2.appendChild(el_label_position_label);
|
9040 |
+
edit_main_td2_1.appendChild(el_label_position1);
|
9041 |
+
edit_main_td2_1.appendChild(el_label_left);
|
9042 |
+
edit_main_td2_1.appendChild(br);
|
9043 |
+
edit_main_td2_1.appendChild(el_label_position2);
|
9044 |
+
edit_main_td2_1.appendChild(el_label_top);
|
9045 |
+
|
9046 |
+
edit_main_td3.appendChild(el_first_value_label);
|
9047 |
+
edit_main_td3_1.appendChild(el_first_value_area);
|
9048 |
+
|
9049 |
+
|
9050 |
+
|
9051 |
+
edit_main_td7.appendChild(el_size_label);
|
9052 |
+
edit_main_td7_1.appendChild(el_size);
|
9053 |
+
|
9054 |
+
edit_main_td4.appendChild(el_style_label);
|
9055 |
+
edit_main_td4_1.appendChild(el_style_textarea);
|
9056 |
+
|
9057 |
+
edit_main_td5.appendChild(el_required_label);
|
9058 |
+
edit_main_td5_1.appendChild(el_required);
|
9059 |
+
|
9060 |
+
edit_main_td8.appendChild(el_unique_label);
|
9061 |
+
edit_main_td8_1.appendChild(el_unique);
|
9062 |
+
|
9063 |
+
|
9064 |
+
edit_main_td_hide_label_1.appendChild(el_hide_label_label);
|
9065 |
+
edit_main_td_hide_label_2.appendChild(el_hide_label);
|
9066 |
+
|
9067 |
+
edit_main_td6.appendChild(el_attr_label);
|
9068 |
+
edit_main_td6.appendChild(el_attr_add);
|
9069 |
+
edit_main_td6.appendChild(br3);
|
9070 |
+
edit_main_td6.appendChild(el_attr_table);
|
9071 |
+
edit_main_td6.setAttribute("colspan", "2");
|
9072 |
+
|
9073 |
+
edit_main_tr1.appendChild(edit_main_td1);
|
9074 |
+
edit_main_tr1.appendChild(edit_main_td1_1);
|
9075 |
+
edit_main_tr9.appendChild(edit_main_td9);
|
9076 |
+
edit_main_tr9.appendChild(edit_main_td9_1);
|
9077 |
+
edit_main_tr2.appendChild(edit_main_td2);
|
9078 |
+
edit_main_tr2.appendChild(edit_main_td2_1);
|
9079 |
+
/* edit_main_tr3.appendChild(edit_main_td3);
|
9080 |
+
edit_main_tr3.appendChild(edit_main_td3_1); */
|
9081 |
+
edit_main_tr4.appendChild(edit_main_td4);
|
9082 |
+
edit_main_tr4.appendChild(edit_main_td4_1);
|
9083 |
+
edit_main_tr5.appendChild(edit_main_td5);
|
9084 |
+
edit_main_tr5.appendChild(edit_main_td5_1);
|
9085 |
+
edit_main_tr6.appendChild(edit_main_td6);
|
9086 |
+
edit_main_tr8.appendChild(edit_main_td8);
|
9087 |
+
edit_main_tr8.appendChild(edit_main_td8_1);
|
9088 |
+
edit_main_tr7.appendChild(edit_main_td7);
|
9089 |
+
edit_main_tr7.appendChild(edit_main_td7_1);
|
9090 |
+
/* edit_main_tr_hide_label.appendChild(edit_main_td_hide_label_1);
|
9091 |
+
edit_main_tr_hide_label.appendChild(edit_main_td_hide_label_2); */
|
9092 |
+
edit_main_table.appendChild(edit_main_tr1);
|
9093 |
+
edit_main_table.appendChild(edit_main_tr9);
|
9094 |
+
edit_main_table.appendChild(edit_main_tr2);
|
9095 |
+
edit_main_table.appendChild(edit_main_tr_hide_label);
|
9096 |
+
edit_main_table.appendChild(edit_main_tr3);
|
9097 |
+
edit_main_table.appendChild(edit_main_tr7);
|
9098 |
+
edit_main_table.appendChild(edit_main_tr4);
|
9099 |
+
edit_main_table.appendChild(edit_main_tr5);
|
9100 |
+
edit_main_table.appendChild(edit_main_tr8);
|
9101 |
+
edit_main_table.appendChild(edit_main_tr6);
|
9102 |
+
edit_div.appendChild(edit_main_table);
|
9103 |
+
|
9104 |
+
t.appendChild(edit_div);
|
9105 |
+
add_id_and_name(i, 'type_text');
|
9106 |
+
set_fieldtype('type_phone_new');
|
9107 |
+
//show table
|
9108 |
+
|
9109 |
+
var adding_type = document.createElement("input");
|
9110 |
+
adding_type.setAttribute("type", "hidden");
|
9111 |
+
adding_type.setAttribute("value", "type_phone_new");
|
9112 |
+
adding_type.setAttribute("name", i+"_typeform_id_temp");
|
9113 |
+
adding_type.setAttribute("id", i+"_typeform_id_temp");
|
9114 |
+
|
9115 |
+
var adding_required= document.createElement("input");
|
9116 |
+
adding_required.setAttribute("type", "hidden");
|
9117 |
+
adding_required.setAttribute("value", w_required);
|
9118 |
+
adding_required.setAttribute("name", i+"_requiredform_id_temp");
|
9119 |
+
adding_required.setAttribute("id", i+"_requiredform_id_temp");
|
9120 |
+
|
9121 |
+
var adding_hide_label= document.createElement("input");
|
9122 |
+
adding_hide_label.setAttribute("type", "hidden");
|
9123 |
+
adding_hide_label.setAttribute("value", w_hide_label);
|
9124 |
+
adding_hide_label.setAttribute("name", i+"_hide_labelform_id_temp");
|
9125 |
+
adding_hide_label.setAttribute("id", i+"_hide_labelform_id_temp");
|
9126 |
+
|
9127 |
+
|
9128 |
+
var adding_unique= document.createElement("input");
|
9129 |
+
adding_unique.setAttribute("type", "hidden");
|
9130 |
+
adding_unique.setAttribute("value", w_unique);
|
9131 |
+
adding_unique.setAttribute("name", i+"_uniqueform_id_temp");
|
9132 |
+
adding_unique.setAttribute("id", i+"_uniqueform_id_temp");
|
9133 |
+
|
9134 |
+
var div = document.createElement('div');
|
9135 |
+
div.setAttribute("id", "main_div");
|
9136 |
+
|
9137 |
+
|
9138 |
+
var div_field = document.createElement('div');
|
9139 |
+
div_field.setAttribute("id", i+"_elemet_tableform_id_temp");
|
9140 |
+
|
9141 |
+
var display_label_div = (w_hide_label == "yes" ? "none" : "table-cell");
|
9142 |
+
var div_label = document.createElement('div');
|
9143 |
+
div_label.setAttribute("align", 'left');
|
9144 |
+
div_label.style.display=display_label_div;
|
9145 |
+
div_label.style.width=w_field_label_size+"px";
|
9146 |
+
div_label.setAttribute("id", i+"_label_sectionform_id_temp");
|
9147 |
+
|
9148 |
+
var div_element = document.createElement('div');
|
9149 |
+
div_element.setAttribute("align", 'left');
|
9150 |
+
div_element.style.display="table-cell";
|
9151 |
+
div_element.setAttribute("id", i+"_element_sectionform_id_temp");
|
9152 |
+
|
9153 |
+
var table_name = document.createElement('div');
|
9154 |
+
table_name.style.display="table";
|
9155 |
+
table_name.setAttribute("id", i+"_table_name");
|
9156 |
+
|
9157 |
+
var tr_name1 = document.createElement('div');
|
9158 |
+
tr_name1.style.display="table-row";
|
9159 |
+
tr_name1.setAttribute("id", i+"_tr_name1");
|
9160 |
+
|
9161 |
+
var td_name_input1 = document.createElement('div');
|
9162 |
+
td_name_input1.style.display="table-cell";
|
9163 |
+
td_name_input1.setAttribute("id", i+"_td_name_input_first");
|
9164 |
+
|
9165 |
+
|
9166 |
+
var label = document.createElement('span');
|
9167 |
+
label.setAttribute("id", i+"_element_labelform_id_temp");
|
9168 |
+
label.innerHTML = w_field_label;
|
9169 |
+
label.setAttribute("class", "label");
|
9170 |
+
label.style.verticalAlign="top";
|
9171 |
+
|
9172 |
+
var required = document.createElement('span');
|
9173 |
+
required.setAttribute("id", i+"_required_elementform_id_temp");
|
9174 |
+
required.innerHTML = "";
|
9175 |
+
required.setAttribute("class", "required");
|
9176 |
+
if(w_required=="yes")
|
9177 |
+
required.innerHTML = " *";
|
9178 |
+
|
9179 |
+
var first = document.createElement('input');
|
9180 |
+
first.setAttribute("type", 'text');
|
9181 |
+
first.setAttribute("class", "input_active");
|
9182 |
+
first.style.cssText = "width:"+w_size+"px";
|
9183 |
+
first.setAttribute("id", i+"_elementform_id_temp");
|
9184 |
+
first.setAttribute("name", i+"_elementform_id_temp");
|
9185 |
+
first.setAttribute("value", w_first_val);
|
9186 |
+
first.setAttribute("top-country", w_top_country);
|
9187 |
+
|
9188 |
+
|
9189 |
+
var main_td = document.getElementById('show_table');
|
9190 |
+
|
9191 |
+
div_label.appendChild(label);
|
9192 |
+
div_label.appendChild(required );
|
9193 |
+
|
9194 |
+
td_name_input1.appendChild(first);
|
9195 |
+
tr_name1.appendChild(td_name_input1);
|
9196 |
+
table_name.appendChild(tr_name1);
|
9197 |
+
div_element.appendChild(adding_type);
|
9198 |
+
div_element.appendChild(adding_required);
|
9199 |
+
div_element.appendChild(adding_hide_label);
|
9200 |
+
div_element.appendChild(adding_unique);
|
9201 |
+
div_element.appendChild(table_name);
|
9202 |
+
div_field.appendChild(div_label);
|
9203 |
+
div_field.appendChild(div_element);
|
9204 |
+
div.appendChild(div_field);
|
9205 |
+
div.appendChild(br1);
|
9206 |
+
|
9207 |
+
main_td.appendChild(div);
|
9208 |
+
|
9209 |
+
if(w_field_label_pos=="top")
|
9210 |
+
label_top(i);
|
9211 |
+
|
9212 |
+
change_class(w_class, i);
|
9213 |
+
refresh_attr(i, 'type_name');
|
9214 |
+
|
9215 |
+
jQuery("#"+i+"_elementform_id_temp").intlTelInput({
|
9216 |
+
nationalMode: false,
|
9217 |
+
preferredCountries: [ w_top_country ],
|
9218 |
+
});
|
9219 |
+
}
|
9220 |
+
|
9221 |
+
|
9222 |
+
|
9223 |
+
|
9224 |
function change_input_range(type, id)
|
9225 |
{
|
9226 |
var s='';
|
25339 |
el_type_label_phone.innerHTML = 'Phone';
|
25340 |
|
25341 |
|
25342 |
+
var el_type_radio_phone_new= document.createElement('input');
|
25343 |
+
el_type_radio_phone_new.setAttribute("id", "el_type_radio_phone_new");
|
25344 |
+
el_type_radio_phone_new.setAttribute("type", "radio");
|
25345 |
+
el_type_radio_phone_new.style.cssText = "margin-left:15px";
|
25346 |
+
el_type_radio_phone_new.setAttribute("value", "phone");
|
25347 |
+
el_type_radio_phone_new.setAttribute("name", "el_type");
|
25348 |
+
el_type_radio_phone_new.setAttribute("onclick", "go_to_type_phone_new('"+new_id+"')");
|
25349 |
+
|
25350 |
+
var el_type_label_phone_new = document.createElement('label');
|
25351 |
+
el_type_label_phone_new.setAttribute("for", "el_type_radio_phone_new");
|
25352 |
+
el_type_label_phone_new.innerHTML = 'Phone with flag';
|
25353 |
+
|
25354 |
+
|
25355 |
var el_type_radio_hidden = document.createElement('input');
|
25356 |
el_type_radio_hidden.setAttribute("id", "el_type_hidden");
|
25357 |
el_type_radio_hidden.setAttribute("type", "radio");
|
25404 |
var br10 = document.createElement('br');
|
25405 |
var br11 = document.createElement('br');
|
25406 |
var br12 = document.createElement('br');
|
25407 |
+
var br13 = document.createElement('br');
|
25408 |
|
25409 |
|
25410 |
td.appendChild(br1);
|
25440 |
td.appendChild(br7);
|
25441 |
td.appendChild(el_type_radio_phone);
|
25442 |
td.appendChild(el_type_label_phone);
|
25443 |
+
td.appendChild(br13);
|
25444 |
+
td.appendChild(el_type_radio_phone_new);
|
25445 |
+
td.appendChild(el_type_label_phone_new);
|
25446 |
td.appendChild(br8);
|
25447 |
td.appendChild(el_type_radio_hidden);
|
25448 |
td.appendChild(el_type_label_hidden);
|
25540 |
type_phone(new_id,'Phone:', '100', 'left', '135', w_first_val, w_title, w_mini_labels, 'no', 'no', '',w_attr_name, w_attr_value)
|
25541 |
}
|
25542 |
|
25543 |
+
function go_to_type_phone_new(new_id)
|
25544 |
+
{
|
25545 |
+
w_attr_name=[];
|
25546 |
+
w_attr_value=[];
|
25547 |
+
type_phone_new(new_id,'Phone:', '100', 'left', 'no', '200', '', 'us', 'no', 'no', '',w_attr_name, w_attr_value);
|
25548 |
+
}
|
25549 |
+
|
25550 |
function go_to_type_submitter_mail(new_id)
|
25551 |
{
|
25552 |
w_attr_name=[];
|
28167 |
w_attr_value=atrs[1];
|
28168 |
type_phone(id, w_field_label, w_field_label_size, w_field_label_pos, w_size, w_first_val, w_title, w_mini_labels, w_required, w_unique, w_class, w_attr_name, w_attr_value); break;
|
28169 |
}
|
28170 |
+
|
28171 |
+
case 'type_phone_new':
|
28172 |
+
{
|
28173 |
+
var countryData = jQuery("#"+id+"_elementform_id_temp").intlTelInput("getSelectedCountryData");
|
28174 |
+
w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value;
|
28175 |
+
w_first_val=document.getElementById(id+"_elementform_id_temp").value;
|
28176 |
+
w_top_country=countryData['iso2'];
|
28177 |
+
atrs=return_attributes(id+'_elementform_id_temp');
|
28178 |
+
w_attr_name=atrs[0];
|
28179 |
+
w_attr_value=atrs[1];
|
28180 |
+
type_phone_new(id, w_field_label, w_field_label_size, w_field_label_pos, w_hide_label, w_size, w_first_val, w_top_country, w_required, w_unique, w_class, w_attr_name, w_attr_value); break;
|
28181 |
+
}
|
28182 |
+
|
28183 |
case 'type_name':
|
28184 |
{
|
28185 |
if(document.getElementById(id+"_enable_fieldsform_id_temp")) {
|
29106 |
w_attr_value=atrs[1];
|
29107 |
type_phone(gen, w_field_label, w_field_label_size, w_field_label_pos, w_size, w_first_val, w_title, w_mini_labels, w_required, w_unique, w_class, w_attr_name, w_attr_value); break;
|
29108 |
}
|
29109 |
+
|
29110 |
+
case 'type_phone_new':
|
29111 |
+
{
|
29112 |
+
w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value;
|
29113 |
+
w_first_val=document.getElementById(id+"_elementform_id_temp").value;
|
29114 |
+
w_top_country=document.getElementById(id+"_elementform_id_temp").getAttribute("top-country");
|
29115 |
+
atrs=return_attributes(id+'_elementform_id_temp');
|
29116 |
+
w_attr_name=atrs[0];
|
29117 |
+
w_attr_value=atrs[1];
|
29118 |
+
type_phone_new(gen, w_field_label, w_field_label_size, w_field_label_pos, w_hide_label, w_size, w_first_val, w_top_country, w_required, w_unique, w_class, w_attr_name, w_attr_value); break;
|
29119 |
+
}
|
29120 |
+
|
29121 |
case 'type_name':
|
29122 |
{
|
29123 |
if(document.getElementById(id+"_enable_fieldsform_id_temp")) {
|
30064 |
form_fields+="*:*new_field*:*";
|
30065 |
break;
|
30066 |
}
|
30067 |
+
|
30068 |
+
case 'type_phone_new':
|
30069 |
+
{
|
30070 |
+
w_hide_label=document.getElementById(id+"_hide_labelform_id_temp").value;
|
30071 |
+
w_first_val=document.getElementById(id+"_elementform_id_temp").value;
|
30072 |
+
w_top_country=document.getElementById(id+"_elementform_id_temp").getAttribute("top-country");
|
30073 |
+
atrs=return_attributes(id+'_elementform_id_temp');
|
30074 |
+
w_attr_name=atrs[0];
|
30075 |
+
w_attr_value=atrs[1];
|
30076 |
+
|
30077 |
+
|
30078 |
+
form_fields+=w_field_label+"*:*w_field_label*:*";
|
30079 |
+
form_fields+=w_field_label_size+"*:*w_field_label_size*:*";
|
30080 |
+
form_fields+=w_field_label_pos+"*:*w_field_label_pos*:*";
|
30081 |
+
form_fields+=w_hide_label+"*:*w_hide_label*:*";
|
30082 |
+
form_fields+=w_size+"*:*w_size*:*";
|
30083 |
+
form_fields+=w_first_val+"*:*w_first_val*:*";
|
30084 |
+
form_fields+=w_top_country+"*:*w_top_country*:*";
|
30085 |
+
form_fields+=w_required+"*:*w_required*:*";
|
30086 |
+
form_fields+=w_unique+"*:*w_unique*:*";
|
30087 |
+
form_fields+=w_class+"*:*w_class*:*";
|
30088 |
+
|
30089 |
+
for(j=0; j<w_attr_name.length; j++)
|
30090 |
+
{
|
30091 |
+
form_fields+=w_attr_name[j]+"="+w_attr_value[j]+"*:*w_attr_name*:*";
|
30092 |
+
}
|
30093 |
+
form_fields+="*:*new_field*:*";
|
30094 |
+
|
30095 |
+
break;
|
30096 |
+
}
|
30097 |
+
|
30098 |
+
|
30099 |
+
|
30100 |
case 'type_name':
|
30101 |
{
|
30102 |
if(document.getElementById(id+"_enable_fieldsform_id_temp")) {
|
js/intlTelInput.js
ADDED
@@ -0,0 +1,1124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* International Telephone Input v11.0.0
|
3 |
+
* https://github.com/jackocnr/intl-tel-input.git
|
4 |
+
* Licensed under the MIT license
|
5 |
+
*/
|
6 |
+
// wrap in UMD - see https://github.com/umdjs/umd/blob/master/jqueryPluginCommonjs.js
|
7 |
+
(function(factory) {
|
8 |
+
if (typeof define === "function" && define.amd) {
|
9 |
+
define([ "jquery" ], function($) {
|
10 |
+
factory($, window, document);
|
11 |
+
});
|
12 |
+
} else if (typeof module === "object" && module.exports) {
|
13 |
+
module.exports = factory(require("jquery"), window, document);
|
14 |
+
} else {
|
15 |
+
factory(jQuery, window, document);
|
16 |
+
}
|
17 |
+
})(function($, window, document, undefined) {
|
18 |
+
"use strict";
|
19 |
+
// these vars persist through all instances of the plugin
|
20 |
+
var pluginName = "intlTelInput", id = 1, // give each instance it's own id for namespaced event handling
|
21 |
+
defaults = {
|
22 |
+
// whether or not to allow the dropdown
|
23 |
+
allowDropdown: true,
|
24 |
+
// if there is just a dial code in the input: remove it on blur, and re-add it on focus
|
25 |
+
autoHideDialCode: true,
|
26 |
+
// add a placeholder in the input with an example number for the selected country
|
27 |
+
autoPlaceholder: "polite",
|
28 |
+
// modify the auto placeholder
|
29 |
+
customPlaceholder: null,
|
30 |
+
// append menu to a specific element
|
31 |
+
dropdownContainer: "",
|
32 |
+
// don't display these countries
|
33 |
+
excludeCountries: [],
|
34 |
+
// format the input value during initialisation and on setNumber
|
35 |
+
formatOnDisplay: true,
|
36 |
+
// geoIp lookup function
|
37 |
+
geoIpLookup: null,
|
38 |
+
// initial country
|
39 |
+
initialCountry: "",
|
40 |
+
// don't insert international dial codes
|
41 |
+
nationalMode: true,
|
42 |
+
// display only these countries
|
43 |
+
onlyCountries: [],
|
44 |
+
// number type to use for placeholders
|
45 |
+
placeholderNumberType: "MOBILE",
|
46 |
+
// the countries at the top of the list. defaults to united states and united kingdom
|
47 |
+
preferredCountries: [ "us", "gb" ],
|
48 |
+
// display the country dial code next to the selected flag so it's not part of the typed number
|
49 |
+
separateDialCode: false,
|
50 |
+
// specify the path to the libphonenumber script to enable validation/formatting
|
51 |
+
utilsScript: ""
|
52 |
+
}, keys = {
|
53 |
+
UP: 38,
|
54 |
+
DOWN: 40,
|
55 |
+
ENTER: 13,
|
56 |
+
ESC: 27,
|
57 |
+
PLUS: 43,
|
58 |
+
A: 65,
|
59 |
+
Z: 90,
|
60 |
+
SPACE: 32,
|
61 |
+
TAB: 9
|
62 |
+
}, // https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes#Non-geographic_area_codes
|
63 |
+
regionlessNanpNumbers = [ "800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889" ];
|
64 |
+
// keep track of if the window.load event has fired as impossible to check after the fact
|
65 |
+
$(window).on("load", function() {
|
66 |
+
// UPDATE: use a public static field so we can fudge it in the tests
|
67 |
+
$.fn[pluginName].windowLoaded = true;
|
68 |
+
});
|
69 |
+
function Plugin(element, options) {
|
70 |
+
this.telInput = $(element);
|
71 |
+
this.options = $.extend({}, defaults, options);
|
72 |
+
// event namespace
|
73 |
+
this.ns = "." + pluginName + id++;
|
74 |
+
// Chrome, FF, Safari, IE9+
|
75 |
+
this.isGoodBrowser = Boolean(element.setSelectionRange);
|
76 |
+
this.hadInitialPlaceholder = Boolean($(element).attr("placeholder"));
|
77 |
+
}
|
78 |
+
Plugin.prototype = {
|
79 |
+
_init: function() {
|
80 |
+
// if in nationalMode, disable options relating to dial codes
|
81 |
+
if (this.options.nationalMode) {
|
82 |
+
this.options.autoHideDialCode = false;
|
83 |
+
}
|
84 |
+
// if separateDialCode then doesn't make sense to A) insert dial code into input (autoHideDialCode), and B) display national numbers (because we're displaying the country dial code next to them)
|
85 |
+
if (this.options.separateDialCode) {
|
86 |
+
this.options.autoHideDialCode = this.options.nationalMode = false;
|
87 |
+
}
|
88 |
+
// we cannot just test screen size as some smartphones/website meta tags will report desktop resolutions
|
89 |
+
// Note: for some reason jasmine breaks if you put this in the main Plugin function with the rest of these declarations
|
90 |
+
// Note: to target Android Mobiles (and not Tablets), we must find "Android" and "Mobile"
|
91 |
+
this.isMobile = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
92 |
+
if (this.isMobile) {
|
93 |
+
// trigger the mobile dropdown css
|
94 |
+
$("body").addClass("iti-mobile");
|
95 |
+
// on mobile, we want a full screen dropdown, so we must append it to the body
|
96 |
+
if (!this.options.dropdownContainer) {
|
97 |
+
this.options.dropdownContainer = "body";
|
98 |
+
}
|
99 |
+
}
|
100 |
+
// we return these deferred objects from the _init() call so they can be watched, and then we resolve them when each specific request returns
|
101 |
+
// Note: again, jasmine breaks when I put these in the Plugin function
|
102 |
+
this.autoCountryDeferred = new $.Deferred();
|
103 |
+
this.utilsScriptDeferred = new $.Deferred();
|
104 |
+
// process all the data: onlyCountries, excludeCountries, preferredCountries etc
|
105 |
+
this._processCountryData();
|
106 |
+
// generate the markup
|
107 |
+
this._generateMarkup();
|
108 |
+
// set the initial state of the input value and the selected flag
|
109 |
+
this._setInitialState();
|
110 |
+
// start all of the event listeners: autoHideDialCode, input keydown, selectedFlag click
|
111 |
+
this._initListeners();
|
112 |
+
// utils script, and auto country
|
113 |
+
this._initRequests();
|
114 |
+
// return the deferreds
|
115 |
+
return [ this.autoCountryDeferred, this.utilsScriptDeferred ];
|
116 |
+
},
|
117 |
+
/********************
|
118 |
+
* PRIVATE METHODS
|
119 |
+
********************/
|
120 |
+
// prepare all of the country data, including onlyCountries, excludeCountries and preferredCountries options
|
121 |
+
_processCountryData: function() {
|
122 |
+
// process onlyCountries or excludeCountries array if present
|
123 |
+
this._processAllCountries();
|
124 |
+
// process the countryCodes map
|
125 |
+
this._processCountryCodes();
|
126 |
+
// process the preferredCountries
|
127 |
+
this._processPreferredCountries();
|
128 |
+
},
|
129 |
+
// add a country code to this.countryCodes
|
130 |
+
_addCountryCode: function(iso2, dialCode, priority) {
|
131 |
+
if (!(dialCode in this.countryCodes)) {
|
132 |
+
this.countryCodes[dialCode] = [];
|
133 |
+
}
|
134 |
+
var index = priority || 0;
|
135 |
+
this.countryCodes[dialCode][index] = iso2;
|
136 |
+
},
|
137 |
+
// filter the given countries using the process function
|
138 |
+
_filterCountries: function(countryArray, processFunc) {
|
139 |
+
var i;
|
140 |
+
// standardise case
|
141 |
+
for (i = 0; i < countryArray.length; i++) {
|
142 |
+
countryArray[i] = countryArray[i].toLowerCase();
|
143 |
+
}
|
144 |
+
// build instance country array
|
145 |
+
this.countries = [];
|
146 |
+
for (i = 0; i < allCountries.length; i++) {
|
147 |
+
if (processFunc($.inArray(allCountries[i].iso2, countryArray))) {
|
148 |
+
this.countries.push(allCountries[i]);
|
149 |
+
}
|
150 |
+
}
|
151 |
+
},
|
152 |
+
// process onlyCountries or excludeCountries array if present
|
153 |
+
_processAllCountries: function() {
|
154 |
+
if (this.options.onlyCountries.length) {
|
155 |
+
// process onlyCountries option
|
156 |
+
this._filterCountries(this.options.onlyCountries, function(arrayPos) {
|
157 |
+
// if country is in array
|
158 |
+
return arrayPos > -1;
|
159 |
+
});
|
160 |
+
} else if (this.options.excludeCountries.length) {
|
161 |
+
// process excludeCountries option
|
162 |
+
this._filterCountries(this.options.excludeCountries, function(arrayPos) {
|
163 |
+
// if country is not in array
|
164 |
+
return arrayPos == -1;
|
165 |
+
});
|
166 |
+
} else {
|
167 |
+
this.countries = allCountries;
|
168 |
+
}
|
169 |
+
},
|
170 |
+
// process the countryCodes map
|
171 |
+
_processCountryCodes: function() {
|
172 |
+
this.countryCodes = {};
|
173 |
+
for (var i = 0; i < this.countries.length; i++) {
|
174 |
+
var c = this.countries[i];
|
175 |
+
this._addCountryCode(c.iso2, c.dialCode, c.priority);
|
176 |
+
// area codes
|
177 |
+
if (c.areaCodes) {
|
178 |
+
for (var j = 0; j < c.areaCodes.length; j++) {
|
179 |
+
// full dial code is country code + dial code
|
180 |
+
this._addCountryCode(c.iso2, c.dialCode + c.areaCodes[j]);
|
181 |
+
}
|
182 |
+
}
|
183 |
+
}
|
184 |
+
},
|
185 |
+
// process preferred countries - iterate through the preferences, fetching the country data for each one
|
186 |
+
_processPreferredCountries: function() {
|
187 |
+
this.preferredCountries = [];
|
188 |
+
for (var i = 0; i < this.options.preferredCountries.length; i++) {
|
189 |
+
var countryCode = this.options.preferredCountries[i].toLowerCase(), countryData = this._getCountryData(countryCode, false, true);
|
190 |
+
if (countryData) {
|
191 |
+
this.preferredCountries.push(countryData);
|
192 |
+
}
|
193 |
+
}
|
194 |
+
},
|
195 |
+
// generate all of the markup for the plugin: the selected flag overlay, and the dropdown
|
196 |
+
_generateMarkup: function() {
|
197 |
+
// prevent autocomplete as there's no safe, cross-browser event we can react to, so it can easily put the plugin in an inconsistent state e.g. the wrong flag selected for the autocompleted number, which on submit could mean the wrong number is saved (esp in nationalMode)
|
198 |
+
this.telInput.attr("autocomplete", "off");
|
199 |
+
// containers (mostly for positioning)
|
200 |
+
var parentClass = "intl-tel-input";
|
201 |
+
if (this.options.allowDropdown) {
|
202 |
+
parentClass += " allow-dropdown";
|
203 |
+
}
|
204 |
+
if (this.options.separateDialCode) {
|
205 |
+
parentClass += " separate-dial-code";
|
206 |
+
}
|
207 |
+
this.telInput.wrap($("<div>", {
|
208 |
+
"class": parentClass
|
209 |
+
}));
|
210 |
+
this.flagsContainer = $("<div>", {
|
211 |
+
"class": "flag-container"
|
212 |
+
}).insertBefore(this.telInput);
|
213 |
+
// currently selected flag (displayed to left of input)
|
214 |
+
var selectedFlag = $("<div>", {
|
215 |
+
"class": "selected-flag"
|
216 |
+
});
|
217 |
+
selectedFlag.appendTo(this.flagsContainer);
|
218 |
+
this.selectedFlagInner = $("<div>", {
|
219 |
+
"class": "iti-flag"
|
220 |
+
}).appendTo(selectedFlag);
|
221 |
+
if (this.options.separateDialCode) {
|
222 |
+
this.selectedDialCode = $("<div>", {
|
223 |
+
"class": "selected-dial-code"
|
224 |
+
}).appendTo(selectedFlag);
|
225 |
+
}
|
226 |
+
if (this.options.allowDropdown) {
|
227 |
+
// make element focusable and tab naviagable
|
228 |
+
selectedFlag.attr("tabindex", "0");
|
229 |
+
// CSS triangle
|
230 |
+
$("<div>", {
|
231 |
+
"class": "iti-arrow"
|
232 |
+
}).appendTo(selectedFlag);
|
233 |
+
// country dropdown: preferred countries, then divider, then all countries
|
234 |
+
this.countryList = $("<ul>", {
|
235 |
+
"class": "country-list hide"
|
236 |
+
});
|
237 |
+
if (this.preferredCountries.length) {
|
238 |
+
this._appendListItems(this.preferredCountries, "preferred");
|
239 |
+
$("<li>", {
|
240 |
+
"class": "divider"
|
241 |
+
}).appendTo(this.countryList);
|
242 |
+
}
|
243 |
+
this._appendListItems(this.countries, "");
|
244 |
+
// this is useful in lots of places
|
245 |
+
this.countryListItems = this.countryList.children(".country");
|
246 |
+
// create dropdownContainer markup
|
247 |
+
if (this.options.dropdownContainer) {
|
248 |
+
this.dropdown = $("<div>", {
|
249 |
+
"class": "intl-tel-input iti-container"
|
250 |
+
}).append(this.countryList);
|
251 |
+
} else {
|
252 |
+
this.countryList.appendTo(this.flagsContainer);
|
253 |
+
}
|
254 |
+
} else {
|
255 |
+
// a little hack so we don't break anything
|
256 |
+
this.countryListItems = $();
|
257 |
+
}
|
258 |
+
},
|
259 |
+
// add a country <li> to the countryList <ul> container
|
260 |
+
_appendListItems: function(countries, className) {
|
261 |
+
// we create so many DOM elements, it is faster to build a temp string
|
262 |
+
// and then add everything to the DOM in one go at the end
|
263 |
+
var tmp = "";
|
264 |
+
// for each country
|
265 |
+
for (var i = 0; i < countries.length; i++) {
|
266 |
+
var c = countries[i];
|
267 |
+
// open the list item
|
268 |
+
tmp += "<li class='country " + className + "' data-dial-code='" + c.dialCode + "' data-country-code='" + c.iso2 + "'>";
|
269 |
+
// add the flag
|
270 |
+
tmp += "<div class='flag-box'><div class='iti-flag " + c.iso2 + "'></div></div>";
|
271 |
+
// and the country name and dial code
|
272 |
+
tmp += "<span class='country-name'>" + c.name + "</span>";
|
273 |
+
tmp += "<span class='dial-code'>+" + c.dialCode + "</span>";
|
274 |
+
// close the list item
|
275 |
+
tmp += "</li>";
|
276 |
+
}
|
277 |
+
this.countryList.append(tmp);
|
278 |
+
},
|
279 |
+
// set the initial state of the input value and the selected flag by:
|
280 |
+
// 1. extracting a dial code from the given number
|
281 |
+
// 2. using explicit initialCountry
|
282 |
+
// 3. picking the first preferred country
|
283 |
+
// 4. picking the first country
|
284 |
+
_setInitialState: function() {
|
285 |
+
var val = this.telInput.val();
|
286 |
+
// if we already have a dial code, and it's not a regionlessNanp we can go ahead and set the flag, else fall back to default
|
287 |
+
if (this._getDialCode(val) && !this._isRegionlessNanp(val)) {
|
288 |
+
this._updateFlagFromNumber(val);
|
289 |
+
} else if (this.options.initialCountry !== "auto") {
|
290 |
+
// see if we should select a flag
|
291 |
+
if (this.options.initialCountry) {
|
292 |
+
this._setFlag(this.options.initialCountry.toLowerCase());
|
293 |
+
} else {
|
294 |
+
// no dial code and no initialCountry, so default to first in list
|
295 |
+
this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2;
|
296 |
+
if (!val) {
|
297 |
+
this._setFlag(this.defaultCountry);
|
298 |
+
}
|
299 |
+
}
|
300 |
+
// if empty and no nationalMode and no autoHideDialCode then insert the default dial code
|
301 |
+
if (!val && !this.options.nationalMode && !this.options.autoHideDialCode && !this.options.separateDialCode) {
|
302 |
+
this.telInput.val("+" + this.selectedCountryData.dialCode);
|
303 |
+
}
|
304 |
+
}
|
305 |
+
// NOTE: if initialCountry is set to auto, that will be handled separately
|
306 |
+
// format
|
307 |
+
if (val) {
|
308 |
+
// this wont be run after _updateDialCode as that's only called if no val
|
309 |
+
this._updateValFromNumber(val);
|
310 |
+
}
|
311 |
+
},
|
312 |
+
// initialise the main event listeners: input keyup, and click selected flag
|
313 |
+
_initListeners: function() {
|
314 |
+
this._initKeyListeners();
|
315 |
+
if (this.options.autoHideDialCode) {
|
316 |
+
this._initFocusListeners();
|
317 |
+
}
|
318 |
+
if (this.options.allowDropdown) {
|
319 |
+
this._initDropdownListeners();
|
320 |
+
}
|
321 |
+
},
|
322 |
+
// initialise the dropdown listeners
|
323 |
+
_initDropdownListeners: function() {
|
324 |
+
var that = this;
|
325 |
+
// hack for input nested inside label: clicking the selected-flag to open the dropdown would then automatically trigger a 2nd click on the input which would close it again
|
326 |
+
var label = this.telInput.closest("label");
|
327 |
+
if (label.length) {
|
328 |
+
label.on("click" + this.ns, function(e) {
|
329 |
+
// if the dropdown is closed, then focus the input, else ignore the click
|
330 |
+
if (that.countryList.hasClass("hide")) {
|
331 |
+
that.telInput.focus();
|
332 |
+
} else {
|
333 |
+
e.preventDefault();
|
334 |
+
}
|
335 |
+
});
|
336 |
+
}
|
337 |
+
// toggle country dropdown on click
|
338 |
+
var selectedFlag = this.selectedFlagInner.parent();
|
339 |
+
selectedFlag.on("click" + this.ns, function(e) {
|
340 |
+
// only intercept this event if we're opening the dropdown
|
341 |
+
// else let it bubble up to the top ("click-off-to-close" listener)
|
342 |
+
// we cannot just stopPropagation as it may be needed to close another instance
|
343 |
+
if (that.countryList.hasClass("hide") && !that.telInput.prop("disabled") && !that.telInput.prop("readonly")) {
|
344 |
+
that._showDropdown();
|
345 |
+
}
|
346 |
+
});
|
347 |
+
// open dropdown list if currently focused
|
348 |
+
this.flagsContainer.on("keydown" + that.ns, function(e) {
|
349 |
+
var isDropdownHidden = that.countryList.hasClass("hide");
|
350 |
+
if (isDropdownHidden && (e.which == keys.UP || e.which == keys.DOWN || e.which == keys.SPACE || e.which == keys.ENTER)) {
|
351 |
+
// prevent form from being submitted if "ENTER" was pressed
|
352 |
+
e.preventDefault();
|
353 |
+
// prevent event from being handled again by document
|
354 |
+
e.stopPropagation();
|
355 |
+
that._showDropdown();
|
356 |
+
}
|
357 |
+
// allow navigation from dropdown to input on TAB
|
358 |
+
if (e.which == keys.TAB) {
|
359 |
+
that._closeDropdown();
|
360 |
+
}
|
361 |
+
});
|
362 |
+
},
|
363 |
+
// init many requests: utils script / geo ip lookup
|
364 |
+
_initRequests: function() {
|
365 |
+
var that = this;
|
366 |
+
// if the user has specified the path to the utils script, fetch it on window.load, else resolve
|
367 |
+
if (this.options.utilsScript) {
|
368 |
+
// if the plugin is being initialised after the window.load event has already been fired
|
369 |
+
if ($.fn[pluginName].windowLoaded) {
|
370 |
+
$.fn[pluginName].loadUtils(this.options.utilsScript, this.utilsScriptDeferred);
|
371 |
+
} else {
|
372 |
+
// wait until the load event so we don't block any other requests e.g. the flags image
|
373 |
+
$(window).on("load", function() {
|
374 |
+
$.fn[pluginName].loadUtils(that.options.utilsScript, that.utilsScriptDeferred);
|
375 |
+
});
|
376 |
+
}
|
377 |
+
} else {
|
378 |
+
this.utilsScriptDeferred.resolve();
|
379 |
+
}
|
380 |
+
if (this.options.initialCountry === "auto") {
|
381 |
+
this._loadAutoCountry();
|
382 |
+
} else {
|
383 |
+
this.autoCountryDeferred.resolve();
|
384 |
+
}
|
385 |
+
},
|
386 |
+
// perform the geo ip lookup
|
387 |
+
_loadAutoCountry: function() {
|
388 |
+
var that = this;
|
389 |
+
// 3 options:
|
390 |
+
// 1) already loaded (we're done)
|
391 |
+
// 2) not already started loading (start)
|
392 |
+
// 3) already started loading (do nothing - just wait for loading callback to fire)
|
393 |
+
if ($.fn[pluginName].autoCountry) {
|
394 |
+
this.handleAutoCountry();
|
395 |
+
} else if (!$.fn[pluginName].startedLoadingAutoCountry) {
|
396 |
+
// don't do this twice!
|
397 |
+
$.fn[pluginName].startedLoadingAutoCountry = true;
|
398 |
+
if (typeof this.options.geoIpLookup === "function") {
|
399 |
+
this.options.geoIpLookup(function(countryCode) {
|
400 |
+
$.fn[pluginName].autoCountry = countryCode.toLowerCase();
|
401 |
+
// tell all instances the auto country is ready
|
402 |
+
// TODO: this should just be the current instances
|
403 |
+
// UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight away (e.g. if they have already done the geo ip lookup somewhere else). Using setTimeout means that the current thread of execution will finish before executing this, which allows the plugin to finish initialising.
|
404 |
+
setTimeout(function() {
|
405 |
+
$(".intl-tel-input input").intlTelInput("handleAutoCountry");
|
406 |
+
});
|
407 |
+
});
|
408 |
+
}
|
409 |
+
}
|
410 |
+
},
|
411 |
+
// initialize any key listeners
|
412 |
+
_initKeyListeners: function() {
|
413 |
+
var that = this;
|
414 |
+
// update flag on keyup
|
415 |
+
// (keep this listener separate otherwise the setTimeout breaks all the tests)
|
416 |
+
this.telInput.on("keyup" + this.ns, function() {
|
417 |
+
if (that._updateFlagFromNumber(that.telInput.val())) {
|
418 |
+
that._triggerCountryChange();
|
419 |
+
}
|
420 |
+
});
|
421 |
+
// update flag on cut/paste events (now supported in all major browsers)
|
422 |
+
this.telInput.on("cut" + this.ns + " paste" + this.ns, function() {
|
423 |
+
// hack because "paste" event is fired before input is updated
|
424 |
+
setTimeout(function() {
|
425 |
+
if (that._updateFlagFromNumber(that.telInput.val())) {
|
426 |
+
that._triggerCountryChange();
|
427 |
+
}
|
428 |
+
});
|
429 |
+
});
|
430 |
+
},
|
431 |
+
// adhere to the input's maxlength attr
|
432 |
+
_cap: function(number) {
|
433 |
+
var max = this.telInput.attr("maxlength");
|
434 |
+
return max && number.length > max ? number.substr(0, max) : number;
|
435 |
+
},
|
436 |
+
// listen for mousedown, focus and blur
|
437 |
+
_initFocusListeners: function() {
|
438 |
+
var that = this;
|
439 |
+
// mousedown decides where the cursor goes, so if we're focusing we must preventDefault as we'll be inserting the dial code, and we want the cursor to be at the end no matter where they click
|
440 |
+
this.telInput.on("mousedown" + this.ns, function(e) {
|
441 |
+
if (!that.telInput.is(":focus") && !that.telInput.val()) {
|
442 |
+
e.preventDefault();
|
443 |
+
// but this also cancels the focus, so we must trigger that manually
|
444 |
+
that.telInput.focus();
|
445 |
+
}
|
446 |
+
});
|
447 |
+
// on focus: if empty, insert the dial code for the currently selected flag
|
448 |
+
this.telInput.on("focus" + this.ns, function(e) {
|
449 |
+
if (!that.telInput.val() && !that.telInput.prop("readonly") && that.selectedCountryData.dialCode) {
|
450 |
+
// insert the dial code
|
451 |
+
that.telInput.val("+" + that.selectedCountryData.dialCode);
|
452 |
+
// after auto-inserting a dial code, if the first key they hit is '+' then assume they are entering a new number, so remove the dial code. use keypress instead of keydown because keydown gets triggered for the shift key (required to hit the + key), and instead of keyup because that shows the new '+' before removing the old one
|
453 |
+
that.telInput.one("keypress.plus" + that.ns, function(e) {
|
454 |
+
if (e.which == keys.PLUS) {
|
455 |
+
that.telInput.val("");
|
456 |
+
}
|
457 |
+
});
|
458 |
+
// after tabbing in, make sure the cursor is at the end we must use setTimeout to get outside of the focus handler as it seems the selection happens after that
|
459 |
+
setTimeout(function() {
|
460 |
+
var input = that.telInput[0];
|
461 |
+
if (that.isGoodBrowser) {
|
462 |
+
var len = that.telInput.val().length;
|
463 |
+
input.setSelectionRange(len, len);
|
464 |
+
}
|
465 |
+
});
|
466 |
+
}
|
467 |
+
});
|
468 |
+
// on blur or form submit: if just a dial code then remove it
|
469 |
+
var form = this.telInput.prop("form");
|
470 |
+
if (form) {
|
471 |
+
$(form).on("submit" + this.ns, function() {
|
472 |
+
that._removeEmptyDialCode();
|
473 |
+
});
|
474 |
+
}
|
475 |
+
this.telInput.on("blur" + this.ns, function() {
|
476 |
+
that._removeEmptyDialCode();
|
477 |
+
});
|
478 |
+
},
|
479 |
+
_removeEmptyDialCode: function() {
|
480 |
+
var value = this.telInput.val(), startsPlus = value.charAt(0) == "+";
|
481 |
+
if (startsPlus) {
|
482 |
+
var numeric = this._getNumeric(value);
|
483 |
+
// if just a plus, or if just a dial code
|
484 |
+
if (!numeric || this.selectedCountryData.dialCode == numeric) {
|
485 |
+
this.telInput.val("");
|
486 |
+
}
|
487 |
+
}
|
488 |
+
// remove the keypress listener we added on focus
|
489 |
+
this.telInput.off("keypress.plus" + this.ns);
|
490 |
+
},
|
491 |
+
// extract the numeric digits from the given string
|
492 |
+
_getNumeric: function(s) {
|
493 |
+
return s.replace(/\D/g, "");
|
494 |
+
},
|
495 |
+
// show the dropdown
|
496 |
+
_showDropdown: function() {
|
497 |
+
this._setDropdownPosition();
|
498 |
+
// update highlighting and scroll to active list item
|
499 |
+
var activeListItem = this.countryList.children(".active");
|
500 |
+
if (activeListItem.length) {
|
501 |
+
this._highlightListItem(activeListItem);
|
502 |
+
this._scrollTo(activeListItem);
|
503 |
+
}
|
504 |
+
// bind all the dropdown-related listeners: mouseover, click, click-off, keydown
|
505 |
+
this._bindDropdownListeners();
|
506 |
+
// update the arrow
|
507 |
+
this.selectedFlagInner.children(".iti-arrow").addClass("up");
|
508 |
+
},
|
509 |
+
// decide where to position dropdown (depends on position within viewport, and scroll)
|
510 |
+
_setDropdownPosition: function() {
|
511 |
+
var that = this;
|
512 |
+
if (this.options.dropdownContainer) {
|
513 |
+
this.dropdown.appendTo(this.options.dropdownContainer);
|
514 |
+
}
|
515 |
+
// show the menu and grab the dropdown height
|
516 |
+
this.dropdownHeight = this.countryList.removeClass("hide").outerHeight();
|
517 |
+
if (!this.isMobile) {
|
518 |
+
var pos = this.telInput.offset(), inputTop = pos.top, windowTop = $(window).scrollTop(), // dropdownFitsBelow = (dropdownBottom < windowBottom)
|
519 |
+
dropdownFitsBelow = inputTop + this.telInput.outerHeight() + this.dropdownHeight < windowTop + $(window).height(), dropdownFitsAbove = inputTop - this.dropdownHeight > windowTop;
|
520 |
+
// by default, the dropdown will be below the input. If we want to position it above the input, we add the dropup class.
|
521 |
+
this.countryList.toggleClass("dropup", !dropdownFitsBelow && dropdownFitsAbove);
|
522 |
+
// if dropdownContainer is enabled, calculate postion
|
523 |
+
if (this.options.dropdownContainer) {
|
524 |
+
// by default the dropdown will be directly over the input because it's not in the flow. If we want to position it below, we need to add some extra top value.
|
525 |
+
var extraTop = !dropdownFitsBelow && dropdownFitsAbove ? 0 : this.telInput.innerHeight();
|
526 |
+
// calculate placement
|
527 |
+
this.dropdown.css({
|
528 |
+
top: inputTop + extraTop,
|
529 |
+
left: pos.left
|
530 |
+
});
|
531 |
+
// close menu on window scroll
|
532 |
+
$(window).on("scroll" + this.ns, function() {
|
533 |
+
that._closeDropdown();
|
534 |
+
});
|
535 |
+
}
|
536 |
+
}
|
537 |
+
},
|
538 |
+
// we only bind dropdown listeners when the dropdown is open
|
539 |
+
_bindDropdownListeners: function() {
|
540 |
+
var that = this;
|
541 |
+
// when mouse over a list item, just highlight that one
|
542 |
+
// we add the class "highlight", so if they hit "enter" we know which one to select
|
543 |
+
this.countryList.on("mouseover" + this.ns, ".country", function(e) {
|
544 |
+
that._highlightListItem($(this));
|
545 |
+
});
|
546 |
+
// listen for country selection
|
547 |
+
this.countryList.on("click" + this.ns, ".country", function(e) {
|
548 |
+
that._selectListItem($(this));
|
549 |
+
});
|
550 |
+
// click off to close
|
551 |
+
// (except when this initial opening click is bubbling up)
|
552 |
+
// we cannot just stopPropagation as it may be needed to close another instance
|
553 |
+
var isOpening = true;
|
554 |
+
$("html").on("click" + this.ns, function(e) {
|
555 |
+
if (!isOpening) {
|
556 |
+
that._closeDropdown();
|
557 |
+
}
|
558 |
+
isOpening = false;
|
559 |
+
});
|
560 |
+
// listen for up/down scrolling, enter to select, or letters to jump to country name.
|
561 |
+
// use keydown as keypress doesn't fire for non-char keys and we want to catch if they
|
562 |
+
// just hit down and hold it to scroll down (no keyup event).
|
563 |
+
// listen on the document because that's where key events are triggered if no input has focus
|
564 |
+
var query = "", queryTimer = null;
|
565 |
+
$(document).on("keydown" + this.ns, function(e) {
|
566 |
+
// prevent down key from scrolling the whole page,
|
567 |
+
// and enter key from submitting a form etc
|
568 |
+
e.preventDefault();
|
569 |
+
if (e.which == keys.UP || e.which == keys.DOWN) {
|
570 |
+
// up and down to navigate
|
571 |
+
that._handleUpDownKey(e.which);
|
572 |
+
} else if (e.which == keys.ENTER) {
|
573 |
+
// enter to select
|
574 |
+
that._handleEnterKey();
|
575 |
+
} else if (e.which == keys.ESC) {
|
576 |
+
// esc to close
|
577 |
+
that._closeDropdown();
|
578 |
+
} else if (e.which >= keys.A && e.which <= keys.Z || e.which == keys.SPACE) {
|
579 |
+
// upper case letters (note: keyup/keydown only return upper case letters)
|
580 |
+
// jump to countries that start with the query string
|
581 |
+
if (queryTimer) {
|
582 |
+
clearTimeout(queryTimer);
|
583 |
+
}
|
584 |
+
query += String.fromCharCode(e.which);
|
585 |
+
that._searchForCountry(query);
|
586 |
+
// if the timer hits 1 second, reset the query
|
587 |
+
queryTimer = setTimeout(function() {
|
588 |
+
query = "";
|
589 |
+
}, 1e3);
|
590 |
+
}
|
591 |
+
});
|
592 |
+
},
|
593 |
+
// highlight the next/prev item in the list (and ensure it is visible)
|
594 |
+
_handleUpDownKey: function(key) {
|
595 |
+
var current = this.countryList.children(".highlight").first();
|
596 |
+
var next = key == keys.UP ? current.prev() : current.next();
|
597 |
+
if (next.length) {
|
598 |
+
// skip the divider
|
599 |
+
if (next.hasClass("divider")) {
|
600 |
+
next = key == keys.UP ? next.prev() : next.next();
|
601 |
+
}
|
602 |
+
this._highlightListItem(next);
|
603 |
+
this._scrollTo(next);
|
604 |
+
}
|
605 |
+
},
|
606 |
+
// select the currently highlighted item
|
607 |
+
_handleEnterKey: function() {
|
608 |
+
var currentCountry = this.countryList.children(".highlight").first();
|
609 |
+
if (currentCountry.length) {
|
610 |
+
this._selectListItem(currentCountry);
|
611 |
+
}
|
612 |
+
},
|
613 |
+
// find the first list item whose name starts with the query string
|
614 |
+
_searchForCountry: function(query) {
|
615 |
+
for (var i = 0; i < this.countries.length; i++) {
|
616 |
+
if (this._startsWith(this.countries[i].name, query)) {
|
617 |
+
var listItem = this.countryList.children("[data-country-code=" + this.countries[i].iso2 + "]").not(".preferred");
|
618 |
+
// update highlighting and scroll
|
619 |
+
this._highlightListItem(listItem);
|
620 |
+
this._scrollTo(listItem, true);
|
621 |
+
break;
|
622 |
+
}
|
623 |
+
}
|
624 |
+
},
|
625 |
+
// check if (uppercase) string a starts with string b
|
626 |
+
_startsWith: function(a, b) {
|
627 |
+
return a.substr(0, b.length).toUpperCase() == b;
|
628 |
+
},
|
629 |
+
// update the input's value to the given val (format first if possible)
|
630 |
+
// NOTE: this is called from _setInitialState, handleUtils and setNumber
|
631 |
+
_updateValFromNumber: function(number) {
|
632 |
+
if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) {
|
633 |
+
var format = !this.options.separateDialCode && (this.options.nationalMode || number.charAt(0) != "+") ? intlTelInputUtils.numberFormat.NATIONAL : intlTelInputUtils.numberFormat.INTERNATIONAL;
|
634 |
+
number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format);
|
635 |
+
}
|
636 |
+
number = this._beforeSetNumber(number);
|
637 |
+
this.telInput.val(number);
|
638 |
+
},
|
639 |
+
// check if need to select a new flag based on the given number
|
640 |
+
// Note: called from _setInitialState, keyup handler, setNumber
|
641 |
+
_updateFlagFromNumber: function(number) {
|
642 |
+
// if we're in nationalMode and we already have US/Canada selected, make sure the number starts with a +1 so _getDialCode will be able to extract the area code
|
643 |
+
// update: if we dont yet have selectedCountryData, but we're here (trying to update the flag from the number), that means we're initialising the plugin with a number that already has a dial code, so fine to ignore this bit
|
644 |
+
if (number && this.options.nationalMode && this.selectedCountryData && this.selectedCountryData.dialCode == "1" && number.charAt(0) != "+") {
|
645 |
+
if (number.charAt(0) != "1") {
|
646 |
+
number = "1" + number;
|
647 |
+
}
|
648 |
+
number = "+" + number;
|
649 |
+
}
|
650 |
+
// try and extract valid dial code from input
|
651 |
+
var dialCode = this._getDialCode(number), countryCode = null, numeric = this._getNumeric(number);
|
652 |
+
if (dialCode) {
|
653 |
+
// check if one of the matching countries is already selected
|
654 |
+
var countryCodes = this.countryCodes[this._getNumeric(dialCode)], alreadySelected = this.selectedCountryData && $.inArray(this.selectedCountryData.iso2, countryCodes) > -1, // check if the given number contains a NANP area code i.e. the only dialCode that could be extracted was +1 (instead of say +1204) and the actual number's length is >=4
|
655 |
+
isNanpAreaCode = dialCode == "+1" && numeric.length >= 4, nanpSelected = this.selectedCountryData && this.selectedCountryData.dialCode == "1";
|
656 |
+
// only update the flag if:
|
657 |
+
// A) NOT (we currently have a NANP flag selected, and the number is a regionlessNanp)
|
658 |
+
// AND
|
659 |
+
// B) either a matching country is not already selected OR the number contains a NANP area code (ensure the flag is set to the first matching country)
|
660 |
+
if (!(nanpSelected && this._isRegionlessNanp(numeric)) && (!alreadySelected || isNanpAreaCode)) {
|
661 |
+
// if using onlyCountries option, countryCodes[0] may be empty, so we must find the first non-empty index
|
662 |
+
for (var j = 0; j < countryCodes.length; j++) {
|
663 |
+
if (countryCodes[j]) {
|
664 |
+
countryCode = countryCodes[j];
|
665 |
+
break;
|
666 |
+
}
|
667 |
+
}
|
668 |
+
}
|
669 |
+
} else if (number.charAt(0) == "+" && numeric.length) {
|
670 |
+
// invalid dial code, so empty
|
671 |
+
// Note: use getNumeric here because the number has not been formatted yet, so could contain bad chars
|
672 |
+
countryCode = "";
|
673 |
+
} else if (!number || number == "+") {
|
674 |
+
// empty, or just a plus, so default
|
675 |
+
countryCode = this.defaultCountry;
|
676 |
+
}
|
677 |
+
if (countryCode !== null) {
|
678 |
+
return this._setFlag(countryCode);
|
679 |
+
}
|
680 |
+
return false;
|
681 |
+
},
|
682 |
+
// check if the given number is a regionless NANP number (expects the number to contain an international dial code)
|
683 |
+
_isRegionlessNanp: function(number) {
|
684 |
+
var numeric = this._getNumeric(number);
|
685 |
+
if (numeric.charAt(0) == "1") {
|
686 |
+
var areaCode = numeric.substr(1, 3);
|
687 |
+
return $.inArray(areaCode, regionlessNanpNumbers) > -1;
|
688 |
+
}
|
689 |
+
return false;
|
690 |
+
},
|
691 |
+
// remove highlighting from other list items and highlight the given item
|
692 |
+
_highlightListItem: function(listItem) {
|
693 |
+
this.countryListItems.removeClass("highlight");
|
694 |
+
listItem.addClass("highlight");
|
695 |
+
},
|
696 |
+
// find the country data for the given country code
|
697 |
+
// the ignoreOnlyCountriesOption is only used during init() while parsing the onlyCountries array
|
698 |
+
_getCountryData: function(countryCode, ignoreOnlyCountriesOption, allowFail) {
|
699 |
+
var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries;
|
700 |
+
for (var i = 0; i < countryList.length; i++) {
|
701 |
+
if (countryList[i].iso2 == countryCode) {
|
702 |
+
return countryList[i];
|
703 |
+
}
|
704 |
+
}
|
705 |
+
if (allowFail) {
|
706 |
+
return null;
|
707 |
+
} else {
|
708 |
+
throw new Error("No country data for '" + countryCode + "'");
|
709 |
+
}
|
710 |
+
},
|
711 |
+
// select the given flag, update the placeholder and the active list item
|
712 |
+
// Note: called from _setInitialState, _updateFlagFromNumber, _selectListItem, setCountry
|
713 |
+
_setFlag: function(countryCode) {
|
714 |
+
var prevCountry = this.selectedCountryData && this.selectedCountryData.iso2 ? this.selectedCountryData : {};
|
715 |
+
// do this first as it will throw an error and stop if countryCode is invalid
|
716 |
+
this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {};
|
717 |
+
// update the defaultCountry - we only need the iso2 from now on, so just store that
|
718 |
+
if (this.selectedCountryData.iso2) {
|
719 |
+
this.defaultCountry = this.selectedCountryData.iso2;
|
720 |
+
}
|
721 |
+
this.selectedFlagInner.attr("class", "iti-flag " + countryCode);
|
722 |
+
// update the selected country's title attribute
|
723 |
+
var title = countryCode ? this.selectedCountryData.name + ": +" + this.selectedCountryData.dialCode : "Unknown";
|
724 |
+
this.selectedFlagInner.parent().attr("title", title);
|
725 |
+
if (this.options.separateDialCode) {
|
726 |
+
var dialCode = this.selectedCountryData.dialCode ? "+" + this.selectedCountryData.dialCode : "", parent = this.telInput.parent();
|
727 |
+
if (prevCountry.dialCode) {
|
728 |
+
parent.removeClass("iti-sdc-" + (prevCountry.dialCode.length + 1));
|
729 |
+
}
|
730 |
+
if (dialCode) {
|
731 |
+
parent.addClass("iti-sdc-" + dialCode.length);
|
732 |
+
}
|
733 |
+
this.selectedDialCode.text(dialCode);
|
734 |
+
}
|
735 |
+
// and the input's placeholder
|
736 |
+
this._updatePlaceholder();
|
737 |
+
// update the active list item
|
738 |
+
this.countryListItems.removeClass("active");
|
739 |
+
if (countryCode) {
|
740 |
+
this.countryListItems.find(".iti-flag." + countryCode).first().closest(".country").addClass("active");
|
741 |
+
}
|
742 |
+
// return if the flag has changed or not
|
743 |
+
return prevCountry.iso2 !== countryCode;
|
744 |
+
},
|
745 |
+
// update the input placeholder to an example number from the currently selected country
|
746 |
+
_updatePlaceholder: function() {
|
747 |
+
var shouldSetPlaceholder = this.options.autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && (this.options.autoPlaceholder === true || this.options.autoPlaceholder === "polite");
|
748 |
+
if (window.intlTelInputUtils && shouldSetPlaceholder && this.selectedCountryData) {
|
749 |
+
var numberType = intlTelInputUtils.numberType[this.options.placeholderNumberType], placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, numberType) : "";
|
750 |
+
placeholder = this._beforeSetNumber(placeholder);
|
751 |
+
if (typeof this.options.customPlaceholder === "function") {
|
752 |
+
placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData);
|
753 |
+
}
|
754 |
+
this.telInput.attr("placeholder", placeholder);
|
755 |
+
}
|
756 |
+
},
|
757 |
+
// called when the user selects a list item from the dropdown
|
758 |
+
_selectListItem: function(listItem) {
|
759 |
+
// update selected flag and active list item
|
760 |
+
var flagChanged = this._setFlag(listItem.attr("data-country-code"));
|
761 |
+
this._closeDropdown();
|
762 |
+
this._updateDialCode(listItem.attr("data-dial-code"), true);
|
763 |
+
// focus the input
|
764 |
+
this.telInput.focus();
|
765 |
+
// put cursor at end - this fix is required for FF and IE11 (with nationalMode=false i.e. auto inserting dial code), who try to put the cursor at the beginning the first time
|
766 |
+
if (this.isGoodBrowser) {
|
767 |
+
var len = this.telInput.val().length;
|
768 |
+
this.telInput[0].setSelectionRange(len, len);
|
769 |
+
}
|
770 |
+
if (flagChanged) {
|
771 |
+
this._triggerCountryChange();
|
772 |
+
}
|
773 |
+
},
|
774 |
+
// close the dropdown and unbind any listeners
|
775 |
+
_closeDropdown: function() {
|
776 |
+
this.countryList.addClass("hide");
|
777 |
+
// update the arrow
|
778 |
+
this.selectedFlagInner.children(".iti-arrow").removeClass("up");
|
779 |
+
// unbind key events
|
780 |
+
$(document).off(this.ns);
|
781 |
+
// unbind click-off-to-close
|
782 |
+
$("html").off(this.ns);
|
783 |
+
// unbind hover and click listeners
|
784 |
+
this.countryList.off(this.ns);
|
785 |
+
// remove menu from container
|
786 |
+
if (this.options.dropdownContainer) {
|
787 |
+
if (!this.isMobile) {
|
788 |
+
$(window).off("scroll" + this.ns);
|
789 |
+
}
|
790 |
+
this.dropdown.detach();
|
791 |
+
}
|
792 |
+
},
|
793 |
+
// check if an element is visible within it's container, else scroll until it is
|
794 |
+
_scrollTo: function(element, middle) {
|
795 |
+
var container = this.countryList, containerHeight = container.height(), containerTop = container.offset().top, containerBottom = containerTop + containerHeight, elementHeight = element.outerHeight(), elementTop = element.offset().top, elementBottom = elementTop + elementHeight, newScrollTop = elementTop - containerTop + container.scrollTop(), middleOffset = containerHeight / 2 - elementHeight / 2;
|
796 |
+
if (elementTop < containerTop) {
|
797 |
+
// scroll up
|
798 |
+
if (middle) {
|
799 |
+
newScrollTop -= middleOffset;
|
800 |
+
}
|
801 |
+
container.scrollTop(newScrollTop);
|
802 |
+
} else if (elementBottom > containerBottom) {
|
803 |
+
// scroll down
|
804 |
+
if (middle) {
|
805 |
+
newScrollTop += middleOffset;
|
806 |
+
}
|
807 |
+
var heightDifference = containerHeight - elementHeight;
|
808 |
+
container.scrollTop(newScrollTop - heightDifference);
|
809 |
+
}
|
810 |
+
},
|
811 |
+
// replace any existing dial code with the new one
|
812 |
+
// Note: called from _selectListItem and setCountry
|
813 |
+
_updateDialCode: function(newDialCode, hasSelectedListItem) {
|
814 |
+
var inputVal = this.telInput.val(), newNumber;
|
815 |
+
// save having to pass this every time
|
816 |
+
newDialCode = "+" + newDialCode;
|
817 |
+
if (inputVal.charAt(0) == "+") {
|
818 |
+
// there's a plus so we're dealing with a replacement (doesn't matter if nationalMode or not)
|
819 |
+
var prevDialCode = this._getDialCode(inputVal);
|
820 |
+
if (prevDialCode) {
|
821 |
+
// current number contains a valid dial code, so replace it
|
822 |
+
newNumber = inputVal.replace(prevDialCode, newDialCode);
|
823 |
+
} else {
|
824 |
+
// current number contains an invalid dial code, so ditch it
|
825 |
+
// (no way to determine where the invalid dial code ends and the rest of the number begins)
|
826 |
+
newNumber = newDialCode;
|
827 |
+
}
|
828 |
+
} else if (this.options.nationalMode || this.options.separateDialCode) {
|
829 |
+
// don't do anything
|
830 |
+
return;
|
831 |
+
} else {
|
832 |
+
// nationalMode is disabled
|
833 |
+
if (inputVal) {
|
834 |
+
// there is an existing value with no dial code: prefix the new dial code
|
835 |
+
newNumber = newDialCode + inputVal;
|
836 |
+
} else if (hasSelectedListItem || !this.options.autoHideDialCode) {
|
837 |
+
// no existing value and either they've just selected a list item, or autoHideDialCode is disabled: insert new dial code
|
838 |
+
newNumber = newDialCode;
|
839 |
+
} else {
|
840 |
+
return;
|
841 |
+
}
|
842 |
+
}
|
843 |
+
this.telInput.val(newNumber);
|
844 |
+
},
|
845 |
+
// try and extract a valid international dial code from a full telephone number
|
846 |
+
// Note: returns the raw string inc plus character and any whitespace/dots etc
|
847 |
+
_getDialCode: function(number) {
|
848 |
+
var dialCode = "";
|
849 |
+
// only interested in international numbers (starting with a plus)
|
850 |
+
if (number.charAt(0) == "+") {
|
851 |
+
var numericChars = "";
|
852 |
+
// iterate over chars
|
853 |
+
for (var i = 0; i < number.length; i++) {
|
854 |
+
var c = number.charAt(i);
|
855 |
+
// if char is number
|
856 |
+
if ($.isNumeric(c)) {
|
857 |
+
numericChars += c;
|
858 |
+
// if current numericChars make a valid dial code
|
859 |
+
if (this.countryCodes[numericChars]) {
|
860 |
+
// store the actual raw string (useful for matching later)
|
861 |
+
dialCode = number.substr(0, i + 1);
|
862 |
+
}
|
863 |
+
// longest dial code is 4 chars
|
864 |
+
if (numericChars.length == 4) {
|
865 |
+
break;
|
866 |
+
}
|
867 |
+
}
|
868 |
+
}
|
869 |
+
}
|
870 |
+
return dialCode;
|
871 |
+
},
|
872 |
+
// get the input val, adding the dial code if separateDialCode is enabled
|
873 |
+
_getFullNumber: function() {
|
874 |
+
var val = $.trim(this.telInput.val()), dialCode = this.selectedCountryData.dialCode, prefix, numericVal = this._getNumeric(val), // normalized means ensure starts with a 1, so we can match against the full dial code
|
875 |
+
normalizedVal = numericVal.charAt(0) == "1" ? numericVal : "1" + numericVal;
|
876 |
+
if (this.options.separateDialCode) {
|
877 |
+
prefix = "+" + dialCode;
|
878 |
+
} else if (val.charAt(0) != "+" && val.charAt(0) != "1" && dialCode && dialCode.charAt(0) == "1" && dialCode.length == 4 && dialCode != normalizedVal.substr(0, 4)) {
|
879 |
+
// if the user has entered a national NANP number, then ensure it includes the full dial code / area code
|
880 |
+
prefix = dialCode.substr(1);
|
881 |
+
} else {
|
882 |
+
prefix = "";
|
883 |
+
}
|
884 |
+
return prefix + val;
|
885 |
+
},
|
886 |
+
// remove the dial code if separateDialCode is enabled
|
887 |
+
_beforeSetNumber: function(number) {
|
888 |
+
if (this.options.separateDialCode) {
|
889 |
+
var dialCode = this._getDialCode(number);
|
890 |
+
if (dialCode) {
|
891 |
+
// US dialCode is "+1", which is what we want
|
892 |
+
// CA dialCode is "+1 123", which is wrong - should be "+1" (as it has multiple area codes)
|
893 |
+
// AS dialCode is "+1 684", which is what we want
|
894 |
+
// Solution: if the country has area codes, then revert to just the dial code
|
895 |
+
if (this.selectedCountryData.areaCodes !== null) {
|
896 |
+
dialCode = "+" + this.selectedCountryData.dialCode;
|
897 |
+
}
|
898 |
+
// a lot of numbers will have a space separating the dial code and the main number, and some NANP numbers will have a hyphen e.g. +1 684-733-1234 - in both cases we want to get rid of it
|
899 |
+
// NOTE: don't just trim all non-numerics as may want to preserve an open parenthesis etc
|
900 |
+
var start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length;
|
901 |
+
number = number.substr(start);
|
902 |
+
}
|
903 |
+
}
|
904 |
+
return this._cap(number);
|
905 |
+
},
|
906 |
+
// trigger the 'countrychange' event
|
907 |
+
_triggerCountryChange: function() {
|
908 |
+
this.telInput.trigger("countrychange", this.selectedCountryData);
|
909 |
+
},
|
910 |
+
/**************************
|
911 |
+
* SECRET PUBLIC METHODS
|
912 |
+
**************************/
|
913 |
+
// this is called when the geoip call returns
|
914 |
+
handleAutoCountry: function() {
|
915 |
+
if (this.options.initialCountry === "auto") {
|
916 |
+
// we must set this even if there is an initial val in the input: in case the initial val is invalid and they delete it - they should see their auto country
|
917 |
+
this.defaultCountry = $.fn[pluginName].autoCountry;
|
918 |
+
// if there's no initial value in the input, then update the flag
|
919 |
+
if (!this.telInput.val()) {
|
920 |
+
this.setCountry(this.defaultCountry);
|
921 |
+
}
|
922 |
+
this.autoCountryDeferred.resolve();
|
923 |
+
}
|
924 |
+
},
|
925 |
+
// this is called when the utils request completes
|
926 |
+
handleUtils: function() {
|
927 |
+
// if the request was successful
|
928 |
+
if (window.intlTelInputUtils) {
|
929 |
+
// if there's an initial value in the input, then format it
|
930 |
+
if (this.telInput.val()) {
|
931 |
+
this._updateValFromNumber(this.telInput.val());
|
932 |
+
}
|
933 |
+
this._updatePlaceholder();
|
934 |
+
}
|
935 |
+
this.utilsScriptDeferred.resolve();
|
936 |
+
},
|
937 |
+
/********************
|
938 |
+
* PUBLIC METHODS
|
939 |
+
********************/
|
940 |
+
// remove plugin
|
941 |
+
destroy: function() {
|
942 |
+
if (this.allowDropdown) {
|
943 |
+
// make sure the dropdown is closed (and unbind listeners)
|
944 |
+
this._closeDropdown();
|
945 |
+
// click event to open dropdown
|
946 |
+
this.selectedFlagInner.parent().off(this.ns);
|
947 |
+
// label click hack
|
948 |
+
this.telInput.closest("label").off(this.ns);
|
949 |
+
}
|
950 |
+
// unbind submit event handler on form
|
951 |
+
if (this.options.autoHideDialCode) {
|
952 |
+
var form = this.telInput.prop("form");
|
953 |
+
if (form) {
|
954 |
+
$(form).off(this.ns);
|
955 |
+
}
|
956 |
+
}
|
957 |
+
// unbind all events: key events, and focus/blur events if autoHideDialCode=true
|
958 |
+
this.telInput.off(this.ns);
|
959 |
+
// remove markup (but leave the original input)
|
960 |
+
var container = this.telInput.parent();
|
961 |
+
container.before(this.telInput).remove();
|
962 |
+
},
|
963 |
+
// get the extension from the current number
|
964 |
+
getExtension: function() {
|
965 |
+
if (window.intlTelInputUtils) {
|
966 |
+
return intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2);
|
967 |
+
}
|
968 |
+
return "";
|
969 |
+
},
|
970 |
+
// format the number to the given format
|
971 |
+
getNumber: function(format) {
|
972 |
+
if (window.intlTelInputUtils) {
|
973 |
+
return intlTelInputUtils.formatNumber(this._getFullNumber(), this.selectedCountryData.iso2, format);
|
974 |
+
}
|
975 |
+
return "";
|
976 |
+
},
|
977 |
+
// get the type of the entered number e.g. landline/mobile
|
978 |
+
getNumberType: function() {
|
979 |
+
if (window.intlTelInputUtils) {
|
980 |
+
return intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2);
|
981 |
+
}
|
982 |
+
return -99;
|
983 |
+
},
|
984 |
+
// get the country data for the currently selected flag
|
985 |
+
getSelectedCountryData: function() {
|
986 |
+
// if this is undefined, the plugin will return it's instance instead, so in that case an empty object makes more sense
|
987 |
+
return this.selectedCountryData || {};
|
988 |
+
},
|
989 |
+
// get the validation error
|
990 |
+
getValidationError: function() {
|
991 |
+
if (window.intlTelInputUtils) {
|
992 |
+
return intlTelInputUtils.getValidationError(this._getFullNumber(), this.selectedCountryData.iso2);
|
993 |
+
}
|
994 |
+
return -99;
|
995 |
+
},
|
996 |
+
// validate the input val - assumes the global function isValidNumber (from utilsScript)
|
997 |
+
isValidNumber: function() {
|
998 |
+
var val = $.trim(this._getFullNumber()), countryCode = this.options.nationalMode ? this.selectedCountryData.iso2 : "";
|
999 |
+
return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, countryCode) : null;
|
1000 |
+
},
|
1001 |
+
// update the selected flag, and update the input val accordingly
|
1002 |
+
setCountry: function(countryCode) {
|
1003 |
+
countryCode = countryCode.toLowerCase();
|
1004 |
+
// check if already selected
|
1005 |
+
if (!this.selectedFlagInner.hasClass(countryCode)) {
|
1006 |
+
this._setFlag(countryCode);
|
1007 |
+
this._updateDialCode(this.selectedCountryData.dialCode, false);
|
1008 |
+
this._triggerCountryChange();
|
1009 |
+
}
|
1010 |
+
},
|
1011 |
+
// set the input value and update the flag
|
1012 |
+
setNumber: function(number) {
|
1013 |
+
// we must update the flag first, which updates this.selectedCountryData, which is used for formatting the number before displaying it
|
1014 |
+
var flagChanged = this._updateFlagFromNumber(number);
|
1015 |
+
this._updateValFromNumber(number);
|
1016 |
+
if (flagChanged) {
|
1017 |
+
this._triggerCountryChange();
|
1018 |
+
}
|
1019 |
+
}
|
1020 |
+
};
|
1021 |
+
// using https://github.com/jquery-boilerplate/jquery-boilerplate/wiki/Extending-jQuery-Boilerplate
|
1022 |
+
// (adapted to allow public functions)
|
1023 |
+
$.fn[pluginName] = function(options) {
|
1024 |
+
var args = arguments;
|
1025 |
+
// Is the first parameter an object (options), or was omitted,
|
1026 |
+
// instantiate a new instance of the plugin.
|
1027 |
+
if (options === undefined || typeof options === "object") {
|
1028 |
+
// collect all of the deferred objects for all instances created with this selector
|
1029 |
+
var deferreds = [];
|
1030 |
+
this.each(function() {
|
1031 |
+
if (!$.data(this, "plugin_" + pluginName)) {
|
1032 |
+
var instance = new Plugin(this, options);
|
1033 |
+
var instanceDeferreds = instance._init();
|
1034 |
+
// we now have 2 deffereds: 1 for auto country, 1 for utils script
|
1035 |
+
deferreds.push(instanceDeferreds[0]);
|
1036 |
+
deferreds.push(instanceDeferreds[1]);
|
1037 |
+
$.data(this, "plugin_" + pluginName, instance);
|
1038 |
+
}
|
1039 |
+
});
|
1040 |
+
// return the promise from the "master" deferred object that tracks all the others
|
1041 |
+
return $.when.apply(null, deferreds);
|
1042 |
+
} else if (typeof options === "string" && options[0] !== "_") {
|
1043 |
+
// If the first parameter is a string and it doesn't start
|
1044 |
+
// with an underscore or "contains" the `init`-function,
|
1045 |
+
// treat this as a call to a public method.
|
1046 |
+
// Cache the method call to make it possible to return a value
|
1047 |
+
var returns;
|
1048 |
+
this.each(function() {
|
1049 |
+
var instance = $.data(this, "plugin_" + pluginName);
|
1050 |
+
// Tests that there's already a plugin-instance
|
1051 |
+
// and checks that the requested public method exists
|
1052 |
+
if (instance instanceof Plugin && typeof instance[options] === "function") {
|
1053 |
+
// Call the method of our plugin instance,
|
1054 |
+
// and pass it the supplied arguments.
|
1055 |
+
returns = instance[options].apply(instance, Array.prototype.slice.call(args, 1));
|
1056 |
+
}
|
1057 |
+
// Allow instances to be destroyed via the 'destroy' method
|
1058 |
+
if (options === "destroy") {
|
1059 |
+
$.data(this, "plugin_" + pluginName, null);
|
1060 |
+
}
|
1061 |
+
});
|
1062 |
+
// If the earlier cached method gives a value back return the value,
|
1063 |
+
// otherwise return this to preserve chainability.
|
1064 |
+
return returns !== undefined ? returns : this;
|
1065 |
+
}
|
1066 |
+
};
|
1067 |
+
/********************
|
1068 |
+
* STATIC METHODS
|
1069 |
+
********************/
|
1070 |
+
// get the country data object
|
1071 |
+
$.fn[pluginName].getCountryData = function() {
|
1072 |
+
return allCountries;
|
1073 |
+
};
|
1074 |
+
// load the utils script
|
1075 |
+
$.fn[pluginName].loadUtils = function(path, utilsScriptDeferred) {
|
1076 |
+
if (!$.fn[pluginName].loadedUtilsScript) {
|
1077 |
+
// don't do this twice! (dont just check if window.intlTelInputUtils exists as if init plugin multiple times in quick succession, it may not have finished loading yet)
|
1078 |
+
$.fn[pluginName].loadedUtilsScript = true;
|
1079 |
+
// dont use $.getScript as it prevents caching
|
1080 |
+
$.ajax({
|
1081 |
+
type: "GET",
|
1082 |
+
url: path,
|
1083 |
+
complete: function() {
|
1084 |
+
// tell all instances that the utils request is complete
|
1085 |
+
$(".intl-tel-input input").intlTelInput("handleUtils");
|
1086 |
+
},
|
1087 |
+
dataType: "script",
|
1088 |
+
cache: true
|
1089 |
+
});
|
1090 |
+
} else if (utilsScriptDeferred) {
|
1091 |
+
utilsScriptDeferred.resolve();
|
1092 |
+
}
|
1093 |
+
};
|
1094 |
+
// version
|
1095 |
+
$.fn[pluginName].version = "11.0.0";
|
1096 |
+
// default options
|
1097 |
+
$.fn[pluginName].defaults = defaults;
|
1098 |
+
// Array of country objects for the flag dropdown.
|
1099 |
+
// Here is the criteria for the plugin to support a given country/territory
|
1100 |
+
// - It has an iso2 code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
1101 |
+
// - It has a country calling code: https://en.wikipedia.org/wiki/List_of_country_calling_codes
|
1102 |
+
// - It has a flag in the region-flags project: https://github.com/behdad/region-flags/tree/gh-pages/png
|
1103 |
+
// - It is supported by libphonenumber (it must be listed here): https://github.com/googlei18n/libphonenumber/blob/master/resources/ShortNumberMetadata.xml
|
1104 |
+
// Each country array has the following information:
|
1105 |
+
// [
|
1106 |
+
// Country name,
|
1107 |
+
// iso2 code,
|
1108 |
+
// International dial code,
|
1109 |
+
// Order (if >1 country with same dial code),
|
1110 |
+
// Area codes
|
1111 |
+
// ]
|
1112 |
+
var allCountries = [ [ "Afghanistan", "af", "93" ], [ "Albania", "al", "355" ], [ "Algeria", "dz", "213" ], [ "American Samoa", "as", "1684" ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1264" ], [ "Antigua and Barbuda", "ag", "1268" ], [ "Argentina", "ar", "54" ], [ "Armenia", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Australia", "au", "61", 0 ], [ "Austria", "at", "43" ], [ "Azerbaijan", "az", "994" ], [ "Bahamas", "bs", "1242" ], [ "Bahrain", "bh", "973" ], [ "Bangladesh", "bd", "880" ], [ "Barbados", "bb", "1246" ], [ "Belarus", "by", "375" ], [ "Belgium", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin", "bj", "229" ], [ "Bermuda", "bm", "1441" ], [ "Bhutan", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1284" ], [ "Brunei", "bn", "673" ], [ "Bulgaria", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi", "bi", "257" ], [ "Cambodia", "kh", "855" ], [ "Cameroon", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1 ], [ "Cayman Islands", "ky", "1345" ], [ "Central African Republic", "cf", "236" ], [ "Chad", "td", "235" ], [ "Chile", "cl", "56" ], [ "China", "cn", "86" ], [ "Christmas Island", "cx", "61", 2 ], [ "Cocos (Keeling) Islands", "cc", "61", 1 ], [ "Colombia", "co", "57" ], [ "Comoros", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Cote d'Ivoire", "ci", "225" ], [ "Croatia", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curacao", "cw", "599", 0 ], [ "Cyprus", "cy", "357" ], [ "Czech Republic", "cz", "420" ], [ "Denmark", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1767" ], [ "Dominican Republic", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia", "ee", "372" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands", "fk", "500" ], [ "Faroe Islands", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana", "gf", "594" ], [ "French Polynesia", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia", "ge", "995" ], [ "Germany", "de", "49" ], [ "Ghana", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece", "gr", "30" ], [ "Greenland", "gl", "299" ], [ "Grenada", "gd", "1473" ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1671" ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1 ], [ "Guinea", "gn", "224" ], [ "Guinea-Bissau", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong", "hk", "852" ], [ "Hungary", "hu", "36" ], [ "Iceland", "is", "354" ], [ "India", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran", "ir", "98" ], [ "Iraq", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2 ], [ "Israel", "il", "972" ], [ "Italy", "it", "39", 0 ], [ "Jamaica", "jm", "1876" ], [ "Japan", "jp", "81" ], [ "Jersey", "je", "44", 3 ], [ "Jordan", "jo", "962" ], [ "Kazakhstan", "kz", "7", 1 ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait", "kw", "965" ], [ "Kyrgyzstan", "kg", "996" ], [ "Laos", "la", "856" ], [ "Latvia", "lv", "371" ], [ "Lebanon", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau", "mo", "853" ], [ "Macedonia", "mk", "389" ], [ "Madagascar", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania", "mr", "222" ], [ "Mauritius", "mu", "230" ], [ "Mayotte", "yt", "262", 1 ], [ "Mexico", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia", "mn", "976" ], [ "Montenegro", "me", "382" ], [ "Montserrat", "ms", "1664" ], [ "Morocco", "ma", "212", 0 ], [ "Mozambique", "mz", "258" ], [ "Myanmar (Burma)", "mm", "95" ], [ "Namibia", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal", "np", "977" ], [ "Netherlands (Nederland)", "nl", "31" ], [ "New Caledonia", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea", "kp", "850" ], [ "Northern Mariana Islands", "mp", "1670" ], [ "Norway (Norge)", "no", "47", 0 ], [ "Oman", "om", "968" ], [ "Pakistan", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine", "ps", "970" ], [ "Panama", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar", "qa", "974" ], [ "Reunion", "re", "262", 0 ], [ "Romania", "ro", "40" ], [ "Russia", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Saint Barthelemy", "bl", "590", 1 ], [ "Saint Helena", "sh", "290" ], [ "Saint Kitts and Nevis", "kn", "1869" ], [ "Saint Lucia", "lc", "1758" ], [ "Saint Martin", "mf", "590", 2 ], [ "Saint Pierre and Miquelon", "pm", "508" ], [ "Saint Vincent and the Grenadines", "vc", "1784" ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "Sao Tome and Principe", "st", "239" ], [ "Saudi Arabia", "sa", "966" ], [ "Senegal", "sn", "221" ], [ "Serbia", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1721" ], [ "Slovakia", "sk", "421" ], [ "Slovenia", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea", "kr", "82" ], [ "South Sudan", "ss", "211" ], [ "Spain", "es", "34" ], [ "Sri Lanka", "lk", "94" ], [ "Sudan", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard and Jan Mayen", "sj", "47", 1 ], [ "Swaziland", "sz", "268" ], [ "Sweden (Sverige)", "se", "46" ], [ "Switzerland", "ch", "41" ], [ "Syria", "sy", "963" ], [ "Taiwan", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad and Tobago", "tt", "1868" ], [ "Tunisia", "tn", "216" ], [ "Turkey", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks and Caicos Islands", "tc", "1649" ], [ "Tuvalu", "tv", "688" ], [ "U.S. Virgin Islands", "vi", "1340" ], [ "Uganda", "ug", "256" ], [ "Ukraine", "ua", "380" ], [ "United Arab Emirates", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "Uzbekistan", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City", "va", "39", 1 ], [ "Venezuela", "ve", "58" ], [ "Vietnam", "vn", "84" ], [ "Wallis and Futuna", "wf", "681" ], [ "Western Sahara", "eh", "212", 1 ], [ "Yemen", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Aland Islands", "ax", "358", 1 ] ];
|
1113 |
+
// loop over all of the countries above
|
1114 |
+
for (var i = 0; i < allCountries.length; i++) {
|
1115 |
+
var c = allCountries[i];
|
1116 |
+
allCountries[i] = {
|
1117 |
+
name: c[0],
|
1118 |
+
iso2: c[1],
|
1119 |
+
dialCode: c[2],
|
1120 |
+
priority: c[3] || 0,
|
1121 |
+
areaCodes: c[4] || null
|
1122 |
+
};
|
1123 |
+
}
|
1124 |
+
});
|
js/main_div_front_end.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
F=2;
|
2 |
var chCode1 = e.which || e.keyCode;
|
3 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
4 |
return false;
|
5 |
if(document.getElementById(num+'_total_element'+form_id)){
|
6 |
var chCode1 = e.which || e.keyCode;
|
7 |
if ( jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39))
|
8 |
return true;
|
9 |
return false;
|
10 |
var chCode1 = e.which || e.keyCode;
|
11 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
12 |
return false;
|
13 |
return false;
|
14 |
var chCode1 = e.which || e.keyCode;
|
15 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
16 |
return false;
|
17 |
return false;
|
18 |
var chCode1 = e.which || e.keyCode;
|
19 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
20 |
return false;
|
21 |
return false;
|
22 |
var chCode1 = e.which || e.keyCode;
|
23 |
if (jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39)) {
|
24 |
return true;
|
25 |
}
|
26 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) {
|
27 |
return false;
|
28 |
}
|
29 |
return false;
|
30 |
return false;
|
31 |
return false;
|
32 |
var chCode1 = e.which || e.keyCode;
|
33 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
34 |
return false;
|
35 |
return false;
|
36 |
return false;
|
37 |
return false;
|
38 |
var chCode1 = e.which || e.keyCode;
|
39 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
40 |
return false;
|
41 |
return false;
|
42 |
return false;
|
43 |
return false;
|
44 |
var chCode1 = e.which || e.keyCode;
|
45 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
46 |
return false;
|
47 |
return false;
|
48 |
while (node.firstChild)
|
49 |
node.removeChild(node.firstChild);
|
50 |
|
51 |
}
|
52 |
|
53 |
}
|
54 |
jQuery('.wdform-element-section').each(function() {
|
55 |
var div_parent = document.createElement('div');
|
56 |
div_parent.setAttribute("class", "page_percentage_deactive");
|
57 |
var div = document.createElement('div');
|
58 |
div.setAttribute("id", "div_percentage");
|
59 |
div.setAttribute("class", "page_percentage_active");
|
60 |
div.setAttribute("align", "right");
|
61 |
var div_arrow = document.createElement('div');
|
62 |
div_arrow.setAttribute("class", "wdform_percentage_arrow");
|
63 |
b.setAttribute("class", "wdform_percentage_text");
|
64 |
var curtop = 0;
|
65 |
if (obj.offsetParent) {
|
66 |
do {
|
67 |
curtop += obj.offsetTop;
|
68 |
} while (obj = obj.offsetParent);
|
69 |
return [curtop];
|
70 |
}
|
71 |
if( node.childNodes[ttt] && node.childNodes[ttt].nodeType == '3' && !/\S/.test( node.childNodes[ttt].nodeValue ))
|
|
|
72 |
var chCode1 = e.which || e.keyCode;
|
73 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
74 |
return false;
|
75 |
if(document.getElementById(num+'_total_element'+form_id)){
|
76 |
var chCode1 = e.which || e.keyCode;
|
77 |
if ( jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39))
|
78 |
return true;
|
79 |
return false;
|
80 |
var chCode1 = e.which || e.keyCode;
|
81 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
82 |
return false;
|
83 |
return false;
|
84 |
var chCode1 = e.which || e.keyCode;
|
85 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
86 |
return false;
|
87 |
return false;
|
88 |
var chCode1 = e.which || e.keyCode;
|
89 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
90 |
return false;
|
91 |
return false;
|
92 |
var chCode1 = e.which || e.keyCode;
|
93 |
if (jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39)) {
|
94 |
return true;
|
95 |
}
|
96 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) {
|
97 |
return false;
|
98 |
}
|
99 |
return false;
|
100 |
return false;
|
101 |
return false;
|
102 |
var chCode1 = e.which || e.keyCode;
|
103 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
104 |
return false;
|
105 |
return false;
|
106 |
return false;
|
107 |
return false;
|
108 |
var chCode1 = e.which || e.keyCode;
|
109 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
110 |
return false;
|
111 |
return false;
|
112 |
return false;
|
113 |
return false;
|
114 |
var chCode1 = e.which || e.keyCode;
|
115 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
116 |
return false;
|
117 |
return false;
|
118 |
while (node.firstChild)
|
119 |
node.removeChild(node.firstChild);
|
120 |
|
121 |
}
|
122 |
|
123 |
}
|
124 |
jQuery('.wdform-element-section').each(function() {
|
125 |
var div_parent = document.createElement('div');
|
126 |
div_parent.setAttribute("class", "page_percentage_deactive");
|
127 |
var div = document.createElement('div');
|
128 |
div.setAttribute("id", "div_percentage");
|
129 |
div.setAttribute("class", "page_percentage_active");
|
130 |
div.setAttribute("align", "right");
|
131 |
var div_arrow = document.createElement('div');
|
132 |
div_arrow.setAttribute("class", "wdform_percentage_arrow");
|
133 |
b.setAttribute("class", "wdform_percentage_text");
|
134 |
var curtop = 0;
|
135 |
if (obj.offsetParent) {
|
136 |
do {
|
137 |
curtop += obj.offsetTop;
|
138 |
} while (obj = obj.offsetParent);
|
139 |
return [curtop];
|
140 |
}
|
141 |
if( node.childNodes[ttt] && node.childNodes[ttt].nodeType == '3' && !/\S/.test( node.childNodes[ttt].nodeValue ))
|
|
|
1 |
var chCode1 = e.which || e.keyCode;
|
2 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
3 |
return false;
|
4 |
if(document.getElementById(num+'_total_element'+form_id)){
|
5 |
var chCode1 = e.which || e.keyCode;
|
6 |
if ( jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39))
|
7 |
return true;
|
8 |
return false;
|
9 |
var chCode1 = e.which || e.keyCode;
|
10 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
11 |
return false;
|
12 |
return false;
|
13 |
var chCode1 = e.which || e.keyCode;
|
14 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
15 |
return false;
|
16 |
return false;
|
17 |
var chCode1 = e.which || e.keyCode;
|
18 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
19 |
return false;
|
20 |
return false;
|
21 |
var chCode1 = e.which || e.keyCode;
|
22 |
if (jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39)) {
|
23 |
return true;
|
24 |
}
|
25 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) {
|
26 |
return false;
|
27 |
}
|
28 |
return false;
|
29 |
return false;
|
30 |
return false;
|
31 |
var chCode1 = e.which || e.keyCode;
|
32 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
33 |
return false;
|
34 |
return false;
|
35 |
return false;
|
36 |
return false;
|
37 |
var chCode1 = e.which || e.keyCode;
|
38 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
39 |
return false;
|
40 |
return false;
|
41 |
return false;
|
42 |
return false;
|
43 |
var chCode1 = e.which || e.keyCode;
|
44 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
45 |
return false;
|
46 |
return false;
|
47 |
while (node.firstChild)
|
48 |
node.removeChild(node.firstChild);
|
49 |
|
50 |
}
|
51 |
|
52 |
}
|
53 |
jQuery('.wdform-element-section').each(function() {
|
54 |
var div_parent = document.createElement('div');
|
55 |
div_parent.setAttribute("class", "page_percentage_deactive");
|
56 |
var div = document.createElement('div');
|
57 |
div.setAttribute("id", "div_percentage");
|
58 |
div.setAttribute("class", "page_percentage_active");
|
59 |
div.setAttribute("align", "right");
|
60 |
var div_arrow = document.createElement('div');
|
61 |
div_arrow.setAttribute("class", "wdform_percentage_arrow");
|
62 |
b.setAttribute("class", "wdform_percentage_text");
|
63 |
var curtop = 0;
|
64 |
if (obj.offsetParent) {
|
65 |
do {
|
66 |
curtop += obj.offsetTop;
|
67 |
} while (obj = obj.offsetParent);
|
68 |
return [curtop];
|
69 |
}
|
70 |
if( node.childNodes[ttt] && node.childNodes[ttt].nodeType == '3' && !/\S/.test( node.childNodes[ttt].nodeValue ))
|
71 |
+
F=2;
|
72 |
var chCode1 = e.which || e.keyCode;
|
73 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
74 |
return false;
|
75 |
if(document.getElementById(num+'_total_element'+form_id)){
|
76 |
var chCode1 = e.which || e.keyCode;
|
77 |
if ( jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39))
|
78 |
return true;
|
79 |
return false;
|
80 |
var chCode1 = e.which || e.keyCode;
|
81 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
82 |
return false;
|
83 |
return false;
|
84 |
var chCode1 = e.which || e.keyCode;
|
85 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
86 |
return false;
|
87 |
return false;
|
88 |
var chCode1 = e.which || e.keyCode;
|
89 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
90 |
return false;
|
91 |
return false;
|
92 |
var chCode1 = e.which || e.keyCode;
|
93 |
if (jQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39)) {
|
94 |
return true;
|
95 |
}
|
96 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57)) {
|
97 |
return false;
|
98 |
}
|
99 |
return false;
|
100 |
return false;
|
101 |
return false;
|
102 |
var chCode1 = e.which || e.keyCode;
|
103 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
104 |
return false;
|
105 |
return false;
|
106 |
return false;
|
107 |
return false;
|
108 |
var chCode1 = e.which || e.keyCode;
|
109 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
110 |
return false;
|
111 |
return false;
|
112 |
return false;
|
113 |
return false;
|
114 |
var chCode1 = e.which || e.keyCode;
|
115 |
if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
|
116 |
return false;
|
117 |
return false;
|
118 |
while (node.firstChild)
|
119 |
node.removeChild(node.firstChild);
|
120 |
|
121 |
}
|
122 |
|
123 |
}
|
124 |
jQuery('.wdform-element-section').each(function() {
|
125 |
var div_parent = document.createElement('div');
|
126 |
div_parent.setAttribute("class", "page_percentage_deactive");
|
127 |
var div = document.createElement('div');
|
128 |
div.setAttribute("id", "div_percentage");
|
129 |
div.setAttribute("class", "page_percentage_active");
|
130 |
div.setAttribute("align", "right");
|
131 |
var div_arrow = document.createElement('div');
|
132 |
div_arrow.setAttribute("class", "wdform_percentage_arrow");
|
133 |
b.setAttribute("class", "wdform_percentage_text");
|
134 |
var curtop = 0;
|
135 |
if (obj.offsetParent) {
|
136 |
do {
|
137 |
curtop += obj.offsetTop;
|
138 |
} while (obj = obj.offsetParent);
|
139 |
return [curtop];
|
140 |
}
|
141 |
if( node.childNodes[ttt] && node.childNodes[ttt].nodeType == '3' && !/\S/.test( node.childNodes[ttt].nodeValue ))
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-form.html
|
|
4 |
Tags: captcha, contact, contact form, contact forms, custom form, email, feedback, form, form builder, form manager, forms, survey
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 4.7
|
7 |
-
Stable tag: 1.10.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -315,11 +315,15 @@ Email field should be used since it verifies that an entry format fulfills examp
|
|
315 |
|
316 |
== Changelog ==
|
317 |
|
|
|
|
|
|
|
|
|
318 |
= 1.10.7 =
|
319 |
-
* Changed: Improved captcha security
|
320 |
-
* Fixed: Bug on matrix field
|
321 |
-
* Fixed: Bug on conditional fields (for date field)
|
322 |
-
* Added: Notification about old forms
|
323 |
|
324 |
= 1.10.6 =
|
325 |
* Fixed: Bug on spinner field
|
4 |
Tags: captcha, contact, contact form, contact forms, custom form, email, feedback, form, form builder, form manager, forms, survey
|
5 |
Requires at least: 3.4
|
6 |
Tested up to: 4.7
|
7 |
+
Stable tag: 1.10.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
315 |
|
316 |
== Changelog ==
|
317 |
|
318 |
+
= 1.10.8 =
|
319 |
+
* Added: New field type: Phone with flag
|
320 |
+
* Fixed: Bug on captcha reset
|
321 |
+
|
322 |
= 1.10.7 =
|
323 |
+
* Changed: Improved captcha security
|
324 |
+
* Fixed: Bug on matrix field
|
325 |
+
* Fixed: Bug on conditional fields (for date field)
|
326 |
+
* Added: Notification about old forms
|
327 |
|
328 |
= 1.10.6 =
|
329 |
* Fixed: Bug on spinner field
|