From 1546d1ad242f65fcb9ad0ec3c2fcc4b237dc7ff0 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Fri, 15 Apr 2022 18:02:48 -0700 Subject: reuse variables for conciseness --- options.js | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'options.js') diff --git a/options.js b/options.js index a0b6b71..a218528 100644 --- a/options.js +++ b/options.js @@ -17,22 +17,17 @@ function saveOptions() { function restoreOptions() { // default to 24 for both unset and invalid - let timefmt = localStorage['timefmt'] || 24; - let timefmt_btn = document.getElementById('t' + timefmt) || + let val = localStorage['timefmt'] || 24; + let btn = document.getElementById('t' + val) || document.getElementById('t24'); - timefmt_btn.checked = true; - - let fg = localStorage['fg']; - if (fg) - document.getElementById('fg').value = fg; - - let fg_date = localStorage['fg_date']; - if (fg_date) - document.getElementById('fg_date').value = fg_date; - - let bg = localStorage['bg']; - if (bg) - document.getElementById('bg').value = bg; + btn.checked = true; + + if ((val = localStorage['fg'])) + document.getElementById('fg').value = val; + if ((val = localStorage['fg_date'])) + document.getElementById('fg_date').value = val; + if ((val = localStorage['bg'])) + document.getElementById('bg').value = val; } function startOptions() { -- cgit v1.2.3-70-g09d2