X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/c8fb5ad24c5751bd2d43b86e4359381d200af066..f898058e76459562e8d54c61458eba0fb1476f35:/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 2d807eb92..93b60c3e7 100644 --- a/app/assets/javascripts/index/notes.js.erb +++ b/app/assets/javascripts/index/notes.js.erb @@ -1,9 +1,8 @@ //= require templates/notes/show //= require templates/notes/new -function initializeNotes(map) { - var params = OSM.mapParams(), - noteLayer = map.noteLayer, +function initializeNotes(map, params) { + var noteLayer = map.noteLayer, notes = {}, newNote; @@ -50,7 +49,10 @@ function initializeNotes(map) { }); if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') { - if (params.notes || params.layers.indexOf('N') >= 0) map.addLayer(noteLayer); + if (params.layers.indexOf(noteLayer.options.code) >= 0) { + map.addLayer(noteLayer); + } + if (params.note) { $.ajax({ url: "/api/" + OSM.API_VERSION + "/notes/" + params.note + ".json", @@ -188,7 +190,7 @@ function initializeNotes(map) { notes[feature.properties.id] = updateMarker(marker, feature); newNote = null; - addNoteButton.removeClass("disabled"); + addNoteButton.removeClass("disabled").addClass("geolink"); } } @@ -223,7 +225,7 @@ function initializeNotes(map) { if (addNoteButton.hasClass("disabled")) return; - addNoteButton.addClass("disabled"); + addNoteButton.removeClass("geolink").addClass("disabled"); map.addLayer(noteLayer); @@ -260,7 +262,7 @@ function initializeNotes(map) { newNote.addTo(noteLayer).bindPopup(popupContent[0], popupOptions()).openPopup(); newNote.on("remove", function (e) { - addNoteButton.removeClass("disabled"); + addNoteButton.removeClass("disabled").addClass("geolink"); }).on("dragstart", function (e) { $(newNote).stopTime("removenote"); }).on("dragend", function (e) {