Allow calling /part from queries

This commit is contained in:
Mattias Erming 2014-04-06 22:53:07 +02:00
parent 57f4071f27
commit 087ae21137
2 changed files with 25 additions and 11 deletions

View File

@ -175,18 +175,26 @@ $(function() {
input.val("");
socket.emit("input", {
id: input.data("target"),
text: text
text: text,
});
});
chat.on("click", ".close", function() {
var id = parseInt($(this).closest(".window").attr("id").replace("window-", ""));
socket.emit("input", {
id: id,
text: "/part",
});
});
chat.on("click", ".user", function(e) {
e.preventDefault();
});
chat.on("focus", "input[type=text]", function() {
$(this).closest(".window").find(".messages").scrollToBottom();
});
chat.on("click", ".user", function(e) {
e.preventDefault();
});
var highest = 1;
$.fn.bringToTop = function() {
return this.css('z-index', highest++)

View File

@ -130,13 +130,21 @@ function input(json) {
break;
case "join":
case "part":
case "nick":
if (client && args[1]) {
client[cmd].apply(client, args.slice(1));
}
break;
case "leave":
case "part":
if (channel.get("type") == "query") {
network.get("channels").remove(channel);
} else if (client) {
client.part(channel.get("name"));
}
break;
case "topic":
var chan = channel.get("name");
if (client) {
@ -205,12 +213,10 @@ function event(event, data) {
var chan = channels.findWhere({name: data[0].channel});
var users = chan.get("users");
if (data[0].client == this.get("client").me) {
users.reset();
if (data[0].client != this.get("client").me) {
users.remove(users.findWhere({name: data[0].client}));
} else {
users.remove(
users.findWhere({name: data[0].client})
);
users.reset();
}
chan.addMessage({