djplaner / Content-Interface-Tweak

Improves both the task of creating content for Blackboard Learn, and reading that content.
https://djplaner.github.io/Content-Interface-Tweak/
GNU General Public License v3.0
0 stars 0 forks source link

Remember the state of the accordion #10

Open djplaner opened 3 years ago

djplaner commented 3 years ago

i.e. a reader has read through a collection of accordions (complex document). Finds a link. Follows it. When they return to the page it doesn't remember which accordions were open. The reader has to remember.

djplaner commented 3 years ago

numerous people appear to solve this by having the Javascript maintain/use a cookie (or localstorage) to record state.

Attempt 1

  1. When starting up check storage option for parameter (unique to page)
  2. Set the active active accordion to that one
  3. When the activate button is pressed, change the storage option.

Challenges / Changes

  1. Would need to support multiple pages
  2. Might be better to track all of the open accordions and not just the active one

Implementation

First version will just be the one page and the active accordion

  1. Check localstorage early in start up of content.js
  2. modify call to accordion content.js:199
  3. Figure out if and how there is a need to modify the various click functions

Actually, modify the code from content.js:259 onwards which is updating the open accordion based on hash parameter.