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

44 lines
1.5 KiB
JavaScript
Raw Normal View History

$(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');
2024-03-09 13:32:35 +08:00
} else {
$.post('index.php?r=user%2Fremove-two-factor', function () {
location.reload();
});
}
});
$('#totpSetupModal').on('hidden.bs.modal', function () {
$('#totp-enabled').prop('checked', false);
});
2024-03-09 13:32:35 +08:00
$('#useDarkTheme').change(function () {
2024-03-08 16:20:22 +08:00
var darkMode = this.checked ? 1 : 0;
2024-03-09 13:32:35 +08:00
$.post('index.php?r=user%2Fset-theme', {dark_mode: darkMode}, function () {
2024-03-08 16:20:22 +08:00
location.reload();
});
});
2024-03-09 13:32:35 +08:00
$('#followSystemTheme').change(function () {
2024-03-08 16:20:22 +08:00
$('#useDarkTheme').prop('checked', false);
var darkMode = this.checked ? 2 : 0;
2024-03-09 13:32:35 +08:00
$.post('index.php?r=user%2Fset-theme', {dark_mode: darkMode}, function () {
2024-03-08 16:20:22 +08:00
location.reload();
});
});
2024-03-09 13:32:35 +08:00
});
document.querySelector('.avatar-container').addEventListener('click', function () {
$('#avatarModal').modal('show');
2024-03-09 14:38:42 +08:00
});
document.querySelector('.editable-username').addEventListener('click', function () {
// 在这里添加你的代码来显示一个模态框或其他你想要的东西
$('#changeAccountName').modal('show');
});