PageSourceSearch

https://www.buzzsneakers.sk/nb-public/themes/nbshop5_v5_8/_static/js/plugins/smartform.js?ver=1008_7.1

js buzzsneakers.sk collected 2026-10-06 20:00:31 UTC 5,828 bytes, 172 lines download raw bytes

1var smartformActivation = function (blockMainClass) {
2
3    function changePlacesOfCityAndStreetInfo() {
4        let street = $(blockMainClass + ' .address-input-wrapper'); //za profil uneti .form-edit-profile
5        let streetNumber = $(blockMainClass + ' .street-no-input-wrapper');
6        let city = $(blockMainClass + ' .city-input-wrapper');
7        let postCode = $(blockMainClass + ' .postcode-input-wrapper');
8
9
10
11        if(typeof city !== "undefined" && typeof street != "undefined" && typeof streetNumber != "undefined" && typeof postCode !== "undefined") {
12            $(street).insertBefore($(city));
13            $(streetNumber).insertBefore($(city));
14        }
15    }
16
17    changePlacesOfCityAndStreetInfo();
18
19}
20
21var smartform = smartform || {};
22
23smartform.beforeInit = function () {
24    if(typeof smartformId !== 'undefined' && smartformId !==''){
25        smartform.setClientId(smartformId);
26    }
27}
28var focusedInputStreet = false;
29var focusedInputStreetNumber = false;
30var smartFormSetup = function () {
31
32    smartform.afterInit = function () {
33
34        var inv_id_country = $("html").attr('lang').toUpperCase();
35        var instances = smartform.getInstanceIds();
36
37        for(let instance of instances) {
38            getFocusedElement(instance);
39            trimPostCode(instance);
40            smartform.getInstance(instance).addressControl.setCountry(inv_id_country);
41            smartform.getInstance(instance).addressControl.addValidationCallback(validationCallback);
42        }
43        function validationCallback(response) {
44
45            let instanceId = response.instanceId;
46
47            validationHandler(instanceId, response.result);
48
49        }
50
51        let validationCallBackOnChangeIsSet = false;
52
53        $("#cart_onepage_street_no").on("change", function () {
54
55            if (validationCallBackOnChangeIsSet) return;
56
57            let instance = smartform.getInstance('smartform-instance-1');
58
59            instance.addressControl.addValidationCallback(validationCallback);
60
61            validationCallBackOnChangeIsSet = true;
62
63        })
64
65        function validationHandler(instanceId, result) {
66
67            if(!smartFormOnLoadValidation) {
68
69                if(result.type !== smartform.AddressValidationResultType.HIT && typeof nbMetricObject.NB_METRIC_DATA.userID !== "undefined" && nbMetricObject.NB_METRIC_DATA.userID) {
70                    $('.' + instanceId).val('');
71                    smartFormOnLoadValidation = true;
72                } else smartFormOnLoadValidation = true;
73
74            } else {
75
76                let address = $('.smartform-address-street.' + instanceId);
77                let addressNumber = $('.smartform-address-number.' + instanceId);
78                let city = $('.smartform-address-city.' + instanceId);
79                let postCode = $('.smartform-address-zip.' + instanceId);
80
81                if(result.type === smartform.AddressValidationResultType.HIT) {
82                    $(address).focus();
83                    $(addressNumber).focus();
84                    $(city).focus();
85                    $(postCode).focus();
86                }
87
88                if(address.val().length > 1 && address.val() !== '' && addressNumber.val() !== '' && result.addressArray.length === 0 && result.type === smartform.AddressValidationResultType.INSUFFICIENT_DATA) {
89
90                    $('.' + instanceId).val('');
91                    toastr.error(smartformErrorMessage);
92                    return;
93
94                }
95
96                if(focusedInputStreet && address.val().length > 1 && address.val() !== '' && addressNumber.val() !== '' && result.addressArray.length === 0 && result.type === smartform.AddressValidationResultType.NOTHING) {
97                    $('.' + instanceId).val('');
98                    toastr.error(smartformErrorMessage);
99                    return;
100                }
101
102                if(!focusedInputStreetNumber && address.val() !== '' && addressNumber.val() !== '' && city.val() !== '' && postCode.val() !== '' && result.type === smartform.AddressValidationResultType.NOTHING) {
103                    $('.' + instanceId).val('');
104                    toastr.error(smartformErrorMessage);
105                }
106
107            }
108
109
110        }
111
112        function getFocusedElement(instance) {
113
114            let instanceInput = $("." + instance);
115
116            if(typeof instanceInput === "undefined" || instanceInput.length === 0) return;
117
118
119            $(instanceInput).on("focus", function () {
120
121                if($(this).hasClass("smartform-address-street")) {
122                    focusedInputStreet = true;
123                } else {
124                    focusedInputStreet = false;
125                }
126
127                if($(this).hasClass("smartform-address-number") && $("#cart_onepage_street").val() !== '' && $("#cart_onepage_city").val() === '') {
128                    focusedInputStreetNumber = true;
129                } else {
130                    focusedInputStreetNumber = false;
131                }
132
133            })
134
135        }
136
137        function trimPostCode(instance) {
138
139            let instanceInput = $("." + instance);
140
141            if(typeof instanceInput === "undefined" || instanceInput.length === 0) return;
142
143
144            $(instanceInput).on("change", function () {
145
146                if($(this).hasClass("smartform-address-zip")) {
147                    let currentPostCode = $(this).val();
148                    let trimmedPostCode = currentPostCode.trim().replace(" ", '');
149                    $(this).val(trimmedPostCode)
150                }
151
152            })
153
154        }
155
156    }
157}
158
159smartFormSetup();
160
161
162let smartFormOnLoadValidation = false;
163
164$(document).ready(function () {
165    smartformActivation('.cart-address');
166
167    smartformActivation('#registration_modal');
168
169    smartformActivation('#registration_page');
170
171    smartformActivation('.form-edit-profile');
172})

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.