X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/55e6abd52da631d0a36ed13e12f5e1dfb2af0d92..f59de09387c7ceb7d6ab2ccf6ea25cb4be8dacb5:/src/wolnelektury/static/js/book_text/references.js
diff --git a/src/wolnelektury/static/js/book_text/references.js b/src/wolnelektury/static/js/book_text/references.js
index fa4a35a69..ee7e2bd91 100644
--- a/src/wolnelektury/static/js/book_text/references.js
+++ b/src/wolnelektury/static/js/book_text/references.js
@@ -10,10 +10,12 @@
}
var map_enabled = false;
- var marker = L.circleMarker([0,0]);
+ var marker = null;
var map = null;
function enable_map() {
+ if (!$("#reference-map").length) return;
+
$("#reference-map").show('slow');
if (map_enabled) return;
@@ -22,6 +24,7 @@
L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=a8a97f0ae5134403ac38c1a075b03e15', {
attribution: 'Maps © Thunderforest, Data © OpenStreetMap contributors'
}).addTo(map);
+ marker = L.circleMarker([0,0]);
map_enabled = true;
}
@@ -659,14 +662,15 @@
history.pushState({}, '', anchor);
},
});
+ return true;
}
}
}
scrollToAnchor(window.location.hash)
- $('#toc, #themes, #book-text, #annotation').on('click', 'a', function(event) {
- event.preventDefault();
- scrollToAnchor($(this).attr('href'));
+ $('#toc, #themes, #book-text, #annotation, .scroll').on('click', 'a', function(event) {
+ if (scrollToAnchor($(this).attr('href'))) {
+ event.preventDefault();
+ }
});
-
})})(jQuery);