1 <div id=
"confirmDeletionDialog">
2 <div class=
"confirmDeletionGrid">
3 <span class=
"deletionGridItem confirmDialogWarning"></span>
4 <span class=
"deletionGridItem" id=
"deleteTorrentMessage"></span>
5 <span class=
"deletionGridItem">
6 <button class=
"disabled" type=
"button" id=
"rememberBtn" title=
"QBT_TR(Remember choice)QBT_TR[CONTEXT=HttpServer]" aria-label=
"QBT_TR(Remember choice)QBT_TR[CONTEXT=HttpServer]" disabled
></button>
8 <span class=
"deletionGridItem">
9 <input type=
"checkbox" id=
"deleteFromDiskCB">
10 <label for=
"deleteFromDiskCB">
11 <em>QBT_TR(Also remove the content files)QBT_TR[CONTEXT=confirmDeletionDlg]
</em>
17 <input type=
"button" value=
"QBT_TR(Remove)QBT_TR[CONTEXT=MainWindow]" id=
"confirmDeletionButton">
18 <input type=
"button" value=
"QBT_TR(Cancel)QBT_TR[CONTEXT=MainWindow]" id=
"cancelDeletionButton">
25 const setRememberBtnEnabled
= (enable
) => {
26 rememberButton
.disabled
= !enable
;
27 rememberButton
.classList
.toggle("disabled", !enable
);
30 const confirmButton
= document
.getElementById("confirmDeletionButton");
31 const cancelButton
= document
.getElementById("cancelDeletionButton");
32 const rememberButton
= document
.getElementById("rememberBtn");
33 const deleteCB
= document
.getElementById("deleteFromDiskCB");
34 const deletionText
= document
.getElementById("deleteTorrentMessage");
38 forceDeleteFiles
= false,
40 } = window
.MUI
.Windows
.instances
["confirmDeletionPage"].options
.data
;
41 let prefDeleteContentFiles
= window
.qBittorrent
.Cache
.preferences
.get().delete_torrent_content_files
;
42 deleteCB
.checked
= forceDeleteFiles
|| prefDeleteContentFiles
;
45 if (hashes
.length
=== 1) {
46 const { full_data
: { name
} } = torrentsTable
.getRow(hashes
[0]);
47 deleteMessage
= "QBT_TR(Are you sure you want to remove %1 from the transfer list?)QBT_TR[CONTEXT=HttpServer]".replace("%1", `"${name}"`);
50 deleteMessage
= "QBT_TR(Are you sure you want to remove these %1 torrents from the transfer list?)QBT_TR[CONTEXT=HttpServer]".replace("%1", hashes
.length
);
53 deletionText
.textContent
= deleteMessage
;
55 // Enable "Remember" button if the current choice is different from the saved preference
56 deleteCB
.addEventListener("click", (e
) => { setRememberBtnEnabled(deleteCB
.checked
!== prefDeleteContentFiles
); });
58 // Set current "Delete files" choice as the default
59 rememberButton
.addEventListener("click", (e
) => {
60 window
.qBittorrent
.Cache
.preferences
.set({
62 "delete_torrent_content_files": deleteCB
.checked
64 onSuccess: function() {
65 prefDeleteContentFiles
= deleteCB
.checked
;
66 setRememberBtnEnabled(false);
72 cancelButton
.addEventListener("click", (e
) => { window
.qBittorrent
.Client
.closeWindows(); });
74 confirmButton
.addEventListener("click", (e
) => {
75 torrentsTable
.deselectAll();
77 url
: "api/v2/torrents/delete",
80 "hashes": hashes
.join("|"),
81 "deleteFiles": deleteCB
.checked
83 onSuccess: function() {
84 if (filterList
=== "tracker")
85 setTrackerFilter(TRACKERS_ALL
);
87 window
.qBittorrent
.Client
.closeWindows();
89 onFailure: function() {
90 alert("QBT_TR(Unable to delete torrents.)QBT_TR[CONTEXT=HttpServer]");