X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/3c4da558b0ca79e2ab1a594d719b81d2766e4bd6..0ae489e3199827640a8007b782f1b9dc6bd0fcc5:/app/assets/javascripts/index/new_note.js diff --git a/app/assets/javascripts/index/new_note.js b/app/assets/javascripts/index/new_note.js index 6b24be07d..b1457d10b 100644 --- a/app/assets/javascripts/index/new_note.js +++ b/app/assets/javascripts/index/new_note.js @@ -1,12 +1,12 @@ OSM.NewNote = function (map) { - var noteLayer = map.noteLayer, - content = $("#sidebar_content"), - page = {}, - addNoteButton = $(".control-note .control-button"), - newNoteMarker, + const noteLayer = map.noteLayer, + content = $("#sidebar_content"), + page = {}, + addNoteButton = $(".control-note .control-button"); + let newNoteMarker, halo; - var noteIcons = { + const noteIcons = { "new": L.icon({ iconUrl: OSM.NEW_NOTE_MARKER, iconSize: [25, 40], @@ -34,7 +34,7 @@ OSM.NewNote = function (map) { }); function createNote(location, text, callback) { - fetch("/api/0.6/notes.json?", { + fetch("/api/0.6/notes.json", { method: "POST", headers: { ...OSM.oauth }, body: new URLSearchParams({ @@ -48,7 +48,7 @@ OSM.NewNote = function (map) { } function addCreatedNoteMarker(feature) { - var marker = L.marker(feature.geometry.coordinates.reverse(), { + const marker = L.marker(feature.geometry.coordinates.reverse(), { icon: noteIcons[feature.properties.status], opacity: 0.9, interactive: true @@ -132,7 +132,7 @@ OSM.NewNote = function (map) { map.addLayer(noteLayer); const params = new URLSearchParams(path.substring(path.indexOf("?"))); - var markerLatlng; + let markerLatlng; if (params.has("lat") && params.has("lon")) { markerLatlng = L.latLng(params.get("lat"), params.get("lon")); @@ -161,7 +161,7 @@ OSM.NewNote = function (map) { createNote(location, text, (feature) => { if (typeof OSM.user === "undefined") { - var anonymousNotesCount = Number(Cookies.get("_osm_anonymous_notes_count")) || 0; + const anonymousNotesCount = Number(Cookies.get("_osm_anonymous_notes_count")) || 0; Cookies.set("_osm_anonymous_notes_count", anonymousNotesCount + 1, { secure: true, expires: 30, path: "/", samesite: "lax" }); } content.find("textarea").val("");