Update jQuery to 3.7 and fix admintests (#5868)

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

This avoids methods that are deprecated in newer versions of jQuery.

* jQuery: avoid `.removeAttr`, prefer `.prop`

* helper.edit: wait up to 10 seconds for ACCEPT_COMMIT

* Chat: disabled attribute is boolean

* Chat: avoid inline onclick handler to support jQuery 3.4+

* jQuery: update to version 3.6.0

* Update to 3.7

* Removed deprecated event.

* Revert change to focus on padeditor.ace

---------

Co-authored-by: webzwo0i <webzwo0i@c3d2.de>
This commit is contained in:
SamTV12345 2023-08-08 18:26:25 +02:00 committed by GitHub
parent 2f5b6b80e1
commit a096f1ae33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 9457 additions and 8785 deletions

View file

@ -42,11 +42,14 @@ exports.chat = (() => {
},
focus: () => {
setTimeout(() => {
$('#chatinput').focus();
$('#chatinput').trigger('focus');
}, 100);
},
// Make chat stick to right hand side of screen
stickToScreen(fromInitialCall) {
if ($('#options-stickychat').prop('checked')) {
$('#options-stickychat').prop('checked', false);
}
if (pad.settings.hideChat) {
return;
}
@ -68,7 +71,7 @@ exports.chat = (() => {
this.stickToScreen(true);
$('#options-stickychat').prop('checked', true);
$('#options-chatandusers').prop('checked', true);
$('#options-stickychat').prop('disabled', 'disabled');
$('#options-stickychat').prop('disabled', true);
userAndChat = true;
} else {
$('#options-stickychat').prop('disabled', false);
@ -223,14 +226,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 +242,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 +260,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;