From d1fd315c86c3272b6075a39ab6d29d7c12eb50c4 Mon Sep 17 00:00:00 2001 From: SamTV12345 <40429738+samtv12345@users.noreply.github.com> Date: Tue, 8 Aug 2023 18:00:19 +0200 Subject: [PATCH] Removed deprecated event. --- src/static/js/admin/jquery.autosize.js | 2 +- src/static/js/admin/settings.js | 4 ++-- src/static/js/chat.js | 2 +- src/static/js/pad.js | 2 +- src/static/js/pad_editbar.js | 4 ++-- src/static/js/vendors/farbtastic.js | 12 ++++++------ src/static/js/vendors/nice-select.js | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/static/js/admin/jquery.autosize.js b/src/static/js/admin/jquery.autosize.js index 8c8ab1a8f..a94ef3cde 100644 --- a/src/static/js/admin/jquery.autosize.js +++ b/src/static/js/admin/jquery.autosize.js @@ -164,7 +164,7 @@ $(window).resize(adjust); // Allow for manual triggering if needed. - $ta.bind('autosize', adjust); + $ta.on('autosize', adjust); // Call adjust in case the textarea already contains text. adjust(); diff --git a/src/static/js/admin/settings.js b/src/static/js/admin/settings.js index 33bb12689..0d9031602 100644 --- a/src/static/js/admin/settings.js +++ b/src/static/js/admin/settings.js @@ -40,7 +40,7 @@ $(document).ready(() => { socket.emit('saveSettings', $('.settings').val()); } else { alert('Invalid JSON'); - $('.settings').focus(); + $('.settings').trigger('focus'); } }); @@ -62,7 +62,7 @@ const isJSONClean = (data) => { // this is a bit naive. In theory some key/value might contain the sequences ',]' or ',}' cleanSettings = cleanSettings.replace(',]', ']').replace(',}', '}'); try { - return typeof jQuery.parseJSON(cleanSettings) === 'object'; + return typeof JSON.parseJSON(cleanSettings) === 'object'; } catch (e) { return false; // the JSON failed to be parsed } diff --git a/src/static/js/chat.js b/src/static/js/chat.js index 9dee3be4f..b1c21fa54 100755 --- a/src/static/js/chat.js +++ b/src/static/js/chat.js @@ -227,7 +227,7 @@ exports.chat = (() => { if ((evt.altKey === true && evt.which === 67) || evt.which === 27) { // If we're in chat already.. $(':focus').trigger('blur'); // required to do not try to remove! - padeditor.ace.focus(); // Sends focus back to pad + padeditor.ace.trigger('focus'); // Sends focus back to pad evt.preventDefault(); return false; } diff --git a/src/static/js/pad.js b/src/static/js/pad.js index 908f3a037..b4105be6b 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -410,7 +410,7 @@ const pad = { const postAceInit = () => { padeditbar.init(); setTimeout(() => { - padeditor.ace.focus(); + padeditor.ace.trigger('focus'); }, 0); $('#options-stickychat').on('click', () => { chat.stickToScreen(); }); // if we have a cookie for always showing chat then show it diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js index d7f12465d..ff7da72cf 100644 --- a/src/static/js/pad_editbar.js +++ b/src/static/js/pad_editbar.js @@ -201,7 +201,7 @@ exports.padeditbar = new class { if (this.isEnabled() && this.commands[cmd]) { this.commands[cmd](cmd, padeditor.ace, item); } - if (padeditor.ace) padeditor.ace.focus(); + if (padeditor.ace) padeditor.ace.trigger('focus'); } // cb is deprecated (this function is synchronous so a callback is unnecessary). @@ -312,7 +312,7 @@ exports.padeditbar = new class { // Timeslider probably.. $('#editorcontainerbox').trigger('focus'); // Focus back onto the pad } else { - padeditor.ace.focus(); // Sends focus back to pad + padeditor.ace.trigger('focus'); // Sends focus back to pad // The above focus doesn't always work in FF, you have to hit enter afterwards evt.preventDefault(); } diff --git a/src/static/js/vendors/farbtastic.js b/src/static/js/vendors/farbtastic.js index cc0c2c1bf..9e167d6bb 100644 --- a/src/static/js/vendors/farbtastic.js +++ b/src/static/js/vendors/farbtastic.js @@ -33,7 +33,7 @@ $._farbtastic = function (container, options) { fb.linkTo = function (callback) { // Unbind previous nodes if (typeof fb.callback == 'object') { - $(fb.callback).unbind('keyup', fb.updateValue); + $(fb.callback).off('keyup').on('keyup').on('keyup', fb.updateValue); } // Reset color @@ -45,7 +45,7 @@ $._farbtastic = function (container, options) { } else if (typeof callback == 'object' || typeof callback == 'string') { fb.callback = $(callback); - fb.callback.bind('keyup', fb.updateValue); + fb.callback.on('keyup', fb.updateValue); if (fb.callback[0].value) { fb.setColor(fb.callback[0].value); } @@ -388,7 +388,7 @@ $._farbtastic = function (container, options) { fb.mousedown = function (event) { // Capture mouse if (!$._farbtastic.dragging) { - $(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup); + $(document).on('mousemove', fb.mousemove).on('mouseup', fb.mouseup); $._farbtastic.dragging = true; } @@ -429,8 +429,8 @@ $._farbtastic = function (container, options) { */ fb.mouseup = function () { // Uncapture mouse - $(document).unbind('mousemove', fb.mousemove); - $(document).unbind('mouseup', fb.mouseup); + $(document).off('mousemove').on('mousemove',fb.mousemove); + $(document).off('mouseup').on('mouseup', fb.mouseup); $._farbtastic.dragging = false; } @@ -519,7 +519,7 @@ $._farbtastic = function (container, options) { fb.initWidget(); // Install mousedown handler (the others are set on the document on-demand) - $('canvas.farbtastic-overlay', container).mousedown(fb.mousedown); + $('canvas.farbtastic-overlay', container).on('mousedown',fb.mousedown); // Set linked elements/callback if (options.callback) { diff --git a/src/static/js/vendors/nice-select.js b/src/static/js/vendors/nice-select.js index ee1fc611a..d19de5332 100644 --- a/src/static/js/vendors/nice-select.js +++ b/src/static/js/vendors/nice-select.js @@ -123,7 +123,7 @@ $dropdown.find('.list').css('max-height', $maxListHeight + 'px'); } else { - $dropdown.focus(); + $dropdown.trigger('focus'); } });