ArneVogel / listudy

Listudy - chess training server
https://listudy.org
GNU Affero General Public License v3.0
292 stars 45 forks source link

Storing options in localstorage #136

Closed olleeriksson closed 1 year ago

olleeriksson commented 1 year ago

Hopefully this one is a little simpler. I've changed so that the options are now stored in local storage. I had it prepared since before.

I changed the remaining two options that used a boolean to store the option to a translation key instead so all options follow the same pattern, and it was also easier to store a text string in local storage.

Also, another quirk. I think the value of keymove(enabled|disabled) and review_(slow|fast) had been reversed so I changed them. For example, the text of key_move_enabled was "Jump to key move: off" so I changed it to "on" instead so that the translation key correctly conveys what it means. In toggle_key_move() there was a similar mix-up which undid the confusion with the translation key. So everything worked before but the boolean value was just the reverse of what the option said.

And added a fallback in the switch-cases just to be safe if an option change name in the future.

BTW, I've got this option prepared as well. Do you want it? I can put up a PR as soon as this one is merged.

image

ArneVogel commented 1 year ago

Thanks a lot. I like the get_option_from_localstorage solution :+1: