Remove channel containers from DOM after quitting network

This commit is contained in:
PolarizedIons 2017-10-02 13:38:34 +02:00
parent 0cc9c4166b
commit 99c8e1c04a
No known key found for this signature in database
GPG Key ID: 849D5E38506B55E1

View File

@ -1,12 +1,20 @@
"use strict"; "use strict";
const $ = require("jquery"); const $ = require("jquery");
const chat = $("#chat");
const socket = require("../socket"); const socket = require("../socket");
const sidebar = $("#sidebar"); const sidebar = $("#sidebar");
socket.on("quit", function(data) { socket.on("quit", function(data) {
const id = data.network; const id = data.network;
sidebar.find("#network-" + id).remove(); const network = sidebar.find("#network-" + id);
network.children(".chan").each(function() {
// this = child
chat.find($(this).data("target")).remove();
});
network.remove();
const chan = sidebar.find(".chan") const chan = sidebar.find(".chan")
.eq(0) .eq(0)