Add new keyboard shortcut: 'M' - toggle read/unread, go to prev item

Currently there is "Toggle read/unread = m", which toggles and
then goes to the next item.

Having the opposite operation available is handy, especially when adding
new feeds and going through them from oldest to newest posts.

It seems natural to map 'M' (= shift + 'm') for this action.

Closes https://github.com/miniflux/v2/issues/1352
This commit is contained in:
Thiago Perrotta 2022-01-29 16:53:10 -05:00 committed by Frédéric Guillot
parent c891ab2588
commit 824fc310a9
17 changed files with 79 additions and 15 deletions

View file

@ -152,7 +152,8 @@
"page.keyboard_shortcuts.open_original_same_window": "Öffne den Original-Link in der aktuellen Registerkarte",
"page.keyboard_shortcuts.open_comments": "Kommentare öffnen",
"page.keyboard_shortcuts.open_comments_same_window": "Öffne den Kommentare-Link in der aktuellen Registerkarte",
"page.keyboard_shortcuts.toggle_read_status": "Gewählten Artikel als gelesen/ungelesen markieren",
"page.keyboard_shortcuts.toggle_read_status_next": "Gewählten Artikel als gelesen/ungelesen markieren, fokus als nächstes",
"page.keyboard_shortcuts.toggle_read_status_prev": "Gewählten Artikel als gelesen/ungelesen markieren, fokus vorherige",
"page.keyboard_shortcuts.refresh_all_feeds": "Alle Abonnements im Hintergrund aktualisieren",
"page.keyboard_shortcuts.mark_page_as_read": "Aktuelle Seite als gelesen markieren",
"page.keyboard_shortcuts.download_content": "Vollständigen Inhalt herunterladen",

View file

@ -152,7 +152,8 @@
"page.keyboard_shortcuts.open_original_same_window": "Άνοιγμα αρχικού συνδέσμου στην τρέχουσα καρτέλα",
"page.keyboard_shortcuts.open_comments": "Άνοιγμα συνδέσμου σχολίων",
"page.keyboard_shortcuts.open_comments_same_window": "Άνοιγμα συνδέσμου σχολίων στην τρέχουσα καρτέλα",
"page.keyboard_shortcuts.toggle_read_status": "Εναλλαγή ανάγνωσης / μη αναγνωσμένης",
"page.keyboard_shortcuts.toggle_read_status_next": "Εναλλαγή ανάγνωσης / μη αναγνωσμένης, εστίαση στη συνέχεια",
"page.keyboard_shortcuts.toggle_read_status_prev": "Εναλλαγή ανάγνωσης / μη αναγνωσμένης, εστίαση στο προηγούμενο",
"page.keyboard_shortcuts.refresh_all_feeds": "Ανανέωση όλων των ροών στο παρασκήνιο",
"page.keyboard_shortcuts.mark_page_as_read": "Σημείωση της τρέχουσας σελίδας ως αναγνωσμένη",
"page.keyboard_shortcuts.download_content": "Κατεβάστε το αρχικό περιεχόμενο",

View file

@ -152,7 +152,8 @@
"page.keyboard_shortcuts.open_original_same_window": "Open original link in current tab",
"page.keyboard_shortcuts.open_comments": "Open comments link",
"page.keyboard_shortcuts.open_comments_same_window": "Open comments link in current tab",
"page.keyboard_shortcuts.toggle_read_status": "Toggle read/unread",
"page.keyboard_shortcuts.toggle_read_status_next": "Toggle read/unread, focus next",
"page.keyboard_shortcuts.toggle_read_status_prev": "Toggle read/unread, focus previous",
"page.keyboard_shortcuts.refresh_all_feeds": "Refresh all feeds in the background",
"page.keyboard_shortcuts.mark_page_as_read": "Mark current page as read",
"page.keyboard_shortcuts.download_content": "Download original content",

View file

@ -152,7 +152,8 @@
"page.keyboard_shortcuts.open_original_same_window": "Abrir enlace original en la pestaña actual",
"page.keyboard_shortcuts.open_comments": "Abrir el enlace de comentarios",
"page.keyboard_shortcuts.open_comments_same_window": "Abrir enlace de comentarios en la pestaña actual",
"page.keyboard_shortcuts.toggle_read_status": "Marcar como leído o no leído",
"page.keyboard_shortcuts.toggle_read_status_next": "Marcar como leído o no leído, enfoque siguiente",
"page.keyboard_shortcuts.toggle_read_status_prev": "Marcar como leído o no leído, foco anterior",
"page.keyboard_shortcuts.refresh_all_feeds": "Refrescar todas las fuentes en el fondo",
"page.keyboard_shortcuts.mark_page_as_read": "Marcar pagína actual como leída",
"page.keyboard_shortcuts.download_content": "Descargar el contento original",

