mirror of
https://github.com/miniflux/v2.git
synced 2025-08-26 18:21:01 +00:00
refactor: Replace "Bookmarks" with "Starred"
Replaces usage of the word "bookmark" with "star"/"starred" in order to be more consistent with the UI and database models, and to reduce confusion with "bookmarklet" and integration features. This is in preparation of future work on read-it-later features. Which are also not called "bookmarks" to prevent any further confusion. https://github.com/orgs/miniflux/discussions/3719 Related-to: https://github.com/miniflux/v2/pull/2219
This commit is contained in:
parent
4d656d2739
commit
60cd7ffe88
37 changed files with 171 additions and 170 deletions
|
@ -215,12 +215,12 @@ function setButtonToSavedState(buttonElement) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the bookmark button state.
|
||||
* Set the star button state.
|
||||
*
|
||||
* @param {Element} buttonElement - The button element to update.
|
||||
* @param {string} newState - The new state to set ("star" or "unstar").
|
||||
*/
|
||||
function setBookmarkButtonState(buttonElement, newState) {
|
||||
function setStarredButtonState(buttonElement, newState) {
|
||||
buttonElement.dataset.value = newState;
|
||||
const iconType = newState === "star" ? "unstar" : "star";
|
||||
setIconAndLabelElement(buttonElement, iconType, buttonElement.dataset[newState === "star" ? "labelUnstar" : "labelStar"]);
|
||||
|
@ -702,25 +702,25 @@ function handleSaveEntryAction(element = null) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Handle bookmarking an entry.
|
||||
* Handle starring an entry.
|
||||
*
|
||||
* @param {Element} element - The element that triggered the bookmark action.
|
||||
* @param {Element} element - The element that triggered the star action.
|
||||
*/
|
||||
function handleBookmarkAction(element) {
|
||||
function handleStarAction(element) {
|
||||
const currentEntry = findEntry(element);
|
||||
if (!currentEntry) return;
|
||||
|
||||
const buttonElement = currentEntry.querySelector(":is(a, button)[data-toggle-bookmark]");
|
||||
const buttonElement = currentEntry.querySelector(":is(a, button)[data-toggle-starred]");
|
||||
if (!buttonElement) return;
|
||||
|
||||
setButtonToLoadingState(buttonElement);
|
||||
|
||||
sendPOSTRequest(buttonElement.dataset.bookmarkUrl).then(() => {
|
||||
sendPOSTRequest(buttonElement.dataset.starUrl).then(() => {
|
||||
const currentState = buttonElement.dataset.value;
|
||||
const isStarred = currentState === "star";
|
||||
const newStarStatus = isStarred ? "unstar" : "star";
|
||||
|
||||
setBookmarkButtonState(buttonElement, newStarStatus);
|
||||
setStarredButtonState(buttonElement, newStarStatus);
|
||||
|
||||
if (isEntryView()) {
|
||||
showToastNotification(currentState, buttonElement.dataset[isStarred ? "toastUnstar" : "toastStar"]);
|
||||
|
@ -1192,7 +1192,7 @@ function initializeKeyboardShortcuts() {
|
|||
keyboardHandler.on("A", markPageAsReadAction);
|
||||
keyboardHandler.on("s", () => handleSaveEntryAction());
|
||||
keyboardHandler.on("d", handleFetchOriginalContentAction);
|
||||
keyboardHandler.on("f", () => handleBookmarkAction());
|
||||
keyboardHandler.on("f", () => handleStarAction());
|
||||
|
||||
// Feed actions
|
||||
keyboardHandler.on("F", goToFeedPage);
|
||||
|
@ -1227,7 +1227,7 @@ function initializeTouchHandler() {
|
|||
function initializeClickHandlers() {
|
||||
// Entry actions
|
||||
onClick(":is(a, button)[data-save-entry]", (event) => handleSaveEntryAction(event.target));
|
||||
onClick(":is(a, button)[data-toggle-bookmark]", (event) => handleBookmarkAction(event.target));
|
||||
onClick(":is(a, button)[data-toggle-starred]", (event) => handleStarAction(event.target));
|
||||
onClick(":is(a, button)[data-toggle-status]", (event) => handleEntryStatus("next", event.target));
|
||||
onClick(":is(a, button)[data-fetch-content-entry]", handleFetchOriginalContentAction);
|
||||
onClick(":is(a, button)[data-share-status]", handleEntryShareAction);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue