Donghoon Kim

Show Entertainment list

...@@ -84,6 +84,12 @@ ...@@ -84,6 +84,12 @@
84 84
85 </ol> 85 </ol>
86 86
87 + <script>
88 + var result_entertainment = []
89 + </script>
90 + <script type="text/javascript" src="/js/showEnt.js"></script>
91 + <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDg4CkUEEt_96n1ork1nL5t4E_SpdKrgMI&libraries=places&callback=initMap" async defer></script>
92 +
87 <!-- Icon Cards--> 93 <!-- Icon Cards-->
88 <div class="row"> 94 <div class="row">
89 <div class="col-xl-3 col-sm-6 mb-3"> 95 <div class="col-xl-3 col-sm-6 mb-3">
......
1 +function initMap() {
2 + // Try HTML5 geolocation.
3 + if (navigator.geolocation) {
4 + navigator.geolocation.getCurrentPosition(function(position) {
5 + pos = {
6 + lat: position.coords.latitude,
7 + lng: position.coords.longitude
8 + };
9 +
10 + searchPlace('department_store','entertainment');
11 + searchPlace('movie_theater','entertainment');
12 + searchPlace('museum','entertainment');
13 + searchPlace('night_club','entertainment');
14 + searchPlace('shopping_mall','entertainment');
15 + searchPlace('zoo','entertainment');
16 + });
17 + }
18 +}
19 +
1 function searchPlace(str, placeType) { 20 function searchPlace(str, placeType) {
2 switch(placeType) { 21 switch(placeType) {
3 case 'food': 22 case 'food':
...@@ -26,84 +45,21 @@ function searchPlace(str, placeType) { ...@@ -26,84 +45,21 @@ function searchPlace(str, placeType) {
26 } 45 }
27 } 46 }
28 47
29 -
30 -function callback_foods(results, status) {
31 - if (status === google.maps.places.PlacesServiceStatus.OK) {
32 - for (var i = 0; i < results.length; i++) {
33 - putDataToDB(results[i], 'food')
34 - createMarker_foods(results[i]);
35 - }
36 - }
37 -}
38 -
39 function callback_entertainment(results, status) { 48 function callback_entertainment(results, status) {
40 if (status === google.maps.places.PlacesServiceStatus.OK) { 49 if (status === google.maps.places.PlacesServiceStatus.OK) {
41 for (var i = 0; i < results.length; i++) { 50 for (var i = 0; i < results.length; i++) {
42 - putDataToDB(results[i], 'entertainment') 51 + result_entertainment.push(result[i])
43 - createMarker_entertainment(results[i]);
44 - }
45 } 52 }
46 -}
47 -
48 -function callback_rooms(results, status) {
49 - if (status === google.maps.places.PlacesServiceStatus.OK) {
50 - for (var i = 0; i < results.length; i++) {
51 - putDataToDB(results[i], 'room')
52 - createMarker_rooms(results[i]);
53 } 53 }
54 - }
55 -}
56 -
57 -function createMarker_foods(place) {
58 - var marker = new google.maps.Marker({
59 - map: map,
60 - position: place.geometry.location,
61 - icon : "./icons/restaurant-15.svg",
62 - //fillcolor : "#FF0000"
63 - });
64 -
65 - google.maps.event.addListener(marker, 'click', function() {
66 - infowindow.setContent(place.name);
67 - infowindow.open(map, this);
68 - });
69 -}
70 -
71 -function createMarker_entertainment(place) {
72 - var placeLoc = place.geometry.location;
73 - var marker = new google.maps.Marker({
74 - map: map,
75 - position: place.geometry.location,
76 - icon : "./icons/gaming-15.svg"
77 - });
78 -
79 - google.maps.event.addListener(marker, 'click', function() {
80 - infowindow.setContent(place.name);
81 - infowindow.open(map, this);
82 - });
83 -}
84 -
85 -function createMarker_rooms(place) {
86 - var placeLoc = place.geometry.location;
87 - var marker = new google.maps.Marker({
88 - map: map,
89 - position: place.geometry.location,
90 - icon : "./icons/lodging-15.svg"
91 - });
92 -
93 - google.maps.event.addListener(marker, 'click', function() {
94 - infowindow.setContent(place.name);
95 - infowindow.open(map, this);
96 - });
97 } 54 }
98 55
99 -function putDataToDB(result, category1) { 56 + // const id = result['id'];
100 - const id = result['id']; 57 + // const place_id =result['place_id'];
101 - const place_id =result['place_id']; 58 + // const name = result['name'];
102 - const name = result['name']; 59 + // const address = result['vicinity'];
103 - const address = result['vicinity']; 60 + // let category_big = category1
104 - let category_big = category1 61 + // const category_small = result.types[0];
105 - const category_small = result.types[0]; 62 + // const image = "default"
106 - const image = "default" 63 + // const rating = result.rating;
107 - const rating = result.rating; 64 + // const lng = result.geometry.viewport.ea.j;
108 - const lng = result.geometry.viewport.ea.j;
109 const lat =result.geometry.viewport.la.j; 65 const lat =result.geometry.viewport.la.j;
......