X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/27ddf8cc762407fe3ab83cc9c302fa534644985a..149903ae7da0968ef3b1b0dc0f329afeaa5a7007:/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 7c98763bf..b75a4daf3 100644 --- a/src/wolnelektury/static/js/book_text/references.js +++ b/src/wolnelektury/static/js/book_text/references.js @@ -8,18 +8,18 @@ $("#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://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { - 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; @@ -60,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, { @@ -74,12 +73,16 @@ } } - $("#reference-images img").remove(); + $("#reference-images a").remove(); if (ref.images) { $.each(ref.images, function(i, e) { $i = $(""); $i.attr('href', e.page); - $('img', $i).attr('src', e.url); + $('img', $i).attr('src', e.thumburl || e.url); + if (e.thumbresolution) { + $('img', $i).attr('width', e.thumbresolution[0]).attr('height', e.thumbresolution[1]); + } + $("#reference-images").append($i); }) }