mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 05:08:05 -06:00
84 lines
3.0 KiB
HTML
84 lines
3.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="${LANG}" class="dark">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>QBT_TR(Rule renaming)QBT_TR[CONTEXT=AutomatedRssDownloader]</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/localpreferences.js?v=${CACHEID}"></script>
|
|
<script src="scripts/color-scheme.js?v=${CACHEID}"></script>
|
|
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
|
|
<script>
|
|
"use strict";
|
|
|
|
window.addEventListener("DOMContentLoaded", () => {
|
|
window.addEventListener("keydown", (event) => {
|
|
switch (event.key) {
|
|
case "Enter":
|
|
event.preventDefault();
|
|
$("renameButton").click();
|
|
break;
|
|
case "Escape":
|
|
event.preventDefault();
|
|
window.parent.qBittorrent.Client.closeFrameWindow(window);
|
|
break;
|
|
}
|
|
});
|
|
|
|
const oldName = new URI().getData("rule");
|
|
|
|
$("rename").value = oldName;
|
|
$("rename").focus();
|
|
$("rename").setSelectionRange(0, oldName.length);
|
|
|
|
$("renameButton").addEventListener("click", (e) => {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
|
|
// check field
|
|
const newName = $("rename").value.trim();
|
|
if (newName === "") {
|
|
alert("QBT_TR(Name cannot be empty)QBT_TR[CONTEXT=HttpServer]");
|
|
return;
|
|
}
|
|
|
|
if (newName === oldName) {
|
|
alert("QBT_TR(Name is unchanged)QBT_TR[CONTEXT=HttpServer]");
|
|
return;
|
|
}
|
|
|
|
$("renameButton").disabled = true;
|
|
|
|
fetch("api/v2/rss/renameRule", {
|
|
method: "POST",
|
|
body: new URLSearchParams({
|
|
"ruleName": oldName,
|
|
"newRuleName": newName
|
|
})
|
|
})
|
|
.then((response) => {
|
|
if (!response.ok)
|
|
return;
|
|
|
|
window.parent.qBittorrent.RssDownloader.updateRulesList();
|
|
window.parent.qBittorrent.Client.closeFrameWindow(window);
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
<div style="padding: 10px 10px 0px 10px;">
|
|
<label for="rename">QBT_TR(Please type the new rule name)QBT_TR[CONTEXT=AutomatedRssDownloader]</label>
|
|
<input type="text" id="rename" style="width: 320px;">
|
|
<div style="text-align: center; padding-top: 10px;">
|
|
<input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" id="renameButton">
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|