X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/94a24222f21ddd57ae1e95ea52389c4c036779e6..a8282aa69e00292bec986722c5230ff89f96f450:/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 5a6af4948..b9fc40f86 100644 --- a/src/wolnelektury/static/js/book_text/references.js +++ b/src/wolnelektury/static/js/book_text/references.js @@ -8,10 +8,8 @@ $("#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() { @@ -61,11 +59,18 @@ if (ref.location) { enable_map(); - marker.setLatLng(ref.location); - //marker.setContent(ref.label); + let newLoc = [ + ref.location[0], + ref.location[1] + Math.round( + (map.getCenter().lng - ref.location[1]) / 360 + ) * 360 + ]; + + marker.setLatLng(newLoc); marker.bindTooltip(ref.label).openTooltip(); map.addLayer(marker); - map.panTo(ref.location, { + + map.panTo(newLoc, { animate: true, duration: 1, }); @@ -81,7 +86,11 @@ $.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); }) }