Files
qBittorrent/src/webui/www/private/setlocation.html
Hanabishi 06fe3e5fb0 WebUI: fix color scheme for iframes
Applies the color scheme for iframe dialogs.

Fixup for #21613.
PR #21750.
2024-11-09 16:02:28 +08:00

85 lines
3.2 KiB
HTML

<!DOCTYPE html>
<html lang="${LANG}" class="dark">
<head>
<meta charset="UTF-8">
<title>QBT_TR(Set location)QBT_TR[CONTEXT=HttpServer]</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";
new Keyboard({
defaultEventType: "keydown",
events: {
"Enter": function(event) {
$("setLocationButton").click();
event.preventDefault();
},
"Escape": function(event) {
window.parent.qBittorrent.Client.closeWindows();
event.preventDefault();
},
"Esc": function(event) {
window.parent.qBittorrent.Client.closeWindows();
event.preventDefault();
}
}
}).activate();
window.addEventListener("DOMContentLoaded", () => {
const path = new URI().getData("path");
// set text field to current value
if (path)
$("setLocation").value = decodeURIComponent(path);
$("setLocation").focus();
$("setLocationButton").addEventListener("click", (e) => {
e.preventDefault();
e.stopPropagation();
// check field
const location = $("setLocation").value.trim();
if ((location === null) || (location === "")) {
$("error_div").textContent = "QBT_TR(Save path is empty)QBT_TR[CONTEXT=TorrentsController]";
return;
}
const hashesList = new URI().getData("hashes");
new Request({
url: "api/v2/torrents/setLocation",
method: "post",
data: {
hashes: hashesList,
location: location
},
onSuccess: () => {
window.parent.qBittorrent.Client.closeWindows();
},
onFailure: (xhr) => {
$("error_div").textContent = xhr.response;
}
}).send();
});
});
</script>
</head>
<body>
<div style="padding: 10px 10px 0px 10px;">
<label for="setLocation" style="font-weight: bold;">QBT_TR(Location:)QBT_TR[CONTEXT=TransferListWidget]</label>
<input type="text" id="setLocation" autocorrect="off" autocapitalize="none" style="width: 99%;">
<div style="float: none; width: 99%;" id="error_div">&nbsp;</div>
<div style="text-align: center; padding-top: 10px;">
<input type="button" value="QBT_TR(Save)QBT_TR[CONTEXT=HttpServer]" id="setLocationButton">
</div>
</div>
</body>
</html>