mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
cancel event even when there's no entry to open/focus (fix #335)
This commit is contained in:
@@ -802,20 +802,22 @@ function($scope, $stateParams, $http, $route, $window, EntryService, SettingsSer
|
|||||||
|
|
||||||
var openNextEntry = function(event) {
|
var openNextEntry = function(event) {
|
||||||
var entry = getNextEntry();
|
var entry = getNextEntry();
|
||||||
if (entry) {
|
openEntry(entry, event);
|
||||||
openEntry(entry, event);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var openPreviousEntry = function(event) {
|
var openPreviousEntry = function(event) {
|
||||||
var entry = getPreviousEntry();
|
var entry = getPreviousEntry();
|
||||||
if (entry) {
|
openEntry(entry, event);
|
||||||
openEntry(entry, event);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var focusNextEntry = function(event) {
|
var focusNextEntry = function(event) {
|
||||||
var entry = getNextEntry();
|
var entry = getNextEntry();
|
||||||
|
|
||||||
|
if (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
if (entry) {
|
if (entry) {
|
||||||
$scope.current = entry;
|
$scope.current = entry;
|
||||||
}
|
}
|
||||||
@@ -823,6 +825,12 @@ function($scope, $stateParams, $http, $route, $window, EntryService, SettingsSer
|
|||||||
|
|
||||||
var focusPreviousEntry = function(event) {
|
var focusPreviousEntry = function(event) {
|
||||||
var entry = getPreviousEntry();
|
var entry = getPreviousEntry();
|
||||||
|
|
||||||
|
if (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
if (entry) {
|
if (entry) {
|
||||||
$scope.current = entry;
|
$scope.current = entry;
|
||||||
}
|
}
|
||||||
@@ -832,6 +840,15 @@ function($scope, $stateParams, $http, $route, $window, EntryService, SettingsSer
|
|||||||
|
|
||||||
var openEntry = function(entry, event) {
|
var openEntry = function(entry, event) {
|
||||||
|
|
||||||
|
if (event) {
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!entry) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ($scope.current != entry || SettingsService.settings.viewMode == 'expanded') {
|
if ($scope.current != entry || SettingsService.settings.viewMode == 'expanded') {
|
||||||
$scope.isOpen = true;
|
$scope.isOpen = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -841,12 +858,7 @@ function($scope, $stateParams, $http, $route, $window, EntryService, SettingsSer
|
|||||||
$scope.mark(entry, true);
|
$scope.mark(entry, true);
|
||||||
}
|
}
|
||||||
$scope.current = entry;
|
$scope.current = entry;
|
||||||
|
|
||||||
if (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (getCurrentIndex() == $scope.entries.length - 1) {
|
if (getCurrentIndex() == $scope.entries.length - 1) {
|
||||||
$scope.loadMoreEntries();
|
$scope.loadMoreEntries();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user