commit
9753835df0
@ -1,116 +1,91 @@ |
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
<!DOCTYPE html> |
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
<html> |
||||||
<html xmlns="http://www.w3.org/1999/xhtml" |
|
||||||
xmlns:v="urn:schemas-microsoft-com:vml"> |
|
||||||
<head> |
<head> |
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> |
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/> |
||||||
<title>Google Maps</title> |
<title>Google Maps</title> |
||||||
|
|
||||||
<script src="http://www.google.com/jsapi?key=ABQIAAAA6vtVqAUu8kZ_eTz7c8kwSBT9UCAhw_xm0LNFHsWmQxTJAdp5lxSY_5r-lZriY_7sACaMnl80JcX6Og"></script> |
<style type="text/css"> |
||||||
|
html, body { |
||||||
<style type="text/css"> |
height: 100%; |
||||||
@import url("http://www.google.com/uds/css/gsearch.css"); |
margin: 0; |
||||||
@import url("http://www.google.com/uds/solutions/localsearch/gmlocalsearch.css"); |
padding: 0; |
||||||
</style> |
|
||||||
|
|
||||||
<script type="text/javascript"> |
|
||||||
|
|
||||||
/* |
|
||||||
* This program is free software: you can redistribute it and/or modify |
|
||||||
* it under the terms of the GNU General Public License as published by |
|
||||||
* the Free Software Foundation, either version 3 of the License, or |
|
||||||
* (at your option) any later version. |
|
||||||
* |
|
||||||
* This program is distributed in the hope that it will be useful, |
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
* GNU General Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU General Public License |
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
||||||
*/ |
|
||||||
|
|
||||||
google.load("maps", "2"); |
|
||||||
google.load("elements", "1", { |
|
||||||
packages : ["localsearch"] |
|
||||||
}); |
|
||||||
|
|
||||||
function initialize() |
|
||||||
{ |
|
||||||
var map = null; |
|
||||||
var defaultMapType = G_SATELLITE_MAP; |
|
||||||
var mapType = null; |
|
||||||
var lat = 30; |
|
||||||
var lng = 0; |
|
||||||
var zoom = 2; |
|
||||||
var latlng = new google.maps.LatLng(lat, lng); |
|
||||||
|
|
||||||
if (window.sankore) |
|
||||||
{ |
|
||||||
lat = parseFloat(window.sankore.preference('latitude', lat)); |
|
||||||
lng = parseFloat(window.sankore.preference('longitude', lng)); |
|
||||||
zoom = parseFloat(window.sankore.preference('zoom', zoom)); |
|
||||||
mapType = window.sankore.preference('mapType', mapType); |
|
||||||
|
|
||||||
latlng = new google.maps.LatLng(lat, lng); |
|
||||||
}; |
|
||||||
|
|
||||||
if (GBrowserIsCompatible()) { |
|
||||||
map = new GMap2(document.getElementById("map_canvas")); |
|
||||||
map.setCenter(latlng); |
|
||||||
map.setUIToDefault(); |
|
||||||
var mapTypeToSet = defaultMapType; |
|
||||||
if (mapType != null) { |
|
||||||
mapTypeToSet = map.getMapTypes()[mapType]; |
|
||||||
} |
} |
||||||
map.setMapType(mapTypeToSet); |
#map { |
||||||
map.setZoom(zoom); |
height: 100%; |
||||||
map.addControl(new google.elements.LocalSearch(), |
} |
||||||
new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(5,30))); |
</style> |
||||||
|
|
||||||
// Add persistence |
<script type="text/javascript"> |
||||||
if (window.sankore) |
var language = window.sankore ? sankore.locale().substr(0,2) : "en"; |
||||||
{ |
|
||||||
GEvent.addListener(map,'zoomend',function() |
function initMap() |
||||||
{ |
{ |
||||||
window.sankore.setPreference('zoom', map.getZoom()); |
var map; |
||||||
}); |
var mapType = null; |
||||||
|
|
||||||
GEvent.addListener(map,'moveend',function() |
// Default map type can be ROADMAP, SATELLITE, HYBRID or TERRAIN |
||||||
{ |
var defaultMapType = google.maps.MapTypeId.HYBRID; |
||||||
window.sankore.setPreference('latitude', map.getCenter().lat()); |
|
||||||
window.sankore.setPreference('longitude', map.getCenter().lng()); |
var lat = 46.2; |
||||||
}); |
var lng = 6.14; |
||||||
|
var zoom = 4; |
||||||
GEvent.addListener(map,'maptypechanged',function() |
|
||||||
{ |
|
||||||
var newMapType = null; |
var position = new google.maps.LatLng(lat, lng); |
||||||
for (var i = 0; i < map.getMapTypes().length; i++) { |
|
||||||
var aMaptype = map.getMapTypes()[i]; |
if (window.sankore) { |
||||||
if (aMaptype == map.getCurrentMapType()) { |
lat = parseFloat(window.sankore.preference('latitude', lat)); |
||||||
newMapType = i; |
lng = parseFloat(window.sankore.preference('longitude', lng)); |
||||||
break; |
zoom = parseFloat(window.sankore.preference('zoom', zoom)); |
||||||
} |
mapType = window.sankore.preference('mapTypeId', mapType); |
||||||
} |
|
||||||
window.sankore.setPreference('mapType', newMapType); |
position = new google.maps.LatLng(lat, lng); |
||||||
}); |
}; |
||||||
}; |
|
||||||
} |
|
||||||
|
map = new google.maps.Map(document.getElementById('map'), { |
||||||
window.onresize(); |
center: position, |
||||||
}; |
zoom: zoom, |
||||||
|
mapTypeId: mapType ? mapType : defaultMapType |
||||||
window.onresize = function() |
}); |
||||||
{ |
|
||||||
document.getElementById('map_canvas').style.width = window.innerWidth + 'px'; |
|
||||||
document.getElementById('map_canvas').style.height = window.innerHeight + 'px'; |
if (window.sankore) { |
||||||
}; |
map.addListener('zoom_changed',function() |
||||||
|
{ |
||||||
|
window.sankore.setPreference('zoom', map.getZoom()); |
||||||
|
}); |
||||||
|
|
||||||
|
map.addListener('dragend',function() |
||||||
|
{ |
||||||
|
window.sankore.setPreference('latitude', map.getCenter().lat()); |
||||||
|
window.sankore.setPreference('longitude', map.getCenter().lng()); |
||||||
|
}); |
||||||
|
|
||||||
|
map.addListener('maptypeid_changed',function() |
||||||
|
{ |
||||||
|
window.sankore.setPreference('mapTypeId', map.getMapTypeId()); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
window.onresize(); |
||||||
|
} |
||||||
|
|
||||||
|
window.onresize = function() |
||||||
|
{ |
||||||
|
document.getElementById('map').style.width = window.innerWidth + 'px'; |
||||||
|
document.getElementById('map').style.height = window.innerHeight + 'px'; |
||||||
|
}; |
||||||
|
|
||||||
</script> |
</script> |
||||||
</head> |
</head> |
||||||
|
|
||||||
<body onload="initialize()" style="margin: 0px"> |
<body> |
||||||
<div id="map_canvas" style="width: 800px; height: 600px"></div> |
<div id="map" style="width: 800px; height: 600px"></div> |
||||||
</body> |
</body> |
||||||
|
|
||||||
|
<script> |
||||||
|
// language has to be set in the URL, hence this way of loading the API |
||||||
|
document.write('\x3Cscript src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBjqhXNSem9YdHR2GAb8zx0qHl4S1RsKxE&callback=initMap&language='+language+'">\x3C/script>'); |
||||||
|
</script> |
||||||
</html> |
</html> |
||||||
|
Loading…
Reference in new issue