From ab8de70aa553ba98ee552a033b7d2c84aabe5d0c Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Fri, 16 Aug 2024 13:57:12 +0100 Subject: [PATCH] Remove semicolons --- app/frontend/controllers/tabs_controller.js | 36 ++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/app/frontend/controllers/tabs_controller.js b/app/frontend/controllers/tabs_controller.js index da98bd8cc..f8b1119b8 100644 --- a/app/frontend/controllers/tabs_controller.js +++ b/app/frontend/controllers/tabs_controller.js @@ -1,35 +1,35 @@ document.addEventListener('DOMContentLoaded', function() { - const urlParams = new URLSearchParams(window.location.search); - let tab = urlParams.get('tab'); + 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()}`); + tab = window.location.hash.substring(1) + urlParams.set('tab', tab) + history.replaceState(null, null, `${window.location.pathname}?${urlParams.toString()}`) } function activateTab(tabId) { - const tabElement = document.getElementById(tabId); + const tabElement = document.getElementById(tabId) if (tabElement) { - tabElement.click(); + tabElement.click() } - history.replaceState(null, null, `${window.location.pathname}?${urlParams.toString()}`); + history.replaceState(null, null, `${window.location.pathname}?${urlParams.toString()}`) } 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()}`); + event.preventDefault() + const targetId = this.getAttribute('href').substring(1) + activateTab(targetId) + urlParams.set('tab', targetId) + history.replaceState(null, null, `${window.location.pathname}?${urlParams.toString()}`) } if (tab) { - activateTab(`tab_${tab}`); + activateTab(`tab_${tab}`) } - window.scrollTo(0, 0); + window.scrollTo(0, 0) document.querySelectorAll('.govuk-tabs__tab').forEach(tabElement => { - tabElement.addEventListener('click', handleTabClick); - }); -}); + tabElement.addEventListener('click', handleTabClick) + }) +})