refactor code
This commit is contained in:
parent
5411660e31
commit
0797237deb
|
@ -57,10 +57,6 @@
|
|||
var options = angular.copy($scope.context.options);
|
||||
var tasks = [];
|
||||
|
||||
if (pauseOnAdded) {
|
||||
options.pause = 'true';
|
||||
}
|
||||
|
||||
for (var i = 0; i < urls.length; i++) {
|
||||
tasks.push({
|
||||
urls: [urls[i].trim()],
|
||||
|
@ -68,7 +64,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
$rootScope.loadPromise = aria2TaskService.newUriTasks(tasks, function (response) {
|
||||
$rootScope.loadPromise = aria2TaskService.newUriTasks(tasks, pauseOnAdded, function (response) {
|
||||
if (!response.hasSuccess) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -168,10 +168,17 @@
|
|||
var contexts = [];
|
||||
|
||||
for (var i = 0; i < context.tasks.length; i++) {
|
||||
var task = context.tasks[i];
|
||||
var options = angular.copy(task.options);
|
||||
|
||||
if (context.pauseOnAdded) {
|
||||
options.pause = 'true';
|
||||
}
|
||||
|
||||
contexts.push({
|
||||
silent: !!context.silent,
|
||||
urls: context.tasks[i].urls,
|
||||
options: context.tasks[i].options
|
||||
urls: task.urls,
|
||||
options: options
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -248,9 +248,10 @@
|
|||
}
|
||||
});
|
||||
},
|
||||
newUriTasks: function (tasks, callback, silent) {
|
||||
newUriTasks: function (tasks, pauseOnAdded, callback, silent) {
|
||||
return aria2RpcService.addUriMulti({
|
||||
tasks: tasks,
|
||||
pauseOnAdded: !!pauseOnAdded,
|
||||
silent: !!silent,
|
||||
callback: callback
|
||||
});
|
||||
|
|
Reference in a new issue