mirror of
https://github.com/thelounge/thelounge
synced 2024-12-19 08:53:18 +00:00
14cc8b7827
See https://www.reddit.com/r/javascript/comments/8f57i1/psa_there_are_over_1000_people_in_the_us_named/dy0rib2/
26 lines
535 B
JavaScript
26 lines
535 B
JavaScript
"use strict";
|
|
|
|
const $ = require("jquery");
|
|
const chat = $("#chat");
|
|
const socket = require("../socket");
|
|
const sidebar = $("#sidebar");
|
|
|
|
socket.on("quit", function(data) {
|
|
const id = data.network;
|
|
const network = sidebar.find(`.network[data-uuid="${id}"]`);
|
|
|
|
network.children(".chan").each(function() {
|
|
// this = child
|
|
chat.find($(this).attr("data-target")).remove();
|
|
});
|
|
|
|
network.remove();
|
|
|
|
const chan = sidebar.find(".chan")
|
|
.eq(0)
|
|
.trigger("click");
|
|
|
|
if (chan.length === 0) {
|
|
sidebar.find(".empty").show();
|
|
}
|
|
});
|