chat display improvements

This commit is contained in:
Rodolphe Breard 2012-11-27 23:53:15 +01:00
parent 9938ff29fb
commit fff80e0876
3 changed files with 16 additions and 3 deletions

View file

@ -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 += '<span class="spk-oth">' + msg.login + ': </span>';

View file

@ -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");