mirror of
https://github.com/manyfold3d/manyfold.git
synced 2026-10-23 04:02:19 -05:00
25 lines
781 B
TypeScript
25 lines
781 B
TypeScript
import { Collapse } from 'bootstrap'
|
|
|
|
document.addEventListener('ManyfoldReady', () => {
|
|
const updateSections = (active: string): void => {
|
|
const selected = 'options-' + active
|
|
document.querySelectorAll('.storage-collapse').forEach((section: HTMLDivElement) => {
|
|
const control = Collapse.getOrCreateInstance(section, { toggle: false })
|
|
if (section.id === selected) {
|
|
control.show()
|
|
} else {
|
|
control.hide()
|
|
}
|
|
})
|
|
}
|
|
|
|
document.querySelectorAll('#library_storage_service').forEach((select: HTMLSelectElement) => {
|
|
updateSections(select.value)
|
|
select.addEventListener('change', (event: Event) => {
|
|
if (event.target != null) {
|
|
updateSections((event.target as HTMLSelectElement).value)
|
|
}
|
|
})
|
|
})
|
|
})
|