From 7819f07da009cfcc8f5d76be2570fa64ade87daa Mon Sep 17 00:00:00 2001 From: fern <126544928+fern-bot@users.noreply.github.com> Date: Fri, 1 Nov 2024 12:30:20 -0400 Subject: [PATCH 1/4] create close-playground.js --- fern/assets/close-playground.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 fern/assets/close-playground.js diff --git a/fern/assets/close-playground.js b/fern/assets/close-playground.js new file mode 100644 index 000000000..1b492ee2d --- /dev/null +++ b/fern/assets/close-playground.js @@ -0,0 +1,31 @@ +document.addEventListener('click', function () { + function isPlaygroundEndpointButtonVisible() { + const playgroundEndpoint = document.querySelector('.playground-endpoint .fern-button.outlined'); + return playgroundEndpoint; + } + + function clickPlaygroundEndpointButton() { + const playgroundEndpointButton = document.querySelector('.playground-endpoint .fern-button.outlined'); + if (playgroundEndpointButton) { + playgroundEndpointButton.click(); + } + } + + const fernHeaderButtons = document.querySelectorAll('.fern-header-container button'); + fernHeaderButtons.forEach(button => { + button.addEventListener('click', function () { + if (isPlaygroundEndpointButtonVisible()) { + clickPlaygroundEndpointButton(); + } + }); + }); + + const fernHeaderTabs = document.querySelectorAll('.fern-header-container .fern-header-tab-button'); + fernHeaderTabs.forEach(button => { + button.addEventListener('click', function () { + if (isPlaygroundEndpointButtonVisible()) { + clickPlaygroundEndpointButton(); + } + }); + }); +}); From 7db548a7ebe79fe23c26400172c26211e01e9c6e Mon Sep 17 00:00:00 2001 From: fern <126544928+fern-bot@users.noreply.github.com> Date: Fri, 1 Nov 2024 12:31:29 -0400 Subject: [PATCH 2/4] Update docs.yml --- fern/docs.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fern/docs.yml b/fern/docs.yml index 6716bdd09..ea782a7df 100644 --- a/fern/docs.yml +++ b/fern/docs.yml @@ -36,6 +36,9 @@ landing-page: page: Welcome path: welcome.mdx css: assets/styles.css +js: + - path: ./assets/close-playground.js + strategy: lazyOnload navbar-links: - type: minimal text: Home From 2fb6a7a79465712f7afd5f2f7bc3f286d9bc1a6b Mon Sep 17 00:00:00 2001 From: fern <126544928+fern-bot@users.noreply.github.com> Date: Fri, 1 Nov 2024 12:38:24 -0400 Subject: [PATCH 3/4] Update close-playground.js --- fern/assets/close-playground.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fern/assets/close-playground.js b/fern/assets/close-playground.js index 1b492ee2d..6b32f31d9 100644 --- a/fern/assets/close-playground.js +++ b/fern/assets/close-playground.js @@ -11,7 +11,16 @@ document.addEventListener('click', function () { } } - const fernHeaderButtons = document.querySelectorAll('.fern-header-container button'); + const playgroundEndpoint = document.querySelector('.fern-header-container .fern-button'); + fernHeaderButtons.forEach(button => { + button.addEventListener('click', function () { + if (isPlaygroundEndpointButtonVisible()) { + clickPlaygroundEndpointButton(); + } + }); + }); + + const fernHeaderButtons = document.querySelectorAll('.fern-header .fern-button'); fernHeaderButtons.forEach(button => { button.addEventListener('click', function () { if (isPlaygroundEndpointButtonVisible()) { From 55081b0c921b26dae0f57f8ee7bc51ce31abe76b Mon Sep 17 00:00:00 2001 From: chdeskur Date: Fri, 1 Nov 2024 13:19:20 -0400 Subject: [PATCH 4/4] update buttons --- fern/assets/close-playground.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/fern/assets/close-playground.js b/fern/assets/close-playground.js index 6b32f31d9..7178185aa 100644 --- a/fern/assets/close-playground.js +++ b/fern/assets/close-playground.js @@ -10,17 +10,8 @@ document.addEventListener('click', function () { playgroundEndpointButton.click(); } } - - const playgroundEndpoint = document.querySelector('.fern-header-container .fern-button'); - fernHeaderButtons.forEach(button => { - button.addEventListener('click', function () { - if (isPlaygroundEndpointButtonVisible()) { - clickPlaygroundEndpointButton(); - } - }); - }); - - const fernHeaderButtons = document.querySelectorAll('.fern-header .fern-button'); + + const fernHeaderButtons = document.querySelectorAll('.fern-header a'); fernHeaderButtons.forEach(button => { button.addEventListener('click', function () { if (isPlaygroundEndpointButtonVisible()) {