WebUI: Improve hash copy actions in context menu
[qBittorrent.git] / src / webui / www / private / uploadlimit.html
blob44dc6a8767a8864d73f7a5c7e962a8eabc047da8
1 <!DOCTYPE html>
2 <html lang="${LANG}">
4 <head>
5 <meta charset="UTF-8">
6 <title>QBT_TR(Torrent Upload Speed Limiting)QBT_TR[CONTEXT=TransferListWidget]</title>
7 <link rel="stylesheet" href="css/style.css?v=${CACHEID}" type="text/css">
8 <script src="scripts/lib/MooTools-Core-1.6.0-compat-compressed.js"></script>
9 <script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
10 <script src="scripts/lib/mocha.min.js"></script>
11 <script src="scripts/speedslider.js?v=${CACHEID}"></script>
12 </head>
14 <body>
15 <div style="width: 100%; text-align: center; margin: 0 auto; overflow: hidden">
16 <div id="uplimitSlider" class="slider">
17 <div id="uplimitUpdate" class="update">
18 <label for="uplimitUpdatevalue">QBT_TR(Upload limit:)QBT_TR[CONTEXT=PropertiesWidget]</label>
19 <input type="text" id="uplimitUpdatevalue" size="6" placeholder="∞" style="text-align: center;">
20 <span id="upLimitUnit">QBT_TR(KiB/s)QBT_TR[CONTEXT=SpeedLimitDialog]</span>
21 </div>
22 <div class="sliderWrapper">
23 <div id="uplimitSliderknob" class="sliderknob"></div>
24 <div id="uplimitSliderarea" class="sliderarea"></div>
25 </div>
26 <div class="clear"></div>
27 </div>
28 <input type="button" id="applyButton" value="QBT_TR(Apply)QBT_TR[CONTEXT=HttpServer]" onclick="setUpLimit()">
29 </div>
31 <script>
32 "use strict";
34 const hashes = new URI().getData("hashes").split("|");
35 const setUpLimit = function() {
36 const limit = $("uplimitUpdatevalue").value.toInt() * 1024;
37 if (hashes[0] === "global") {
38 new Request({
39 url: "api/v2/transfer/setUploadLimit",
40 method: "post",
41 data: {
42 "limit": limit
44 onComplete: function() {
45 window.parent.updateMainData();
46 window.parent.qBittorrent.Client.closeWindows();
48 }).send();
50 else {
51 new Request({
52 url: "api/v2/torrents/setUploadLimit",
53 method: "post",
54 data: {
55 "hashes": hashes.join("|"),
56 "limit": limit
58 onComplete: function() {
59 window.parent.qBittorrent.Client.closeWindows();
61 }).send();
65 new Keyboard({
66 defaultEventType: "keydown",
67 events: {
68 "Enter": function(event) {
69 $("applyButton").click();
70 event.preventDefault();
72 "Escape": function(event) {
73 window.parent.qBittorrent.Client.closeWindows();
74 event.preventDefault();
76 "Esc": function(event) {
77 window.parent.qBittorrent.Client.closeWindows();
78 event.preventDefault();
81 }).activate();
83 $("uplimitUpdatevalue").focus();
85 MochaUI.addUpLimitSlider(hashes);
86 </script>
87 </body>
89 </html>