79 lines
2.2 KiB
HTML
79 lines
2.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
|
|
<style type="text/css">
|
|
html { height: 100% }
|
|
body { height: 100%; margin: 0px; padding: 0px ; background-color: #000; }
|
|
#mcmap { height: 100% }
|
|
</style>
|
|
<script type="text/javascript"
|
|
src="http://maps.google.com/maps/api/js?sensor=false">
|
|
</script>
|
|
<script type="text/javascript">
|
|
var config = {
|
|
path: 'tiles',
|
|
fileExt: 'png',
|
|
tileSize: 384,
|
|
defaultZoom: 1,
|
|
maxZoom: {maxzoom},
|
|
cacheMinutes: {cachelife}
|
|
};
|
|
|
|
var MCMapOptions = {
|
|
getTileUrl: function(tile, zoom) {
|
|
var url = config.path;
|
|
if(tile.x < 0 || tile.x >= Math.pow(2, zoom) || tile.y < 0 || tile.y >= Math.pow(2, zoom)) {
|
|
url += '/blank';
|
|
} else if(zoom == 0) {
|
|
url += '/base';
|
|
} else {
|
|
for(var z = zoom - 1; z >= 0; --z) {
|
|
var x = Math.floor(tile.x / Math.pow(2, z)) % 2;
|
|
var y = Math.floor(tile.y / Math.pow(2, z)) % 2;
|
|
url += '/' + (x + 2 * y);
|
|
}
|
|
}
|
|
url = url + '.' + config.fileExt;
|
|
if(config.cacheMinutes > 0) {
|
|
var d = new Date();
|
|
url += '?c=' + Math.floor(d.getTime() / (1000 * 60 * config.cacheMinutes));
|
|
}
|
|
return(url);
|
|
},
|
|
tileSize: new google.maps.Size(config.tileSize, config.tileSize),
|
|
maxZoom: config.maxZoom,
|
|
minZoom: 0,
|
|
isPng: !(config.fileExt.match(/^png$/i) == null)
|
|
};
|
|
|
|
var MCMapType = new google.maps.ImageMapType(MCMapOptions);
|
|
MCMapType.name = "MC Map";
|
|
MCMapType.alt = "Minecraft Map";
|
|
|
|
var map;
|
|
|
|
function initialize() {
|
|
var mapOptions = {
|
|
zoom: config.defaultZoom,
|
|
center: new google.maps.LatLng(-45, 90),
|
|
mapTypeControlOptions: {
|
|
mapTypeIds: ['mcmap'],
|
|
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
|
|
}
|
|
};
|
|
map = new google.maps.Map(document.getElementById("mcmap"), mapOptions);
|
|
|
|
// Now attach the coordinate map type to the map's registry
|
|
map.mapTypes.set('mcmap', MCMapType);
|
|
|
|
// We can now set the map to use the 'coordinate' map type
|
|
map.setMapTypeId('mcmap');
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="initialize()">
|
|
<div id="mcmap" style="width:100%; height:100%"></div>
|
|
</body>
|
|
</html>
|