From f0f418f197227dfa55397b3debdc8fdc4dc9ed7f Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Sat, 7 May 2022 13:27:41 -0700 Subject: web: remember layout setting --- web/static/dartboat.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'web/static/dartboat.js') 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'; -- cgit v1.2.3-70-g09d2