Fix displaying map.
[wolnelektury.git] / src / wolnelektury / static / js / book_text / references.js
index 0585d84..5a6af49 100644 (file)
     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 &copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap contributors</a>'
+        L.tileLayer('https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=a8a97f0ae5134403ac38c1a075b03e15', {
+            attribution: 'Maps © <a href="http://www.thunderforest.com">Thunderforest</a>, Data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'
         }).addTo(map);
 
         map_enabled = true;
@@ -29,7 +31,8 @@
     }
     
 
-    $("#reference-close").on("click", function() {
+    $("#reference-close").on("click", function(event) {
+        event.preventDefault();
         $("#reference-box").hide();
     });
     
@@ -73,7 +76,7 @@
             }
         }
 
-        $("#reference-images img").remove();
+        $("#reference-images a").remove();
         if (ref.images) {
             $.each(ref.images, function(i, e) {
                 $i = $("<a target='_blank'><img></a>");