1 2$(function () { 3 4 var is_submitted = false; 5 var options = {componentRestrictions: { country: 'JP' }}; 6 7 var input1 = document.getElementById('SpotKeyword1'); 8 var searchBox1 = new google.maps.places.SearchBox(input1, options); 9 10 searchBox1.addListener('places_changed', function() { 11 setGoolgePlace($("#SpotKeyword1"), searchBox1.getPlaces()); 12 }); 13 14 if($("#SpotKeyword2").length){ 15 var input2 = document.getElementById('SpotKeyword2'); 16 var searchBox2 = new google.maps.places.SearchBox(input2, options); 17 18 searchBox2.addListener('places_changed', function() { 19 setGoolgePlace($("#SpotKeyword2"),searchBox2.getPlaces()); 20 }); 21 } 22 23 24 25 $("#SpotIndexForm1, #SpotIndexForm2").submit( function() { 26 return is_submitted; 27 }); 28 29 function setGoolgePlace(field, places){ 30 var form = field.closest("form"); 31 32 //ãã¬ã¤ã¹ã0ä»¶ ãã¼ã¯ã¼ãæ¤ç´¢ 33 if (places.length == 0) { 34 form.find("input[name=place_id]").val(""); 35 form.find("input[name=lat]").val(""); 36 form.find("input[name=lng]").val(""); 37 form.find("input[name=types]").val(""); 38 }else if(places.length > 1){ 39 $('#placeModal').modal('show'); 40 41 var links = ""; 42 links+=getKeywordLi(field.val()); 43 44 places.forEach(function(place) { 45 links+=getPlaceLi(place); 46 }); 47 $("#placeModal .modal-body p").html('<ul>'+links+'</ul>'); 48 49 return; 50 }else{ 51 places.forEach(function(place) { 52 //Placeãªã®ããã¼ã¯ã¼ãæ¤ç´¢ãªã®ãç¹å®ã§ããªãå ´å 53 if(typeof(place.scope)=="undefined"){ 54 $('#placeModal').modal('show'); 55 var links = ""; 56 links+=getKeywordLi(field.val()); 57 links+=getPlaceLi(place); 58 59 $("#placeModal .modal-body p").html('<ul>'+links+'</ul>'); 60 return; 61 }else{ 62 field.val(place.name); 63 form.find("input[name=place_id]").val(place.place_id); 64 form.find("input[name=lat]").val(place.geometry.location.lat()); 65 form.find("input[name=lng]").val(place.geometry.location.lng()); 66 form.find("input[name=types]").val(place.types); 67 is_submitted = true; 68 } 69 }); 70 } 71 72 form.submit(); 73 } 74 75 76 function getPlaceLi(place){ 77 //console.log(place); 78 var s = "/search"; 79 s+='?place_id='+place.place_id; 80 s+='&lat='+place.geometry.location.lat(); 81 s+='&lng='+place.geometry.location.lng(); 82 s+='&types='+place.types; 83 s+='&keyword='+place.name; 84 85 var address = place.formatted_address; 86 address = address.replace(/^æ¥æ¬, /, ''); 87 address = address.replace(/^ã\d+-\d+ /, ''); 88 89 return '<li class="col-xs-12"><a href="'+s+'" class="col-xs-12 btn btn-default"><span class="title icon-present color"> '+place.name+'</span><span class="address">'+address+'</span></a></li>'; 90 } 91 92 function getKeywordLi(keyword){ 93 keyword = keyword.replace( / /g , "" ) ; 94 var s = "/search?keyword="+keyword; 95 return '<li class="col-xs-12"><a href="'+s+'" class="col-xs-12 btn btn-default"><span class="title icon-present color"> ã'+keyword+'ãã§æ¤ç´¢</span></a></li>'; 96 } 97 98 99});
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.