chat: Move click handlers to chat.js

This commit is contained in:
Richard Hansen 2021-12-06 16:07:23 -05:00
parent 7b7b085a1c
commit f7d7d89874
2 changed files with 10 additions and 5 deletions

View file

@ -218,6 +218,11 @@ exports.chat = (() => {
}, },
init(pad) { init(pad) {
this._pad = pad; this._pad = pad;
$('#options-stickychat').on('click', () => this.stickToScreen());
$('#options-chatandusers').on('click', () => this.chatAndUsers());
$('#chaticon').on('click', () => { this.show(); return false; });
$('#titlecross').on('click', () => { this.hide(); return false; });
$('#titlesticky').on('click', () => { this.stickToScreen(true); return false; });
$('#chatinput').on('keydown', (evt) => { $('#chatinput').on('keydown', (evt) => {
// If the event is Alt C or Escape & we're already in the chat menu // If the event is Alt C or Escape & we're already in the chat menu
// Send the users focus back to the pad // Send the users focus back to the pad

View file

@ -122,11 +122,11 @@
<% e.begin_block("mySettings"); %> <% e.begin_block("mySettings"); %>
<h2 data-l10n-id="pad.settings.myView"></h2> <h2 data-l10n-id="pad.settings.myView"></h2>
<p class="hide-for-mobile"> <p class="hide-for-mobile">
<input type="checkbox" id="options-stickychat" onClick="chat.stickToScreen();"> <input type="checkbox" id="options-stickychat">
<label for="options-stickychat" data-l10n-id="pad.settings.stickychat"></label> <label for="options-stickychat" data-l10n-id="pad.settings.stickychat"></label>
</p> </p>
<p class="hide-for-mobile"> <p class="hide-for-mobile">
<input type="checkbox" id="options-chatandusers" onClick="chat.chatAndUsers();"> <input type="checkbox" id="options-chatandusers">
<label for="options-chatandusers" data-l10n-id="pad.settings.chatandusers"></label> <label for="options-chatandusers" data-l10n-id="pad.settings.chatandusers"></label>
</p> </p>
<p> <p>
@ -375,7 +375,7 @@
<!----------- CHAT ------------> <!----------- CHAT ------------>
<!-----------------------------> <!----------------------------->
<div id="chaticon" class="visible" onclick="chat.show();return false;" title="Chat (Alt C)"> <div id="chaticon" class="visible" title="Chat (Alt C)">
<span id="chatlabel" data-l10n-id="pad.chat"></span> <span id="chatlabel" data-l10n-id="pad.chat"></span>
<span class="buttonicon buttonicon-chat"></span> <span class="buttonicon buttonicon-chat"></span>
<span id="chatcounter">0</span> <span id="chatcounter">0</span>
@ -385,8 +385,8 @@
<div class="chat-content"> <div class="chat-content">
<div id="titlebar"> <div id="titlebar">
<h1 id ="titlelabel" data-l10n-id="pad.chat"></h1> <h1 id ="titlelabel" data-l10n-id="pad.chat"></h1>
<a id="titlecross" class="hide-reduce-btn" onClick="chat.hide();return false;">-&nbsp;</a> <a id="titlecross" class="hide-reduce-btn">-&nbsp;</a>
<a id="titlesticky" class="stick-to-screen-btn" onClick="chat.stickToScreen(true);return false;" data-l10n-id="pad.chat.stick.title">&nbsp;&nbsp;</a> <a id="titlesticky" class="stick-to-screen-btn" data-l10n-id="pad.chat.stick.title">&nbsp;&nbsp;</a>
</div> </div>
<div id="chattext" class="thin-scrollbar" aria-live="polite" aria-relevant="additions removals text" role="log" aria-atomic="false"> <div id="chattext" class="thin-scrollbar" aria-live="polite" aria-relevant="additions removals text" role="log" aria-atomic="false">
<div alt="loading.." id="chatloadmessagesball" class="chatloadmessages loadingAnimation" align="top"></div> <div alt="loading.." id="chatloadmessagesball" class="chatloadmessages loadingAnimation" align="top"></div>