WebUI: Use Map instead of Mootools Hash in Torrents table
[qBittorrent.git] / src / webui / www / private / newfeed.html
blob0887dce736fbb9f07dcbcb6db9100bf2026c9737
1 <!DOCTYPE html>
2 <html lang="${LANG}">
4 <head>
5 <meta charset="UTF-8">
6 <title>QBT_TR(Please type a RSS feed URL)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 $("submitButton").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.addEventListener("DOMContentLoaded", () => {
32 $("feedURL").focus();
33 const path = new URI().getData("path");
34 $("submitButton").addEventListener("click", (e) => {
35 e.preventDefault();
36 e.stopPropagation();
38 // check field
39 const feedURL = $("feedURL").value.trim();
40 if (feedURL === "") {
41 alert("QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]");
42 return;
45 $("submitButton").disabled = true;
47 new Request({
48 url: "api/v2/rss/addFeed",
49 method: "post",
50 data: {
51 url: feedURL,
52 path: path ? (path + "\\" + feedURL) : ""
54 onSuccess: (response) => {
55 window.parent.qBittorrent.Rss.updateRssFeedList();
56 window.parent.qBittorrent.Client.closeWindows();
58 onFailure: (response) => {
59 if (response.status === 409)
60 alert(response.responseText);
61 $("submitButton").disabled = false;
63 }).send();
64 });
65 });
66 </script>
67 </head>
69 <body>
70 <div style="padding: 10px 10px 0px 10px;">
71 <label for="feedURL" style="font-weight: bold;">QBT_TR(Feed URL:)QBT_TR[CONTEXT=RSSWidget]</label>
72 <input type="text" id="feedURL" style="width: 320px;">
73 <div style="text-align: center; padding-top: 10px;">
74 <input type="button" value="QBT_TR(OK)QBT_TR[CONTEXT=HttpServer]" id="submitButton">
75 </div>
76 </div>
77 </body>
79 </html>