WebUI: Remove redundant event listener
[qBittorrent.git] / src / webui / www / private / addtrackers.html
blobdf84f14439983b08fccc7fc0db00f1c591cbd9aa
1 <!DOCTYPE html>
2 <html lang="${LANG}" class="dark">
4 <head>
5 <meta charset="UTF-8">
6 <title>QBT_TR(Add trackers)QBT_TR[CONTEXT=TrackersAdditionDialog]</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 window.addEventListener("keydown", (event) => {
17 switch (event.key) {
18 case "Escape":
19 event.preventDefault();
20 window.parent.qBittorrent.Client.closeFrameWindow(window);
21 break;
23 });
25 $("trackersUrls").focus();
26 $("addTrackersButton").addEventListener("click", (e) => {
27 e.preventDefault();
28 e.stopPropagation();
30 fetch("api/v2/torrents/addTrackers", {
31 method: "POST",
32 body: new URLSearchParams({
33 hash: new URI().getData("hash"),
34 urls: $("trackersUrls").value
37 .then((response) => {
38 if (!response.ok)
39 return;
41 window.parent.qBittorrent.Client.closeFrameWindow(window);
42 });
43 });
44 });
45 </script>
46 </head>
48 <body>
49 <div style="text-align: center; margin-top: 10px;">
50 <label for="trackersUrls">QBT_TR(List of trackers to add (one per line):)QBT_TR[CONTEXT=TrackersAdditionDialog]</label>
51 <textarea name="list" id="trackersUrls" rows="10" cols="1"></textarea>
52 <input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="addTrackersButton">
53 </div>
54 </body>
56 </html>