keyboard shortcut to star/unstar an entry

This commit is contained in:
Athou
2013-05-02 22:42:52 +02:00
parent b411528ac7
commit c2c07988b8

View File

@@ -518,8 +518,10 @@ function($scope, $stateParams, $http, $route, $window, EntryService, SettingsSer
}; };
$scope.star = function(entry, star, event) { $scope.star = function(entry, star, event) {
event.preventDefault(); if (event) {
event.stopPropagation(); event.preventDefault();
event.stopPropagation();
}
if (entry.starred != star) { if (entry.starred != star) {
entry.starred = star; entry.starred = star;
EntryService.star({ EntryService.star({
@@ -642,6 +644,13 @@ function($scope, $stateParams, $http, $route, $window, EntryService, SettingsSer
window.open($scope.current.url); window.open($scope.current.url);
} }
}); });
Mousetrap.bind('s', function(e) {
$scope.$apply(function() {
if ($scope.current) {
$scope.star($scope.current, !$scope.current.starred);
}
});
});
Mousetrap.bind('?', function(e) { Mousetrap.bind('?', function(e) {
$scope.$apply(function() { $scope.$apply(function() {
$scope.shortcutsModal = true; $scope.shortcutsModal = true;