Add ability to use 'shift+delete' to delete torrents in WebUI

Closes #13827.
This commit is contained in:
Chocobo1 2020-11-26 15:48:44 +08:00
parent 9c938b91b7
commit d46343fb9c
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
3 changed files with 9 additions and 2 deletions

View file

@ -11,6 +11,9 @@
'use strict';
window.addEvent('domready', function() {
const isDeletingFiles = (new URI().getData('deleteFiles') === "true");
$('deleteFromDiskCB').checked = isDeletingFiles;
const hashes = new URI().getData('hashes').split('|');
$('cancelBtn').focus();
$('cancelBtn').addEvent('click', function(e) {

View file

@ -1225,6 +1225,10 @@ new Keyboard({
'delete': function(event) {
deleteFN();
event.preventDefault();
},
'shift+delete': (event) => {
deleteFN(true);
event.preventDefault();
}
}
}).activate();

View file

@ -376,14 +376,14 @@ const initializeWindows = function() {
}
};
deleteFN = function() {
deleteFN = function(deleteFiles = false) {
const hashes = torrentsTable.selectedRowsIds();
if (hashes.length) {
new MochaUI.Window({
id: 'confirmDeletionPage',
title: "QBT_TR(Deletion confirmation)QBT_TR[CONTEXT=confirmDeletionDlg]",
loadMethod: 'iframe',
contentURL: 'confirmdeletion.html?hashes=' + hashes.join("|"),
contentURL: ('confirmdeletion.html?hashes=' + hashes.join("|") + '&deleteFiles=' + deleteFiles),
scrollbars: false,
resizable: false,
maximizable: false,