hardlounge/client/js/socket-events/quit.js

27 lines
530 B
JavaScript
Raw Normal View History

2017-05-18 20:08:54 +00:00
"use strict";
const $ = require("jquery");
const socket = require("../socket");
const sidebar = $("#sidebar");
2018-07-08 13:42:54 +00:00
const {vueApp} = require("../vue");
2017-05-18 20:08:54 +00:00
socket.on("quit", function(data) {
2019-11-09 08:55:50 +00:00
vueApp.networks.splice(
vueApp.networks.findIndex((n) => n.uuid === data.network),
1
);
2018-07-08 13:42:54 +00:00
vueApp.$nextTick(() => {
const chan = sidebar.find(".chan");
2017-09-12 12:52:16 +00:00
if (chan.length === 0) {
// Open the connect window
$("#footer .connect").trigger("click", {
pushState: false,
});
} else {
chan.eq(0).trigger("click");
}
});
2017-05-18 20:08:54 +00:00
});