2017-05-18 20:08:54 +00:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const $ = require("jquery");
|
2017-10-02 11:38:34 +00:00
|
|
|
const chat = $("#chat");
|
2017-05-18 20:08:54 +00:00
|
|
|
const socket = require("../socket");
|
|
|
|
const sidebar = $("#sidebar");
|
|
|
|
|
|
|
|
socket.on("quit", function(data) {
|
|
|
|
const id = data.network;
|
2018-03-04 18:28:37 +00:00
|
|
|
const network = sidebar.find(`#network-${id}`);
|
2017-10-02 11:38:34 +00:00
|
|
|
|
|
|
|
network.children(".chan").each(function() {
|
|
|
|
// this = child
|
|
|
|
chat.find($(this).data("target")).remove();
|
|
|
|
});
|
|
|
|
|
|
|
|
network.remove();
|
2017-09-12 12:52:16 +00:00
|
|
|
|
2017-05-18 20:08:54 +00:00
|
|
|
const chan = sidebar.find(".chan")
|
|
|
|
.eq(0)
|
|
|
|
.trigger("click");
|
2017-09-12 12:52:16 +00:00
|
|
|
|
2017-05-18 20:08:54 +00:00
|
|
|
if (chan.length === 0) {
|
|
|
|
sidebar.find(".empty").show();
|
|
|
|
}
|
|
|
|
});
|