summaryrefslogtreecommitdiff
path: root/assets/mapper.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/mapper.js')
-rw-r--r--assets/mapper.js39
1 files changed, 37 insertions, 2 deletions
diff --git a/assets/mapper.js b/assets/mapper.js
index cfdee54..a948202 100644
--- a/assets/mapper.js
+++ b/assets/mapper.js
@@ -115,8 +115,8 @@ const Categories = [
// Store known sections (refs #3)
const KnownSections = []
-// Our map
-const map = L.map('map')
+// Our map -- We customize attribution down below
+const map = L.map('map', {attributionControl: false})
const mcg = L.markerClusterGroup({
disableClusteringAtZoom: 18,
spiderfyOnMaxZoom: false,
@@ -462,6 +462,39 @@ L.control.watermark = function(opts) {
}
L.control.watermark({ position: 'bottomleft' }).addTo(map);
+/**
+ * Collapsable attribution
+ **/
+const attribution = L.control({ position: 'bottomright' })
+attribution.onAdd = function(map) {
+ var div = L.DomUtil.create('div')
+ div.id = 'attribution'
+ div.innerHTML = '<h1>©</h1>'
+ div.setAttribute('onmouseenter', 'expandAttribution()')
+ div.setAttribute('onmouseleave', 'collapseAttribution()')
+ return div
+}
+function expandAttribution() {
+ $('#attribution').addClass('expanded')
+ .html(renderAttribution())
+}
+function collapseAttribution() {
+ $('#attribution').removeClass('expanded')
+ .html('<h1>©</h1>')
+}
+
+function renderAttribution() {
+ var template = $('#attribution-template').html()
+ var attribution = {
+ leaflet_url: 'http://leafletjs.com/',
+ osm_url: 'https://osm.org/',
+ rt_url: 'http://www.reseautransition.be/',
+ incommon_url: 'https://incommon.cc/'
+ }
+ return Mustache.render(template, { data: attribution })
+}
+
+
/*
function show_markers(sec_id) {
// Create corresponding layer
@@ -559,6 +592,8 @@ $(document).ready(function() {
OpenStreetMap_HOT.addTo(map)
+ attribution.addTo(map)
+
mcg.addTo(map)
navSetup()