WebUI: migrate to fetch API
[qBittorrent.git] / src / webui / www / private / download.html
blob5f481a735f74aebeb003fbb5c42b3889767ca74d
1 <!DOCTYPE html>
2 <html lang="${LANG}" class="dark">
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/localpreferences.js?v=${CACHEID}"></script>
12 <script src="scripts/color-scheme.js?v=${CACHEID}"></script>
13 <script src="scripts/download.js?v=${CACHEID}"></script>
14 <script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
15 <script src="scripts/pathAutofill.js?v=${CACHEID}"></script>
16 </head>
18 <body>
19 <iframe id="download_frame" name="download_frame" class="invisible" title="" src="about:blank"></iframe>
20 <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">
21 <div style="text-align: center;">
22 <br>
23 <h2><label for="urls">QBT_TR(Add torrent links)QBT_TR[CONTEXT=AddNewTorrentDialog]</label></h2>
24 <textarea id="urls" rows="10" name="urls"></textarea>
25 <p><i>QBT_TR(One link per line (HTTP links, Magnet links and info-hashes are supported))QBT_TR[CONTEXT=AddNewTorrentDialog]</i></p>
26 <fieldset class="settings" style="border: 0; text-align: left; margin-top: 6px;">
27 <legend>QBT_TR(Torrent options)QBT_TR[CONTEXT=AddNewTorrentDialog]</legend>
28 <table style="margin: auto;">
29 <tbody>
30 <tr>
31 <td>
32 <label for="autoTMM">QBT_TR(Torrent Management Mode:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
33 </td>
34 <td>
35 <select id="autoTMM" name="autoTMM" onchange="qBittorrent.Download.changeTMM(this)">
36 <option selected value="false">QBT_TR(Manual)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
37 <option value="true">QBT_TR(Automatic)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
38 </select>
39 </td>
40 </tr>
41 <tr>
42 <td>
43 <label for="savepath">QBT_TR(Save files to location:)QBT_TR[CONTEXT=HttpServer]</label>
44 </td>
45 <td>
46 <input type="text" id="savepath" name="savepath" class="pathDirectory" style="width: 16em;">
47 </td>
48 </tr>
49 <tr>
50 <td>
51 <label for="rename">QBT_TR(Rename torrent)QBT_TR[CONTEXT=HttpServer]</label>
52 </td>
53 <td>
54 <input type="text" id="rename" name="rename" style="width: 16em;">
55 </td>
56 </tr>
57 <tr>
58 <td>
59 <label id="categoryLabel" for="categorySelect">QBT_TR(Category:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
60 </td>
61 <td>
62 <div class="select-watched-folder-editable">
63 <select id="categorySelect" onchange="qBittorrent.Download.changeCategorySelect(this)">
64 <option selected value="\other"></option>
65 </select>
66 <input type="text" name="category" aria-labelledby="categoryLabel">
67 </div>
68 </td>
69 </tr>
70 <tr>
71 <td>
72 <label for="startTorrent">QBT_TR(Start torrent)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
73 </td>
74 <td>
75 <input type="hidden" id="startTorrentHidden" name="stopped">
76 <input type="checkbox" id="startTorrent">
77 </td>
78 </tr>
79 <tr>
80 <td>
81 <label for="addToTopOfQueue">QBT_TR(Add to top of queue)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
82 </td>
83 <td>
84 <input type="checkbox" id="addToTopOfQueue" name="addToTopOfQueue" value="true">
85 </td>
86 </tr>
87 <tr>
88 <td>
89 <label for="stopCondition">QBT_TR(Stop condition:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
90 </td>
91 <td>
92 <select id="stopCondition" name="stopCondition">
93 <option selected value="None">QBT_TR(None)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
94 <option value="MetadataReceived">QBT_TR(Metadata received)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
95 <option value="FilesChecked">QBT_TR(Files checked)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
96 </select>
97 </td>
98 </tr>
99 <tr>
100 <td>
101 <label for="skip_checking">QBT_TR(Skip hash check)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
102 </td>
103 <td>
104 <input type="checkbox" id="skip_checking" name="skip_checking" value="true">
105 </td>
106 </tr>
107 <tr>
108 <td>
109 <label for="contentLayout">QBT_TR(Content layout:)QBT_TR[CONTEXT=AddNewTorrentDialog]</label>
110 </td>
111 <td>
112 <select id="contentLayout" name="contentLayout">
113 <option selected value="Original">QBT_TR(Original)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
114 <option value="Subfolder">QBT_TR(Create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
115 <option value="NoSubfolder">QBT_TR(Don't create subfolder)QBT_TR[CONTEXT=AddNewTorrentDialog]</option>
116 </select>
117 </td>
118 </tr>
119 <tr>
120 <td>
121 <label for="sequentialDownload">QBT_TR(Download in sequential order)QBT_TR[CONTEXT=TransferListWidget]</label>
122 </td>
123 <td>
124 <input type="checkbox" id="sequentialDownload" name="sequentialDownload" value="true">
125 </td>
126 </tr>
127 <tr>
128 <td>
129 <label for="firstLastPiecePrio">QBT_TR(Download first and last pieces first)QBT_TR[CONTEXT=TransferListWidget]</label>
130 </td>
131 <td>
132 <input type="checkbox" id="firstLastPiecePrio" name="firstLastPiecePrio" value="true">
133 </td>
134 </tr>
135 <tr>
136 <td>
137 <label for="dlLimitText">QBT_TR(Limit download rate)QBT_TR[CONTEXT=HttpServer]</label>
138 </td>
139 <td>
140 <input type="hidden" id="dlLimitHidden" name="dlLimit">
141 <input type="text" id="dlLimitText" style="width: 16em;" placeholder="KiB/s">
142 </td>
143 </tr>
144 <tr>
145 <td>
146 <label for="upLimitText">QBT_TR(Limit upload rate)QBT_TR[CONTEXT=HttpServer]</label>
147 </td>
148 <td>
149 <input type="hidden" id="upLimitHidden" name="upLimit">
150 <input type="text" id="upLimitText" style="width: 16em;" placeholder="KiB/s">
151 </td>
152 </tr>
153 </tbody>
154 </table>
155 <div id="submitbutton" style="margin-top: 12px; text-align: center;">
156 <button type="submit" id="submitButton">QBT_TR(Download)QBT_TR[CONTEXT=downloadFromURL]</button>
157 </div>
158 </fieldset>
159 </div>
160 </form>
161 <div id="download_spinner" class="mochaSpinner"></div>
163 <script>
164 "use strict";
166 const encodedUrls = new URI().getData("urls");
167 if (encodedUrls) {
168 const urls = encodedUrls.split("|").map((url) => {
169 return decodeURIComponent(url);
172 if (urls.length)
173 $("urls").value = urls.join("\n");
176 let submitted = false;
178 $("downloadForm").addEventListener("submit", () => {
179 $("startTorrentHidden").value = $("startTorrent").checked ? "false" : "true";
181 $("dlLimitHidden").value = Number($("dlLimitText").value) * 1024;
182 $("upLimitHidden").value = Number($("upLimitText").value) * 1024;
184 $("download_spinner").style.display = "block";
185 submitted = true;
188 $("download_frame").addEventListener("load", () => {
189 if (submitted)
190 window.parent.qBittorrent.Client.closeFrameWindow(window);
193 window.qBittorrent.pathAutofill.attachPathAutofill();
194 </script>
195 </body>
197 </html>