Skip to content

Commit 19d0a51

Browse files
fixed toggling sidebar on mobile
1 parent 15879c9 commit 19d0a51

File tree

1 file changed

+19
-12
lines changed
  • scaladoc/resources/dotty_res/scripts

1 file changed

+19
-12
lines changed

scaladoc/resources/dotty_res/scripts/ux.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,6 @@ function attachAllListeners() {
110110

111111
const documentableBriefs = document.querySelectorAll(".documentableBrief");
112112
[...documentableBriefs].forEach((brief) => {
113-
console.log(
114-
brief.parentElement.parentElement.parentElement.previousElementSibling
115-
.children[0],
116-
);
117-
118113
brief.addEventListener("click", () => {
119114
brief.parentElement.parentElement.parentElement.parentElement.classList.add(
120115
"expand",
@@ -187,12 +182,12 @@ function attachAllListeners() {
187182
);
188183

189184
const toggleShowAllElem = (element) => {
190-
if(element.textContent == "Show all") {
191-
element.textContent = "Collapse"
185+
if (element.textContent == "Show all") {
186+
element.textContent = "Collapse";
192187
} else {
193-
element.textContent = "Show all"
188+
element.textContent = "Show all";
194189
}
195-
}
190+
};
196191

197192
document.querySelectorAll(".supertypes").forEach((el) =>
198193
el.lastElementChild.addEventListener("click", () => {
@@ -313,10 +308,22 @@ function attachAllListeners() {
313308
// when document is loaded graph needs to be shown
314309
}
315310

316-
const DYNAMIC_PAGE_LOAD = "dynamicPageLoad"
311+
const DYNAMIC_PAGE_LOAD = "dynamicPageLoad";
317312
window.addEventListener(DYNAMIC_PAGE_LOAD, () => {
318-
attachAllListeners()
319-
})
313+
attachAllListeners();
314+
});
315+
316+
window.addEventListener("dynamicPageLoad", () => {
317+
const leftColumn = document.querySelector(".show");
318+
if (leftColumn) leftColumn.classList.remove("show");
319+
320+
const mobileSidebarToggleButton = document.querySelector(".menu-shown");
321+
if (mobileSidebarToggleButton)
322+
mobileSidebarToggleButton.classList.remove("menu-shown");
323+
324+
const content = document.querySelector(".sidebar-shown");
325+
if (content) content.classList.remove("sidebar-shown");
326+
});
320327

321328
window.addEventListener("DOMContentLoaded", () => {
322329
hljs.registerLanguage("scala", highlightDotty);

0 commit comments

Comments
 (0)