mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
Fix regressions introduced in previous JS refactoring
This commit is contained in:
parent
a634839678
commit
17aae72583
5 changed files with 45 additions and 51 deletions
|
@ -115,17 +115,17 @@ function markPageAsRead() {
|
|||
}
|
||||
|
||||
// Handle entry status changes from the list view and entry view.
|
||||
function handleEntryStatus() {
|
||||
if (isListView()) {
|
||||
let currentItem = document.querySelector(".current-item");
|
||||
if (currentItem !== null) {
|
||||
// The order is important here,
|
||||
// On the unread page, the read item will be hidden.
|
||||
function handleEntryStatus(element) {
|
||||
let currentEntry = findEntry(element);
|
||||
if (currentEntry) {
|
||||
// The order is important here,
|
||||
// On the unread page, the read item will be hidden.
|
||||
// If "goToNextListItem" first, it may go to an item about to hide:
|
||||
// Imagine that user click 'mark as read' right below the '.current-item'
|
||||
toggleEntryStatus(currentEntry);
|
||||
if (isListView() && currentEntry.classList.contains('current-item')) {
|
||||
goToNextListItem();
|
||||
toggleEntryStatus(currentItem);
|
||||
}
|
||||
} else {
|
||||
toggleEntryStatus(document.querySelector(".entry"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,14 +180,10 @@ function updateEntriesStatus(entryIDs, status, callback) {
|
|||
}
|
||||
|
||||
// Handle save entry from list view and entry view.
|
||||
function handleSaveEntry() {
|
||||
if (isListView()) {
|
||||
let currentItem = document.querySelector(".current-item");
|
||||
if (currentItem !== null) {
|
||||
saveEntry(currentItem.querySelector("a[data-save-entry]"));
|
||||
}
|
||||
} else {
|
||||
saveEntry(document.querySelector("a[data-save-entry]"));
|
||||
function handleSaveEntry(element) {
|
||||
let currentEntry = findEntry(element);
|
||||
if (currentEntry) {
|
||||
saveEntry(currentEntry.querySelector("a[data-save-entry]"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,14 +208,10 @@ function saveEntry(element) {
|
|||
}
|
||||
|
||||
// Handle bookmark from the list view and entry view.
|
||||
function handleBookmark() {
|
||||
if (isListView()) {
|
||||
let currentItem = document.querySelector(".current-item");
|
||||
if (currentItem !== null) {
|
||||
toggleBookmark(currentItem);
|
||||
}
|
||||
} else {
|
||||
toggleBookmark(document.querySelector(".entry"));
|
||||
function handleBookmark(element) {
|
||||
let currentEntry = findEntry(element);
|
||||
if (currentEntry) {
|
||||
toggleBookmark(currentEntry);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -454,6 +446,18 @@ function isListView() {
|
|||
return document.querySelector(".items") !== null;
|
||||
}
|
||||
|
||||
function findEntry(element) {
|
||||
if (isListView()) {
|
||||
if (element) {
|
||||
return DomHelper.findParent(element, "item");
|
||||
} else {
|
||||
return document.querySelector(".current-item");
|
||||
}
|
||||
} else {
|
||||
return document.querySelector(".entry");
|
||||
}
|
||||
}
|
||||
|
||||
function handleConfirmationMessage(linkElement, callback) {
|
||||
linkElement.style.display = "none";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue