Allow to refresh existing search
[qBittorrent.git] / src / webui / www / private / newfolder.html
blob9397228194ca57321b5305bf28f4e8aae2b92963
1 <!DOCTYPE html>
2 <html lang="${LANG}" class="dark">
4 <head>
5 <meta charset="UTF-8">
6 <title>QBT_TR(Please choose a folder name)QBT_TR[CONTEXT=RSSWidget]</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 src="scripts/pathAutofill.js?v=${CACHEID}"></script>
14 <script>
15 "use strict";
17 window.addEventListener("DOMContentLoaded", () => {
18 window.addEventListener("keydown", (event) => {
19 switch (event.key) {
20 case "Enter":
21 event.preventDefault();
22 $("submitButton").click();
23 break;
24 case "Escape":
25 event.preventDefault();
26 window.parent.qBittorrent.Client.closeFrameWindow(window);
27 break;
29 });
31 $("folderName").focus();
32 const path = new URI().getData("path");
33 $("submitButton").addEventListener("click", (e) => {
34 e.preventDefault();
35 e.stopPropagation();
37 // check field
38 const folderName = $("folderName").value.trim();
39 if (folderName === "") {
40 alert("QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]");
41 return;
44 $("submitButton").disabled = true;
46 fetch("api/v2/rss/addFolder", {
47 method: "POST",
48 body: new URLSearchParams({
49 path: path ? (path + "\\" + folderName) : folderName
52 .then(async (response) => {
53 if (!response.ok) {
54 if (response.status === 409)
55 alert(await response.text());
56 $("submitButton").disabled = false;
57 return;
60 window.parent.qBittorrent.Rss.updateRssFeedList();
61 window.parent.qBittorrent.Client.closeFrameWindow(window);
62 });
63 });
64 });
66 window.qBittorrent.pathAutofill.attachPathAutofill();
67 </script>
68 </head>
70 <body>
71 <div style="padding: 10px 10px 0px 10px;">
72 <label for="folderName" style="font-weight: bold;">QBT_TR(Folder name:)QBT_TR[CONTEXT=RSSWidget]</label>
73 <input type="text" id="folderName" class="pathDirectory" style="width: 320px;">
74 <div style="text-align: center; padding-top: 10px;">
75 <input type="button" value="QBT_TR(OK)QBT_TR[CONTEXT=HttpServer]" id="submitButton">
76 </div>
77 </div>
78 </body>
80 </html>