Added day-seperator in chat

This commit is contained in:
mluto 2013-01-06 12:56:25 +01:00
parent 0eeed7abef
commit e932b206e2
2 changed files with 16 additions and 1 deletions

View file

@ -559,6 +559,14 @@ table#otheruserstable {
margin-right: 3px; margin-right: 3px;
margin-top: 2px; margin-top: 2px;
} }
.chatDaySeperator
{
text-align:center;
border-bottom: 1px solid #aaa;
line-height:0.85em;
margin:3px 0 5px;
color:#888;
}
.exporttype { .exporttype {
margin-top: 4px; margin-top: 4px;
background-repeat: no-repeat; background-repeat: no-repeat;

View file

@ -25,6 +25,8 @@ var padcookie = require('./pad_cookie').padcookie;
var Tinycon = require('tinycon/tinycon'); var Tinycon = require('tinycon/tinycon');
var lastDateStr = null;
var chat = (function() var chat = (function()
{ {
var isStuck = false; var isStuck = false;
@ -120,9 +122,14 @@ var chat = (function()
var authorName = msg.userName == null ? _('pad.userlist.unnamed') : padutils.escapeHtml(msg.userName); var authorName = msg.userName == null ? _('pad.userlist.unnamed') : padutils.escapeHtml(msg.userName);
var html = "<p class='" + authorClass + "'><b>" + authorName + ":</b><span class='time " + authorClass + "' title='" + dateStr + "'>" + timeStr + "</span> " + text + "</p>"; var html = "";
if(lastDateStr != null && lastDateStr != dateStr)
html = "<p class='chatDaySeperator'>" + dateStr + "</p>";
html += "<p class='" + authorClass + "'><b>" + authorName + ":</b><span class='time " + authorClass + "' title='" + dateStr + "'>" + timeStr + "</span> " + text + "</p>";
$("#chattext").append(html); $("#chattext").append(html);
lastDateStr = dateStr;
//should we increment the counter?? //should we increment the counter??
if(increment) if(increment)
{ {