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

@ -112,15 +112,15 @@ $(document).ready(() => {
const updateHandlers = () => {
// Search
$('#search-query').unbind('keyup').keyup(() => {
$('#search-query').off('keyup').on('keyup', () => {
search($('#search-query').val());
});
// Prevent form submit
$('#search-query').parent().bind('submit', () => false);
$('#search-query').parent().on('submit', () => false);
// update & install
$('.do-install, .do-update').unbind('click').click(function (e) {
$('.do-install, .do-update').off('click').on('click', function (e) {
const $row = $(e.target).closest('tr');
const plugin = $row.data('plugin');
if ($(this).hasClass('do-install')) {
@ -134,7 +134,7 @@ $(document).ready(() => {
});
// uninstall
$('.do-uninstall').unbind('click').click((e) => {
$('.do-uninstall').off('click').on('click', (e) => {
const $row = $(e.target).closest('tr');
const pluginName = $row.data('plugin');
socket.emit('uninstall', pluginName);
@ -143,14 +143,14 @@ $(document).ready(() => {
});
// Sort
$('.sort.up').unbind('click').click(function () {
$('.sort.up').off('click').on('click', function () {
search.sortBy = $(this).attr('data-label').toLowerCase();
search.sortDir = false;
search.offset = 0;
search(search.searchTerm, search.results.length);
search.results = [];
});
$('.sort.down, .sort.none').unbind('click').click(function () {
$('.sort.down, .sort.none').off('click').on('click', function () {
search.sortBy = $(this).attr('data-label').toLowerCase();
search.sortDir = true;
search.offset = 0;