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.