blokmap/map.html
Gilles Jacobs b2691befae ok
2014-12-09 21:11:31 +01:00

71 lines
2.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Blokken in Gent</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<link rel="stylesheet" href="map.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
<script src="http://matchingnotes.com/javascripts/leaflet-google.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js"></script>
</head>
<body>
<div id="map"></div>
<script id="popup-template" type="text/x-handlebars-template">
<div id="resto-popup">
<h3>{{name}}</h3>
Waar: {{address}}<br />
Plaatsen: {{capacity}}<br />
Van {{period.start}} tot {{period.end}}<br />
<table>
<tr>
<td>Maandag</td>
<td>Dinsdag</td>
<td>Woensdag</td>
<td>Donderdag</td>
<td>Vrijdag</td>
<td>Zaterdag</td>
<td>Zondag</td>
</tr>
<tr>
<td>{{#if hours.monday}}{{hours.monday}}{{else}}--{{/if}}</td>
<td>{{#if hours.tuesday}}{{hours.tuesday}}{{else}}--{{/if}}</td>
<td>{{#if hours.wednesday}}{{hours.wednesday}}{{else}}--{{/if}}</td>
<td>{{#if hours.thursday}}{{hours.thursday}}{{else}}--{{/if}}</td>
<td>{{#if hours.friday}}{{hours.friday}}{{else}}--{{/if}}</td>
<td>{{#if hours.saturday}}{{hours.saturday}}{{else}}--{{/if}}</td>
<td>{{#if hours.sunday}}{{hours.sunday}}{{else}}--{{/if}}</td>
</tr>
</table>
{{extra}}
</div>
</script>
<script type="text/javascript">
var popuptemplate = Handlebars.compile($('#popup-template').html());
function onEachFeature(feature, layer) {
if (feature.properties) {
layer.bindPopup(popuptemplate(feature.properties));
}
}
$(document).ready(function() {
var map = L.map('map').setView([51.0475378, 3.7261835], 13);
var osm = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Made by <a href="http://zeus.ugent.be">Zeus</a> with ❤!'
}).addTo(map);
$.getJSON('data.json')
.done(function(data) {
var geojson = L.geoJson(data, {
onEachFeature: onEachFeature
});
map.addLayer(geojson);
});
});
</script>
</body>
</html>