View file

@ -152,7 +152,8 @@
"page.keyboard_shortcuts.open_original_same_window": "Avaa alkuperäinen linkki nykyisessä välilehdessä",
"page.keyboard_shortcuts.open_comments": "Avaa kommenttilinkki",
"page.keyboard_shortcuts.open_comments_same_window": "Avaa kommenttilinkki nykyisessä välilehdessä",
"page.keyboard_shortcuts.toggle_read_status": "Vaihda luettu/lukematon",
"page.keyboard_shortcuts.toggle_read_status_next": "Vaihda luettu/lukematon, keskity seuraavaksi",
"page.keyboard_shortcuts.toggle_read_status_prev": "Vaihda luettu/lukematon, keskity edelliseen",
"page.keyboard_shortcuts.refresh_all_feeds": "Päivitä kaikki syötteet taustalla",
"page.keyboard_shortcuts.mark_page_as_read": "Merkitse nykyinen sivu luetuksi",
"page.keyboard_shortcuts.download_content": "Lataa alkuperäinen sisältö",

View file

@ -152,7 +152,8 @@
"page.keyboard_shortcuts.open_original_same_window": "Ouvrir le lien original dans l'onglet en cours",
"page.keyboard_shortcuts.open_comments": "Ouvrir le lien des commentaires",
"page.keyboard_shortcuts.open_comments_same_window": "Ouvrir le lien des commentaires dans l'onglet en cours",
"page.keyboard_shortcuts.toggle_read_status": "Basculer entre lu/non lu",
"page.keyboard_shortcuts.toggle_read_status_next": "Basculer entre lu/non lu, et changer le focus sur l'élément suivant",
"page.keyboard_shortcuts.toggle_read_status_prev": "Basculer entre lu/non lu, et changer le focus sur l'élément précédent",
"page.keyboard_shortcuts.refresh_all_feeds": "Actualiser les abonnements en arrière-plan",
"page.keyboard_shortcuts.mark_page_as_read": "Marquer la page actuelle comme lu",
"page.keyboard_shortcuts.download_content": "Télécharger le contenu original",

View file

@ -152,7 +152,8 @@
"page.keyboard_shortcuts.open_original_same_window": "Apri il link originale nella scheda corrente",
"page.keyboard_shortcuts.open_comments": "Apri la pagina web dei commenti",
"page.keyboard_shortcuts.open_comments_same_window": "Apri il link dei commenti nella scheda corrente",
"page.keyboard_shortcuts.toggle_read_status": "Cambia lo stato di lettura (letto/da leggere)",
"page.keyboard_shortcuts.toggle_read_status_next": "Cambia lo stato di lettura (letto/da leggere), concentrati dopo",
"page.keyboard_shortcuts.toggle_read_status_prev": "Cambia lo stato di lettura (letto/da leggere), focus precedente",
"page.keyboard_shortcuts.refresh_all_feeds": "Aggiorna tutti i feed in background",
"page.keyboard_shortcuts.mark_page_as_read": "Segna la pagina attuale come letta",
"page.keyboard_shortcuts.download_content": "Scarica il contenuto integrale",

View file

@ -152,7 +152,8 @@
"page.keyboard_shortcuts.open_original_same_window": "現在のタブでオリジナルのリンクを開く",
"page.keyboard_shortcuts.open_comments": "コメントリンクを開く",
"page.keyboard_shortcuts.open_comments_same_window": "現在のタブでコメントリンクを開く",
"page.keyboard_shortcuts.toggle_read_status": "既読/未読 切り替え",
"page.keyboard_shortcuts.toggle_read_status_next": "既読/未読 切り替え, 次に焦点を合わせる",
"page.keyboard_shortcuts.toggle_read_status_prev": "既読/未読 切り替え, 前にフォーカス",
"page.keyboard_shortcuts.refresh_all_feeds": "全てのフィードをバックグラウンドで更新",
"page.keyboard_shortcuts.mark_page_as_read": "現在のページを既読にする",
"page.keyboard_shortcuts.download_content": "オリジナルの内容をダウンロード",

View file

