chat: Move chat-specific option processing to `chat.js`
parent
1cbba4ea3a
commit
a1388b7876
|
@ -292,6 +292,18 @@ exports.chat = (() => {
|
|||
pad.collabClient.sendMessage({type: 'GET_CHAT_MESSAGES', start, end});
|
||||
this.historyPointer = start;
|
||||
});
|
||||
|
||||
const {searchParams} = new URL(window.location.href);
|
||||
const {showChat = true, alwaysShowChat = false, chatAndUsers = false} = clientVars.padOptions;
|
||||
const settings = this._pad.settings;
|
||||
settings.hideChat = showChat.toString() === 'false';
|
||||
if (settings.hideChat) this.hide();
|
||||
if (alwaysShowChat.toString() === 'true' && !settings.hideChat) this.stickToScreen();
|
||||
if (chatAndUsers.toString() === 'true') this.chatAndUsers();
|
||||
settings.hideChat = searchParams.get('showChat') === 'false';
|
||||
if (settings.hideChat) this.hide();
|
||||
if (searchParams.get('alwaysShowChat') === 'true' && !settings.hideChat) this.stickToScreen();
|
||||
if (searchParams.get('chatAndUsers') === 'true') this.chatAndUsers();
|
||||
},
|
||||
};
|
||||
})();
|
||||
|
|
|
@ -70,16 +70,6 @@ const getParameters = [
|
|||
$('#editbar').css('display', 'flex');
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'showChat',
|
||||
checkVal: null,
|
||||
callback: (val) => {
|
||||
if (val === 'false') {
|
||||
settings.hideChat = true;
|
||||
chat.hide();
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'showLineNumbers',
|
||||
checkVal: 'false',
|
||||
|
@ -117,20 +107,6 @@ const getParameters = [
|
|||
settings.rtlIsTrue = true;
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'alwaysShowChat',
|
||||
checkVal: 'true',
|
||||
callback: (val) => {
|
||||
if (!settings.hideChat) chat.stickToScreen();
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'chatAndUsers',
|
||||
checkVal: 'true',
|
||||
callback: (val) => {
|
||||
chat.chatAndUsers();
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'lang',
|
||||
checkVal: null,
|
||||
|
|
Loading…
Reference in New Issue