X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/149903ae7da0968ef3b1b0dc0f329afeaa5a7007..d8a368e376f9f50ff0e3714ef716df548e86bd7f:/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 b75a4daf3..795c737f2 100644 --- a/src/wolnelektury/static/js/book_text/references.js +++ b/src/wolnelektury/static/js/book_text/references.js @@ -59,10 +59,18 @@ if (ref.location) { enable_map(); - marker.setLatLng(ref.location); + 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, }); @@ -89,5 +97,7 @@ $("#reference-link").text(ref.label); $("#reference-link").attr('href', ref.wikipedia_link); + + _paq.push(['trackEvent', 'html', 'reference']); }); })})(jQuery);