forked from Archives/Athou_commafeed
propagate keyboard event
This commit is contained in:
@@ -157,13 +157,9 @@ module.controller('FeedListCtrl', function($scope, $routeParams, $http, $route,
|
|||||||
if (!entry.read) {
|
if (!entry.read) {
|
||||||
$scope.mark(entry, true);
|
$scope.mark(entry, true);
|
||||||
}
|
}
|
||||||
if (!event || (!event.ctrlKey && event.which != 2)) {
|
if (!event.ctrlKey && event.which != 2) {
|
||||||
if (event) {
|
event.preventDefault();
|
||||||
event.preventDefault();
|
event.stopPropagation();
|
||||||
event.stopPropagation();
|
|
||||||
}
|
|
||||||
console.log($scope.current)
|
|
||||||
console.log(entry)
|
|
||||||
if ($scope.current != entry) {
|
if ($scope.current != entry) {
|
||||||
$scope.isOpen = true;
|
$scope.isOpen = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -173,7 +169,7 @@ module.controller('FeedListCtrl', function($scope, $routeParams, $http, $route,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var openNextEntry = function() {
|
var openNextEntry = function(event) {
|
||||||
var entry = null;
|
var entry = null;
|
||||||
if ($scope.current) {
|
if ($scope.current) {
|
||||||
var index;
|
var index;
|
||||||
@@ -191,11 +187,11 @@ module.controller('FeedListCtrl', function($scope, $routeParams, $http, $route,
|
|||||||
entry = $scope.entries[0];
|
entry = $scope.entries[0];
|
||||||
}
|
}
|
||||||
if (entry) {
|
if (entry) {
|
||||||
$scope.entryClicked(entry);
|
$scope.entryClicked(entry, event);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var openPreviousEntry = function() {
|
var openPreviousEntry = function(event) {
|
||||||
var entry = null;
|
var entry = null;
|
||||||
if ($scope.current) {
|
if ($scope.current) {
|
||||||
var index;
|
var index;
|
||||||
@@ -211,11 +207,17 @@ module.controller('FeedListCtrl', function($scope, $routeParams, $http, $route,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (entry) {
|
if (entry) {
|
||||||
$scope.entryClicked(entry);
|
$scope.entryClicked(entry, event);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Mousetrap.bind('space', openNextEntry);
|
Mousetrap.bind('space', function(e) {
|
||||||
Mousetrap.bind('j', openNextEntry);
|
openNextEntry(e);
|
||||||
Mousetrap.bind('k', openPreviousEntry);
|
});
|
||||||
|
Mousetrap.bind('j', function(e) {
|
||||||
|
openNextEntry(e);
|
||||||
|
});
|
||||||
|
Mousetrap.bind('k', function(e) {
|
||||||
|
openPreviousEntry(e);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user