From: Tom Hughes Date: Sat, 26 Oct 2024 10:16:45 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/pull/5289' X-Git-Tag: live~45 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/cb16d3c33146b35be0e71204844f4d966e6ae923?hp=99bf0a01eb15a458cdc829274df9dc6b3760af0e Merge remote-tracking branch 'upstream/pull/5289' --- diff --git a/app/assets/javascripts/index/note.js b/app/assets/javascripts/index/note.js index 3839d2715..24d24f8ae 100644 --- a/app/assets/javascripts/index/note.js +++ b/app/assets/javascripts/index/note.js @@ -22,20 +22,21 @@ OSM.Note = function (map) { page.pushstate = page.popstate = function (path, id) { OSM.loadSidebarContent(path, function () { - initialize(path, id, function () { - var data = $(".details").data(); - if (!data) return; - var latLng = L.latLng(data.coordinates.split(",")); - if (!map.getBounds().contains(latLng)) moveToNote(); - }); + initialize(path, id); + + var data = $(".details").data(); + if (!data) return; + var latLng = L.latLng(data.coordinates.split(",")); + if (!map.getBounds().contains(latLng)) moveToNote(); }); }; page.load = function (path, id) { - initialize(path, id, moveToNote); + initialize(path, id); + moveToNote(); }; - function initialize(path, id, callback) { + function initialize(path, id) { content.find("button[type=submit]").on("click", function (e) { e.preventDefault(); var data = $(e.target).data(); @@ -50,7 +51,8 @@ OSM.Note = function (map) { data: { text: $(form.text).val() }, success: function () { OSM.loadSidebarContent(path, function () { - initialize(path, id, moveToNote); + initialize(path, id); + moveToNote(); }); }, error: function (xhr) { @@ -78,8 +80,6 @@ OSM.Note = function (map) { icon: noteIcons[data.status] }); } - - if (callback) callback(); } function updateButtons(form) {