mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-03 06:02:29 -06:00
87 lines
3.3 KiB
HTML
87 lines
3.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="${LANG}" class="dark">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>QBT_TR(Please type a RSS feed URL)QBT_TR[CONTEXT=RSSWidget]</title>
|
|
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css">
|
|
<script defer src="scripts/localpreferences.js?v=${CACHEID}"></script>
|
|
<script defer src="scripts/color-scheme.js?v=${CACHEID}"></script>
|
|
<script>
|
|
"use strict";
|
|
|
|
window.addEventListener("DOMContentLoaded", (event) => {
|
|
window.addEventListener("keydown", (event) => {
|
|
switch (event.key) {
|
|
case "Enter":
|
|
event.preventDefault();
|
|
document.getElementById("submitButton").click();
|
|
break;
|
|
case "Escape":
|
|
event.preventDefault();
|
|
window.parent.qBittorrent.Client.closeFrameWindow(window);
|
|
break;
|
|
}
|
|
});
|
|
|
|
const searchParams = new URLSearchParams(window.location.search);
|
|
const currentUrl = searchParams.get("url");
|
|
|
|
document.getElementById("url").value = currentUrl;
|
|
document.getElementById("url").focus();
|
|
document.getElementById("url").setSelectionRange(0, currentUrl.length);
|
|
|
|
document.getElementById("submitButton").addEventListener("click", (e) => {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
|
|
// check field
|
|
const newUrl = document.getElementById("url").value.trim();
|
|
if (newUrl === "") {
|
|
alert("QBT_TR(URL cannot be empty)QBT_TR[CONTEXT=RSSWidget]");
|
|
return;
|
|
}
|
|
|
|
if (newUrl === currentUrl) {
|
|
alert("QBT_TR(URL is unchanged)QBT_TR[CONTEXT=RSSWidget]");
|
|
return;
|
|
}
|
|
|
|
document.getElementById("submitButton").disabled = true;
|
|
|
|
fetch("api/v2/rss/setFeedURL", {
|
|
method: "POST",
|
|
body: new URLSearchParams({
|
|
path: searchParams.get("path"),
|
|
url: newUrl
|
|
})
|
|
})
|
|
.then(async (response) => {
|
|
if (!response.ok) {
|
|
alert((response.status === 409)
|
|
? await response.text()
|
|
: "QBT_TR(Unable to update URL)QBT_TR[CONTEXT=RSSWidget]");
|
|
document.getElementById("submitButton").disabled = false;
|
|
return;
|
|
}
|
|
|
|
window.parent.qBittorrent.Rss.updateRssFeedList();
|
|
window.parent.qBittorrent.Client.closeFrameWindow(window);
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<div style="padding: 10px 10px 0px 10px;">
|
|
<label for="url" style="font-weight: bold;">QBT_TR(Feed URL:)QBT_TR[CONTEXT=RSSWidget]</label>
|
|
<input type="text" id="url" style="width: 320px;">
|
|
<div style="text-align: center; padding-top: 10px;">
|
|
<input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" id="submitButton">
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|