mirror of
https://github.com/Carve/qbittorrent-webui-cjratliff.com.git
synced 2025-02-28 23:50:57 +01:00
89 lines
3.0 KiB
HTML
89 lines
3.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="${LANG}">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Please choose a new name for this RSS feed</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) => {
|
|
$("renameButton").click();
|
|
event.preventDefault();
|
|
},
|
|
"Escape": (event) => {
|
|
window.parent.qBittorrent.Client.closeWindows();
|
|
event.preventDefault();
|
|
},
|
|
"Esc": (event) => {
|
|
window.parent.qBittorrent.Client.closeWindows();
|
|
event.preventDefault();
|
|
}
|
|
}
|
|
}).activate();
|
|
window.addEventListener("DOMContentLoaded", () => {
|
|
const oldPath = new URI().getData("oldPath");
|
|
|
|
$("rename").value = oldPath;
|
|
$("rename").focus();
|
|
$("rename").setSelectionRange(0, oldPath.length);
|
|
|
|
$("renameButton").addEventListener("click", (e) => {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
|
|
// check field
|
|
const newPath = $("rename").value.trim();
|
|
if (newPath === "") {
|
|
alert("Name cannot be empty");
|
|
return;
|
|
}
|
|
|
|
if (newPath === oldPath) {
|
|
alert("Name is unchanged");
|
|
return;
|
|
}
|
|
|
|
$("renameButton").disabled = true;
|
|
|
|
new Request({
|
|
url: "api/v2/rss/moveItem",
|
|
method: "post",
|
|
data: {
|
|
itemPath: oldPath,
|
|
destPath: newPath
|
|
},
|
|
onSuccess: (response) => {
|
|
window.parent.qBittorrent.Rss.updateRssFeedList();
|
|
window.parent.qBittorrent.Client.closeWindows();
|
|
},
|
|
onFailure: (response) => {
|
|
if (response.status === 409)
|
|
alert(response.responseText);
|
|
$("renameButton").disabled = false;
|
|
}
|
|
}).send();
|
|
});
|
|
});
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<div style="padding: 10px 10px 0px 10px;">
|
|
<label for="rename" style="font-weight: bold;">New feed name:</label>
|
|
<input type="text" id="rename" style="width: 320px;">
|
|
<div style="text-align: center; padding-top: 10px;">
|
|
<input type="button" value="Save" id="renameButton">
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|