2022-10-18 22:39:32 -04:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="${LANG}">
|
|
|
|
|
|
|
|
<head>
|
2024-10-03 08:37:11 -04:00
|
|
|
<meta charset="UTF-8">
|
2022-11-30 13:49:48 -05:00
|
|
|
<title>Torrent Download Speed Limiting</title>
|
2024-10-03 08:37:11 -04:00
|
|
|
<link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css">
|
2022-10-18 22:39:32 -04:00
|
|
|
<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/lib/mocha.min.js"></script>
|
|
|
|
<script src="scripts/speedslider.js?v=${CACHEID}"></script>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div style="width: 100%; text-align: center; margin: 0 auto; overflow: hidden">
|
|
|
|
<div id="dllimitSlider" class="slider">
|
2024-10-03 08:37:11 -04:00
|
|
|
<div id="dllimitUpdate" class="update">
|
|
|
|
<label for="dllimitUpdatevalue">Download limit:</label>
|
|
|
|
<input type="text" id="dllimitUpdatevalue" size="6" placeholder="∞" style="text-align: center;">
|
|
|
|
<span id="dlLimitUnit">KiB/s</span>
|
|
|
|
</div>
|
2022-10-18 22:39:32 -04:00
|
|
|
<div class="sliderWrapper">
|
|
|
|
<div id="dllimitSliderknob" class="sliderknob"></div>
|
|
|
|
<div id="dllimitSliderarea" class="sliderarea"></div>
|
|
|
|
</div>
|
|
|
|
<div class="clear"></div>
|
|
|
|
</div>
|
2024-10-03 08:37:11 -04:00
|
|
|
<input type="button" id="applyButton" value="Apply" onclick="setDlLimit()">
|
2022-10-18 22:39:32 -04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
2024-10-03 08:37:11 -04:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const hashes = new URI().getData("hashes").split("|");
|
|
|
|
const setDlLimit = function() {
|
|
|
|
const limit = $("dllimitUpdatevalue").value.toInt() * 1024;
|
|
|
|
if (hashes[0] === "global") {
|
|
|
|
new Request({
|
|
|
|
url: "api/v2/transfer/setDownloadLimit",
|
|
|
|
method: "post",
|
|
|
|
data: {
|
|
|
|
"limit": limit
|
|
|
|
},
|
|
|
|
onComplete: function() {
|
|
|
|
window.parent.updateMainData();
|
|
|
|
window.parent.qBittorrent.Client.closeWindows();
|
|
|
|
}
|
|
|
|
}).send();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
new Request({
|
|
|
|
url: "api/v2/torrents/setDownloadLimit",
|
|
|
|
method: "post",
|
|
|
|
data: {
|
|
|
|
"hashes": hashes.join("|"),
|
|
|
|
"limit": limit
|
|
|
|
},
|
|
|
|
onComplete: function() {
|
|
|
|
window.parent.qBittorrent.Client.closeWindows();
|
|
|
|
}
|
|
|
|
}).send();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-10-18 22:39:32 -04:00
|
|
|
new Keyboard({
|
2024-10-03 08:37:11 -04:00
|
|
|
defaultEventType: "keydown",
|
2022-10-18 22:39:32 -04:00
|
|
|
events: {
|
2024-10-03 08:37:11 -04:00
|
|
|
"Enter": function(event) {
|
|
|
|
$("applyButton").click();
|
2022-10-18 22:39:32 -04:00
|
|
|
event.preventDefault();
|
|
|
|
},
|
2024-10-03 08:37:11 -04:00
|
|
|
"Escape": function(event) {
|
|
|
|
window.parent.qBittorrent.Client.closeWindows();
|
2022-10-18 22:39:32 -04:00
|
|
|
event.preventDefault();
|
|
|
|
},
|
2024-10-03 08:37:11 -04:00
|
|
|
"Esc": function(event) {
|
|
|
|
window.parent.qBittorrent.Client.closeWindows();
|
2022-10-18 22:39:32 -04:00
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).activate();
|
|
|
|
|
2024-10-03 08:37:11 -04:00
|
|
|
$("dllimitUpdatevalue").focus();
|
2022-10-18 22:39:32 -04:00
|
|
|
|
|
|
|
MochaUI.addDlLimitSlider(hashes);
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|