Update Leaflet to 1.6.0

This commit is contained in:
Midgard 2020-05-20 16:12:27 +02:00
parent 8f464cdd93
commit bffc160d65
Signed by: midgard
GPG Key ID: 511C112F1331BBB4
5 changed files with 683 additions and 570 deletions

File diff suppressed because it is too large Load Diff

View File

@ -20,10 +20,10 @@
<meta name="twitter:description" content="Heb je nood aan een plek om te blokken? Zeus en de Gentse Studentenraad maakten een overzicht van alle beschikbare bloklocaties op één kaart.">
<meta name="twitter:image" content="https://blok.ugent.be/img/share_square.png">
<link rel="stylesheet" href="css/leaflet.css" />
<link rel="stylesheet" href="css/map.css" />
<link rel="stylesheet" href="css/leaflet-1.6.0.css">
<link rel="stylesheet" href="css/map.css">
<script type="text/javascript" src="js/leaflet.js"></script>
<script type="text/javascript" src="js/leaflet-1.6.0.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js"></script>
<script type="text/javascript" src="js/map.js"></script>

5
src/js/leaflet-1.6.0.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,16 +1,16 @@
$(document).ready(function() {
/* change image path */
L.Icon.Default.imagePath = 'img';
L.Icon.Default.imagePath = 'img/';
var popuptemplate = Handlebars.compile($('#popup-template').html());
var RedIcon = L.Icon.Default.extend({
options: {
iconUrl: 'img/red-marker.png'
iconUrl: 'red-marker.png'
}
});
var ChristmasIcon = L.Icon.Default.extend({
options: {
iconUrl: 'img/christmas-marker.png'
iconUrl: 'christmas-marker.png'
}
});
var redIcon = new RedIcon();
@ -72,90 +72,90 @@ $(document).ready(function() {
// code copied from http://jsfiddle.net/sowelie/3JbNY/
var HoverMarker = L.Marker.extend({
bindPopup: function(htmlContent, options) {
if (options && options.showOnMouseOver) {
// call the super method
L.Marker.prototype.bindPopup.apply(this, [htmlContent, options]);
// unbind the click event
this.off("click", this.openPopup, this);
// bind to mouse over
this.on("mouseover", function(e) {
// get the element that the mouse hovered onto
var target = e.originalEvent.fromElement || e.originalEvent.relatedTarget;
var parent = this._getParent(target, "leaflet-popup");
// check to see if the element is a popup, and if it is this marker's popup
if (parent == this._popup._container)
return true;
// show the popup
this.openPopup();
}, this);
// and mouse out
this.on("mouseout", function(e) {
// get the element that the mouse hovered onto
var target = e.originalEvent.toElement || e.originalEvent.relatedTarget;
// check to see if the element is a popup
if (this._getParent(target, "leaflet-popup")) {
L.DomEvent.on(this._popup._container, "mouseout", this._popupMouseOut, this);
return true;
}
// hide the popup
this.closePopup();
}, this);
}
},
_popupMouseOut: function(e) {
// detach the event
L.DomEvent.off(this._popup, "mouseout", this._popupMouseOut, this);
// get the element that the mouse hovered onto
var target = e.toElement || e.relatedTarget;
// check to see if the element is a popup
if (this._getParent(target, "leaflet-popup"))
return true;
// check to see if the marker was hovered back onto
if (target == this._icon)
return true;
// hide the popup
this.closePopup();
},
_getParent: function(element, className) {
var parent = element.parentNode;
while (parent != null) {
if (parent.className && L.DomUtil.hasClass(parent, className))
return parent;
parent = parent.parentNode;
}
return false;
}
});