Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김동훈
/
OpenSource_Project
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
1
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Donghoon Kim
2018-12-14 05:39:12 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
837cfff8691040d82fec1685b1fc425b8525507f
837cfff8
1 parent
ffdbf2b6
Show Entertainment list
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
73 deletions
public/Entertainment.html
public/js/showEnt.js
public/Entertainment.html
View file @
837cfff
...
...
@@ -84,6 +84,12 @@
</ol>
<script>
var
result_entertainment
=
[]
</script>
<script
type=
"text/javascript"
src=
"/js/showEnt.js"
></script>
<script
src=
"https://maps.googleapis.com/maps/api/js?key=AIzaSyDg4CkUEEt_96n1ork1nL5t4E_SpdKrgMI&libraries=places&callback=initMap"
async
defer
></script>
<!-- Icon Cards-->
<div
class=
"row"
>
<div
class=
"col-xl-3 col-sm-6 mb-3"
>
...
...
public/js/showEnt.js
View file @
837cfff
function
initMap
()
{
// Try HTML5 geolocation.
if
(
navigator
.
geolocation
)
{
navigator
.
geolocation
.
getCurrentPosition
(
function
(
position
)
{
pos
=
{
lat
:
position
.
coords
.
latitude
,
lng
:
position
.
coords
.
longitude
};
searchPlace
(
'department_store'
,
'entertainment'
);
searchPlace
(
'movie_theater'
,
'entertainment'
);
searchPlace
(
'museum'
,
'entertainment'
);
searchPlace
(
'night_club'
,
'entertainment'
);
searchPlace
(
'shopping_mall'
,
'entertainment'
);
searchPlace
(
'zoo'
,
'entertainment'
);
});
}
}
function
searchPlace
(
str
,
placeType
)
{
switch
(
placeType
)
{
case
'food'
:
...
...
@@ -26,84 +45,21 @@ function searchPlace(str, placeType) {
}
}
function
callback_foods
(
results
,
status
)
{
if
(
status
===
google
.
maps
.
places
.
PlacesServiceStatus
.
OK
)
{
for
(
var
i
=
0
;
i
<
results
.
length
;
i
++
)
{
putDataToDB
(
results
[
i
],
'food'
)
createMarker_foods
(
results
[
i
]);
}
}
}
function
callback_entertainment
(
results
,
status
)
{
if
(
status
===
google
.
maps
.
places
.
PlacesServiceStatus
.
OK
)
{
for
(
var
i
=
0
;
i
<
results
.
length
;
i
++
)
{
putDataToDB
(
results
[
i
],
'entertainment'
)
createMarker_entertainment
(
results
[
i
]);
}
result_entertainment
.
push
(
result
[
i
])
}
}
function
callback_rooms
(
results
,
status
)
{
if
(
status
===
google
.
maps
.
places
.
PlacesServiceStatus
.
OK
)
{
for
(
var
i
=
0
;
i
<
results
.
length
;
i
++
)
{
putDataToDB
(
results
[
i
],
'room'
)
createMarker_rooms
(
results
[
i
]);
}
}
}
function
createMarker_foods
(
place
)
{
var
marker
=
new
google
.
maps
.
Marker
({
map
:
map
,
position
:
place
.
geometry
.
location
,
icon
:
"./icons/restaurant-15.svg"
,
//fillcolor : "#FF0000"
});
google
.
maps
.
event
.
addListener
(
marker
,
'click'
,
function
()
{
infowindow
.
setContent
(
place
.
name
);
infowindow
.
open
(
map
,
this
);
});
}
function
createMarker_entertainment
(
place
)
{
var
placeLoc
=
place
.
geometry
.
location
;
var
marker
=
new
google
.
maps
.
Marker
({
map
:
map
,
position
:
place
.
geometry
.
location
,
icon
:
"./icons/gaming-15.svg"
});
google
.
maps
.
event
.
addListener
(
marker
,
'click'
,
function
()
{
infowindow
.
setContent
(
place
.
name
);
infowindow
.
open
(
map
,
this
);
});
}
function
createMarker_rooms
(
place
)
{
var
placeLoc
=
place
.
geometry
.
location
;
var
marker
=
new
google
.
maps
.
Marker
({
map
:
map
,
position
:
place
.
geometry
.
location
,
icon
:
"./icons/lodging-15.svg"
});
google
.
maps
.
event
.
addListener
(
marker
,
'click'
,
function
()
{
infowindow
.
setContent
(
place
.
name
);
infowindow
.
open
(
map
,
this
);
});
}
function
putDataToDB
(
result
,
category1
)
{
const
id
=
result
[
'id'
];
const
place_id
=
result
[
'place_id'
];
const
name
=
result
[
'name'
];
const
address
=
result
[
'vicinity'
];
let
category_big
=
category1
const
category_small
=
result
.
types
[
0
];
const
image
=
"default"
const
rating
=
result
.
rating
;
const
lng
=
result
.
geometry
.
viewport
.
ea
.
j
;
// const id = result['id'];
// const place_id =result['place_id'];
// const name = result['name'];
// const address = result['vicinity'];
// let category_big = category1
// const category_small = result.types[0];
// const image = "default"
// const rating = result.rating;
// const lng = result.geometry.viewport.ea.j;
const
lat
=
result
.
geometry
.
viewport
.
la
.
j
;
...
...
Please
register
or
login
to post a comment