yii2-netdisk/web/js/user-info.js

35 lines
1.1 KiB
JavaScript

$(document).ready(function () {
$('#deleteConfirm').change(function () {
if (this.checked) {
$('#deleteButton').prop('disabled', false);
} else {
$('#deleteButton').prop('disabled', true);
}
});
$('#totp-enabled').change(function () {
if (this.checked) {
$('#totpSetupModal').modal('show');
}else {
$.post('index.php?r=user%2Fremove-two-factor', function () {
location.reload();
});
}
});
$('#totpSetupModal').on('hidden.bs.modal', function () {
$('#totp-enabled').prop('checked', false);
});
$('#useDarkTheme').change(function() {
var darkMode = this.checked ? 1 : 0;
$.post('index.php?r=user%2Fset-theme', {dark_mode: darkMode}, function() {
location.reload();
});
});
$('#followSystemTheme').change(function() {
$('#useDarkTheme').prop('checked', false);
var darkMode = this.checked ? 2 : 0;
$.post('index.php?r=user%2Fset-theme', {dark_mode: darkMode}, function() {
location.reload();
});
});
});