chat: New `hide` method to completely hide chat

rhansen-chat
Richard Hansen 2021-12-06 17:41:00 -05:00
parent 8ae5f25075
commit 1cbba4ea3a
2 changed files with 10 additions and 4 deletions

View File

@ -100,6 +100,14 @@ exports.chat = (() => {
$('#chatbox').removeClass('visible'); $('#chatbox').removeClass('visible');
} }
}, },
minimize() {
if ($('#options-stickychat').prop('checked')) this.reduce();
this.reduce();
},
hide() {
this.minimize();
$('#chaticon').hide();
},
scrollDown(force) { scrollDown(force) {
if ($('#chatbox').hasClass('visible')) { if ($('#chatbox').hasClass('visible')) {
if (force || !this.lastMessage || !this.lastMessage.position() || if (force || !this.lastMessage || !this.lastMessage.position() ||

View File

@ -76,8 +76,7 @@ const getParameters = [
callback: (val) => { callback: (val) => {
if (val === 'false') { if (val === 'false') {
settings.hideChat = true; settings.hideChat = true;
chat.reduce(); chat.hide();
$('#chaticon').hide();
} }
}, },
}, },
@ -480,10 +479,9 @@ const pad = {
} }
if (window.clientVars.readonly) { if (window.clientVars.readonly) {
chat.reduce(); chat.hide();
$('#myusernameedit').attr('disabled', true); $('#myusernameedit').attr('disabled', true);
$('#chatinput').attr('disabled', true); $('#chatinput').attr('disabled', true);
$('#chaticon').hide();
$('#options-chatandusers').parent().hide(); $('#options-chatandusers').parent().hide();
$('#options-stickychat').parent().hide(); $('#options-stickychat').parent().hide();
} else if (!settings.hideChat) { $('#chaticon').show(); } } else if (!settings.hideChat) { $('#chaticon').show(); }