WebUI: Remove redundant event listener
[qBittorrent.git] / src / webui / www / private / addwebseeds.html
blobc03f7687bf926e02e2fe4858466d182217dec6b2
1 <!DOCTYPE html>
2 <html lang="${LANG}" class="dark">
4 <head>
5 <meta charset="UTF-8">
6 <title>QBT_TR(Add web seeds)QBT_TR[CONTEXT=HttpServer]</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 $("urls").focus();
26 $("addWebSeedsButton").addEventListener("click", (e) => {
27 e.stopPropagation();
29 fetch("api/v2/torrents/addWebSeeds", {
30 method: "POST",
31 body: new URLSearchParams({
32 hash: new URI().getData("hash"),
33 urls: $("urls").value.split("\n").map(w => encodeURIComponent(w.trim())).filter(w => (w.length > 0)).join("|")
36 .then((response) => {
37 if (!response.ok)
38 return;
40 window.parent.qBittorrent.Client.closeFrameWindow(window);
41 });
42 });
43 });
44 </script>
45 </head>
47 <body>
48 <div style="text-align: center;">
49 <br>
50 <label for="urls">QBT_TR(List of web seeds to add (one per line):)QBT_TR[CONTEXT=HttpServer]</label>
51 <textarea name="list" id="urls" rows="10" cols="1"></textarea>
52 <br>
53 <input type="button" value="QBT_TR(Add)QBT_TR[CONTEXT=HttpServer]" id="addWebSeedsButton">
54 </div>
55 </body>
57 </html>