WebUI: Use Map instead of Mootools Hash in Torrents table
[qBittorrent.git] / src / webui / www / private / rename.html
bloba59b7379ce80f08ee573a14f2505a03b8c24ce28
1 <!DOCTYPE html>
2 <html lang="${LANG}">
4 <head>
5 <meta charset="UTF-8">
6 <title>QBT_TR(Rename)QBT_TR[CONTEXT=TransferListWidget]</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 $("renameButton").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 name = new URI().getData("name");
34 // set text field to current value
35 if (name)
36 $("rename").value = name;
38 $("rename").focus();
39 $("renameButton").addEventListener("click", (e) => {
40 e.preventDefault();
41 e.stopPropagation();
43 // check field
44 const name = $("rename").value.trim();
45 if ((name === null) || (name === ""))
46 return;
48 const hash = new URI().getData("hash");
49 if (hash) {
50 new Request({
51 url: "api/v2/torrents/rename",
52 method: "post",
53 data: {
54 hash: hash,
55 name: name
57 onComplete: function() {
58 window.parent.qBittorrent.Client.closeWindows();
60 }).send();
62 });
63 });
64 </script>
65 </head>
67 <body>
68 <div style="padding: 10px 10px 0px 10px;">
69 <label for="rename" style="font-weight: bold;">QBT_TR(New name:)QBT_TR[CONTEXT=TransferListWidget]</label>
70 <input type="text" id="rename" style="width: 99%;">
71 <div style="text-align: center; padding-top: 10px;">
72 <input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" id="renameButton">
73 </div>
74 </div>
75 </body>
77 </html>