xxxxxxxxxx
<html>
<head>
<script src='https://api.tiles.mapbox.com/mapbox.js/v0.6.4/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v0.6.4/mapbox.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id='map'></div>
<script type="text/javascript">
mapbox.auto('map', 'https://a.tiles.mapbox.com/v3/inbar.map-6zm8kgdb.jsonp', function(map, tiledata) {
map.setZoomRange(1, 4);
// tiledata.markers is the markers layer.
var markersLayer = tiledata.markers;
markersLayer.addCallback('drawn', function() {
if (map.zoom() < 2) markersLayer.disable();
else markersLayer.enable();
});
var interaction = mapbox.markers.interaction(markersLayer)
.showOnHover(false);
// Custom formatter function
interaction.formatter(function(feature) {
var o = '', props = feature.properties;
if (props.title) {
o += '<strong class="marker-title">' + props.title + '</strong>';
}
if (props.description) {
o += '<div class="marker-description">' + props.description + '</div>';
}
o += '<div class="allclear"></div>';
if (typeof html_sanitize !== undefined) {
o = html_sanitize(o,
function(url) {
if (/^(https?:\/\/|data:image)/.test(url)) return url;
},
function(x) { return x; });
}
return o;
});
// Replace marker factory function with our version
markersLayer.factory(function(m) {
// Create a marker using the simplestyle factory
var elem = mapbox.markers.simplestyle_factory(m);
// Add function that centers marker on click
MM.addEvent(elem, 'click', function(e) {
map.ease.location({
lat: m.geometry.coordinates[1]+40/map.zoom(),
lon: m.geometry.coordinates[0]
}).zoom(map.zoom()).optimal();
});
return elem;
});
});
</script>
</body>
</html>
Modified http://api.tiles.mapbox.com/mapbox.js/v0.6.4/mapbox.js to a secure url
https://api.tiles.mapbox.com/mapbox.js/v0.6.4/mapbox.js