@ -153,7 +153,8 @@
"page.keyboard_shortcuts.open_original_same_window": "Oorspronkelijke koppeling op huidig tabblad openen",
"page.keyboard_shortcuts.open_comments": "Open opmerkingen link",
"page.keyboard_shortcuts.open_comments_same_window": "Open de reactiekoppeling op het huidige tabblad",
"page.keyboard_shortcuts.toggle_read_status": "Markeer gelezen/ongelezen",
"page.keyboard_shortcuts.toggle_read_status_next": "Markeer gelezen/ongelezen, focus volgende",
"page.keyboard_shortcuts.toggle_read_status_prev": "Markeer gelezen/ongelezen, focus vorige",
"page.keyboard_shortcuts.refresh_all_feeds": "Vernieuw alle feeds in de achtergrond",
"page.keyboard_shortcuts.mark_page_as_read": "Markeer deze pagina als gelezen",
"page.keyboard_shortcuts.download_content": "Download originele content",

View file

@ -154,7 +154,8 @@
"page.keyboard_shortcuts.open_original_same_window": "Otwórz oryginalny link w bieżącej karcie",
"page.keyboard_shortcuts.open_comments": "Otwórz link do komentarzy",
"page.keyboard_shortcuts.open_comments_same_window": "Otwórz link do komentarzy w bieżącej karcie",
"page.keyboard_shortcuts.toggle_read_status": "Oznacz jako przeczytane/nieprzeczytane",
"page.keyboard_shortcuts.toggle_read_status_next": "Oznacz jako przeczytane/nieprzeczytane, skup się dalej",
"page.keyboard_shortcuts.toggle_read_status_prev": "Oznacz jako przeczytane/nieprzeczytane, skup poprzednie",
"page.keyboard_shortcuts.refresh_all_feeds": "Odśwież wszystkie subskrypcje w tle",
"page.keyboard_shortcuts.mark_page_as_read": "Zaznacz aktualną stronę jako przeczytaną",
"page.keyboard_shortcuts.download_content": "Pobierz oryginalną zawartość",

View file

@ -152,7 +152,8 @@
"page.keyboard_shortcuts.open_original_same_window": "Abrir o conteúdo original na janela atual",
"page.keyboard_shortcuts.open_comments": "Abrir os comentários",
"page.keyboard_shortcuts.open_comments_same_window": "Abrir os comentários na janela atual",
"page.keyboard_shortcuts.toggle_read_status": "Inverter estado de leitura do item",
"page.keyboard_shortcuts.toggle_read_status_next": "Inverter estado de leitura do item, focar próximo item",
"page.keyboard_shortcuts.toggle_read_status_prev": "Inverter estado de leitura do item, focar item anterior",
"page.keyboard_shortcuts.refresh_all_feeds": "Atualizar todas as fontes",
"page.keyboard_shortcuts.mark_page_as_read": "Marcar página atual como lida",
"page.keyboard_shortcuts.download_content": "Buscar o conteúdo original",

View file

@ -154,7 +154,8 @@
"page.keyboard_shortcuts.open_original": "Открыть оригинальную ссылку",
"page.keyboard_shortcuts.open_comments_same_window": "Открыть ссылку на комментарии в текущей вкладке",
"page.keyboard_shortcuts.open_comments": "Открыть ссылку для комментариев",
"page.keyboard_shortcuts.toggle_read_status": "Переключатель прочитанного",
"page.keyboard_shortcuts.toggle_read_status_next": "Переключатель прочитанного, сосредоточиться на следующем",
"page.keyboard_shortcuts.toggle_read_status_prev": "Переключатель прочитанного, фокус предыдущий",
"page.keyboard_shortcuts.refresh_all_feeds": "Обновить все подписки в фоне",
"page.keyboard_shortcuts.mark_page_as_read": "Отметить текущую страницу прочитанной",
"page.keyboard_shortcuts.download_content": "Загрузить оригинальное содержимое",

View file

@ -152,7 +152,8 @@
"page.keyboard_shortcuts.open_original_same_window": "Orijinal bağlantıyı mevcut sekmede aç",
"page.keyboard_shortcuts.open_comments": "Yorumlar bağlantısını aç",
"page.keyboard_shortcuts.open_comments_same_window": "Yorumlar bağlantısını mevcut sekmede aç",
"page.keyboard_shortcuts.toggle_read_status": "Okundu/okunmadı arasında geçiş yap",
"page.keyboard_shortcuts.toggle_read_status_next": "Okundu/okunmadı arasında geçiş yap, sonrakine odaklan",
"page.keyboard_shortcuts.toggle_read_status_prev": "Okundu/okunmadı arasında geçiş yap, öncekine odaklan",
"page.keyboard_shortcuts.refresh_all_feeds": "Tüm beslemeleri arka planda yenile",
"page.keyboard_shortcuts.mark_page_as_read": "Mevcut sayfayı okundu olarak işaretle",
"page.keyboard_shortcuts.download_content": "Orijinal içeriği indir",

