X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/393651e8bde09adb38e3d3d377f9b5f6627ea429..53e4d600e712dea988028a12f68927c3400a6901:/app/assets/javascripts/index/notes.js.erb?ds=sidebyside diff --git a/app/assets/javascripts/index/notes.js.erb b/app/assets/javascripts/index/notes.js.erb index 012538e1d..8972d6bf9 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,7 @@ function initializeNotes(map) { }); if (OSM.STATUS != 'api_offline' && OSM.STATUS != 'database_offline') { - if (params.notes || (params.layers && params.layers.indexOf('N')) >= 0) { + if (params.layers.indexOf(noteLayer.options.code) >= 0) { map.addLayer(noteLayer); } @@ -191,7 +190,7 @@ function initializeNotes(map) { notes[feature.properties.id] = updateMarker(marker, feature); newNote = null; - addNoteButton.removeClass("disabled").addClass("geolink"); + addNoteButton.removeClass("active").addClass("geolink"); } } @@ -225,8 +224,9 @@ function initializeNotes(map) { e.stopPropagation(); if (addNoteButton.hasClass("disabled")) return; + if (addNoteButton.hasClass("active")) return; - addNoteButton.removeClass("geolink").addClass("disabled"); + addNoteButton.removeClass("geolink").addClass("active"); map.addLayer(noteLayer); @@ -263,7 +263,7 @@ function initializeNotes(map) { newNote.addTo(noteLayer).bindPopup(popupContent[0], popupOptions()).openPopup(); newNote.on("remove", function (e) { - addNoteButton.removeClass("disabled").addClass("geolink"); + addNoteButton.removeClass("active").addClass("geolink"); }).on("dragstart", function (e) { $(newNote).stopTime("removenote"); }).on("dragend", function (e) {