WebUI: Use Map instead of Mootools Hash in Torrents table
[qBittorrent.git] / src / webui / www / private / setlocation.html
blob57aced98106f6a2178cb7aede62b18210842d8cd
1 <!DOCTYPE html>
2 <html lang="${LANG}">
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/misc.js?locale=${LANG}&v=${CACHEID}"></script>
11 <script>
12 "use strict";
14 new Keyboard({
15 defaultEventType: "keydown",
16 events: {
17 "Enter": function(event) {
18 $("setLocationButton").click();
19 event.preventDefault();
21 "Escape": function(event) {
22 window.parent.qBittorrent.Client.closeWindows();
23 event.preventDefault();
25 "Esc": function(event) {
26 window.parent.qBittorrent.Client.closeWindows();
27 event.preventDefault();
30 }).activate();
32 window.addEventListener("DOMContentLoaded", () => {
33 const path = new URI().getData("path");
35 // set text field to current value
36 if (path)
37 $("setLocation").value = decodeURIComponent(path);
39 $("setLocation").focus();
40 $("setLocationButton").addEventListener("click", (e) => {
41 e.preventDefault();
42 e.stopPropagation();
44 // check field
45 const location = $("setLocation").value.trim();
46 if ((location === null) || (location === "")) {
47 $("error_div").textContent = "QBT_TR(Save path is empty)QBT_TR[CONTEXT=TorrentsController]";
48 return;
51 const hashesList = new URI().getData("hashes");
52 new Request({
53 url: "api/v2/torrents/setLocation",
54 method: "post",
55 data: {
56 hashes: hashesList,
57 location: location
59 onSuccess: function() {
60 window.parent.qBittorrent.Client.closeWindows();
62 onFailure: function(xhr) {
63 $("error_div").textContent = xhr.response;
65 }).send();
66 });
67 });
68 </script>
69 </head>
71 <body>
72 <div style="padding: 10px 10px 0px 10px;">
73 <label for="setLocation" style="font-weight: bold;">QBT_TR(Location:)QBT_TR[CONTEXT=TransferListWidget]</label>
74 <input type="text" id="setLocation" autocorrect="off" autocapitalize="none" style="width: 99%;">
75 <div style="float: none; width: 99%;" id="error_div">&nbsp;</div>
76 <div style="text-align: center; padding-top: 10px;">
77 <input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" id="setLocationButton">
78 </div>
79 </div>
80 </body>
82 </html>