From 1cbba4ea3a246ee4eb6d99d8665b21978b55066a Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Mon, 6 Dec 2021 17:41:00 -0500 Subject: [PATCH] chat: New `hide` method to completely hide chat --- src/static/js/chat.js | 8 ++++++++ src/static/js/pad.js | 6 ++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/static/js/chat.js b/src/static/js/chat.js index 789c5304f..164b5da98 100755 --- a/src/static/js/chat.js +++ b/src/static/js/chat.js @@ -100,6 +100,14 @@ exports.chat = (() => { $('#chatbox').removeClass('visible'); } }, + minimize() { + if ($('#options-stickychat').prop('checked')) this.reduce(); + this.reduce(); + }, + hide() { + this.minimize(); + $('#chaticon').hide(); + }, scrollDown(force) { if ($('#chatbox').hasClass('visible')) { if (force || !this.lastMessage || !this.lastMessage.position() || diff --git a/src/static/js/pad.js b/src/static/js/pad.js index d6cebdd90..0d619b6f1 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -76,8 +76,7 @@ const getParameters = [ callback: (val) => { if (val === 'false') { settings.hideChat = true; - chat.reduce(); - $('#chaticon').hide(); + chat.hide(); } }, }, @@ -480,10 +479,9 @@ const pad = { } if (window.clientVars.readonly) { - chat.reduce(); + chat.hide(); $('#myusernameedit').attr('disabled', true); $('#chatinput').attr('disabled', true); - $('#chaticon').hide(); $('#options-chatandusers').parent().hide(); $('#options-stickychat').parent().hide(); } else if (!settings.hideChat) { $('#chaticon').show(); }