Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/pull/5289'
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Oct 26, 2024
2 parents 99bf0a0 + 34e0620 commit cb16d3c
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions app/assets/javascripts/index/note.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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) {
Expand Down Expand Up @@ -78,8 +80,6 @@ OSM.Note = function (map) {
icon: noteIcons[data.status]
});
}

if (callback) callback();
}

function updateButtons(form) {
Expand Down

0 comments on commit cb16d3c

Please sign in to comment.