WebUI: prefer arrow function in callbacks
[qBittorrent.git] / src / webui / www / private / download.html
blob45186abe608c97c58c0ad5a1890c490d48a6001d
1 <!DOCTYPE html>
2 <html lang="${LANG}">
4 <head>
5 <meta charset="UTF-8" />
6 <title>QBT_TR(Add Torrent Links)QBT_TR[CONTEXT=downloadFromURL]</title>
7 <link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css" />
8 <link rel="stylesheet" href="css/Window.css?v=${CACHEID}" type="text/css" />
9 <script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
10 <script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
11 <script src="scripts/download.js?v=${CACHEID}"></script>
12 <script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
13 </head>
15 <body>
16 <iframe id="download_frame" name="download_frame" class="invisible" title="" src="about:blank"></iframe>
17 <form action="api/v2/torrents/add" enctype="multipart/form-data" method="post" id="downloadForm" style="text-align: center;" target="download_frame" autocorrect="off" autocapitalize="none">
18 <div style="text-align: center;">
19 <br />
20 <h2 class="vcenter">QBT_TR(Download Torrents from their URLs or Magnet links)QBT_TR[CONTEXT=HttpServer]</h2>
21 <textarea id="urls" rows="10" name="urls"></textarea>
22 <p>QBT_TR(Only one link per line)QBT_TR[CONTEXT=HttpServer]</p>
23 <fieldset class="settings" style="border: 0; text-align: left; margin-top: 6px;">
24 <table style="margin: auto;">
25 <tr>
26 <td>
27 <label for="autoTMM">QBT_TR(Torrent Management Mode:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
28 </td>
29 <td>
30 <select id="autoTMM" name="autoTMM" onchange="qBittorrent.Download.changeTMM(this)">
31 <option selected value="false">QBT_TR(Manual)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
32 <option value="true">QBT_TR(Automatic)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
33 </select>
34 </td>
35 </tr>
36 <tr>
37 <td>
38 <label for="savepath">QBT_TR(Save files to location:)QBT_TR[CONTEXT=HttpServer]</label>
39 </td>
40 <td>
41 <input type="text" id="savepath" name="savepath" style="width: 16em;" />
42 </td>
43 </tr>
44 <tr>
45 <td>
46 <label for="cookie">QBT_TR(Cookie:)QBT_TR[CONTEXT=HttpServer]</label>
47 </td>
48 <td>
49 <input type="text" id="cookie" name="cookie" style="width: 16em;" />
50 </td>
51 </tr>
52 <tr>
53 <td>
54 <label for="rename">QBT_TR(Rename torrent)QBT_TR[CONTEXT=HttpServer]</label>
55 </td>
56 <td>
57 <input type="text" id="rename" name="rename" style="width: 16em;" />
58 </td>
59 </tr>
60 <tr>
61 <td>
62 <label for="category">QBT_TR(Category:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
63 </td>
64 <td>
65 <div class="select-watched-folder-editable">
66 <select id="categorySelect" onchange="qBittorrent.Download.changeCategorySelect(this)">
67 <option selected value="\other"></option>
68 </select>
69 <input name="category" type="text" />
70 </div>
71 </td>
72 </tr>
73 <tr>
74 <td>
75 <label for="startTorrent">QBT_TR(Start torrent)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
76 </td>
77 <td>
78 <input type="hidden" id="startTorrentHidden" name="stopped" />
79 <input type="checkbox" id="startTorrent" />
80 </td>
81 </tr>
82 <tr>
83 <td>
84 <label for="addToTopOfQueue">QBT_TR(Add to top of queue)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
85 </td>
86 <td>
87 <input type="checkbox" id="addToTopOfQueue" name="addToTopOfQueue" value="true" />
88 </td>
89 </tr>
90 <tr>
91 <td>
92 <label for="stopCondition">QBT_TR(Stop condition:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
93 </td>
94 <td>
95 <select id="stopCondition" name="stopCondition">
96 <option selected value="None">QBT_TR(None)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
97 <option value="MetadataReceived">QBT_TR(Metadata received)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
98 <option value="FilesChecked">QBT_TR(Files checked)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
99 </select>
100 </td>
101 </tr>
102 <tr>
103 <td>
104 <label for="skip_checking">QBT_TR(Skip hash check)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
105 </td>
106 <td>
107 <input type="checkbox" id="skip_checking" name="skip_checking" value="true" />
108 </td>
109 </tr>
110 <tr>
111 <td>
112 <label for="contentLayout">QBT_TR(Content layout:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
113 </td>
114 <td>
115 <select id="contentLayout" name="contentLayout">
116 <option selected value="Original">QBT_TR(Original)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
117 <option value="Subfolder">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
118 <option value="NoSubfolder">QBT_TR(Don't create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
119 </select>
120 </td>
121 </tr>
122 <tr>
123 <td>
124 <label for="sequentialDownload">QBT_TR(Download in sequential order)QBT_TR[CONTEXT=TransferListWidget]</label>
125 </td>
126 <td>
127 <input type="checkbox" id="sequentialDownload" name="sequentialDownload" value="true" />
128 </td>
129 </tr>
130 <tr>
131 <td>
132 <label for="firstLastPiecePrio">QBT_TR(Download first and last pieces first)QBT_TR[CONTEXT=TransferListWidget]</label>
133 </td>
134 <td>
135 <input type="checkbox" id="firstLastPiecePrio" name="firstLastPiecePrio" value="true" />
136 </td>
137 </tr>
138 <tr>
139 <td>
140 <label for="dlLimitText">QBT_TR(Limit download rate)QBT_TR[CONTEXT=HttpServer]</label>
141 </td>
142 <td>
143 <input type="hidden" id="dlLimitHidden" name="dlLimit" />
144 <input type="text" id="dlLimitText" style="width: 16em;" placeholder="KiB/s" />
145 </td>
146 </tr>
147 <tr>
148 <td>
149 <label for="upLimitText">QBT_TR(Limit upload rate)QBT_TR[CONTEXT=HttpServer]</label>
150 </td>
151 <td>
152 <input type="hidden" id="upLimitHidden" name="upLimit" />
153 <input type="text" id="upLimitText" style="width: 16em;" placeholder="KiB/s" />
154 </td>
155 </tr>
156 </table>
157 <div id="submitbutton" style="margin-top: 12px; text-align: center;">
158 <button type="submit" id="submitButton">QBT_TR(Download)QBT_TR[CONTEXT=downloadFromURL]</button>
159 </div>
160 </fieldset>
161 </div>
162 </form>
163 <div id="download_spinner" class="mochaSpinner"></div>
165 <script>
166 "use strict";
168 const encodedUrls = new URI().getData("urls");
169 if (encodedUrls) {
170 const urls = encodedUrls.split("|").map((url) => {
171 return decodeURIComponent(url);
174 if (urls.length)
175 $("urls").set("value", urls.join("\n"));
178 let submitted = false;
180 $("downloadForm").addEventListener("submit", () => {
181 $("startTorrentHidden").value = $("startTorrent").checked ? "false" : "true";
183 $("dlLimitHidden").value = $("dlLimitText").value.toInt() * 1024;
184 $("upLimitHidden").value = $("upLimitText").value.toInt() * 1024;
186 $("download_spinner").style.display = "block";
187 submitted = true;
190 $("download_frame").addEventListener("load", () => {
191 if (submitted)
192 window.parent.qBittorrent.Client.closeWindows();
194 </script>
195 </body>
197 </html>