no new features

This commit is contained in:
Evert Prants 2016-09-24 20:30:39 +03:00
parent 23d732902f
commit 3b6c4b16a3
4 changed files with 95 additions and 16 deletions

View File

@ -203,10 +203,12 @@ body {
padding: 12px;
display: none;
overflow: hidden;
z-index: 10;
}
.ircclient #chat .ircwrapper .chatarea .topicbar:hover {
height: auto;
overflow: visible;
max-height: 100px;
overflow: auto;
word-wrap: break-word;
}
.ircclient #chat .ircwrapper .chatarea .letterbox {
@ -230,6 +232,7 @@ body {
display: none;
z-index: 11;
background-color: #fff;
overflow: auto;
}
.ircclient #chat .ircwrapper .chatarea .nicklist .nick {
cursor: pointer;
@ -318,6 +321,9 @@ body {
right: 5px;
cursor: pointer;
}
.message.type_simple.mentioned {
background-color: #d4ffd4;
}
.message.type_simple .timestamp {
color: #696969;
}
@ -342,6 +348,19 @@ body {
.message.type_simple .arrowout {
font-weight: bolder;
}
.message.type_simple .channel {
font-weight: bold;
color: #a0a0a0;
}
.message.type_simple .m_listentry .channel {
min-width: 120px;
display: inline-block;
}
.message.type_simple .m_listentry .usercount {
display: inline-block;
min-width: 45px;
text-align: center;
}
.message .reason:before,
.message .hostmask:before {
content: "(";
@ -392,6 +411,16 @@ body {
.message.m_action .actionee {
color: #3f51b5;
}
.message.m_mode .content {
font-style: italic;
}
.message.m_mode .mode {
color: #008000;
}
.message.m_error .content {
color: #f00;
font-weight: bold;
}
.message .irc-bg00,
.topicbar .irc-bg00,
.message .irc-bg0,

View File

@ -480,7 +480,7 @@ class Tab {
let ttt = document.createElement('div');
ttt.innerHTML = internals;
ttt.className = "tab";
ttt.setAttribute('id', 'tab-'+this.name);
ttt.setAttribute('id', 'tab-'+this.buffer.name);
clientdom.tabby.appendChild(ttt);
this.element = ttt;
@ -541,6 +541,7 @@ class Buffer {
this.topic = null;
this.input = "";
this.lastscroll = 0;
this.wasAtBottom = false;
this.unreadCount = 0;
this.server = servername;
@ -578,7 +579,10 @@ class Buffer {
}
this.renderMessages();
clientdom.letterbox.scrollTop = this.lastscroll;
if(this.wasAtBottom)
clientdom.letterbox.scrollTop = clientdom.letterbox.scrollHeight;
else
clientdom.letterbox.scrollTop = this.lastscroll;
clientdom.currentNickname.innerHTML = irc.serverData[this.server].my_nick;
}
@ -596,6 +600,10 @@ class Buffer {
appendMessage(meta) {
let mesgConstr = composer.message[irc.chatType](meta.time, meta.sender, meta.message, meta.type);
if((meta.type == "privmsg" || meta.type == "notice") && meta.message.indexOf(irc.serverData[this.server].my_nick) != -1)
addClass(mesgConstr, "mentioned");
clientdom.letterbox.appendChild(mesgConstr);
let lFactor = clientdom.letterbox.offsetHeight + clientdom.letterbox.scrollTop
@ -617,18 +625,24 @@ class Buffer {
let mesg = {message: message, sender: sender, type: type, time: time || new Date()}
this.messages.push(mesg);
if(type == "regular")
console.log(sender);
if(this.active)
if(this.active) {
this.appendMessage(mesg);
else
} else {
this.unreadCount += 1;
if((type == "privmsg" || type == "notice") && message.indexOf(irc.serverData[this.server].my_nick) != -1)
console.log("TODO: notify user of mentioned");
}
this.tab.setUnreadCount(this.unreadCount);
}
switchOff() {
let lFactor = clientdom.letterbox.offsetHeight + clientdom.letterbox.scrollTop
if(lFactor > clientdom.letterbox.scrollHeight - 100)
this.wasAtBottom = true;
else
this.wasAtBottom = false;
this.tab.setActive(false);
this.lastscroll = clientdom.letterbox.scrollTop;
this.active = false;
@ -815,8 +829,9 @@ class InputHandler {
case "action":
irc.socket.emit("userinput", {command: "privmsg", server: buf.server, message: "\x01ACTION "+inp.substring(cmd.length+2)+"\x01", arguments: [buf.name]});
break;
case "nick":
case "list":
irc.socket.emit("userinput", {command: cmd, server: buf.server, message: "", arguments: listargs});
irc.socket.emit("userinput", {command: cmd, server: buf.server, message: "", arguments: listargs.splice(1)});
break;
case "quote":
case "raw":
@ -976,7 +991,6 @@ class IRCChatWindow {
let bufIndex = this.buffers.indexOf(buffer);
if(buffer.active) {
console.log(bufIndex);
if (bufIndex == 0) {
if(this.buffers[bufIndex+1]) {
this.render(this.buffers[bufIndex+1]);
@ -1037,7 +1051,7 @@ class IRCChatWindow {
let activeBuf = this.getActiveBuffer();
if(activeBuf.server == server) {
activeBuf.my_nickname.innerHTML = newNick;
clientdom.currentNickname.innerHTML = newNick;
}
}
@ -1117,7 +1131,6 @@ class IRCChatWindow {
handleMode(data) {
let buf = null;
console.log(data);
if(data.target == irc.serverData[data.server].my_nick)
buf = this.getServerBuffer(data.server);
else
@ -1238,10 +1251,18 @@ window.onload = function() {
irc.chat.handleQuit(data.server, data.user, data.reason);
break;
case "message":
if(data.to == irc.serverData[data.server].my_nick)
if(data.to == irc.serverData[data.server].my_nick) {
irc.chat.messageBuffer(data.user.nickname, data.server, {message: data.message, type: data.messageType, from: data.user.nickname});
else
} else if(data.to == null) {
let atest = irc.chat.getActiveBuffer();
if(atest.server != data.server)
atest = irc.chat.getServerBuffer(data.server);
atest.addMessage(data.message, data.user.nickname, data.messageType);
} else {
irc.chat.messageBuffer(data.to, data.server, {message: data.message, type: data.messageType, from: data.user.nickname});
}
break;
case "channel_nicks":
irc.chat.buildNicklist(data.channel, data.server, data.nicks);

View File

@ -184,9 +184,11 @@ body
padding: 12px;
display: none;
overflow: hidden;
z-index: 10
&:hover
height: auto
overflow: visible
max-height: 100px
overflow: auto
word-wrap: break-word
.letterbox
position: absolute;
@ -208,6 +210,7 @@ body
display: none;
z-index: 11;
background-color: #ffffff;
overflow: auto;
.nick
cursor: pointer;
&:hover
@ -286,6 +289,8 @@ body
.message
&.type_simple
&.mentioned
background-color: #d4ffd4;
.timestamp
color: #696969;
&:before
@ -302,6 +307,17 @@ body
content: ">";
.arrowin, .arrowout
font-weight: bolder;
.channel
font-weight: bold;
color: #a0a0a0;
.m_listentry
.channel
min-width: 120px;
display: inline-block;
.usercount
display: inline-block;
min-width: 45px;
text-align: center;
.reason, .hostmask
&:before
@ -333,6 +349,14 @@ body
font-weight: bold;
&.m_action .actionee
color: #3f51b5;
&.m_mode
.content
font-style: italic;
.mode
color: #008000;
&.m_error .content
color: red;
font-weight: bold;
.message, .topicbar
.irc-bg00,.irc-bg0

View File

@ -82,6 +82,8 @@ class IRCConnectionHandler {
let serverName = this.conn.config.server;
let realServerName = this.conn.data.actualServer;
if(line.user.nickname == '')
realServerName = line.user.hostname;
let list = null;
switch(line.command) {
@ -200,6 +202,7 @@ class IRCConnectionHandler {
case "376":
this.conn.emit('pass_to_client', {type: "server_message", messageType: "motd", message: line.trailing, server: serverName, from: realServerName});
break;
case "351":
case "251":
case "290":
case "292":
@ -246,7 +249,9 @@ class IRCConnectionHandler {
break;
case "401":
case "402":
this.conn.emit('pass_to_client', {type: "message", to: line.arguments[1], message: line.trailing,
case "421":
case "432":
this.conn.emit('pass_to_client', {type: "message", to: null, message: line.arguments[1]+': '+line.trailing,
server: serverName, user: {nickname: realServerName}, messageType: "error"});
break;
case "311":