From 1f7dcff966bc8009624abd7b3dd328969bc7a765 Mon Sep 17 00:00:00 2001 From: SlavaSereb <88251870+SlavaSereb@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:15:36 +0200 Subject: [PATCH] Update scalar-api-interaction.js --- scalar-api-interaction.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scalar-api-interaction.js b/scalar-api-interaction.js index a646e53..758b10b 100644 --- a/scalar-api-interaction.js +++ b/scalar-api-interaction.js @@ -3,11 +3,15 @@ // Function to hide the specified element function hideElement() { - const elementToHide = document.querySelector('#app > div.api-references-layout > div.scalar-app.scalar-api-reference.references-layout.references-sidebar.references-sidebar-mobile-open > section > div.narrow-references-container > div:nth-child(2) > section > div > div > div:nth-child(2) > div > div > div:nth-child(1)'); - console.log("Found element to hide:", !!elementToHide); - if (elementToHide) { - elementToHide.style.display = 'none'; - console.log("Element hidden successfully"); + let elementsToHide = []; + elementsToHide.push(document.querySelector('#app > div.api-references-layout > div.scalar-app.scalar-api-reference.references-layout.references-sidebar.references-sidebar-mobile-open > section > div.narrow-references-container > div:nth-child(2) > section > div > div > div:nth-child(2) > div > div > div:nth-child(1)')); + elementsToHide.push(document.querySelector('#app > div.api-references-layout > div.scalar-app.scalar-api-reference.references-layout.references-sidebar.references-sidebar-mobile-open > section > div.narrow-references-container > div:nth-child(2) > section > div > div > div:nth-child(2) > div > div > div:nth-child(2)')); + + if (elementsToHide) { + elementsToHide.forEach( (elementToHide) => { + elementToHide.style.display = 'none'; + console.log("Element hidden successfully"); + }) } }