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; padding: 12px;
display: none; display: none;
overflow: hidden; overflow: hidden;
z-index: 10;
} }
.ircclient #chat .ircwrapper .chatarea .topicbar:hover { .ircclient #chat .ircwrapper .chatarea .topicbar:hover {
height: auto; height: auto;
overflow: visible; max-height: 100px;
overflow: auto;
word-wrap: break-word; word-wrap: break-word;
} }
.ircclient #chat .ircwrapper .chatarea .letterbox { .ircclient #chat .ircwrapper .chatarea .letterbox {
@ -230,6 +232,7 @@ body {
display: none; display: none;
z-index: 11; z-index: 11;
background-color: #fff; background-color: #fff;
overflow: auto;
} }
.ircclient #chat .ircwrapper .chatarea .nicklist .nick { .ircclient #chat .ircwrapper .chatarea .nicklist .nick {
cursor: pointer; cursor: pointer;
@ -318,6 +321,9 @@ body {
right: 5px; right: 5px;
cursor: pointer; cursor: pointer;
} }
.message.type_simple.mentioned {
background-color: #d4ffd4;
}
.message.type_simple .timestamp { .message.type_simple .timestamp {
color: #696969; color: #696969;
} }
@ -342,6 +348,19 @@ body {
.message.type_simple .arrowout { .message.type_simple .arrowout {
font-weight: bolder; 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 .reason:before,
.message .hostmask:before { .message .hostmask:before {
content: "("; content: "(";
@ -392,6 +411,16 @@ body {
.message.m_action .actionee { .message.m_action .actionee {
color: #3f51b5; 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, .message .irc-bg00,
.topicbar .irc-bg00, .topicbar .irc-bg00,
.message .irc-bg0, .message .irc-bg0,

View File

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

View File

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

View File

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