PageSourceSearch

https://tmamaquinas.com.br/wp-content/plugins/telephone-field-for-…/lib/js/elementor_tel.js?ver=7.0.6

js tmamaquinas.com.br collected 2026-10-05 18:26:36 UTC 5,917 bytes, 171 lines download raw bytes

1( function( $ ) {
2	"use strict";
3	jQuery(document).ready(function($) {
4		setTimeout(function(){ 
5			$(".elementor").not(".elementor-location-popup").each(function(e){
6				$( "input.elementor-field-telephone", $(this) ).each(function( index ) {
7					elementor_field_telephone($(this));
8				});
9			}) 
10		}, 200);
11        jQuery( document ).on( 'elementor/popup/show', () => {
12            $( "input.elementor-field-telephone" ).each(function( index ) {
13                    elementor_field_telephone($(this));
14            });
15        } );
16		$("input").on("done_load_repeater",function(e){
17			$( "input.elementor-field-telephone" ).each(function( index ) {
18					elementor_field_telephone($(this));
19			});
20		})
21		function elementor_field_telephone(field){
22			var onlyCountries_data = field.data("onlyct");
23			var exclude = field.data("excludecountries");
24			var preferredCountries_data = field.data("pre");
25			var geoIpLookup_data = field.data("auto");
26			var countrySearch = field.data("telephone_search");
27			var initialCountry_data = field.data("defcountry");
28			var input = "form_fields["+field.data("name")+"]";
29			//field.attr('name',"form_fields[]");
30			if(countrySearch == "yes"){
31				countrySearch = true;
32			}else{
33				countrySearch = false;
34			}
35			var data = [];
36			if (onlyCountries_data == "") { 
37				onlyCountries_data = [];
38			}else{
39				onlyCountries_data = onlyCountries_data.split('|');
40			}
41			if (exclude == "") { 
42				exclude = [];
43			}else{
44				exclude = exclude.split('|');
45			}
46			if (preferredCountries_data == "") { 
47				preferredCountries_data = [ "us", "gb" ];
48			}else{
49				preferredCountries_data = preferredCountries_data.split('|');
50			}
51			if (initialCountry_data == "") { 
52				initialCountry_data = "auto";
53			}
54			if( field.data("auto") == "yes" ){
55				initialCountry_data = "auto";
56				var iti = field.intlTelInput({
57					nationalMode: true,
58					countrySearch: countrySearch,
59					onlyCountries: onlyCountries_data,
60					excludeCountries: exclude,
61					initialCountry: initialCountry_data,
62					preferredCountries: preferredCountries_data,
63					utilsScript: elementor_tel.utilsScript,
64					separateDialCode: true,
65					hiddenInput: () => ({ phone: input}),
66					geoIpLookup: function(success, failure) {
67						$.get("https://ipinfo.io", function() {}, "jsonp").always(function(resp) {
68							var countryCode = (resp && resp.country) ? resp.country : "";
69							success(countryCode);
70						});
71					},
72				});	
73			}else{
74				var iti = field.intlTelInput({
75					countrySearch: countrySearch,
76					onlyCountries: onlyCountries_data,
77					excludeCountries: exclude,
78					initialCountry: initialCountry_data,
79					preferredCountries: preferredCountries_data,
80					utilsScript: elementor_tel.utilsScript,
81					separateDialCode: true,
82					hiddenInput: () => ({ phone: input})
83				});
84			}
85		}
86		// phon us
87		$("body").on('keypress','.elementor-field-telephone-us', function(e) {
88			var key = e.charCode || e.keyCode || 0;
89			var phone = $(this);
90			if (phone.val().length === 0) {
91			phone.val(phone.val() + '(');
92			}
93			// Auto-format- do not expose the mask as the user begins to type
94			if (key !== 8 && key !== 9) {
95			if (phone.val().length === 4) {
96				phone.val(phone.val() + ')');
97			}
98			if (phone.val().length === 5) {
99				phone.val(phone.val() + ' ');
100			}
101			if (phone.val().length === 9) {
102				phone.val(phone.val() + '-');
103			}
104			if (phone.val().length >= 14) {
105				phone.val(phone.val().slice(0, 13));
106			}
107			}
108			// Allow numeric (and tab, backspace, delete) keys only
109			return (key == 8 ||
110			key == 9 ||
111			key == 46 ||
112			(key >= 48 && key <= 57) ||
113			(key >= 96 && key <= 105));
114		})
115		.on('focus', function() {
116			var phone = $(this);
117			if (phone.val().length === 0) {
118			phone.val('(');
119			} else {
120			var val = phone.val();
121			phone.val('').val(val); // Ensure cursor remains at the end
122			}
123		})
124		.on('blur', function() {
125			var $phone = $(this);
126			if ($phone.val() === '(') {
127			$phone.val('');
128			}
129		});
130		$("body").on("change",".elementor-field-telephone",function(){
131			var content = $.trim($(this).val());
132			var check_field = $(this).closest('.elementor-field-type-telephone').find('.phone_check');
133			var number = $(this).intlTelInput("getNumber");
134			$(this).next().attr("value",number);
135			$(this).next().val(number);
136			if( $(this).data("validation") == "yes" && content.length > 0 ) {
137				var number = $(this).intlTelInput("getNumber");
138				if ($(this).intlTelInput("isValidNumber")) { 
139					check_field.attr("value","yes");
140					check_field.val("yes");
141					$(this).addClass('wpcf7-not-valid-blue').removeClass('wpcf7-not-valid-red').removeClass('wpcf7-not-valid');	
142				}else{
143					check_field.attr("value","no");
144					check_field.val("no");
145					$(this).addClass('wpcf7-not-valid-red').removeClass('wpcf7-not-valid-blue');
146				}
147			}
148		})
149		$("body").on("keyup",".elementor-field-telephone",function(){
150			var check_field = $(this).closest('.elementor-field-type-telephone').find('.phone_check');
151			var content = $.trim($(this).val());
152			if( $(this).data("validation") == "yes"  ) {
153				if ($(this).intlTelInput("isValidNumber")) { 
154					check_field.attr("value","yes");
155					check_field.val("yes");
156					$(this).addClass('wpcf7-not-valid-blue').removeClass('wpcf7-not-valid-red').removeClass('wpcf7-not-valid');	
157				}else{
158					check_field.attr("value","no");
159					check_field.val("no");
160					$(this).addClass('wpcf7-not-valid-red').removeClass('wpcf7-not-valid-blue');
161				}
162			}
163		})
164		$("body").on("focus",".elementor-field-telephone",function(){
165			$(this).removeClass('wpcf7-not-valid-blue').removeClass('wpcf7-not-valid-red');
166		})
167		document.addEventListener("countrychange", function() {
168			$("input.elementor-field-telephone").change();
169		});
170	})
171} )( jQuery );

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.