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