✏️ Replace deprecated Jquery methods

This commit is contained in:
Sebastien Clement 2021-09-07 11:00:31 +02:00
parent dd266cbc1c
commit c419ab24ea
No known key found for this signature in database
GPG Key ID: 6C78A38312BBA4B6

View File

@ -25,13 +25,13 @@ document.addEventListener('DOMContentLoaded', function () {
}); });
function updateDynamicListeners() { function updateDynamicListeners() {
$('.local-snap-listener').click(function () { $('.local-snap-listener').on('click', function () {
let id = this.getAttribute('data-id'); let id = this.getAttribute('data-id');
console.log(id); console.log(id);
}); });
let manual_back_list = $('.manual-back-list'); let manual_back_list = $('.manual-back-list');
manual_back_list.unbind(); manual_back_list.off();
manual_back_list.click(function () { manual_back_list.on("click", function () {
let id = this.getAttribute('data-id'); let id = this.getAttribute('data-id');
let name = this.getAttribute('data-name'); let name = this.getAttribute('data-name');
manualBackup(id, name); manualBackup(id, name);
@ -185,27 +185,27 @@ function printStatusWithBar(status, progress) {
} }
function listeners() { function listeners() {
$('#btn-backup-now').click(backupNow); $('#btn-backup-now').on('click', backupNow);
$('#btn-clean-now').click(cleanNow); $('#btn-clean-now').on('click',cleanNow);
$('#trigger-backup-settings').click(getBackupSettings); $('#trigger-backup-settings').on('click', getBackupSettings);
$('#password_protected').change(function () { $('#password_protected').on('change', function () {
if (!$(this).is(':checked')) { if (!$(this).is(':checked')) {
$('#password_protect_value').parent().parent().addClass('d-none'); $('#password_protect_value').parent().parent().addClass('d-none');
} else { } else {
$('#password_protect_value').parent().parent().removeClass('d-none'); $('#password_protect_value').parent().parent().removeClass('d-none');
} }
}) })
$('#cron-drop-settings').change(updateDropVisibility); $('#cron-drop-settings').on('change', updateDropVisibility);
$('#save-backup-settings').click(sendBackupSettings); $('#save-backup-settings').click(sendBackupSettings);
$('#auto_clean_local').change(function () { $('#auto_clean_local').on('change', function () {
if (!$(this).is(':checked')) { if (!$(this).is(':checked')) {
$('#local-snap-keep').parent().parent().addClass("d-none"); $('#local-snap-keep').parent().parent().addClass("d-none");
} else { } else {
$('#local-snap-keep').parent().parent().removeClass("d-none"); $('#local-snap-keep').parent().parent().removeClass("d-none");
} }
}); });
$('#auto_clean_backup').change(function () { $('#auto_clean_backup').on('change', function () {
if (!$(this).is(':checked')) { if (!$(this).is(':checked')) {
$('#backup-snap-keep').parent().parent().addClass("d-none"); $('#backup-snap-keep').parent().parent().addClass("d-none");
} else { } else {
@ -216,7 +216,7 @@ function listeners() {
$('#trigger-nextcloud-settings').click(getNextcloudSettings); $('#trigger-nextcloud-settings').click(getNextcloudSettings);
$('#save-nextcloud-settings').click(sendNextcloudSettings); $('#save-nextcloud-settings').click(sendNextcloudSettings);
$('#ssl').change(function () { $('#ssl').on('change', function () {
let div = $('#self_signed').parent().parent(); let div = $('#self_signed').parent().parent();
if ($('#ssl').is(':checked')) if ($('#ssl').is(':checked'))
div.removeClass("invisible") div.removeClass("invisible")