Enable customizing the save statistics time interval
[qBittorrent.git] / src / webui / www / private / rename_rule.html
bloba7cf930f83a2b190901f82128c7cb48ea9302130
1 <!DOCTYPE html>
2 <html lang="${LANG}">
4 <head>
5 <meta charset="UTF-8">
6 <title>QBT_TR(Rule renaming)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 $("renameButton").click();
19 event.preventDefault();
21 "Escape": (event) => {
22 window.parent.MochaUI.closeWindow(window.parent.$("renameRulePage"));
23 event.preventDefault();
25 "Esc": (event) => {
26 window.parent.MochaUI.closeWindow(window.parent.$("renameRulePage"));
27 event.preventDefault();
30 }).activate();
31 window.addEventListener("DOMContentLoaded", () => {
32 const oldName = new URI().getData("rule");
34 $("rename").value = oldName;
35 $("rename").focus();
36 $("rename").setSelectionRange(0, oldName.length);
38 $("renameButton").addEventListener("click", (e) => {
39 e.preventDefault();
40 e.stopPropagation();
42 // check field
43 const newName = $("rename").value.trim();
44 if (newName === "") {
45 alert("QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]");
46 return;
49 if (newName === oldName) {
50 alert("QBT_TR(Name is unchanged)QBT_TR[CONTEXT=HttpServer]");
51 return;
54 $("renameButton").disabled = true;
55 new Request({
56 url: "api/v2/rss/renameRule",
57 method: "post",
58 data: {
59 ruleName: oldName,
60 newRuleName: newName
62 onSuccess: (response) => {
63 window.parent.qBittorrent.RssDownloader.updateRulesList();
64 window.parent.MochaUI.closeWindow(window.parent.$("renameRulePage"));
66 }).send();
67 });
68 });
69 </script>
70 </head>
72 <body>
73 <div style="padding: 10px 10px 0px 10px;">
74 <label for="rename">QBT_TR(Please type the new rule name)QBT_TR[CONTEXT=AutomatedRssDownloader]</label>
75 <input type="text" id="rename" style="width: 320px;">
76 <div style="text-align: center; padding-top: 10px;">
77 <input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" id="renameButton">
78 </div>
79 </div>
80 </body>
82 </html>