support copy download url in task list page

This commit is contained in:
MaysWind 2017-10-22 20:03:43 +08:00
parent 517cc4305c
commit 30de305f4d
5 changed files with 29 additions and 1 deletions

View file

@ -20,6 +20,7 @@ Select All=全选
Select None=不选
Select Invert=反选
Display Order=显示顺序
Copy Download Url=复制下载链接
Help=帮助
Search=搜索
Default=默认

View file

@ -20,6 +20,7 @@ Select All=全選
Select None=不選
Select Invert=反選
Display Order=顯示順序
Copy Download Url=複製下載鏈接
Help=幫助
Search=搜索
Default=默認

View file

@ -24,6 +24,7 @@
'Select None': 'Select None',
'Select Invert': 'Select Invert',
'Display Order': 'Display Order',
'Copy Download Url': 'Copy Download Url',
'Help': 'Help',
'Search': 'Search',
'Default': 'Default',

View file

@ -1,7 +1,7 @@
(function () {
'use strict';
angular.module('ariaNg').controller('MainController', ['$rootScope', '$scope', '$route', '$window', '$location', '$document', '$interval', 'aria2RpcErrors', 'ariaNgCommonService', 'ariaNgSettingService', 'ariaNgTitleService', 'ariaNgMonitorService', 'ariaNgNotificationService', 'aria2TaskService', 'aria2SettingService', function ($rootScope, $scope, $route, $window, $location, $document, $interval, aria2RpcErrors, ariaNgCommonService, ariaNgSettingService, ariaNgTitleService, ariaNgMonitorService, ariaNgNotificationService, aria2TaskService, aria2SettingService) {
angular.module('ariaNg').controller('MainController', ['$rootScope', '$scope', '$route', '$window', '$location', '$document', '$interval', 'clipboard', 'aria2RpcErrors', 'ariaNgCommonService', 'ariaNgSettingService', 'ariaNgTitleService', 'ariaNgMonitorService', 'ariaNgNotificationService', 'aria2TaskService', 'aria2SettingService', function ($rootScope, $scope, $route, $window, $location, $document, $interval, clipboard, aria2RpcErrors, ariaNgCommonService, ariaNgSettingService, ariaNgTitleService, ariaNgMonitorService, ariaNgNotificationService, aria2TaskService, aria2SettingService) {
var pageTitleRefreshPromise = null;
var globalStatRefreshPromise = null;
@ -44,6 +44,16 @@
return $rootScope.taskContext.getSelectedTaskIds().length > 0;
};
$scope.isSingleUrlTaskSelected = function () {
var selectedTask = $rootScope.taskContext.getSelectedTasks();
if (selectedTask.length !== 1) {
return false;
}
return !!selectedTask[0].singleUrl;
};
$scope.isSpecifiedTaskSelected = function () {
var selectedTasks = $rootScope.taskContext.getSelectedTasks();
@ -197,6 +207,14 @@
$rootScope.taskContext.selectAll();
};
$scope.copySelectedOneTaskDownloadLink = function () {
var selectedTask = $rootScope.taskContext.getSelectedTasks();
if (selectedTask.length === 1) {
clipboard.copyText(selectedTask[0].singleUrl);
}
};
$scope.changeDisplayOrder = function (type, autoSetReverse) {
var oldType = ariaNgCommonService.parseOrderType(ariaNgSettingService.getDisplayOrder());
var newType = ariaNgCommonService.parseOrderType(type);

View file

@ -144,6 +144,13 @@
</li>
</ul>
</li>
<li class="divider" ng-show="isSingleUrlTaskSelected()"></li>
<li ng-show="isSingleUrlTaskSelected()">
<a tabindex="-1" class="pointer-cursor" title="{{'Copy Download Url' | translate}}" ng-click="copySelectedOneTaskDownloadLink()">
<i class="fa fa-copy"></i>
<span translate>Copy Download Url</span>
</a>
</li>
</ul>
</div>
</div>