WebUI: Use Map instead of Mootools Hash in Torrents table
[qBittorrent.git] / src / webui / www / private / newrule.html
blob09a2708df1389c8a05de86ed899a5ba4b2e45bc2
1 <!DOCTYPE html>
2 <html lang="${LANG}">
4 <head>
5 <meta charset="UTF-8">
6 <title>QBT_TR(New rule name)QBT_TR[CONTEXT=AutomatedRssDownloader]</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": (event) => {
18 $("submitButton").click();
19 event.preventDefault();
21 "Escape": (event) => {
22 window.parent.MochaUI.closeWindow(window.parent.$("newRulePage"));
23 event.preventDefault();
25 "Esc": (event) => {
26 window.parent.MochaUI.closeWindow(window.parent.$("newRulePage"));
27 event.preventDefault();
30 }).activate();
31 window.addEventListener("DOMContentLoaded", () => {
32 $("name").focus();
33 $("submitButton").addEventListener("click", (e) => {
34 e.preventDefault();
35 e.stopPropagation();
37 // check field
38 const name = $("name").value.trim();
39 if (name === "") {
40 alert("QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]");
41 return;
43 $("submitButton").disabled = true;
44 new Request({
45 url: "api/v2/rss/setRule",
46 method: "post",
47 data: {
48 ruleName: name,
49 ruleDef: "{}"
51 onSuccess: (response) => {
52 window.parent.qBittorrent.RssDownloader.updateRulesList();
53 window.parent.MochaUI.closeWindow(window.parent.$("newRulePage"));
55 }).send();
56 });
57 });
58 </script>
59 </head>
61 <body>
62 <div style="padding: 10px 10px 0px 10px;">
63 <label for="name">QBT_TR(Please type the name of the new download rule.)QBT_TR[CONTEXT=AutomatedRssDownloader]</label>
64 <input type="text" id="name" style="width: 320px;">
65 <div style="text-align: center; padding-top: 10px;">
66 <input type="button" value="QBT_TR(OK)QBT_TR[CONTEXT=HttpServer]" id="submitButton">
67 </div>
68 </div>
69 </body>
71 </html>