From 4f52951d2310a4c216466705d955d9ef571b56bc Mon Sep 17 00:00:00 2001 From: Marwin Hochfelsner <50826859+hlfan@users.noreply.github.com> Date: Sun, 27 Jul 2025 14:59:39 +0200 Subject: [PATCH] Make handler able to handle SVG links --- app/assets/javascripts/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/index.js b/app/assets/javascripts/index.js index d3e0cbbb7..7295df7f2 100644 --- a/app/assets/javascripts/index.js +++ b/app/assets/javascripts/index.js @@ -334,13 +334,14 @@ $(function () { } // Ignore cross-protocol and cross-origin links. - if (location.protocol !== this.protocol || location.host !== this.host) { + const url = new URL($(this).attr("href"), location); + if (location.protocol !== url.protocol || location.host !== url.host) { return; } - if (OSM.router.route(this.pathname + this.search + this.hash)) { + if (OSM.router.route(url.pathname + url.search + url.hash)) { e.preventDefault(); - if (this.pathname !== "/directions") { + if (url.pathname !== "/directions") { $("header").addClass("closed"); } } -- 2.39.5