WebUI: Use Map instead of Mootools Hash in Torrents table
[qBittorrent.git] / src / webui / www / private / addpeers.html
blob6bc22544935e6b4d4bdabc8854fdc48e94c8cb23
1 <!DOCTYPE html>
2 <html lang="${LANG}">
4 <head>
5 <meta charset="UTF-8">
6 <title>QBT_TR(Add Peers)QBT_TR[CONTEXT=PeersAdditionDialog]</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>
11 "use strict";
13 new Keyboard({
14 defaultEventType: "keydown",
15 events: {
16 "Escape": function(event) {
17 window.parent.qBittorrent.Client.closeWindows();
18 event.preventDefault();
20 "Esc": function(event) {
21 window.parent.qBittorrent.Client.closeWindows();
22 event.preventDefault();
25 }).activate();
27 window.addEventListener("DOMContentLoaded", () => {
28 const hash = new URI().getData("hash");
29 if (!hash)
30 return;
32 $("peers").focus();
34 $("addPeersOk").addEventListener("click", (e) => {
35 e.preventDefault();
36 e.stopPropagation();
38 const peers = $("peers").value.trim().split(/[\r\n]+/);
39 if (peers.length === 0)
40 return;
42 new Request({
43 url: "api/v2/torrents/addPeers",
44 method: "post",
45 data: {
46 hashes: hash,
47 peers: peers.join("|")
49 onFailure: function() {
50 alert("QBT_TR(Unable to add peers. Please ensure you are adhering to the IP:port format.)QBT_TR[CONTEXT=HttpServer]");
52 onSuccess: function() {
53 window.parent.qBittorrent.Client.closeWindows();
55 }).send();
56 });
57 });
58 </script>
59 </head>
61 <body>
62 <div style="padding: 10px 10px 0px 10px;">
63 <label for="peers">QBT_TR(List of peers to add (one IP per line):)QBT_TR[CONTEXT=PeersAdditionDialog]</label>
64 <textarea id="peers" rows="10" style="width: 100%;" placeholder="QBT_TR(Format: IPv4:port / [IPv6]:port)QBT_TR[CONTEXT=PeersAdditionDialog]"></textarea>
65 <div style="margin-top: 10px; text-align: center;">
66 <button type="button" onclick="parent.qBittorrent.Client.closeWindows();">QBT_TR(Cancel)QBT_TR[CONTEXT=PeersAdditionDialog]</button>
67 <button type="button" id="addPeersOk">QBT_TR(Ok)QBT_TR[CONTEXT=PeersAdditionDialog]</button>
68 </div>
69 </div>
70 </body>
72 </html>