PageSourceSearch

https://spainu.app/wp-content/plugins/smart-phone-field-for-gravity-forms/frontend/js/spf_main.js?ver=2.1.6

js spainu.app collected 2026-10-08 01:29:45 UTC 6,101 bytes, 169 lines download raw bytes

1"use strict";
2
3var $j = jQuery.noConflict();
4
5$j(document).bind("gform_post_render", function (event, form_id) {
6    var spfMainData = window["spfMainData_" + form_id];
7
8    if (!spfMainData) {
9        return;
10    }
11
12    jQuery('.pcafe_sp_field').each( function(i, e) {
13        var _this       = jQuery(this).find('.ginput_container_phone'),
14            phoneData   = _this.data(),
15            form_id     = phoneData.formid,
16            field_id    = phoneData.fieldid,
17            input_id    = '#input_' + form_id + '_' + field_id,
18            field_input = 'input_' + field_id,
19            flagOption  = phoneData.flag,
20            options     = {
21                utilsScript: spfMainData.utilsScript,
22                countrySearch: false,
23                formatAsYouType: false,
24                formatOnDisplay: false,
25                fixDropdownWidth: true,
26                initialCountry: 'us',
27                useFullscreenPopup: false
28            };
29
30        if ( phoneData.de_country !== 0 && phoneData.auto_flag === 0 ) {
31            options.initialCountry = phoneData.de_country;
32        }
33
34        if (flagOption == "flagcode") {
35            options.hiddenInput = function(telInputName) {
36                return {
37                    phone: field_input
38                };
39            };
40            options.autoHideDialCode = false;
41            options.nationalMode = false;
42        } else if (flagOption == "flagdial") {
43            options.showSelectedDialCode = true;
44            options.autoHideDialCode = true;
45            options.nationalMode = false;
46        } else {
47            options.nationalMode = true;
48        }
49
50        if( phoneData.pre_country && phoneData.pre_country != "none" ) {
51            options.preferredCountries = phoneData.pre_country.split(',');
52        }
53
54        if ( phoneData.auto_flag ) {
55            options.initialCountry = "auto";
56            options.geoIpLookup = function (success, failure) {
57                $j.get("https://ipinfo.io", function () {}, "jsonp").always(
58                    function (resp) {
59                        var countryCode =
60                            resp && resp.country ? resp.country : "";
61                        success(countryCode);
62                    }
63                );
64            };
65        }
66
67        options = gform.applyFilters( 'gform_spf_options_pre_init', options, form_id, field_id);
68
69        $j(input_id).intlTelInput(options);    
70    });
71
72    /**
73     * Phone Number Validation
74    */
75
76    jQuery('.pcafe_sp_field').each( function(i, e) {
77        var _this       = jQuery(this).find('.ginput_container_phone'),
78            phoneData   = _this.data(),
79            index = phoneData.formid + '_' + phoneData.fieldid,
80            seInputID = "spf_" + index,
81            setCountryCode = "spf_c_" + index,
82            inputId     = '#input_' + phoneData.formid + '_' + phoneData.fieldid,
83            teleInput   = jQuery(inputId);
84
85        teleInput.keypress(function (e) {   
86            var charCode = (e.which) ? e.which : event.keyCode;
87            if (String.fromCharCode(charCode).match(/[^0-9+]/g))    
88                return false;                        
89        }); 
90
91        teleInput.on("change", function () {
92            var rawNumber = teleInput.intlTelInput("getNumber");
93            var country = teleInput.intlTelInput("getSelectedCountryData");
94            if (phoneData.flag != "flagdial") {
95                sessionStorage.setItem(seInputID, rawNumber);
96                teleInput.closest("div").find("input:hidden").val(rawNumber);
97            }
98            sessionStorage.setItem(setCountryCode, country.iso2);
99        });
100
101        if (phoneData.flag == "flagcode") {
102            var ova = teleInput.val();
103            if (!ova.length) {
104                sessionStorage.removeItem(seInputID);
105            } else {
106                sessionStorage.setItem(seInputID, ova);
107            }
108            teleInput.on("change", function () {
109                var nno = $j(this).val();
110                if (!nno.length) {
111                    sessionStorage.removeItem(seInputID);
112                }
113            });
114        }
115
116        if ( sessionStorage.getItem(seInputID) != undefined && phoneData.flag == "flagcode" ) {
117            teleInput.closest("div").find("input:hidden").val(sessionStorage.getItem(seInputID));
118        }
119
120        if (sessionStorage.getItem(setCountryCode) != undefined) {
121            teleInput.intlTelInput( "setCountry", sessionStorage.getItem(setCountryCode) );
122        }
123
124        teleInput.blur(function () {
125            isInputValid($j(this));
126        });
127
128        teleInput.keydown(function () {
129            hideInputValidation($j(this));
130        });
131
132        function hideInputValidation(phoneID) {
133            phoneID.removeClass("error");
134            phoneID.parent().parent().parent().find(".valid-msg").addClass("hide");
135            phoneID.parent().parent().parent().find(".error-msg").addClass("hide");
136        }
137
138        function isInputValid(phoneID) {
139            var errorMsg = phoneID.parent().parent().parent().find(".error-msg"),
140                validMsg = phoneID.parent().parent().parent().find(".valid-msg");
141
142            if ($j.trim(phoneID.val())) {
143                if (phoneID.intlTelInput("isValidNumberPrecise")) {
144                    validMsg.removeClass("hide");
145                    errorMsg.addClass("hide");
146                } else {
147                    phoneID.addClass("error");
148                    errorMsg.removeClass("hide");
149                    validMsg.addClass("hide");
150                }
151            }
152        }
153    });
154    
155});
156
157
158$j(document).on("gform_confirmation_loaded", function (event, formId) {
159    jQuery('.pcafe_sp_field').each( function(i, e) {
160        var _this       = jQuery(this).find('.ginput_container_phone'),
161            phoneData   = _this.data(),
162            index = phoneData.formid + '_' + phoneData.fieldid,
163            getInputID = "spf_" + index,
164            setCountryCode = "spf_c_" + index;
165
166        sessionStorage.removeItem(getInputID);
167        sessionStorage.removeItem(setCountryCode);
168    });
169});   

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.