From e08f18f447d1f286bd22bb0f6d694b21f8918c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Fri, 7 Jul 2017 00:18:37 -0400 Subject: [PATCH] Add collapse/expand commands to toggle all previews --- client/index.html | 24 ++++++++++++++++++++++++ client/js/constants.js | 2 ++ client/js/lounge.js | 10 ++++++++++ 3 files changed, 36 insertions(+) diff --git a/client/index.html b/client/index.html index cc6e4685..1a0c0f34 100644 --- a/client/index.html +++ b/client/index.html @@ -586,6 +586,18 @@ +
+
+ /collapse +
+
+

+ Collapse all previews in the current channel (opposite of + /expand) +

+
+
+
/connect host [port] @@ -649,6 +661,18 @@
+
+
+ /expand +
+
+

+ Expand all previews in the current channel (opposite of + /collapse) +

+
+
+
/invite nick [channel] diff --git a/client/js/constants.js b/client/js/constants.js index c001cbaf..f95fbd00 100644 --- a/client/js/constants.js +++ b/client/js/constants.js @@ -25,11 +25,13 @@ const commands = [ "/ban", "/banlist", "/close", + "/collapse", "/connect", "/ctcp", "/deop", "/devoice", "/disconnect", + "/expand", "/invite", "/join", "/kick", diff --git a/client/js/lounge.js b/client/js/lounge.js index 27faa8b8..3e3e28ff 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -324,6 +324,16 @@ $(function() { return; } + if (text.indexOf("/collapse") === 0) { + $(".chan.active .toggle-button.opened").click(); + return; + } + + if (text.indexOf("/expand") === 0) { + $(".chan.active .toggle-button:not(.opened)").click(); + return; + } + socket.emit("input", { target: chat.data("id"), text: text