From ad4c052b667bd2c992f99774b67a5f565a45e132 Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Fri, 16 Aug 2024 14:03:27 +0100 Subject: [PATCH] Add spaces and use window.history instead of just history --- app/frontend/controllers/tabs_controller.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/frontend/controllers/tabs_controller.js b/app/frontend/controllers/tabs_controller.js index f8b1119b8..7cfd65bbb 100644 --- a/app/frontend/controllers/tabs_controller.js +++ b/app/frontend/controllers/tabs_controller.js @@ -1,26 +1,26 @@ -document.addEventListener('DOMContentLoaded', function() { +document.addEventListener('DOMContentLoaded', function () { const urlParams = new URLSearchParams(window.location.search) let tab = urlParams.get('tab') if (!tab && window.location.hash) { tab = window.location.hash.substring(1) urlParams.set('tab', tab) - history.replaceState(null, null, `${window.location.pathname}?${urlParams.toString()}`) + window.history.replaceState(null, null, `${window.location.pathname}?${urlParams.toString()}`) } - function activateTab(tabId) { + function activateTab (tabId) { const tabElement = document.getElementById(tabId) if (tabElement) { tabElement.click() } - history.replaceState(null, null, `${window.location.pathname}?${urlParams.toString()}`) + window.history.replaceState(null, null, `${window.location.pathname}?${urlParams.toString()}`) } - function handleTabClick(event) { + function handleTabClick (event) { event.preventDefault() const targetId = this.getAttribute('href').substring(1) activateTab(targetId) urlParams.set('tab', targetId) - history.replaceState(null, null, `${window.location.pathname}?${urlParams.toString()}`) + window.history.replaceState(null, null, `${window.location.pathname}?${urlParams.toString()}`) } if (tab) {