From 5613c1a82cb91a9d47a2b3efc178c81dd0dabe7d Mon Sep 17 00:00:00 2001 From: Tristan Schneider Date: Fri, 28 Oct 2022 21:15:29 +0000 Subject: [PATCH] add time since last word feature --- index.php | 2 ++ owe.js | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/index.php b/index.php index a9967c8..550e008 100644 --- a/index.php +++ b/index.php @@ -39,6 +39,8 @@ if (array_key_exists("submitted", $_REQUEST)) { $sentences = fopen("./data/sentences.txt", "a") or die("unable to open sentences file"); $content = "\n"; + var relative_time = getTimeSinceLast(); + var days = Math.floor(relative_time/(3600*24)); + var hours = Math.floor(relative_time/(3600))%24; + var minutes = Math.floor(relative_time/(60))%60; + loginArea.innerHTML += "Schon seit " + days + " Tagen, " + hours + " Stunden und " + minutes + " Minuten!"; } window.onfocus = resetUnread;