diff --git a/openapi/v2023.8.1/index.html b/openapi/v2023.8.1/index.html index 80f1e7a..52a04e4 100644 --- a/openapi/v2023.8.1/index.html +++ b/openapi/v2023.8.1/index.html @@ -3,8 +3,8 @@ - - GovStack Consent Building Block APIs + + GovStack Consent BB APIs { const rapiDocElement = document.querySelector("rapi-doc"); - // Function to apply the style when the element is available - const applyStyleToApiInfo = () => { - const header = - rapiDocElement.shadowRoot.querySelector(".main-header"); - const mainContentElement = - rapiDocElement.shadowRoot.querySelector(".main-content"); - const apiInfoElement = - rapiDocElement.shadowRoot.querySelector("#api-info"); - const labelOperationPathElements = - rapiDocElement.shadowRoot.querySelectorAll( - "[part*='section-operation-webhook-method']" - ); + if (window.innerWidth <= 768) { + // Assuming 768px as the breakpoint for tablet size + rapiDocElement.setAttribute("render-style", "read"); // for sizes less than a tablet + + // Function to apply the style when the element is available + const applyStyleToApiInfo = () => { + const mainContentElement = + rapiDocElement.shadowRoot.querySelector(".main-content"); + const apiInfoElement = + rapiDocElement.shadowRoot.querySelector("#api-info"); + const labelOperationPathElements = + rapiDocElement.shadowRoot.querySelectorAll( + "[part*='section-operation-webhook-method']" + ); + + if ( + apiInfoElement && + labelOperationPathElements && + mainContentElement + ) { + mainContentElement.style.padding = "10px"; + apiInfoElement.style.marginLeft = "0"; + labelOperationPathElements.forEach(function (element) { + element.style.overflowX = "scroll"; + }); + observer.disconnect(); // Stop observing once style is applied + } + }; - if ( - apiInfoElement && - labelOperationPathElements && - mainContentElement && - header - ) { - mainContentElement.style.padding = "10px"; - apiInfoElement.style.marginLeft = "0"; - header.style.padding = "8px 4px 8px 16px"; - labelOperationPathElements.forEach(function (element) { - element.style.overflowX = "scroll"; + // Observe changes in the Shadow DOM + const observer = new MutationObserver(applyStyleToApiInfo); + if (rapiDocElement.shadowRoot) { + observer.observe(rapiDocElement.shadowRoot, { + childList: true, + subtree: true, }); - observer.disconnect(); // Stop observing once style is applied + applyStyleToApiInfo(); // Try applying the style immediately in case the element is already there } - }; - - // Observe changes in the Shadow DOM - const observer = new MutationObserver(applyStyleToApiInfo); - if (rapiDocElement.shadowRoot) { - observer.observe(rapiDocElement.shadowRoot, { - childList: true, - subtree: true, - }); - applyStyleToApiInfo(); // Try applying the style immediately in case the element is already there - } - if (window.innerWidth <= 768) { - // Assuming 768px as the breakpoint for tablet size - rapiDocElement.setAttribute("render-style", "view"); // for sizes less than a tablet } else { - rapiDocElement.setAttribute("render-style", "view"); // for sizes greater than a tablet + rapiDocElement.setAttribute("render-style", "focused"); // for sizes greater than a tablet } }); - + \ No newline at end of file diff --git a/openapi/v2023.8.2/index.html b/openapi/v2023.8.2/index.html index 80f1e7a..52a04e4 100644 --- a/openapi/v2023.8.2/index.html +++ b/openapi/v2023.8.2/index.html @@ -3,8 +3,8 @@ - - GovStack Consent Building Block APIs + + GovStack Consent BB APIs { const rapiDocElement = document.querySelector("rapi-doc"); - // Function to apply the style when the element is available - const applyStyleToApiInfo = () => { - const header = - rapiDocElement.shadowRoot.querySelector(".main-header"); - const mainContentElement = - rapiDocElement.shadowRoot.querySelector(".main-content"); - const apiInfoElement = - rapiDocElement.shadowRoot.querySelector("#api-info"); - const labelOperationPathElements = - rapiDocElement.shadowRoot.querySelectorAll( - "[part*='section-operation-webhook-method']" - ); + if (window.innerWidth <= 768) { + // Assuming 768px as the breakpoint for tablet size + rapiDocElement.setAttribute("render-style", "read"); // for sizes less than a tablet + + // Function to apply the style when the element is available + const applyStyleToApiInfo = () => { + const mainContentElement = + rapiDocElement.shadowRoot.querySelector(".main-content"); + const apiInfoElement = + rapiDocElement.shadowRoot.querySelector("#api-info"); + const labelOperationPathElements = + rapiDocElement.shadowRoot.querySelectorAll( + "[part*='section-operation-webhook-method']" + ); + + if ( + apiInfoElement && + labelOperationPathElements && + mainContentElement + ) { + mainContentElement.style.padding = "10px"; + apiInfoElement.style.marginLeft = "0"; + labelOperationPathElements.forEach(function (element) { + element.style.overflowX = "scroll"; + }); + observer.disconnect(); // Stop observing once style is applied + } + }; - if ( - apiInfoElement && - labelOperationPathElements && - mainContentElement && - header - ) { - mainContentElement.style.padding = "10px"; - apiInfoElement.style.marginLeft = "0"; - header.style.padding = "8px 4px 8px 16px"; - labelOperationPathElements.forEach(function (element) { - element.style.overflowX = "scroll"; + // Observe changes in the Shadow DOM + const observer = new MutationObserver(applyStyleToApiInfo); + if (rapiDocElement.shadowRoot) { + observer.observe(rapiDocElement.shadowRoot, { + childList: true, + subtree: true, }); - observer.disconnect(); // Stop observing once style is applied + applyStyleToApiInfo(); // Try applying the style immediately in case the element is already there } - }; - - // Observe changes in the Shadow DOM - const observer = new MutationObserver(applyStyleToApiInfo); - if (rapiDocElement.shadowRoot) { - observer.observe(rapiDocElement.shadowRoot, { - childList: true, - subtree: true, - }); - applyStyleToApiInfo(); // Try applying the style immediately in case the element is already there - } - if (window.innerWidth <= 768) { - // Assuming 768px as the breakpoint for tablet size - rapiDocElement.setAttribute("render-style", "view"); // for sizes less than a tablet } else { - rapiDocElement.setAttribute("render-style", "view"); // for sizes greater than a tablet + rapiDocElement.setAttribute("render-style", "focused"); // for sizes greater than a tablet } }); - + \ No newline at end of file