|
|
@ -31,11 +31,9 @@ |
|
|
|
MochaUI.extend({ |
|
|
|
MochaUI.extend({ |
|
|
|
addUpLimitSlider: function(hashes) { |
|
|
|
addUpLimitSlider: function(hashes) { |
|
|
|
if ($('uplimitSliderarea')) { |
|
|
|
if ($('uplimitSliderarea')) { |
|
|
|
const windowOptions = MochaUI.Windows.windowOptions; |
|
|
|
|
|
|
|
const sliderFirst = true; |
|
|
|
|
|
|
|
// Get global upload limit
|
|
|
|
// Get global upload limit
|
|
|
|
let maximum = 500; |
|
|
|
let maximum = 500; |
|
|
|
const req = new Request({ |
|
|
|
new Request({ |
|
|
|
url: 'api/v2/transfer/uploadLimit', |
|
|
|
url: 'api/v2/transfer/uploadLimit', |
|
|
|
method: 'post', |
|
|
|
method: 'post', |
|
|
|
data: {}, |
|
|
|
data: {}, |
|
|
@ -58,7 +56,7 @@ MochaUI.extend({ |
|
|
|
let up_limit = maximum; |
|
|
|
let up_limit = maximum; |
|
|
|
if (up_limit < 0) up_limit = 0; |
|
|
|
if (up_limit < 0) up_limit = 0; |
|
|
|
maximum = 10000; |
|
|
|
maximum = 10000; |
|
|
|
const mochaSlide = new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), { |
|
|
|
new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), { |
|
|
|
steps: maximum, |
|
|
|
steps: maximum, |
|
|
|
offset: 0, |
|
|
|
offset: 0, |
|
|
|
initialStep: up_limit.round(), |
|
|
|
initialStep: up_limit.round(), |
|
|
@ -84,7 +82,7 @@ MochaUI.extend({ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
const req = new Request.JSON({ |
|
|
|
new Request.JSON({ |
|
|
|
url: 'api/v2/torrents/uploadLimit', |
|
|
|
url: 'api/v2/torrents/uploadLimit', |
|
|
|
noCache : true, |
|
|
|
noCache : true, |
|
|
|
method: 'post', |
|
|
|
method: 'post', |
|
|
@ -100,7 +98,7 @@ MochaUI.extend({ |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (up_limit < 0) up_limit = 0; |
|
|
|
if (up_limit < 0) up_limit = 0; |
|
|
|
const mochaSlide = new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), { |
|
|
|
new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), { |
|
|
|
steps: maximum, |
|
|
|
steps: maximum, |
|
|
|
offset: 0, |
|
|
|
offset: 0, |
|
|
|
initialStep: (up_limit / 1024.0).round(), |
|
|
|
initialStep: (up_limit / 1024.0).round(), |
|
|
@ -135,11 +133,9 @@ MochaUI.extend({ |
|
|
|
|
|
|
|
|
|
|
|
addDlLimitSlider: function(hashes) { |
|
|
|
addDlLimitSlider: function(hashes) { |
|
|
|
if ($('dllimitSliderarea')) { |
|
|
|
if ($('dllimitSliderarea')) { |
|
|
|
const windowOptions = MochaUI.Windows.windowOptions; |
|
|
|
|
|
|
|
const sliderFirst = true; |
|
|
|
|
|
|
|
// Get global upload limit
|
|
|
|
// Get global upload limit
|
|
|
|
let maximum = 500; |
|
|
|
let maximum = 500; |
|
|
|
const req = new Request({ |
|
|
|
new Request({ |
|
|
|
url: 'api/v2/transfer/downloadLimit', |
|
|
|
url: 'api/v2/transfer/downloadLimit', |
|
|
|
method: 'post', |
|
|
|
method: 'post', |
|
|
|
data: {}, |
|
|
|
data: {}, |
|
|
@ -162,7 +158,7 @@ MochaUI.extend({ |
|
|
|
let dl_limit = maximum; |
|
|
|
let dl_limit = maximum; |
|
|
|
if (dl_limit < 0) dl_limit = 0; |
|
|
|
if (dl_limit < 0) dl_limit = 0; |
|
|
|
maximum = 10000; |
|
|
|
maximum = 10000; |
|
|
|
const mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), { |
|
|
|
new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), { |
|
|
|
steps: maximum, |
|
|
|
steps: maximum, |
|
|
|
offset: 0, |
|
|
|
offset: 0, |
|
|
|
initialStep: dl_limit.round(), |
|
|
|
initialStep: dl_limit.round(), |
|
|
@ -188,7 +184,7 @@ MochaUI.extend({ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
|
const req = new Request.JSON({ |
|
|
|
new Request.JSON({ |
|
|
|
url: 'api/v2/torrents/downloadLimit', |
|
|
|
url: 'api/v2/torrents/downloadLimit', |
|
|
|
noCache : true, |
|
|
|
noCache : true, |
|
|
|
method: 'post', |
|
|
|
method: 'post', |
|
|
@ -204,7 +200,7 @@ MochaUI.extend({ |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (dl_limit < 0) dl_limit = 0; |
|
|
|
if (dl_limit < 0) dl_limit = 0; |
|
|
|
const mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), { |
|
|
|
new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), { |
|
|
|
steps: maximum, |
|
|
|
steps: maximum, |
|
|
|
offset: 0, |
|
|
|
offset: 0, |
|
|
|
initialStep: (dl_limit / 1024.0).round(), |
|
|
|
initialStep: (dl_limit / 1024.0).round(), |
|
|
|