forked from vinaygaba/Traveller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
113 lines (87 loc) · 4.16 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-script-type" content="text/javascript" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-language" content="en" />
<meta property="og:image" content="/view/images/gdg.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="author" content="Vinay Gaba" />
<meta name="description" content="Traveller : Add a map on your site with every place that you have visited! " />
<meta name="keywords" content="Vinay Gaba, vinaygaba,Traveller, Map, Google Maps" />
<meta name="robots" content="index, follow" />
<meta name="revisit-after" content="14 days" />
<title>Traveller</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="css/style.css" >
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link href='https://fonts.googleapis.com/css?family=Candal' rel='stylesheet' type='text/css'>
</head>
<body style="overflow:hidden;">
<div id="map_canvas"></div>
<div id="infoPanel">
<span id="infoText"></div>
</div>
<script type="text/javascript" src="js/mapstyles.js"></script>
<script>
var map;
var cities = 0;
var blueMarkerColor = "#4346c0";
var redMarkerColor = "#10955e";
function initMap() {
map = new google.maps.Map(document.getElementById('map_canvas'), {
center: {lat: 20.5937, lng: 78.9629},
zoom: 2,
disableDefaultUI: true,
draggable:false,
zoomControl: true,
});
//Set map style
map.set('styles',NAME_OF_STYLE);
//Replace the below placeholder with the path to the json file
$.getJSON(PATH_TO_JSON, function(json) {
for(each in json){
cities = cities + 1;
var myLatLng = {lat: parseFloat(json[each]["lat"]), lng: parseFloat(json[each]["lon"])};
//You can replace the marker colors by changing the values in blueMarkerColor/redMarkerColor
//or creating new variables altogether
var strokeColor = json[each]["purpose"]=="lived"?blueMarkerColor:redMarkerColor;
var marker = new google.maps.Marker({
position: myLatLng,
icon: {
path: google.maps.SymbolPath.CIRCLE,
scale: 2,
strokeColor: strokeColor,
fillOpacity: 1,
fillColor:strokeColor
},
title:json[each]["purpose"],
map: map
});
attachMessage(marker, json[each]["name"]);
// Attaches an info window to a marker with the provided message.
function attachMessage(marker, Message) {
console.log(Message)
var infowindow = new google.maps.InfoWindow({
content: Message
});
marker.addListener('mouseover', function() {
infowindow.open(marker.get('map'), marker);
});
marker.addListener('mouseout', function() {
infowindow.close(marker.get('map'), marker);
});
}
}
$('#infoText').html(cities + " Cities");
});
}
</script>
<!-- Update the place holder with the Google Maps API Key below-->
<script src="https://maps.googleapis.com/maps/api/js?key=GOOGLE_MAP_API_KEY&callback=initMap" async defer></script>
<script src="https://code.jquery.com/jquery-2.2.3.min.js" integrity="sha256-a23g1Nt4dtEYOj7bR+vTu7+T8VP13humZFBJNIYoEJo=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
</body>
</html>