diff --git a/app/langs/zh-CN.json b/app/langs/zh-CN.json index 5cff9bb..9861c25 100644 --- a/app/langs/zh-CN.json +++ b/app/langs/zh-CN.json @@ -85,10 +85,11 @@ "Unknown": "未知", "Total Count": "共计", "Bytes": "字节", + "Hours": "小时", "Minutes": "分", "Seconds": "秒", "Milliseconds": "毫秒", - "(0 is disabled)": "(0为禁用)", + "Disabled": "禁用", "Changes to the settings take effect after refreshing page.": "设置将在页面刷新后生效.", "Type is illegal!": "类型错误!", "none": "无", @@ -105,6 +106,16 @@ "notice": "一般 (Notice)", "warn": "警告 (Warn)", "error": "错误 (Error)", + "format": { + "time.millisecond": "{{value}} 毫秒", + "time.milliseconds": "{{value}} 毫秒", + "time.second": "{{value}} 秒", + "time.seconds": "{{value}} 秒", + "time.minute": "{{value}} 分钟", + "time.minutes": "{{value}} 分钟", + "time.hour": "{{value}} 小时", + "time.hours": "{{value}} 小时" + }, "options": { "dir.name": "下载路径", "dir.description": "", diff --git a/app/scripts/config/language-default.js b/app/scripts/config/language-default.js index e04988b..54c07de 100644 --- a/app/scripts/config/language-default.js +++ b/app/scripts/config/language-default.js @@ -89,10 +89,11 @@ 'Unknown': 'Unknown', 'Total Count': 'Total Count', 'Bytes': 'Bytes', + 'Hours': 'Hours', 'Minutes': 'Minutes', 'Seconds': 'Seconds', 'Milliseconds': 'Milliseconds', - '(0 is disabled)': '(0 is disabled)', + 'Disabled': 'Disabled', 'Changes to the settings take effect after refreshing page.': 'Changes to the settings take effect after refreshing page.', 'Type is illegal!': 'Type is illegal!', 'none': 'None', @@ -109,6 +110,16 @@ 'notice': 'Notice', 'warn': 'Warn', 'error': 'Error', + 'format': { + 'time.millisecond': '{{value}} Millisecond', + 'time.milliseconds': '{{value}} Milliseconds', + 'time.second': '{{value}} Second', + 'time.seconds': '{{value}} Seconds', + 'time.minute': '{{value}} Minute', + 'time.minutes': '{{value}} Minutes', + 'time.hour': '{{value}} Hour', + 'time.hours': '{{value}} Hours', + }, 'options': { 'dir.name': 'Download Path', 'dir.description': '', diff --git a/app/scripts/controllers/settings-ariang.js b/app/scripts/controllers/settings-ariang.js index 9cc7dcb..9218009 100644 --- a/app/scripts/controllers/settings-ariang.js +++ b/app/scripts/controllers/settings-ariang.js @@ -1,8 +1,9 @@ (function () { 'use strict'; - angular.module('ariaNg').controller('AriaNgSettingsController', ['$scope', 'ariaNgLanguages', 'ariaNgSettingService', function ($scope, ariaNgLanguages, ariaNgSettingService) { + angular.module('ariaNg').controller('AriaNgSettingsController', ['$scope', 'ariaNgLanguages', 'ariaNgCommonService', 'ariaNgSettingService', function ($scope, ariaNgLanguages, ariaNgCommonService, ariaNgSettingService) { $scope.languages = ariaNgLanguages; + $scope.availableTime = ariaNgCommonService.getTimeOptions([1000, 2000, 3000, 5000, 10000, 30000, 60000], true); $scope.settings = ariaNgSettingService.getAllOptions(); $scope.settingService = ariaNgSettingService; }]); diff --git a/app/scripts/services/ariaNgCommonService.js b/app/scripts/services/ariaNgCommonService.js index 8547670..cf94f0a 100644 --- a/app/scripts/services/ariaNgCommonService.js +++ b/app/scripts/services/ariaNgCommonService.js @@ -110,6 +110,49 @@ }); return obj; + }, + getTimeOptions: function (timeList, withDisabled) { + var options = []; + + if (withDisabled) { + options.push({ + name: 'Disabled', + value: 0, + optionValue: 0 + }); + } + + if (!angular.isArray(timeList) || timeList.length < 1) { + return options; + } + + for (var i = 0; i < timeList.length; i++) { + var time = timeList[i]; + var name = ''; + var value = time; + + if (time < 1000) { + value = time; + name = (value == 1 ? 'format.time.millisecond' : 'format.time.milliseconds'); + } else if (time < 1000 * 60) { + value = time / 1000; + name = (value == 1 ? 'format.time.second' : 'format.time.seconds'); + } else if (time < 1000 * 60 * 24) { + value = time / 1000 / 60; + name = (value == 1 ? 'format.time.minute' : 'format.time.minutes'); + } else { + value = time / 1000 / 60 / 24; + name = (value == 1 ? 'format.time.hour' : 'format.time.hours'); + } + + options.push({ + name: name, + value: value, + optionValue: time + }) + } + + return options; } }; }]); diff --git a/app/views/settings-ariang.html b/app/views/settings-ariang.html index 6327fb8..63fc9e6 100644 --- a/app/views/settings-ariang.html +++ b/app/views/settings-ariang.html @@ -47,31 +47,27 @@
-
+
Global Stat Refresh Interval * - (0 is disabled)
-
- - Milliseconds -
+
-
+
Download Task Refresh Interval * - (0 is disabled)
-
- - Milliseconds -
+