diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-07 13:27:41 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-05-07 13:27:41 -0700 |
commit | f0f418f197227dfa55397b3debdc8fdc4dc9ed7f (patch) | |
tree | 389ca56665358e3358f12b03d6ecf2817f292800 | |
parent | 2a83df9bdd53c2e8ed061c257954e0b69c633b4a (diff) | |
download | dartboat-f0f418f197227dfa55397b3debdc8fdc4dc9ed7f.tar.gz dartboat-f0f418f197227dfa55397b3debdc8fdc4dc9ed7f.tar.xz |
web: remember layout setting
-rw-r--r-- | web/static/dartboat.js | 8 | ||||
-rw-r--r-- | web/static/style.css | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/web/static/dartboat.js b/web/static/dartboat.js index 8a1b19f..22c0728 100644 --- a/web/static/dartboat.js +++ b/web/static/dartboat.js @@ -112,9 +112,11 @@ function boatAfloat() { _init(); } -function flipControls() { - const enabled = $('#main').classList.toggle('right-controls'); +function flipControls(store_opt = true) { + const enabled = $('#main').classList.toggle('controls-on-right'); $('#flip-controls-button').textContent = enabled ? '\u2190' : '\u2192'; + if (store_opt) + localStorage.setItem('dartboat_controls_on_right', enabled); } document.addEventListener('DOMContentLoaded', () => { @@ -128,6 +130,8 @@ document.addEventListener('DOMContentLoaded', () => { toCString(e.target.value)); $$('[data-opt]').forEach(x => x.addEventListener('change', f)); + if (localStorage.getItem('dartboat_controls_on_right') == 'true') + flipControls(false); $('#flip-controls-button').addEventListener('click', flipControls); f = e => $(`#${e.target.dataset.modal}`).style.display = 'block'; diff --git a/web/static/style.css b/web/static/style.css index ba5e66e..2220cf9 100644 --- a/web/static/style.css +++ b/web/static/style.css @@ -27,7 +27,7 @@ div#main { grid-gap: 2px; } -div#main.right-controls { +div#main.controls-on-right { grid-template-columns: 1fr 80vh; grid-template-areas: 'settings-bar settings-bar' 'visits info' 'visits controls'; } |