$ git clone http://ion.nu/git/webchat
commit 8e820e5d1d015bda94ad85f8582d743ef36cd650
Author: Alicia <...>
Date: Thu Dec 31 00:45:18 2015 +0100
Fixed the timestamps (previously stuck at [00:00])
diff --git a/chat.js b/chat.js
index a271a44..1346ec9 100644
--- a/chat.js
+++ b/chat.js
@@ -64,6 +64,12 @@ function chatnote(msg)
{
chatnoteon(msg, tabs[0]);
}
+function twodigits(num)
+{
+ num=num.toString();
+ while(num.length<2){num='0'+num;}
+ return num;
+}
var unseenmessages=0;
function chatmsgon(name, msg, color, tab)
{
@@ -83,7 +89,8 @@ function chatmsgon(name, msg, color, tab)
var scroll=(!tab.chat.scrollTopMax || tab.chat.scrollTop==tab.chat.scrollTopMax);
var line=document.createElement("div");
var timestamp=document.createElement("pre");
- timestamp.textContent='[00:00]';
+ var date=new Date();
+ timestamp.textContent='['+twodigits(date.getHours())+':'+twodigits(date.getMinutes())+']';
var text=document.createElement("span");
if(msg.substring(0,4)=='/me ')
{