chat display improvements
This commit is contained in:
parent
9938ff29fb
commit
fff80e0876
3 changed files with 16 additions and 3 deletions
|
@ -46,6 +46,7 @@
|
||||||
border-right: 1px solid #aaa;
|
border-right: 1px solid #aaa;
|
||||||
border-radius: 8px 8px 0 0;
|
border-radius: 8px 8px 0 0;
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tab-lst > li > span::selection {
|
#tab-lst > li > span::selection {
|
||||||
|
@ -76,10 +77,11 @@
|
||||||
|
|
||||||
.chat-log {
|
.chat-log {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 5px;
|
padding: 2px 5px 2px 0;
|
||||||
height: 268px;
|
height: 268px;
|
||||||
outline: 1px solid #aaa;
|
outline: 1px solid #aaa;
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
#add-contact, .chat-input {
|
#add-contact, .chat-input {
|
||||||
|
|
13
lib/nsui.js
13
lib/nsui.js
|
@ -98,8 +98,19 @@ Nsui.prototype.addContentToTab = function(tab_name, content) {
|
||||||
tab.appendText(this.formatMessage(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) {
|
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) {
|
if (typeof msg.login !== "undefined" && msg.login !== null) {
|
||||||
fmt += '<span class="spk-oth">' + msg.login + ': </span>';
|
fmt += '<span class="spk-oth">' + msg.login + ': </span>';
|
||||||
|
|
|
@ -62,7 +62,7 @@ Tab.prototype.initBodyElement = function() {
|
||||||
var chat_input_w = document.createElement("div");
|
var chat_input_w = document.createElement("div");
|
||||||
|
|
||||||
this.chat_input = document.createElement("input");
|
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.chat_log.classList.add("chat-log");
|
||||||
this.el_body = document.createElement("div");
|
this.el_body = document.createElement("div");
|
||||||
this.el_body.classList.add("tab-body");
|
this.el_body.classList.add("tab-body");
|
||||||
|
|
Reference in a new issue