From 99fcbebff5d5dfce9a572adfd1713c9ccb85f851 Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 29 Sep 2023 07:50:42 +0300 Subject: [PATCH] replace hash to prevent unnecessary jumping when the user alrdy has a hash --- files/assets/js/core.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/files/assets/js/core.js b/files/assets/js/core.js index 8c7844383..e33d7dcf4 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -644,7 +644,10 @@ if (screen_width <= 768) { if (object) { object.addEventListener('shown.bs.modal', function (e) { - location.hash = `m-${e.target.id}`; + if (location.hash) + location.replace(`${location.href.split('#')[0]}#m-${e.target.id}`); + else + location.hash = `m-${e.target.id}`; }); object.addEventListener('hide.bs.modal', function (e) {