Showing
2 changed files
with
42 additions
and
80 deletions
... | @@ -41,36 +41,36 @@ | ... | @@ -41,36 +41,36 @@ |
41 | 41 | ||
42 | <!-- Sidebar --> | 42 | <!-- Sidebar --> |
43 | <ul class="sidebar navbar-nav"> | 43 | <ul class="sidebar navbar-nav"> |
44 | - | 44 | + |
45 | <li class="nav-item"> | 45 | <li class="nav-item"> |
46 | <a class="nav-link" href="index.html"> | 46 | <a class="nav-link" href="index.html"> |
47 | <i class="fas fa-map-marker"></i> | 47 | <i class="fas fa-map-marker"></i> |
48 | <span>Map</span> | 48 | <span>Map</span> |
49 | </a> | 49 | </a> |
50 | </li> | 50 | </li> |
51 | - | 51 | + |
52 | <li class="nav-item"> | 52 | <li class="nav-item"> |
53 | <a class="nav-link" href="Foods.html"> | 53 | <a class="nav-link" href="Foods.html"> |
54 | <i class="fas fa-utensils" area-hidden ="true"></i> | 54 | <i class="fas fa-utensils" area-hidden ="true"></i> |
55 | <span>Foods</span> | 55 | <span>Foods</span> |
56 | </a> | 56 | </a> |
57 | </li> | 57 | </li> |
58 | - | 58 | + |
59 | <li class="nav-item active"> | 59 | <li class="nav-item active"> |
60 | <a class="nav-link" href="Entertainment.html"> | 60 | <a class="nav-link" href="Entertainment.html"> |
61 | <i class="fas fa-gamepad"></i> | 61 | <i class="fas fa-gamepad"></i> |
62 | <span>Entertainment</span> | 62 | <span>Entertainment</span> |
63 | </a> | 63 | </a> |
64 | </li> | 64 | </li> |
65 | - | 65 | + |
66 | <li class="nav-item"> | 66 | <li class="nav-item"> |
67 | <a class="nav-link" href="Rooms.html"> | 67 | <a class="nav-link" href="Rooms.html"> |
68 | <i class="fas fa-bed"></i> | 68 | <i class="fas fa-bed"></i> |
69 | <span>Rooms</span> | 69 | <span>Rooms</span> |
70 | </a> | 70 | </a> |
71 | </li> | 71 | </li> |
72 | - | 72 | + |
73 | - | 73 | + |
74 | </ul> | 74 | </ul> |
75 | <div id="content-wrapper"> | 75 | <div id="content-wrapper"> |
76 | 76 | ||
... | @@ -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"> |
... | @@ -179,7 +185,7 @@ | ... | @@ -179,7 +185,7 @@ |
179 | <i class="fas fa-angle-up"></i> | 185 | <i class="fas fa-angle-up"></i> |
180 | </a> | 186 | </a> |
181 | 187 | ||
182 | - | 188 | + |
183 | 189 | ||
184 | <!-- Bootstrap core JavaScript--> | 190 | <!-- Bootstrap core JavaScript--> |
185 | <script src="vendor/jquery/jquery.min.js"></script> | 191 | <script src="vendor/jquery/jquery.min.js"></script> | ... | ... |
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 | - } | ||
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 | } | 52 | } |
54 | } | 53 | } |
55 | } | 54 | } |
56 | 55 | ||
57 | -function createMarker_foods(place) { | 56 | + // const id = result['id']; |
58 | - var marker = new google.maps.Marker({ | 57 | + // const place_id =result['place_id']; |
59 | - map: map, | 58 | + // const name = result['name']; |
60 | - position: place.geometry.location, | 59 | + // const address = result['vicinity']; |
61 | - icon : "./icons/restaurant-15.svg", | 60 | + // let category_big = category1 |
62 | - //fillcolor : "#FF0000" | 61 | + // const category_small = result.types[0]; |
63 | - }); | 62 | + // const image = "default" |
64 | - | 63 | + // const rating = result.rating; |
65 | - google.maps.event.addListener(marker, 'click', function() { | 64 | + // const lng = result.geometry.viewport.ea.j; |
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 | -} | ||
98 | - | ||
99 | -function putDataToDB(result, category1) { | ||
100 | - const id = result['id']; | ||
101 | - const place_id =result['place_id']; | ||
102 | - const name = result['name']; | ||
103 | - const address = result['vicinity']; | ||
104 | - let category_big = category1 | ||
105 | - const category_small = result.types[0]; | ||
106 | - const image = "default" | ||
107 | - const rating = result.rating; | ||
108 | - const lng = result.geometry.viewport.ea.j; | ||
109 | const lat =result.geometry.viewport.la.j; | 65 | const lat =result.geometry.viewport.la.j; | ... | ... |
-
Please register or login to post a comment