chatbox style
This commit is contained in:
parent
9cbd9e0a46
commit
41fbb1ab70
3 changed files with 83 additions and 49 deletions
|
@ -146,7 +146,7 @@ Nsui.prototype.formatInteger = function(num, len) {
|
|||
Nsui.prototype.formatMessage = function(msg) {
|
||||
var dt = new Date(), fmt = "";
|
||||
|
||||
fmt += "(" + this.formatInteger(dt.getHours(), 2) + ":" + this.formatInteger(dt.getMinutes(), 2) + ":" + this.formatInteger(dt.getSeconds(), 2) + ")";
|
||||
fmt += '<span class="chat-timestamp">' + this.formatInteger(dt.getHours(), 2) + ':' + this.formatInteger(dt.getMinutes(), 2) + ':' + this.formatInteger(dt.getSeconds(), 2) + '</span><div class="chat-message-body">';
|
||||
|
||||
if (typeof msg.login !== "undefined" && msg.login !== null) {
|
||||
fmt += '<span class="spk-oth">' + msg.login + ': </span>';
|
||||
|
@ -154,8 +154,7 @@ Nsui.prototype.formatMessage = function(msg) {
|
|||
fmt += '<span class="spk-me">' + document.getElementById('login').value + ': </span>';
|
||||
}
|
||||
|
||||
fmt += this.sanitizeText(msg.message);
|
||||
fmt += "<br>";
|
||||
fmt += this.sanitizeText(msg.message) + '</div>';
|
||||
|
||||
return fmt;
|
||||
};
|
||||
|
|
|
@ -54,6 +54,7 @@ Tab.prototype.initBodyElement = function() {
|
|||
var chat_input_w = document.createElement("div");
|
||||
|
||||
this.chat_input = document.createElement("input");
|
||||
this.chat_input.placeholder = "Some text here...";
|
||||
this.chat_log = document.createElement("p");
|
||||
this.chat_log.classList.add("chat-log");
|
||||
this.el_body = document.createElement("div");
|
||||
|
@ -146,7 +147,7 @@ Tab.prototype.flushText = function() {
|
|||
|
||||
Tab.prototype.appendMessage = function(msg) {
|
||||
this.history_index = 0;
|
||||
this.chat_log.innerHTML += $cs.ui.formatMessage(msg);
|
||||
this.chat_log.innerHTML += '<div class="chat-message">' + $cs.ui.formatMessage(msg) + '</div>';
|
||||
|
||||
if (!(typeof msg.login !== "undefined" && msg.login !== null)) {
|
||||
this.history.push(msg.message);
|
||||
|
|
Reference in a new issue