PageSourceSearch

https://salons.nl/wp-content/themes/listingpro/assets/js/jquery.city-autocomplete.js?ver=7.1.3

js salons.nl collected 2026-10-08 21:43:52 UTC 7,691 bytes, 184 lines download raw bytes

1(function ($) {
2
3    var lpregions = false;
4    var lpattern = jQuery('#page').data('lpattern');
5    if (lpattern === "with_region") {
6        lpregions = true;
7    }
8
9
10    $.fn.cityAutocomplete = function (options) {
11        var autocompleteService = new google.maps.places.AutocompleteService();
12        var predictionsDropDown = $('<div class="city-autocomplete"></div>').appendTo('body');
13        var input = this;
14
15        input.keyup(function () {
16            var searchStr = $(this).val();
17
18            if (searchStr.length > 0) {
19
20                if (!lpregions) {
21                    var params = {
22                        input: searchStr,
23                        types: ['(cities)']
24                    };
25                } else {
26                    var params = {
27                        input: searchStr,
28                        types: ['(regions)']
29                    };
30                }
31
32
33                if (input.data('country').length > 0) {
34                    params.componentRestrictions = { country: input.data('country') }
35                }
36
37                autocompleteService.getPlacePredictions(params, updatePredictions);
38            } else {
39                predictionsDropDown.hide();
40            }
41        });
42
43        predictionsDropDown.delegate('div', 'click', function () {
44            //New update 2.7.0
45            substrr = $(this).text();
46            substrr = substrr.split(",");
47            if (substrr[1] == 'undefined' || substrr[1] == '' || substrr[1] == null) {
48                substrr = substrr[0];
49            } else {
50                substrr = substrr[0] + ',' + substrr[1];
51            }
52            //End New update 2.7.0
53            jQuery('input[name=lp_s_loc]').val(substrr);
54            jQuery('input[name=location]').val(substrr);
55            input.val($(this).text());
56            input.data('isseleted', 'true');
57            predictionsDropDown.hide();
58        });
59
60        $(document).mouseup(function (e) {
61            if (!predictionsDropDown.is(e.target) && predictionsDropDown.has(e.target).length === 0) {
62                predictionsDropDown.hide();
63            }
64        });
65
66        $(window).resize(function () {
67            updatePredictionsDropDownDisplay(predictionsDropDown, input);
68        });
69
70        updatePredictionsDropDownDisplay(predictionsDropDown, input);
71
72        function updatePredictions(predictions, status) {
73            if (google.maps.places.PlacesServiceStatus.OK != status) {
74                predictionsDropDown.hide();
75                return;
76            }
77
78            predictionsDropDown.empty();
79            var predcities = [];
80            $.each(predictions, function (i, prediction) {
81                if (!lpregions) {
82                    predcities.push($.fn.cityAutocomplete.transliterate(prediction.terms[0].value));
83                } else {
84                    predcities.push(prediction.description);
85                }
86            });
87            if (!lpregions) {
88                predcities = predcities.filter((v, i, a) => a.indexOf(v) === i);
89            }
90            $.each(predcities, function (i, cities) {
91                predictionsDropDown.append('<div class="help">' + cities + '</div');
92            });
93            predictionsDropDown.show();
94        }
95
96        return input;
97    };
98
99    $.fn.cityAutocomplete.transliterate = function (s) {
100        s = String(s);
101
102        var char_map = {
103            // Latin
104            'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE', 'Ç': 'C',
105            'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I', 'Î': 'I', 'Ï': 'I',
106            'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O', 'Õ': 'O', 'Ö': 'O', 'Ő': 'O',
107            'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U', 'Ü': 'U', 'Ű': 'U', 'Ý': 'Y', 'Þ': 'TH',
108            'ß': 'ss',
109            'à': 'a', 'á': 'a', 'â': 'a', 'ã': 'a', 'ä': 'a', 'å': 'a', 'æ': 'ae', 'ç': 'c',
110            'è': 'e', 'é': 'e', 'ê': 'e', 'ë': 'e', 'ì': 'i', 'í': 'i', 'î': 'i', 'ï': 'i',
111            'ð': 'd', 'ñ': 'n', 'ò': 'o', 'ó': 'o', 'ô': 'o', 'õ': 'o', 'ö': 'o', 'ő': 'o',
112            'ø': 'o', 'ù': 'u', 'ú': 'u', 'û': 'u', 'ü': 'u', 'ű': 'u', 'ý': 'y', 'þ': 'th',
113            'ÿ': 'y',
114
115            // Latin symbols
116            '©': '(c)',
117
118            // Greek
119            'Α': 'A', 'Β': 'B', 'Γ': 'G', 'Δ': 'D', 'Ε': 'E', 'Ζ': 'Z', 'Η': 'H', 'Θ': '8',
120            'Ι': 'I', 'Κ': 'K', 'Λ': 'L', 'Μ': 'M', 'Ν': 'N', 'Ξ': '3', 'Ο': 'O', 'Π': 'P',
121            'Ρ': 'R', 'Σ': 'S', 'Τ': 'T', 'Υ': 'Y', 'Φ': 'F', 'Χ': 'X', 'Ψ': 'PS', 'Ω': 'W',
122            'Ά': 'A', 'Έ': 'E', 'Ί': 'I', 'Ό': 'O', 'Ύ': 'Y', 'Ή': 'H', 'Ώ': 'W', 'Ϊ': 'I',
123            'Ϋ': 'Y',
124            'α': 'a', 'β': 'b', 'γ': 'g', 'δ': 'd', 'ε': 'e', 'ζ': 'z', 'η': 'h', 'θ': '8',
125            'ι': 'i', 'κ': 'k', 'λ': 'l', 'μ': 'm', 'ν': 'n', 'ξ': '3', 'ο': 'o', 'π': 'p',
126            'ρ': 'r', 'σ': 's', 'τ': 't', 'υ': 'y', 'φ': 'f', 'χ': 'x', 'ψ': 'ps', 'ω': 'w',
127            'ά': 'a', 'έ': 'e', 'ί': 'i', 'ό': 'o', 'ύ': 'y', 'ή': 'h', 'ώ': 'w', 'ς': 's',
128            'ϊ': 'i', 'ΰ': 'y', 'ϋ': 'y', 'ΐ': 'i',
129
130            // Turkish
131            'Ş': 'S', 'İ': 'I', 'Ç': 'C', 'Ü': 'U', 'Ö': 'O', 'Ğ': 'G',
132            'ş': 's', 'ı': 'i', 'ç': 'c', 'ü': 'u', 'ö': 'o', 'ğ': 'g',
133
134            // Russian
135            'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D', 'Е': 'E', 'Ё': 'Yo', 'Ж': 'Zh',
136            'З': 'Z', 'И': 'I', 'Й': 'J', 'К': 'K', 'Л': 'L', 'М': 'M', 'Н': 'N', 'О': 'O',
137            'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T', 'У': 'U', 'Ф': 'F', 'Х': 'H', 'Ц': 'C',
138            'Ч': 'Ch', 'Ш': 'Sh', 'Щ': 'Sh', 'Ъ': '', 'Ы': 'Y', 'Ь': '', 'Э': 'E', 'Ю': 'Yu',
139            'Я': 'Ya',
140            'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', 'е': 'e', 'ё': 'yo', 'ж': 'zh',
141            'з': 'z', 'и': 'i', 'й': 'j', 'к': 'k', 'л': 'l', 'м': 'm', 'н': 'n', 'о': 'o',
142            'п': 'p', 'р': 'r', 'с': 's', 'т': 't', 'у': 'u', 'ф': 'f', 'х': 'h', 'ц': 'c',
143            'ч': 'ch', 'ш': 'sh', 'щ': 'sh', 'ъ': '', 'ы': 'y', 'ь': '', 'э': 'e', 'ю': 'yu',
144            'я': 'ya',
145
146            // Ukrainian
147            'Є': 'Ye', 'І': 'I', 'Ї': 'Yi', 'Ґ': 'G',
148            'є': 'ye', 'і': 'i', 'ї': 'yi', 'ґ': 'g',
149
150            // Czech
151            'Č': 'C', 'Ď': 'D', 'Ě': 'E', 'Ň': 'N', 'Ř': 'R', 'Š': 'S', 'Ť': 'T', 'Ů': 'U',
152            'Ž': 'Z',
153            'č': 'c', 'ď': 'd', 'ě': 'e', 'ň': 'n', 'ř': 'r', 'š': 's', 'ť': 't', 'ů': 'u',
154            'ž': 'z',
155
156            // Polish
157            'Ą': 'A', 'Ć': 'C', 'Ę': 'e', 'Ł': 'L', 'Ń': 'N', 'Ó': 'o', 'Ś': 'S', 'Ź': 'Z',
158            'Å»': 'Z',
159            'ą': 'a', 'ć': 'c', 'ę': 'e', 'ł': 'l', 'ń': 'n', 'ó': 'o', 'ś': 's', 'ź': 'z',
160            'ż': 'z',
161
162            // Latvian
163            'Ā': 'A', 'Č': 'C', 'Ē': 'E', 'Ģ': 'G', 'Ī': 'i', 'Ķ': 'k', 'Ļ': 'L', 'Ņ': 'N',
164            'Š': 'S', 'Ū': 'u', 'Ž': 'Z',
165            'ā': 'a', 'č': 'c', 'ē': 'e', 'ģ': 'g', 'ī': 'i', 'ķ': 'k', 'ļ': 'l', 'ņ': 'n',
166            'š': 's', 'ū': 'u', 'ž': 'z'
167        };
168
169        for (var k in char_map) {
170            s = s.replace(new RegExp(k, 'g'), char_map[k]);
171        }
172
173        return s;
174    };
175
176    function updatePredictionsDropDownDisplay(dropDown, input) {
177        dropDown.css({
178            'width': input.outerWidth(),
179            'left': input.offset().left,
180            'top': input.offset().top + input.outerHeight()
181        });
182    }
183
184}(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.