This commit is contained in:
Mattias Erming 2014-04-21 13:20:20 +02:00
parent d49ee1326b
commit a458ad24b3
2 changed files with 7 additions and 7 deletions

View File

@ -36,7 +36,7 @@ $(function() {
} }
function handleEvent(event, json) { function handleEvent(event, json) {
var data = json.data; var data = [].concat(json.data);
switch (event) { switch (event) {
case "network": case "network":
@ -68,7 +68,7 @@ $(function() {
break; break;
case "channel": case "channel":
var id = data.id; var id = data[0].id;
if (json.action == "remove") { if (json.action == "remove") {
$("#channel-" + id + ", #window-" + id).remove(); $("#channel-" + id + ", #window-" + id).remove();
var highest = 0; var highest = 0;
@ -89,13 +89,13 @@ $(function() {
sidebar.find(".channel").removeClass("active"); sidebar.find(".channel").removeClass("active");
$("#network-" + json.target).append( $("#network-" + json.target).append(
render("#channels", {channels: [data]}) render("#channels", {channels: data})
).find(".channel") ).find(".channel")
.last() .last()
.addClass("active"); .addClass("active");
chat.append( chat.append(
render("#windows", {windows: [data]}) render("#windows", {windows: data})
).find(".window") ).find(".window")
.last() .last()
.find("input") .find("input")
@ -123,7 +123,7 @@ $(function() {
target = target.parent().find(".active"); target = target.parent().find(".active");
} }
var msg = $(render("#messages", {messages: [data]})); var msg = $(render("#messages", {messages: data}));
target = target.find(".messages"); target = target.find(".messages");
target.append(msg); target.append(msg);

View File

@ -70,7 +70,7 @@ function connect(params) {
client: client, client: client,
}, {silent: true}); }, {silent: true});
networks.trigger("network", networks); networks.trigger("network", {data: networks});
client.nick(params.nick); client.nick(params.nick);
client.user(params.nick, params.realname); client.user(params.nick, params.realname);
@ -208,7 +208,7 @@ function input(json) {
case "quit": case "quit":
case "disconnect": case "disconnect":
networks.remove(network); networks.remove(network);
networks.trigger("network", networks); networks.trigger("network", {data: networks});
break; break;
} }