mirror of
https://github.com/Carve/qbittorrent-webui-cjratliff.com.git
synced 2025-02-28 23:50:57 +01:00
92 lines
3.1 KiB
HTML
92 lines
3.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="${LANG}">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Please type a RSS feed URL</title>
|
|
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css">
|
|
<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>
|
|
"use strict";
|
|
|
|
new Keyboard({
|
|
defaultEventType: "keydown",
|
|
events: {
|
|
"Enter": (event) => {
|
|
event.preventDefault();
|
|
$("submitButton").click();
|
|
},
|
|
"Escape": (event) => {
|
|
event.preventDefault();
|
|
window.parent.qBittorrent.Client.closeWindow("editFeedURL");
|
|
},
|
|
"Esc": (event) => {
|
|
event.preventDefault();
|
|
window.parent.qBittorrent.Client.closeWindow("editFeedURL");
|
|
}
|
|
}
|
|
}).activate();
|
|
|
|
window.addEventListener("DOMContentLoaded", () => {
|
|
const currentUrl = new URI().getData("url");
|
|
|
|
$("url").value = currentUrl;
|
|
$("url").focus();
|
|
$("url").setSelectionRange(0, currentUrl.length);
|
|
|
|
$("submitButton").addEventListener("click", (e) => {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
|
|
// check field
|
|
const newUrl = $("url").value.trim();
|
|
if (newUrl === "") {
|
|
alert("URL cannot be empty");
|
|
return;
|
|
}
|
|
|
|
if (newUrl === currentUrl) {
|
|
alert("URL is unchanged");
|
|
return;
|
|
}
|
|
|
|
$("submitButton").disabled = true;
|
|
|
|
new Request({
|
|
url: "api/v2/rss/setFeedURL",
|
|
method: "post",
|
|
data: {
|
|
path: new URI().getData("path"),
|
|
url: newUrl
|
|
},
|
|
onSuccess: (response) => {
|
|
window.parent.qBittorrent.Rss.updateRssFeedList();
|
|
window.parent.qBittorrent.Client.closeWindow("editFeedURL");
|
|
},
|
|
onFailure: (response) => {
|
|
if (response.status === 409)
|
|
alert(response.responseText);
|
|
else
|
|
alert("Unable to update URL");
|
|
$("submitButton").disabled = false;
|
|
}
|
|
}).send();
|
|
});
|
|
});
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<div style="padding: 10px 10px 0px 10px;">
|
|
<label for="url" style="font-weight: bold;">Feed URL:</label>
|
|
<input type="text" id="url" style="width: 320px;">
|
|
<div style="text-align: center; padding-top: 10px;">
|
|
<input type="button" value="Save" id="submitButton">
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|