$(document).on('click', '.rename-btn', function () { var relativePath = $(this).attr('value'); var fileName = $(this).closest('tr').find('td:eq(1)').text().trim(); $('#renameRelativePath').val(relativePath); $('#renameform-newname').val(fileName); $('#renameModal').modal('show'); }) var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { return new bootstrap.Tooltip(tooltipTriggerEl) }); $(document).on('click', '.download-btn', function () { window.location.href = $(this).attr('value'); }); $(document).on('click', '.folder-download-btn', function () { var relativePath = $(this).attr('value'); window.open('index.php?r=home%2Fdownload-folder&relativePath=' + encodeURIComponent(relativePath), '_blank'); }); $(document).on('click', '.delete-btn', function () { var relativePath = $(this).attr('value'); $('#deleteRelativePath').val(relativePath); $('#deleteModal').modal('show'); }); $(document).on('click', '.file-upload-btn', function () { $('#file-input').click(); }); $('#file-input').on('change', function () { uploadFiles(this.files); }); $(document).on('click', '.folder-upload-btn', function () { $('#folder-input').click(); }); $('#folder-input').on('change', function () { uploadFiles(this.files); }); $(document).on('click', '.offline-download-btn', function () { console.log('离线下载功能尚未实现'); //TO DO }); $(document).on('click', '.refresh-btn', function () { window.location.reload(); }); $(document).on('click', '.new-folder-btn', function () { var relativePath = $(this).attr('value'); $('#newDirRelativePath').val(relativePath); $('#newFolderModal').modal('show'); }) $(document).on('click', '.single-download-btn', function () { var relativePath = $('.select-item:checked').first().data('relativePath'); window.location.href = 'index.php?r=home%2Fdownload&relativePath=' + encodeURIComponent(relativePath); }); $(document).on('click', '.batch-zip-download-btn', function () { var relativePaths = $('.select-item:checked').map(function () { return $(this).data('relativePath'); }).get(); // 创建一个新的表单 var form = $('