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.