WebUI: unify curly bracket usage
[qBittorrent.git] / src / webui / www / private / rename_feed.html
blob4002286d7bf4bf81102241e01584b604e0229ff8
1 <!DOCTYPE html>
2 <html lang="${LANG}">
4 <head>
5 <meta charset="UTF-8" />
6 <title>QBT_TR(Please choose a new name for this RSS feed)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/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.qBittorrent.Client.closeWindows();
23 event.preventDefault();
25 "Esc": (event) => {
26 window.parent.qBittorrent.Client.closeWindows();
27 event.preventDefault();
30 }).activate();
31 window.addEvent("domready", () => {
32 const oldPath = new URI().getData("oldPath");
34 $("rename").value = oldPath;
35 $("rename").focus();
36 $("rename").setSelectionRange(0, oldPath.length);
38 $("renameButton").addEvent("click", (e) => {
39 new Event(e).stop();
40 // check field
41 const newPath = $("rename").value.trim();
42 if (newPath === "") {
43 alert("QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]");
44 return;
47 if (newPath === oldPath) {
48 alert("QBT_TR(Name is unchanged)QBT_TR[CONTEXT=HttpServer]");
49 return;
52 $("renameButton").disabled = true;
54 new Request({
55 url: "api/v2/rss/moveItem",
56 method: "post",
57 data: {
58 itemPath: oldPath,
59 destPath: newPath
61 onSuccess: (response) => {
62 window.parent.qBittorrent.Rss.updateRssFeedList();
63 window.parent.qBittorrent.Client.closeWindows();
65 onFailure: (response) => {
66 if (response.status === 409)
67 alert(response.responseText);
68 $("renameButton").disabled = false;
70 }).send();
71 });
72 });
73 </script>
74 </head>
76 <body>
77 <div style="padding: 10px 10px 0px 10px;">
78 <p style="font-weight: bold;">QBT_TR(New feed name:)QBT_TR[CONTEXT=RSSWidget]</p>
79 <input type="text" id="rename" style="width: 320px;" />
80 <div style="text-align: center; padding-top: 10px;">
81 <input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" id="renameButton" />
82 </div>
83 </div>
84 </body>
86 </html>