View file

@ -150,7 +150,8 @@
"page.keyboard_shortcuts.open_original_same_window": "在当前标签页中打开原始链接",
"page.keyboard_shortcuts.open_comments": "打开评论链接",
"page.keyboard_shortcuts.open_comments_same_window": "在当前标签页中打开评论链接",
"page.keyboard_shortcuts.toggle_read_status": "切换已读/未读状态",
"page.keyboard_shortcuts.toggle_read_status_next": "切换已读/未读状态, 关注下一个",
"page.keyboard_shortcuts.toggle_read_status_prev": "切换已读/未读状态, 关注前一个",
"page.keyboard_shortcuts.refresh_all_feeds": "在后台更新全部源",
"page.keyboard_shortcuts.mark_page_as_read": "标记当前页已读",
"page.keyboard_shortcuts.download_content": "抓取全文内容",

View file

@ -147,7 +147,8 @@
<li>{{ t "page.keyboard_shortcuts.open_original_same_window" }} = <strong>V</strong></li>
<li>{{ t "page.keyboard_shortcuts.open_comments" }} = <strong>c</strong></li>
<li>{{ t "page.keyboard_shortcuts.open_comments_same_window" }} = <strong>C</strong></li>
<li>{{ t "page.keyboard_shortcuts.toggle_read_status" }} = <strong>m</strong></li>
<li>{{ t "page.keyboard_shortcuts.toggle_read_status_next" }} = <strong>m</strong></li>
<li>{{ t "page.keyboard_shortcuts.toggle_read_status_prev" }} = <strong>M</strong></li>
<li>{{ t "page.keyboard_shortcuts.mark_page_as_read" }} = <strong>A</strong></li>
<li>{{ t "page.keyboard_shortcuts.download_content" }} = <strong>d</strong></li>
<li>{{ t "page.keyboard_shortcuts.toggle_bookmark_status" }} = <strong>f</strong></li>

View file

@ -128,6 +128,7 @@ function markPageAsRead() {
}
// Handle entry status changes from the list view and entry view.
// Focus the previous entry if it exists.
function handleEntryStatus(element, setToRead) {
let toasting = !element;
let currentEntry = findEntry(element);
@ -141,6 +142,21 @@ function handleEntryStatus(element, setToRead) {
}
}
// Handle entry status changes from the list view and entry view.
// Focus the next entry if it exists.
function handleEntryStatusNext(element, setToRead) {
let toasting = !element;
let currentEntry = findEntry(element);
if (currentEntry) {
if (!setToRead || currentEntry.querySelector("a[data-toggle-status]").dataset.value == "unread") {
toggleEntryStatus(currentEntry, toasting);
}
if (isListView() && currentEntry.classList.contains('current-item')) {
goToPrevListItem();
}
}
}
// Change the entry status to the opposite value.
function toggleEntryStatus(element, toasting) {
let entryID = parseInt(element.dataset.id, 10);
@ -512,6 +528,38 @@ function goToNextListItem() {
}
}
function goToPrevListItem() {
let items = DomHelper.getVisibleElements(".items .item");
if (items.length === 0) {
return;
}
if (document.querySelector(".current-item") === null) {
items[0].classList.add("current-item");
items[0].querySelector('.item-header a').focus();
return;
}
for (let i = 0; i < items.length; i++) {
if (items[i].classList.contains("current-item")) {
items[i].classList.remove("current-item");
let prevItem;
if (i - 1 >= 0) {
prevItem = items[i - 1];
} else {
prevItem = items[items.length - 1];
}
prevItem.classList.add("current-item");
DomHelper.scrollPageTo(prevItem);
prevItem.querySelector('.item-header a').focus();
break;
}
}
}
function scrollToCurrentItem() {
let currentItem = document.querySelector(".current-item");
if (currentItem !== null) {

View file

@ -24,6 +24,7 @@ document.addEventListener("DOMContentLoaded", function () {
keyboardHandler.on("c", () => openCommentLink());
keyboardHandler.on("C", () => openCommentLink(true));
keyboardHandler.on("m", () => handleEntryStatus());
keyboardHandler.on("M", () => handleEntryStatusNext());
keyboardHandler.on("A", () => markPageAsRead());
keyboardHandler.on("s", () => handleSaveEntry());
keyboardHandler.on("d", () => handleFetchOriginalContent());