From 6d7ba58f880be618ade07f8ea080fe8c4bf8a896 Mon Sep 17 00:00:00 2001 From: cyfraeviolae Date: Wed, 3 Apr 2024 03:10:44 -0400 Subject: venv --- .../middleware/exceptions/templates/scripts.js | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/scripts.js (limited to 'venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/scripts.js') diff --git a/venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/scripts.js b/venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/scripts.js new file mode 100644 index 0000000..014a256 --- /dev/null +++ b/venv/lib/python3.11/site-packages/litestar/middleware/exceptions/templates/scripts.js @@ -0,0 +1,27 @@ +const expanders = document.querySelectorAll(".frame .expander"); + +for (const expander of expanders) { + expander.addEventListener("click", (evt) => { + const currentSnippet = evt.currentTarget.closest(".frame"); + const snippetWrapper = currentSnippet.querySelector( + ".code-snippet-wrapper", + ); + if (currentSnippet.classList.contains("collapsed")) { + snippetWrapper.style.height = `${snippetWrapper.scrollHeight}px`; + currentSnippet.classList.remove("collapsed"); + } else { + currentSnippet.classList.add("collapsed"); + snippetWrapper.style.height = "0px"; + } + }); +} + +// init height for non-collapsed code snippets so animation will be show +// their first collapse +const nonCollapsedSnippets = document.querySelectorAll( + ".frame:not(.collapsed) .code-snippet-wrapper", +); + +for (const snippet of nonCollapsedSnippets) { + snippet.style.height = `${snippet.scrollHeight}px`; +} -- cgit v1.2.3