changeset 1292:a6892dcf5659

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 03 Jan 2019 15:01:36 -0700
parents 2bbc6f132d61
children 007ceb8dcf89
files website/src/fschmidt/stopwatch.html
diffstat 1 files changed, 7 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/website/src/fschmidt/stopwatch.html	Wed Jan 02 21:54:35 2019 -0700
+++ b/website/src/fschmidt/stopwatch.html	Thu Jan 03 15:01:36 2019 -0700
@@ -22,7 +22,7 @@
 				return Math.floor(Date.now()/1000);
 			}
 
-			function showTime() {
+			function show() {
 				var start = localStorage.start;
 				var time;
 				if( !start ) {
@@ -40,9 +40,8 @@
 				minutes = ('0'+minutes).slice(-2);
 				time = hours + ':' + minutes + ':' + seconds;
 				document.querySelector('[time]').innerHTML = time;
-			}
 
-			function fixButtons() {
+				// fix buttons
 				var isRunning = localStorage.start && !localStorage.stop;
 				if( isRunning ) {
 					document.querySelector('[start]').style.display = 'none';
@@ -67,25 +66,23 @@
 					localStorage.removeItem('stop');
 					localStorage.start = now() - (stop - localStorage.start);
 				}
-				fixButtons();
+				show();
 			}
 
 			function stop() {
 				localStorage.stop = now();
-				fixButtons();
+				show();
 			}
 
 			function reset() {
 				localStorage.removeItem('start');
 				localStorage.removeItem('stop');
-				showTime();
-				fixButtons();
+				show();
 			}
 
 			function loaded() {
-				showTime();
-				fixButtons();
-				setInterval(showTime,1000);
+				show();
+				setInterval(show,1000);
 			}
 
 		</script>