74 lines
1.8 KiB
JavaScript
74 lines
1.8 KiB
JavaScript
window.marker = null;
|
|
|
|
function initialize() {
|
|
var map;
|
|
var latitude = $('#map_canvas').attr('data-latitude');
|
|
var longitude = $('#map_canvas').attr('data-longitude');
|
|
var nottingham = new google.maps.LatLng(latitude, longitude);
|
|
var style = [
|
|
{
|
|
"stylers": [
|
|
{
|
|
"hue": "#2c3e50"
|
|
},
|
|
{
|
|
"saturation": 250
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"featureType": "road",
|
|
"elementType": "geometry",
|
|
"stylers": [
|
|
{
|
|
"lightness": 50
|
|
},
|
|
{
|
|
"visibility": "simplified"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"featureType": "road",
|
|
"elementType": "labels",
|
|
"stylers": [
|
|
{
|
|
"visibility": "off"
|
|
}
|
|
]
|
|
}
|
|
];
|
|
var mapOptions = {
|
|
center: nottingham,
|
|
mapTypeId: google.maps.MapTypeId.ROADMAP,
|
|
backgroundColor: "#000",
|
|
zoom: 15,
|
|
panControl: false,
|
|
zoomControl: true,
|
|
mapTypeControl: false,
|
|
scaleControl: false,
|
|
streetViewControl: false,
|
|
overviewMapControl: false,
|
|
zoomControlOptions: {
|
|
style: google.maps.ZoomControlStyle.LARGE
|
|
}
|
|
}
|
|
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
|
|
var mapType = new google.maps.StyledMapType(style, {
|
|
name: "Grayscale"
|
|
});
|
|
map.mapTypes.set('grey', mapType);
|
|
map.setMapTypeId('grey');
|
|
var marker_image = 'plugins/google-map/images/marker.png';
|
|
var pinIcon = new google.maps.MarkerImage(marker_image, null, null, null, new google.maps.Size(37, 37));
|
|
marker = new google.maps.Marker({
|
|
position: nottingham,
|
|
map: map,
|
|
icon: pinIcon,
|
|
title: 'Shoper'
|
|
});
|
|
}
|
|
var map = document.getElementById('map_canvas');
|
|
if (map != null) {
|
|
google.maps.event.addDomListener(window, 'load', initialize);
|
|
} |