Time on chat

This commit is contained in:
Kasper Rynning-Tønnesen
2017-09-28 12:04:36 +02:00
parent 182ebeca50
commit 0ee6a9fde7
3 changed files with 8 additions and 4 deletions

View File

@@ -98,7 +98,9 @@ allchat: function(inp) {
}
color = Helper.hexToRgb(color.substring(0,6));
var color_temp = Helper.rgbToHsl([color.r, color.g, color.b], false);
$("#chatall").append("<li title='"+inp.channel+"''><span style='color:"+color_temp+";'>"+inp.from+"</span></li>");
var _time = new Date();
var time = Helper.pad(_time.getHours()) + ":" + Helper.pad(_time.getMinutes());
$("#chatall").append("<li title='"+inp.channel+"''>" + time + " <span style='color:"+color_temp+";'>"+inp.from+"</span></li>");
var in_text = document.createTextNode(inp.msg);
$("#chatall li:last")[0].appendChild(in_text);
document.getElementById("chatall").scrollTop = document.getElementById("chatall").scrollHeight;
@@ -130,7 +132,9 @@ channelchat: function(data) {
}
color = Helper.hexToRgb(color.substring(0,6));
var color_temp = Helper.rgbToHsl([color.r, color.g, color.b], false);
$("#chatchannel").append("<li><span style='color:"+color_temp+";'>"+data.from+"</span></li>");
var _time = new Date();
var time = Helper.pad(_time.getHours()) + ":" + Helper.pad(_time.getMinutes());
$("#chatchannel").append("<li>" + time + "<span style='color:"+color_temp+";'>"+data.from+"</span></li>");
var in_text = document.createTextNode(data.msg);
$("#chatchannel li:last")[0].appendChild(in_text);
document.getElementById("chatchannel").scrollTop = document.getElementById("chatchannel").scrollHeight;