chat display improvements
This commit is contained in:
parent
9938ff29fb
commit
fff80e0876
3 changed files with 16 additions and 3 deletions
13
lib/nsui.js
13
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 += '<span class="spk-oth">' + msg.login + ': </span>';
|
||||
|
|
|
@ -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");
|
||||
|
|
Reference in a new issue