From d5583559c042e1a2a6e71da8c43daba59137cf2f Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 14 Aug 2021 00:54:16 -0400 Subject: [PATCH] Chat: Move `onClick` attributes to `chat.js` This avoids the reliance on the global `chat` variable, and it is a step toward supporting a strict Content Security Policy (#4401). --- src/static/js/chat.js | 5 +++++ src/templates/pad.html | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/static/js/chat.js b/src/static/js/chat.js index 63c17c153..4082c7c19 100755 --- a/src/static/js/chat.js +++ b/src/static/js/chat.js @@ -218,6 +218,11 @@ exports.chat = (() => { }, init(pad) { this._pad = pad; + $('#options-stickychat').on('click', () => this.stickToScreen()); + $('#options-chatandusers').on('click', () => this.chatAndUsers()); + $('#chaticon').on('click', (e) => { e.preventDefault(); this.show(); }); + $('#titlecross').on('click', (e) => { e.preventDefault(); this.hide(); }); + $('#titlesticky').on('click', (e) => { e.preventDefault(); this.stickToScreen(true); }); $('#chatinput').on('keydown', (evt) => { // If the event is Alt C or Escape & we're already in the chat menu // Send the users focus back to the pad diff --git a/src/templates/pad.html b/src/templates/pad.html index 84dc3d668..ebad29645 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -122,11 +122,11 @@ <% e.begin_block("mySettings"); %>

- +

- +

@@ -368,7 +368,7 @@ -

+
0 @@ -378,8 +378,8 @@