From 30ec96be0dd8941669f184e3306e97d129d245d2 Mon Sep 17 00:00:00 2001 From: Aevann Date: Thu, 3 Aug 2023 13:46:00 +0300 Subject: [PATCH] same as last commit --- files/assets/js/core.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/files/assets/js/core.js b/files/assets/js/core.js index 9a10ffebb..fc507bb13 100644 --- a/files/assets/js/core.js +++ b/files/assets/js/core.js @@ -598,11 +598,10 @@ if (screen_width <= 768) { }, 100); }); - window.addEventListener('hashchange', (e) => { - if (e.oldURL.includes('#m-')) { - const modal_id = e.oldURL.split('#m-')[1] - const modal = document.getElementById(modal_id) - bootstrap.Modal.getInstance(modal).hide() + window.addEventListener('hashchange', () => { + if (!location.hash.startsWith("#m-")) { + const curr_modal = bootstrap.Modal.getInstance(document.getElementsByClassName('show')[0]) + if (curr_modal) curr_modal.hide() } }); }