persist expand state

This commit is contained in:
Garry Ing 2021-04-11 14:54:57 -04:00
parent 3913152fa3
commit 3df190e056
No known key found for this signature in database
GPG Key ID: 3B379B1F2193CC3E

View File

@ -372,10 +372,20 @@ if (typeof window.graphData !== 'undefined') {
// Note expander
const noteExpander = document.querySelector('#note-expand')
const noteContainer = document.querySelector('#note-container')
if (noteExpander) {
if (window.localStorage.getItem('noteExpanded') === 'true') {
noteExpander.classList.add('rotate-180')
noteContainer.classList.add('w-two-thirds')
}
noteExpander.addEventListener('click', (event) => {
document.querySelector('#note-container').classList.toggle('w-two-thirds')
noteContainer.classList.toggle('w-two-thirds')
event.target.classList.toggle('rotate-180')
if (window.localStorage.getItem('noteExpanded') === 'true') {
window.localStorage.setItem('noteExpanded', 'false')
} else {
window.localStorage.setItem('noteExpanded', 'true')
}
})
}