mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-27 15:04:36 +00:00
Merge pull request #2307 from pmzqla/webui-altspeed
WebUI: Alternative speed limits fixes
This commit is contained in:
commit
7bc7b0e6b8
@ -27,7 +27,7 @@ myTable = new dynamicTable();
|
||||
var updatePropertiesPanel = function(){};
|
||||
var updateTransferInfo = function(){};
|
||||
var updateTransferList = function(){};
|
||||
var alternativeSpeedsLimit = false;
|
||||
var alternativeSpeedLimits = false;
|
||||
|
||||
var stateToImg = function (state) {
|
||||
if (state == "pausedUP" || state == "pausedDL") {
|
||||
@ -297,25 +297,25 @@ window.addEvent('load', function () {
|
||||
new Request({url: 'command/alternativeSpeedLimitsEnabled',
|
||||
method: 'get',
|
||||
onSuccess : function (isEnabled) {
|
||||
alternativeSpeedsLimit = !!isEnabled;
|
||||
if (alternativeSpeedsLimit)
|
||||
alternativeSpeedLimits = !!parseInt(isEnabled);
|
||||
if (alternativeSpeedLimits)
|
||||
$('alternativeSpeedLimits').src = "images/slow.png"
|
||||
}
|
||||
}).send();
|
||||
|
||||
$('alternativeSpeedLimits').addEvent('click', function() {
|
||||
// Change icon immediately to give some feedback
|
||||
updateAltSpeedIcon(!alternativeSpeedsLimit);
|
||||
updateAltSpeedIcon(!alternativeSpeedLimits);
|
||||
|
||||
new Request({url: 'command/toggleAlternativeSpeedLimits',
|
||||
method: 'post',
|
||||
onComplete: function() {
|
||||
alternativeSpeedsLimit = !alternativeSpeedsLimit;
|
||||
alternativeSpeedLimits = !alternativeSpeedLimits;
|
||||
updateTransferInfo();
|
||||
},
|
||||
onFailure: function() {
|
||||
// Restore icon in case of failure
|
||||
updateAltSpeedIcon(alternativeSpeedsLimit)
|
||||
updateAltSpeedIcon(alternativeSpeedLimits)
|
||||
}
|
||||
}).send();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user