X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/8fb3d7365fb91d1822ae5f37361af077d48a9c8c..baf10cd39289cd7e94a819305e46f43e85a136c6:/app/assets/javascripts/index/notes.js.erb diff --git a/app/assets/javascripts/index/notes.js.erb b/app/assets/javascripts/index/notes.js.erb index 43c735a23..4e45cbe05 100644 --- a/app/assets/javascripts/index/notes.js.erb +++ b/app/assets/javascripts/index/notes.js.erb @@ -1,7 +1,6 @@ function initializeNotes(map) { var noteLayer = map.noteLayer, - notes = {}, - newNote; + notes = {}; var noteIcons = { "new": L.icon({ @@ -32,17 +31,12 @@ 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) { @@ -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,7 +86,7 @@ function initializeNotes(map) { notes[feature.properties.id] = updateMarker(marker, feature); } - for (id in oldNotes) { + for (var id in oldNotes) { noteLayer.removeLayer(oldNotes[id]); }