qbittorrent-webui-cjratliff.../private/edittracker.html

74 lines
2.4 KiB
HTML

<!DOCTYPE html>
<html lang="${LANG}">
<head>
<meta charset="UTF-8">
<title>Tracker editing</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>
"use strict";
window.addEventListener("DOMContentLoaded", () => {
new Keyboard({
defaultEventType: "keydown",
events: {
"Enter": function(event) {
$("editTrackerButton").click();
event.preventDefault();
},
"Escape": function(event) {
window.parent.qBittorrent.Client.closeWindows();
event.preventDefault();
},
"Esc": function(event) {
window.parent.qBittorrent.Client.closeWindows();
event.preventDefault();
}
}
}).activate();
const currentUrl = new URI().getData("url");
if (!currentUrl)
return;
$("trackerUrl").value = currentUrl;
$("trackerUrl").focus();
$("editTrackerButton").addEventListener("click", (e) => {
e.preventDefault();
e.stopPropagation();
const hash = new URI().getData("hash");
new Request({
url: "api/v2/torrents/editTracker",
method: "post",
data: {
hash: hash,
origUrl: currentUrl,
newUrl: $("trackerUrl").value
},
onComplete: function() {
window.parent.qBittorrent.Client.closeWindows();
}
}).send();
});
});
</script>
</head>
<body>
<div style="text-align: center;">
<br>
<label for="trackerUrl">Tracker URL:</label>
<div style="text-align: center; padding-top: 10px;">
<input type="text" id="trackerUrl" style="width: 90%;">
</div>
<br>
<input type="button" value="Edit" id="editTrackerButton">
</div>
</body>
</html>