]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/notes.js.erb
Add SOTM advert
[rails.git] / app / assets / javascripts / index / notes.js.erb
index c3169ca09b396108d3d8aa5c304d7d7bdf54b887..4e45cbe05238b092f88559e930fc9d01f28bb73f 100644 (file)
@@ -1,7 +1,6 @@
 function initializeNotes(map) {
   var noteLayer = map.noteLayer,
-      notes = {},
-      newNote;
+      notes = {};
 
   var noteIcons = {
     "new": L.icon({
@@ -32,18 +31,13 @@ function initializeNotes(map) {
       noteLayer.clearLayers();
       notes = {};
     }
-  }).on("popupclose", function (e) {
-    if (newNote && e.popup == newNote._popup) {
-      $(newNote).oneTime(10, "removenote", function () {
-        map.removeLayer(newNote);
-        newNote = null;
-      });
-    } 
-  })
+  });
 
   noteLayer.on('click', function(e) {
-    OSM.route('/browse/note/' + e.layer.id);
-  })
+    if (e.layer.id) {
+      OSM.router.route('/note/' + e.layer.id);
+    }
+  });
 
   function updateMarker(marker, feature) {
     if (marker) {
@@ -51,7 +45,7 @@ function initializeNotes(map) {
     } else {
       marker = L.marker(feature.geometry.coordinates.reverse(), {
         icon: noteIcons[feature.properties.status],
-        opacity: 0.9,
+        opacity: 0.8,
         clickable: true
       });
       marker.id = feature.properties.id;
@@ -92,11 +86,11 @@ function initializeNotes(map) {
         notes[feature.properties.id] = updateMarker(marker, feature);
       }
 
-      for (id in oldNotes) {
+      for (var id in oldNotes) {
         noteLayer.removeLayer(oldNotes[id]);
       }
 
       noteLoader = null;
     }
-  };
+  }
 }