Collapsible functionality implemented

This commit is contained in:
Luis Fernando Molina committed 2020-12-12 16:30:19 +01:00
1 parent 1fc049eb25
commit 583144b2f4
2 files changed
+70 -7

No files matched your search

@@ -443,6 +443,30 @@ function newSuperalgosDocSpace() {
scrollingDiv.scrollTop = topPos
}
function enableCollapsibleContent() {
let collapsibleElementsArray = document.getElementsByClassName("docs-collapsible-element")
for (let i = 0; i < collapsibleElementsArray.length; i++) {
collapsibleElementsArray[i].addEventListener("click", function () {
this.classList.toggle("docs-collapsible-active")
let content = this.nextElementSibling
if (content.style.display === "block") {
content.style.display = "none";
} else {
content.style.display = "block";
}
})
}
}
function disableCollapsibleContent() {
let collapsibleElementsArray = document.getElementsByClassName("docs-collapsible-element")
for (let i = 0; i < collapsibleElementsArray.length; i++) {
collapsibleElementsArray[i].removeEventListener("click", function () { })
}
}
function openSpaceAreaAndNavigateTo(category, type, project) {
navigateTo(category, type, project)
thisObject.sidePanelTab.open()
@@ -450,6 +474,8 @@ function newSuperalgosDocSpace() {
function navigateTo(category, type, project) {
disableCollapsibleContent()
docSchemaParagraphMap = new Map()
objectBeingRendered = {
category: category,
@@ -458,6 +484,7 @@ function newSuperalgosDocSpace() {
}
renderPage()
enableCollapsibleContent()
scrollToElement('docs-context-menu-clickeable-div')
}
@@ -542,16 +569,13 @@ function newSuperalgosDocSpace() {
paragraphIndex++
for (let i = 0; i < nodeAppDefinition.menuItems.length; i++) {
let menuItem = nodeAppDefinition.menuItems[i]
paragraph = {
style: "Subtitle",
text: menuItem.label
}
renderParagraph(paragraph, key)
paragraphIndex++
HTML = HTML + '<button type="button" class="docs-collapsible-element">' + menuItem.label + '</button>'
HTML = HTML + '<div class="docs-collapsible-content">'
paragraph = {
style: "Text",
text: menuItem.label + ' has the following properties:'
text: 'The ' + menuItem.label + ' menu item has the following properties:'
}
renderParagraph(paragraph, key)
paragraphIndex++
@@ -564,6 +588,8 @@ function newSuperalgosDocSpace() {
renderParagraph(paragraph, key)
paragraphIndex++
}
HTML = HTML + '</div>'
}
}
}