Show current date when hovering the time of a chat-message

This commit is contained in:
mluto 2013-01-04 17:18:03 +01:00
parent a42f220ee2
commit 4ea6ab6827

View file

@ -82,13 +82,22 @@ var chat = (function()
msg.time += this._pad.clientTimeOffset;
//create the time string
var minutes = "" + new Date(msg.time).getMinutes();
var hours = "" + new Date(msg.time).getHours();
var msgDate = new Date(msg.time);
var minutes = "" + msgDate.getMinutes();
var hours = "" + msgDate.getHours();
var month = "" + (msgDate.getMonth() + 1);
var day = "" + msgDate.getDate();
var year = "" + (msgDate.getYear() + 1900);
if(minutes.length == 1)
minutes = "0" + minutes ;
if(hours.length == 1)
hours = "0" + hours ;
if(month.length == 1)
month = "0" + month ;
if(day.length == 1)
day = "0" + day ;
var timeStr = hours + ":" + minutes;
var dateStr = month + "/" + day + "/" + year;
//create the authorclass
var authorClass = "author-" + msg.userId.replace(/[^a-y0-9]/g, function(c)
@ -111,7 +120,7 @@ var chat = (function()
var authorName = msg.userName == null ? _('pad.userlist.unnamed') : padutils.escapeHtml(msg.userName);
var html = "<p class='" + authorClass + "'><b>" + authorName + ":</b><span class='time " + authorClass + "'>" + timeStr + "</span> " + text + "</p>";
var html = "<p class='" + authorClass + "'><b>" + authorName + ":</b><span class='time " + authorClass + "' title='" + dateStr + "'>" + timeStr + "</span> " + text + "</p>";
$("#chattext").append(html);
//should we increment the counter??