support pressing "ctrl+enter" shortcuts to start download in "new task" page

This commit is contained in:
MaysWind 2016-07-31 22:33:37 +08:00
parent 9d6dae708e
commit c085dc7a88
2 changed files with 8 additions and 1 deletions

View file

@ -131,6 +131,12 @@
optionStatus.setReady(); optionStatus.setReady();
}; };
$scope.urlTextboxKeyDown = function (event) {
if (event.keyCode == 13 && event.ctrlKey && $scope.newTaskForm.$valid) {
$scope.startDownload();
}
};
$rootScope.loadPromise = $timeout(function () { $rootScope.loadPromise = $timeout(function () {
;//Do Nothing ;//Do Nothing
}, 100); }, 100);

View file

@ -43,7 +43,8 @@
<div class="col-sm-12"> <div class="col-sm-12">
<p translate>Download Links:</p> <p translate>Download Links:</p>
<div class="form-group has-feedback no-margin" ng-class="{ 'has-error' : newTaskForm.urls.$invalid && newTaskForm.urls.$dirty, 'has-success' : newTaskForm.urls.$valid && newTaskForm.urls.$dirty }"> <div class="form-group has-feedback no-margin" ng-class="{ 'has-error' : newTaskForm.urls.$invalid && newTaskForm.urls.$dirty, 'has-success' : newTaskForm.urls.$valid && newTaskForm.urls.$dirty }">
<textarea name="urls" class="form-control" rows="10" ng-model="context.urls" ng-required="true" <textarea name="urls" class="form-control" rows="10"
ng-model="context.urls" ng-required="true" ng-keydown="urlTextboxKeyDown($event)"
ng-placeholder="'Support multiple URLs, one URL per line.' | translate" ng-placeholder="'Support multiple URLs, one URL per line.' | translate"
ng-pattern="/^(\n?(((http|https|ftp|ssh):\/\/.+)|(magnet:\?.+)))*$/i"></textarea> ng-pattern="/^(\n?(((http|https|ftp|ssh):\/\/.+)|(magnet:\?.+)))*$/i"></textarea>
<div class="form-control-icon" ng-if="newTaskForm.urls.$dirty"> <div class="form-control-icon" ng-if="newTaskForm.urls.$dirty">