82 lines
2.9 KiB
HTML
Raw Permalink Normal View History

2022-10-18 22:39:32 -04:00
<!DOCTYPE html>
<html lang="${LANG}">
<head>
<meta charset="UTF-8">
<title>Please choose a folder name</title>
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css">
2022-10-18 22:39:32 -04:00
<script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
<script src="scripts/pathAutofill.js?v=${CACHEID}"></script>
2022-10-18 22:39:32 -04:00
<script>
"use strict";
2022-10-18 22:39:32 -04:00
new Keyboard({
defaultEventType: "keydown",
2022-10-18 22:39:32 -04:00
events: {
"Enter": (event) => {
$("submitButton").click();
2022-10-18 22:39:32 -04:00
event.preventDefault();
},
"Escape": (event) => {
window.parent.qBittorrent.Client.closeWindows();
2022-10-18 22:39:32 -04:00
event.preventDefault();
},
"Esc": (event) => {
window.parent.qBittorrent.Client.closeWindows();
2022-10-18 22:39:32 -04:00
event.preventDefault();
}
}
}).activate();
window.addEventListener("DOMContentLoaded", () => {
$("folderName").focus();
const path = new URI().getData("path");
$("submitButton").addEventListener("click", (e) => {
e.preventDefault();
e.stopPropagation();
2022-10-18 22:39:32 -04:00
// check field
const folderName = $("folderName").value.trim();
if (folderName === "") {
alert("Name cannot be empty");
2022-10-18 22:39:32 -04:00
return;
}
$("submitButton").disabled = true;
2022-10-18 22:39:32 -04:00
new Request({
url: "api/v2/rss/addFolder",
method: "post",
2022-10-18 22:39:32 -04:00
data: {
path: path ? (path + "\\" + folderName) : folderName
2022-10-18 22:39:32 -04:00
},
onSuccess: (response) => {
window.parent.qBittorrent.Rss.updateRssFeedList();
window.parent.qBittorrent.Client.closeWindows();
2022-10-18 22:39:32 -04:00
},
onFailure: (response) => {
if (response.status === 409)
alert(response.responseText);
$("submitButton").disabled = false;
2022-10-18 22:39:32 -04:00
}
}).send();
});
});
window.qBittorrent.pathAutofill.attachPathAutofill();
2022-10-18 22:39:32 -04:00
</script>
</head>
<body>
<div style="padding: 10px 10px 0px 10px;">
<label for="folderName" style="font-weight: bold;">Folder name:</label>
<input type="text" id="folderName" class="pathDirectory" style="width: 320px;">
2022-10-18 22:39:32 -04:00
<div style="text-align: center; padding-top: 10px;">
<input type="button" value="OK" id="submitButton">
2022-10-18 22:39:32 -04:00
</div>
</div>
</body>
</html>