1$(function () { 2 3 var 4 $icon = $('#location-icon'), 5 $input = $('#location-input'), 6 $inputLat = $('#location-lat'), 7 $inputLon = $('#location-lon'), 8 locale = $('[name=locale]').val(), 9 cache = {}; 10 11 $icon.on('click', function (e) { 12 e.preventDefault(); 13 var location = $(this).data('location'); 14 var suffix = locale.split('_')[1]; 15 if (suffix == 'cn') { 16 suffix = 'en'; 17 } 18 19 $input.val(location['name_' + suffix]); 20 $inputLat.val(location.lat); 21 $inputLon.val(location.lon); 22 }); 23 24 $input.autocomplete({ 25 minLength: 2, 26 autoFocus: true, 27 source: function (request, response) { 28 var term = request.term; 29 if (term in cache) { 30 response(cache[term]); 31 return; 32 } 33 34 $.get('/local/ajax/offices_locations.php', {term: term, locale: locale}, function (data) { 35 cache[term] = data; 36 response(data); 37 }, 'json'); 38 } 39 }).each(function () { 40 $(this).autocomplete("instance")._resizeMenu = function () { 41 this.menu.element.outerWidth(this.element.outerWidth()); 42 } 43 }); 44 45});
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.