WebUI: Remove redundant event listener
[qBittorrent.git] / src / webui / www / private / confirmtrackerdeletion.html
blobecf51b3f5e88eee5f0ccc4c0fe3e1696a5479090
1 <!DOCTYPE html>
2 <html lang="${LANG}" class="dark">
4 <head>
5 <meta charset="UTF-8">
6 <title>QBT_TR(Remove tracker)QBT_TR[CONTEXT=confirmDeletionDlg]</title>
7 <link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css">
8 <script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
9 <script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
10 <script src="scripts/localpreferences.js?v=${CACHEID}"></script>
11 <script src="scripts/color-scheme.js?v=${CACHEID}"></script>
12 <script>
13 "use strict";
15 window.addEventListener("DOMContentLoaded", () => {
16 const host = new URI().getData("host");
17 const urls = new URI().getData("urls");
18 $("confirmDeleteTrackerText").textContent = "QBT_TR(Are you sure you want to remove tracker %1 from all torrents?)QBT_TR[CONTEXT=TrackersFilterWidget]".replace("%1", `"${host}"`);
20 $("cancelBtn").focus();
21 $("cancelBtn").addEventListener("click", (e) => {
22 e.stopPropagation();
23 window.parent.qBittorrent.Client.closeFrameWindow(window);
24 });
25 $("confirmBtn").addEventListener("click", (e) => {
26 e.stopPropagation();
28 fetch("api/v2/torrents/removeTrackers", {
29 method: "POST",
30 body: new URLSearchParams({
31 hash: "*",
32 urls: urls
35 .then((response) => {
36 if (!response.ok)
37 return;
39 window.parent.qBittorrent.Client.closeFrameWindow(window);
40 });
41 });
42 });
43 </script>
44 </head>
46 <body>
47 <div style="padding: 10px 10px 0px 10px;">
48 <p id="confirmDeleteTrackerText"></p>
49 <div style="text-align: right;">
50 <input type="button" id="cancelBtn" value="QBT_TR(Cancel)QBT_TR[CONTEXT=MainWindow]">
51 <input type="button" id="confirmBtn" value="QBT_TR(Remove)QBT_TR[CONTEXT=MainWindow]">
52 </div>
53 </div>
54 </body>
56 </html>