Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions fern/assets/close-playground.js
Original file line number Diff line number Diff line change
@@ -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 a');
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();
}
});
});
});
3 changes: 3 additions & 0 deletions fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading