mirror of
https://github.com/thelounge/thelounge
synced 2024-12-28 21:33:08 +00:00
31 lines
691 B
JavaScript
31 lines
691 B
JavaScript
"use strict";
|
|
|
|
const $ = require("jquery");
|
|
const socket = require("../socket");
|
|
const templates = require("../../views");
|
|
|
|
socket.on("sessions:list", function(data) {
|
|
data.sort((a, b) => b.lastUse - a.lastUse);
|
|
|
|
let html = "";
|
|
data.forEach((connection) => {
|
|
if (connection.current) {
|
|
$("#session-current").html(templates.session(connection));
|
|
return;
|
|
}
|
|
|
|
html += templates.session(connection);
|
|
});
|
|
|
|
if (html.length === 0) {
|
|
html = "<p><em>You are not currently logged in to any other device.</em></p>";
|
|
}
|
|
|
|
$("#session-list").html(html);
|
|
});
|
|
|
|
$("#settings").on("click", ".remove-session", function() {
|
|
socket.emit("sign-out", $(this).data("token"));
|
|
|
|
return false;
|
|
});
|