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 --- tempo.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'tempo.js') diff --git a/tempo.js b/tempo.js index 3dcb1b9..4380603 100644 --- a/tempo.js +++ b/tempo.js @@ -31,17 +31,13 @@ function updateTime() { function startTempo() { timefmt = localStorage['timefmt']; - let fg = localStorage['fg']; - if (fg) - document.body.style.color = fg; - - let fg_date = localStorage['fg_date']; - if (fg_date) - document.getElementById('dateval').style.color = fg_date; - - let bg = localStorage['bg']; - if (bg) - document.body.style.backgroundColor = bg; + let val; + if ((val = localStorage['fg'])) + document.body.style.color = val; + if ((val = localStorage['fg_date'])) + document.getElementById('dateval').style.color = val; + if ((val = localStorage['bg'])) + document.body.style.backgroundColor = val; updateTime(); setTimeout(function() { updateTime(); setInterval(updateTime, 1000) }, -- cgit v1.2.3-70-g09d2