timekeeper

[Abandoned unfinished] CGI web application in C for time tracking. (My first, just a learning project)
Log | Files | Refs | README

commit a0992ab6b44f2a1136abf345d9e58f73a6d4ca6d
parent 5e8b95ab652d56417925052d06f9ba4df579bfae
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date:   Sun, 17 Mar 2024 16:10:51 -0700

Allow counter script to work without a total row

In some cases the total row isn't displayed, yet a live counter is
still suppost to be updated.

Diffstat:
Mscripts/counter.js | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/counter.js b/scripts/counter.js @@ -33,7 +33,10 @@ function updatetime(counter, start, total, total_elapsed) { let counter = document.getElementById("counter") if (counter) { - let total = document.getElementById("total") let d = parseduration(counter.dateTime) - updatetime(counter, gettime() - d, total, parseduration(total.dateTime) - d) + let total = document.getElementById("total") + if (total) + updatetime(counter, gettime() - d, total, parseduration(total.dateTime) - d) + else + updatetime(counter, gettime() - d) }