- Allow to set up per-torrent download rate limit from Web UI too

This commit is contained in:
Christophe Dumez 2009-11-25 10:09:14 +00:00
parent 236c0da563
commit afaf40eee0
4 changed files with 91 additions and 6 deletions

View file

@ -34,20 +34,60 @@ MochaUI.extend({
onChange: function(pos){
if(pos > 0) {
$('uplimitUpdatevalue').set('html', pos);
$('UpLimitUnit').set('html', "_(KiB/s)");
$('upLimitUnit').set('html', "_(KiB/s)");
} else {
$('uplimitUpdatevalue').set('html', '∞');
$('UpLimitUnit').set('html', "");
$('upLimitUnit').set('html', "");
}
}.bind(this)
});
// Set default value
if(up_limit == 0) {
$('uplimitUpdatevalue').set('html', '∞');
$('UpLimitUnit').set('html', "");
$('upLimitUnit').set('html', "");
} else {
$('uplimitUpdatevalue').set('html', (up_limit/1024.).round());
$('UpLimitUnit').set('html', "_(KiB/s)");
$('upLimitUnit').set('html', "_(KiB/s)");
}
}
}
}).send();
}
},
addDlLimitSlider: function(hash){
if ($('dllimitSliderarea')) {
var windowOptions = MochaUI.Windows.windowOptions;
var sliderFirst = true;
var req = new Request({
url: '/command/getTorrentDlLimit',
method: 'post',
data: {hash: hash},
onSuccess: function(data) {
if(data){
var dl_limit = data.toInt();
if(dl_limit < 0) dl_limit = 0;
var mochaSlide = new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
steps: 500,
offset: 0,
initialStep: (dl_limit/1024.).round(),
onChange: function(pos){
if(pos > 0) {
$('dllimitUpdatevalue').set('html', pos);
$('dlLimitUnit').set('html', "_(KiB/s)");
} else {
$('dllimitUpdatevalue').set('html', '∞');
$('dlLimitUnit').set('html', "");
}
}.bind(this)
});
// Set default value
if(dl_limit == 0) {
$('dllimitUpdatevalue').set('html', '∞');
$('dlLimitUnit').set('html', "");
} else {
$('dllimitUpdatevalue').set('html', (dl_limit/1024.).round());
$('dlLimitUnit').set('html', "_(KiB/s)");
}
}
}