Display External IP Address in status bar
[qBittorrent.git] / src / webui / www / private / views / confirmAutoTMM.html
blob14ae0a87e5dba6535ad921f4faa233d23fe1a277
1 <div id="confirmAutoTMMDialog">
2 <div class="genericConfirmGrid">
3 <span class="confirmGridItem confirmWarning"></span>
4 <span class="confirmGridItem dialogMessage" id="confirmAutoTmmMessage"></span>
5 </div>
6 </div>
7 <div>
8 <input type="button" value="QBT_TR(Yes)QBT_TR[CONTEXT=MainWindow]" id="confirmAutoTmmButton">
9 <input type="button" value="QBT_TR(No)QBT_TR[CONTEXT=MainWindow]" id="cancelAutoTmmButton">
10 </div>
12 <script>
13 "use strict";
15 (() => {
16 const confirmButton = document.getElementById("confirmAutoTmmButton");
17 const cancelButton = document.getElementById("cancelAutoTmmButton");
18 const confirmText = document.getElementById("confirmAutoTmmMessage");
20 const {
21 options: { data: { hashes, enable }, id },
22 windowEl
23 } = window.MUI.Windows.instances["confirmAutoTMMDialog"];
25 confirmText.textContent = "QBT_TR(Are you sure you want to enable Automatic Torrent Management for the selected torrent(s)? They may be relocated.)QBT_TR[CONTEXT=confirmAutoTMMDialog]";
27 cancelButton.addEventListener("click", (e) => { window.qBittorrent.Client.closeWindow(id); });
28 confirmButton.addEventListener("click", (e) => {
29 new Request({
30 url: "api/v2/torrents/setAutoManagement",
31 method: "post",
32 data: {
33 hashes: hashes.join("|"),
34 enable: enable
36 onSuccess: () => {
37 updateMainData();
38 window.qBittorrent.Client.closeWindow(id);
40 onFailure: () => {
41 alert("QBT_TR(Unable to set Auto Torrent Management for the selected torrents.)QBT_TR[CONTEXT=HttpServer]");
43 }).send();
44 });
46 // set tabindex so window element receives keydown events
47 windowEl.setAttribute("tabindex", "-1");
48 windowEl.focus();
49 windowEl.addEventListener("keydown", (e) => {
50 switch (e.key) {
51 case "Enter":
52 confirmButton.click();
53 break;
54 case "Escape":
55 window.qBittorrent.Client.closeWindow(id);
56 break;
58 });
59 })();
60 </script>