KirkMcDonald / kirkmcdonald.github.io

Simple web-based calculator for the game Factorio.
Apache License 2.0
547 stars 146 forks source link

Suggestion: Use HTML5 localStorage to save default settings #59

Open DarkMatterMatt opened 6 years ago

DarkMatterMatt commented 6 years ago

It would be helpful to load default settings when navigating to the main page (with no hash).

You could easily use HTML5 localStorage for this (with JSON.stringify and JSON.parse).

KirkMcDonald commented 6 years ago

I think there are three parts to this:

  1. Add a button to the settings tab which will save the current settings to local storage.
  2. Add a button to the settings tab which will load the saved settings.
  3. Load those settings if the URL fragment is empty.
DarkMatterMatt commented 6 years ago

I've forked your code and made it work on a locally hosted site - the only annoying thing is GitHub thinks I've changed everything because of the way Atom Beautifier works. Do you have a code formatter that you use (that I can use to compare changes in my code)?

KirkMcDonald commented 6 years ago

I do not use a code formatter. I do it all by hand, for better or worse.

filipre commented 5 years ago

Related PR: https://github.com/KirkMcDonald/kirkmcdonald.github.io/pull/65