X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/aebacc88de18c24c583a12b589eb98cf0b826627..d095dfe3d4c1ec90cebdfb3307564022cbeaf878:/app/assets/javascripts/index/changeset.js diff --git a/app/assets/javascripts/index/changeset.js b/app/assets/javascripts/index/changeset.js index 39b4abde1..1ec5940b2 100644 --- a/app/assets/javascripts/index/changeset.js +++ b/app/assets/javascripts/index/changeset.js @@ -1,6 +1,6 @@ OSM.Changeset = function (map) { - var page = {}, - content = $("#sidebar_content"); + const page = {}, + content = $("#sidebar_content"); page.pushstate = page.popstate = function (path) { OSM.loadSidebarContent(path, function () { @@ -12,9 +12,10 @@ OSM.Changeset = function (map) { const changesetData = content.find("[data-changeset]").data("changeset"); changesetData.type = "changeset"; + const hashParams = OSM.parseHash(window.location.hash); initialize(); map.addObject(changesetData, function (bounds) { - if (!window.location.hash && bounds.isValid()) { + if (!hashParams.center && bounds.isValid()) { OSM.router.withoutMoveListener(function () { map.fitBounds(bounds); }); @@ -23,7 +24,7 @@ OSM.Changeset = function (map) { }; function updateChangeset(method, url, include_data) { - var data; + let data; content.find("#comment-error").prop("hidden", true); content.find("button[data-method][data-url]").prop("disabled", true); @@ -55,8 +56,8 @@ OSM.Changeset = function (map) { function initialize() { content.find("button[data-method][data-url]").on("click", function (e) { e.preventDefault(); - var data = $(e.target).data(); - var include_data = e.target.name === "comment"; + const data = $(e.target).data(); + const include_data = e.target.name === "comment"; updateChangeset(data.method, data.url, include_data); });