PageSourceSearch

https://www.dekalbcountyonline.com/wp-content/themes/listingpro/assets/js/jquery.city-autocomplete.js

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