GHA CI: Bump libtorrent versions
[qBittorrent.git] / src / webui / www / private / setlocation.html
blob1455340df5afe09c83db89c354afea4786f94cb1
1 <!DOCTYPE html>
2 <html lang="${LANG}" class="dark">
4 <head>
5 <meta charset="UTF-8">
6 <title>QBT_TR(Set location)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 src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
13 <script>
14 "use strict";
16 window.addEventListener("DOMContentLoaded", () => {
17 window.addEventListener("keydown", (event) => {
18 switch (event.key) {
19 case "Enter":
20 event.preventDefault();
21 $("setLocationButton").click();
22 break;
23 case "Escape":
24 event.preventDefault();
25 window.parent.qBittorrent.Client.closeFrameWindow(window);
26 break;
28 });
30 const searchParams = new URLSearchParams(window.location.search);
31 const path = searchParams.get("path");
33 // set text field to current value
34 if (path !== null)
35 $("setLocation").value = decodeURIComponent(path);
37 $("setLocation").focus();
38 $("setLocationButton").addEventListener("click", (e) => {
39 e.preventDefault();
40 e.stopPropagation();
42 // check field
43 const location = $("setLocation").value.trim();
44 if ((location === null) || (location === "")) {
45 $("error_div").textContent = "QBT_TR(Save path is empty)QBT_TR[CONTEXT=TorrentsController]";
46 return;
49 fetch("api/v2/torrents/setLocation", {
50 method: "POST",
51 body: new URLSearchParams({
52 hashes: searchParams.get("hashes"),
53 location: location
56 .then(async (response) => {
57 if (!response.ok) {
58 $("error_div").textContent = await response.text();
59 return;
62 window.parent.qBittorrent.Client.closeFrameWindow(window);
63 });
64 });
65 });
66 </script>
67 </head>
69 <body>
70 <div style="padding: 10px 10px 0px 10px;">
71 <label for="setLocation" style="font-weight: bold;">QBT_TR(Location:)QBT_TR[CONTEXT=TransferListWidget]</label>
72 <input type="text" id="setLocation" autocorrect="off" autocapitalize="none" style="width: 99%;">
73 <div style="float: none; width: 99%;" id="error_div">&nbsp;</div>
74 <div style="text-align: center; padding-top: 10px;">
75 <input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" id="setLocationButton">
76 </div>
77 </div>
78 </body>
80 </html>