From 30de305f4d248e07bb1a15fb643c3811f895f0aa Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 22 Oct 2017 20:03:43 +0800 Subject: [PATCH] support copy download url in task list page --- src/langs/zh_Hans.txt | 1 + src/langs/zh_Hant.txt | 1 + src/scripts/config/defaultLanguage.js | 1 + src/scripts/controllers/main.js | 20 +++++++++++++++++++- src/views/list.html | 7 +++++++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/langs/zh_Hans.txt b/src/langs/zh_Hans.txt index 16b0460..58fe8df 100644 --- a/src/langs/zh_Hans.txt +++ b/src/langs/zh_Hans.txt @@ -20,6 +20,7 @@ Select All=全选 Select None=不选 Select Invert=反选 Display Order=显示顺序 +Copy Download Url=复制下载链接 Help=帮助 Search=搜索 Default=默认 diff --git a/src/langs/zh_Hant.txt b/src/langs/zh_Hant.txt index 69ad8e5..3c226ef 100644 --- a/src/langs/zh_Hant.txt +++ b/src/langs/zh_Hant.txt @@ -20,6 +20,7 @@ Select All=全選 Select None=不選 Select Invert=反選 Display Order=顯示順序 +Copy Download Url=複製下載鏈接 Help=幫助 Search=搜索 Default=默認 diff --git a/src/scripts/config/defaultLanguage.js b/src/scripts/config/defaultLanguage.js index dd03fe5..bfabd99 100644 --- a/src/scripts/config/defaultLanguage.js +++ b/src/scripts/config/defaultLanguage.js @@ -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', diff --git a/src/scripts/controllers/main.js b/src/scripts/controllers/main.js index 2babb41..1d929c8 100644 --- a/src/scripts/controllers/main.js +++ b/src/scripts/controllers/main.js @@ -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); diff --git a/src/views/list.html b/src/views/list.html index 6d215c9..4856087 100644 --- a/src/views/list.html +++ b/src/views/list.html @@ -144,6 +144,13 @@ +
  • +
  • + + + Copy Download Url + +