X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/19eb8110dcf8df62147ca2d0a5c8769a7fb11f71..56a76b9dc0745d22d9b1eac54348d6109dc3c0e1:/src/wolnelektury/static/js/book_text/references.js?ds=sidebyside diff --git a/src/wolnelektury/static/js/book_text/references.js b/src/wolnelektury/static/js/book_text/references.js index 45a585240..4c72fe60b 100644 --- a/src/wolnelektury/static/js/book_text/references.js +++ b/src/wolnelektury/static/js/book_text/references.js @@ -4,22 +4,22 @@ if (interestingReferences) { interestingReferences = $.parseJSON(interestingReferences); } - if (interestingReferences) { - $("#settings-references").show(); + if (Object.keys(interestingReferences).length) { + $("#settings-references").css('display', 'block'); } - - var map_enabled = false; - var marker = L.marker([0,0]); + var marker = L.circleMarker([0,0]); var map = null; function enable_map() { + $("#reference-map").show('slow'); + if (map_enabled) return; map = L.map('reference-map').setView([0, 0], 11); - L.tileLayer('https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png?lang=pl', { - attribution: 'Map data © OpenStreetMap contributors' + L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=a8a97f0ae5134403ac38c1a075b03e15', { + attribution: 'Maps © Thunderforest, Data © OpenStreetMap contributors' }).addTo(map); map_enabled = true; @@ -29,7 +29,8 @@ } - $("#reference-close").on("click", function() { + $("#reference-close").on("click", function(event) { + event.preventDefault(); $("#reference-box").hide(); }); @@ -59,7 +60,6 @@ enable_map(); marker.setLatLng(ref.location); - //marker.setContent(ref.label); marker.bindTooltip(ref.label).openTooltip(); map.addLayer(marker); map.panTo(ref.location, { @@ -73,7 +73,7 @@ } } - $("#reference-images img").remove(); + $("#reference-images a").remove(); if (ref.images) { $.each(ref.images, function(i, e) { $i = $("");