X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/55e6abd52da631d0a36ed13e12f5e1dfb2af0d92..89881ffd8c2da92f115f23b002f48b7e626014d0:/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..394ec3ffd 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;
}
@@ -607,6 +610,7 @@
$('a.anchor').on('click', function(e) {
// Workaround for bad TOC markers.
if ($(this).closest('#toc').length) return;
+ if ($(this).closest('.toc').length) return;
if ($(this).closest('#wltoc').length) return;
e.preventDefault();
@@ -659,14 +663,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);