jQuery: Migrate to .on(), .off(), .trigger()

This avoids methods that are deprecated in newer versions of jQuery.
This commit is contained in:
webzwo0i 2021-07-05 17:12:47 +02:00 committed by SamTV12345
parent 2f5b6b80e1
commit d5b981719f
47 changed files with 195 additions and 195 deletions

View file

@ -42,7 +42,7 @@ exports.chat = (() => {
},
focus: () => {
setTimeout(() => {
$('#chatinput').focus();
$('#chatinput').trigger('focus');
}, 100);
},
// Make chat stick to right hand side of screen
@ -223,14 +223,14 @@ exports.chat = (() => {
// Send the users focus back to the pad
if ((evt.altKey === true && evt.which === 67) || evt.which === 27) {
// If we're in chat already..
$(':focus').blur(); // required to do not try to remove!
$(':focus').trigger('blur'); // required to do not try to remove!
padeditor.ace.focus(); // Sends focus back to pad
evt.preventDefault();
return false;
}
});
// Clear the chat mentions when the user clicks on the chat input box
$('#chatinput').click(() => {
$('#chatinput').on('click', () => {
chatMentions = 0;
Tinycon.setBubble(0);
});
@ -239,14 +239,14 @@ exports.chat = (() => {
$('body:not(#chatinput)').on('keypress', function (evt) {
if (evt.altKey && evt.which === 67) {
// Alt c focuses on the Chat window
$(this).blur();
$(this).trigger('blur');
self.show();
$('#chatinput').focus();
$('#chatinput').trigger('focus');
evt.preventDefault();
}
});
$('#chatinput').keypress((evt) => {
$('#chatinput').on('keypress', (evt) => {
// if the user typed enter, fire the send
if (evt.key === 'Enter' && !evt.shiftKey) {
evt.preventDefault();
@ -257,7 +257,7 @@ exports.chat = (() => {
// initial messages are loaded in pad.js' _afterHandshake
$('#chatcounter').text(0);
$('#chatloadmessagesbutton').click(() => {
$('#chatloadmessagesbutton').on('click', () => {
const start = Math.max(this.historyPointer - 20, 0);
const end = this.historyPointer;