From fff80e0876e979fd56083cf639819148e40f6204 Mon Sep 17 00:00:00 2001 From: Rodolphe Breard Date: Tue, 27 Nov 2012 23:53:15 +0100 Subject: [PATCH] chat display improvements --- chromesoul.css | 4 +++- lib/nsui.js | 13 ++++++++++++- lib/tab.nsui.js | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/chromesoul.css b/chromesoul.css index 449b8dd..24b2a93 100644 --- a/chromesoul.css +++ b/chromesoul.css @@ -46,6 +46,7 @@ border-right: 1px solid #aaa; border-radius: 8px 8px 0 0; color: #aaa; + cursor: pointer; } #tab-lst > li > span::selection { @@ -76,10 +77,11 @@ .chat-log { margin: 0; - padding: 5px; + padding: 2px 5px 2px 0; height: 268px; outline: 1px solid #aaa; overflow-y: scroll; + font-family: monospace; } #add-contact, .chat-input { diff --git a/lib/nsui.js b/lib/nsui.js index b569cf2..be129d4 100644 --- a/lib/nsui.js +++ b/lib/nsui.js @@ -98,8 +98,19 @@ Nsui.prototype.addContentToTab = function(tab_name, content) { tab.appendText(this.formatMessage(content)); }; +Nsui.prototype.formatInteger = function(num, len) { + num = "" + num; + while (num.length < len) { + num = "0" + num; + } + + return num; +}; + Nsui.prototype.formatMessage = function(msg) { - var fmt = ""; + var dt = new Date(), fmt = ""; + + fmt += "(" + this.formatInteger(dt.getHours(), 2) + ":" + this.formatInteger(dt.getMinutes(), 2) + ":" + this.formatInteger(dt.getSeconds(), 2) + ")"; if (typeof msg.login !== "undefined" && msg.login !== null) { fmt += '' + msg.login + ': '; diff --git a/lib/tab.nsui.js b/lib/tab.nsui.js index 622dc25..d2de41a 100644 --- a/lib/tab.nsui.js +++ b/lib/tab.nsui.js @@ -62,7 +62,7 @@ Tab.prototype.initBodyElement = function() { var chat_input_w = document.createElement("div"); this.chat_input = document.createElement("input"); - this.chat_log = document.createElement("pre"); + this.chat_log = document.createElement("p"); this.chat_log.classList.add("chat-log"); this.el_body = document.createElement("div"); this.el_body.classList.add("tab-body");