//= require qs/dist/qs
$(document).ready(function () {
- var loaderTimeout;
-
var map = new L.OSM.Map("map", {
zoomControl: false,
layerControl: false,
map.setSidebarOverlaid(false);
- clearTimeout(loaderTimeout);
-
- loaderTimeout = setTimeout(function () {
- $("#sidebar_loader").show();
- }, 200);
+ $("#sidebar_loader").show().addClass("delayed-fade-in");
// IE<10 doesn't respect Vary: X-Requested-With header, so
// prevent caching the XHR response as a full-page URL.
url: content_path,
dataType: "html",
complete: function (xhr) {
- clearTimeout(loaderTimeout);
$("#flash").empty();
- $("#sidebar_loader").hide();
+ $("#sidebar_loader").removeClass("delayed-fade-in").hide();
var content = $(xhr.responseText);
if (OSM.MATOMO) {
map.on("layeradd", function (e) {
if (e.layer.options) {
- var goal = OSM.MATOMO.goals[e.layer.options.keyid];
+ var goal = OSM.MATOMO.goals[e.layer.options.layerId];
if (goal) {
$("body").trigger("matomogoal", goal);
});
function sendRemoteEditCommand(url, callback) {
- var iframe = $("<iframe>");
- var timeoutId = setTimeout(function () {
- alert(I18n.t("site.index.remote_failed"));
- iframe.remove();
- }, 5000);
-
- iframe
- .hide()
- .appendTo("body")
- .attr("src", url)
- .on("load", function () {
- clearTimeout(timeoutId);
- iframe.remove();
- if (callback) callback();
+ fetch(url, { mode: "no-cors", signal: AbortSignal.timeout(5000) })
+ .then(callback)
+ .catch(function () {
+ alert(I18n.t("site.index.remote_failed"));
});
}
if (OSM.router.route(this.pathname + this.search + this.hash)) {
e.preventDefault();
+ if (this.pathname !== "/directions") {
+ $("header").addClass("closed");
+ }
}
});