diff options
| author | 2021-10-19 10:46:39 +0200 | |
|---|---|---|
| committer | 2021-10-19 10:46:39 +0200 | |
| commit | 85b898c623ae09d5caa88041bd8ceb26d4f1defc (patch) | |
| tree | 2ac16791bc739d58b732f06c8cf60b6aefae9b18 | |
| parent | f96563ebb0c1e38a320eda1e7fdd8490785cd047 (diff) | |
Add shortcut to jump to next unread article (issue #3393) (#3891)
* Add shortcut to jump to next unread article
* phpcbf
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
| -rw-r--r-- | app/i18n/cz/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/de/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/en-us/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/en/conf.php | 1 | ||||
| -rwxr-xr-x | app/i18n/es/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/fr/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/he/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/it/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/ja/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/kr/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/nl/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/oc/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/pl/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/pt-br/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/ru/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/sk/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/tr/conf.php | 1 | ||||
| -rw-r--r-- | app/i18n/zh-cn/conf.php | 1 | ||||
| -rw-r--r-- | app/views/configure/shortcut.phtml | 8 | ||||
| -rw-r--r-- | app/views/helpers/javascript_vars.phtml | 1 | ||||
| -rw-r--r-- | cli/i18n/ignore/en-us.php | 1 | ||||
| -rw-r--r-- | config-user.default.php | 1 | ||||
| -rw-r--r-- | p/scripts/main.js | 39 |
23 files changed, 68 insertions, 0 deletions
diff --git a/app/i18n/cz/conf.php b/app/i18n/cz/conf.php index d8013948f..adfd920da 100644 --- a/app/i18n/cz/conf.php +++ b/app/i18n/cz/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => 'Pomocí přepínače <kbd>⇧ Shift</kbd> fungují navigační zkratky v rámci kanálů.<br/>Pomocí přepínače <kbd>Alt ⎇</kbd> fungují v rámci kategorií.', 'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.', // TODO - Translation 'next_article' => 'Skočit na další článek', + 'next_unread_article' => 'Open the next unread article', // TODO - Translation 'non_standard' => 'Some keys (<kbd>%s</kbd>) may not work as shortcuts.', // TODO - Translation 'normal_view' => 'Switch to normal view', // TODO - Translation 'other_action' => 'Ostatní akce', diff --git a/app/i18n/de/conf.php b/app/i18n/de/conf.php index 0a84a5ef9..50a10f025 100644 --- a/app/i18n/de/conf.php +++ b/app/i18n/de/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => 'Mit der <kbd>⇧ Umschalttaste</kbd> finden die Tastenkombination auf Feeds Anwendung.<br/>Mit der <kbd>Alt ⎇</kbd>-Taste finden die Tastenkombination auf Kategorien Anwendung.', 'navigation_no_mod_help' => 'Die folgenden Navigationsverknüpfungen unterstützen keine Modifikatoren.', 'next_article' => 'Zum nächsten Artikel springen', + 'next_unread_article' => 'Zum nächsten ungelesenen Artikel springen', 'non_standard' => 'Einige Tasten (<kbd>%s</kbd>) können nicht als Shortcut verwendet werden.', 'normal_view' => 'Wechsle zur normalen Ansicht', 'other_action' => 'Andere Aktionen', diff --git a/app/i18n/en-us/conf.php b/app/i18n/en-us/conf.php index 63bb266ec..32600d11b 100644 --- a/app/i18n/en-us/conf.php +++ b/app/i18n/en-us/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => 'With the <kbd>⇧ Shift</kbd> modifier, navigation shortcuts apply on feeds.<br/>With the <kbd>Alt ⎇</kbd> modifier, navigation shortcuts apply on categories.', 'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.', 'next_article' => 'Open the next article', + 'next_unread_article' => 'Open the next unread article', 'non_standard' => 'Some keys (<kbd>%s</kbd>) may not work as shortcuts.', 'normal_view' => 'Switch to normal view', 'other_action' => 'Other actions', diff --git a/app/i18n/en/conf.php b/app/i18n/en/conf.php index bb84b662b..a732e2cb7 100644 --- a/app/i18n/en/conf.php +++ b/app/i18n/en/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => 'With the <kbd>⇧ Shift</kbd> modifier, navigation shortcuts apply on feeds.<br/>With the <kbd>Alt ⎇</kbd> modifier, navigation shortcuts apply on categories.', 'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.', 'next_article' => 'Open the next article', + 'next_unread_article' => 'Open the next unread article', 'non_standard' => 'Some keys (<kbd>%s</kbd>) may not work as shortcuts.', 'normal_view' => 'Switch to normal view', 'other_action' => 'Other actions', diff --git a/app/i18n/es/conf.php b/app/i18n/es/conf.php index 0e429967e..a16005fa9 100755 --- a/app/i18n/es/conf.php +++ b/app/i18n/es/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => 'Con el modificador <kbd>⇧ Mayúsculas</kbd> es posible usar los atajos de teclado en las fuentes.<br/>Con el modificador <kbd>Alt ⎇</kbd> es posible aplicar los atajos de teclado en las categorías.', 'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.', // TODO - Translation 'next_article' => 'Saltar al siguiente artículo', + 'next_unread_article' => 'Open the next unread article', // TODO - Translation 'non_standard' => 'Some keys (<kbd>%s</kbd>) may not work as shortcuts.', // TODO - Translation 'normal_view' => 'Switch to normal view', // TODO - Translation 'other_action' => 'Otras acciones', diff --git a/app/i18n/fr/conf.php b/app/i18n/fr/conf.php index 972740eb1..ca3f1bbd6 100644 --- a/app/i18n/fr/conf.php +++ b/app/i18n/fr/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => 'Avec le modificateur <kbd>⇧ Maj</kbd>, les raccourcis de navigation s’appliquent aux flux.<br/>Avec le modificateur <kbd>Alt ⎇</kbd>, les raccourcis de navigation s’appliquent aux catégories.', 'navigation_no_mod_help' => 'Les raccourcis suivant ne supportent pas les modificateurs.', 'next_article' => 'Passer à l’article suivant', + 'next_unread_article' => 'Passer à l’article non lu suivant', 'non_standard' => 'Certains raccourcis (<kbd>%s</kbd>) peuvent ne pas fonctionner.', 'normal_view' => 'Basculer vers la vue normale', 'other_action' => 'Autres actions', diff --git a/app/i18n/he/conf.php b/app/i18n/he/conf.php index 34f32ddcc..555a6ad53 100644 --- a/app/i18n/he/conf.php +++ b/app/i18n/he/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => 'בעזרת מקש השיפט קיצורי דרך חלים על הזנות .<br/>עם מקש האלט הם חלים על קטגוריות.', 'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.', // TODO - Translation 'next_article' => 'דילוג למאמר הבא', + 'next_unread_article' => 'Open the next unread article', // TODO - Translation 'non_standard' => 'Some keys (<kbd>%s</kbd>) may not work as shortcuts.', // TODO - Translation 'normal_view' => 'Switch to normal view', // TODO - Translation 'other_action' => 'פעולות אחרות', diff --git a/app/i18n/it/conf.php b/app/i18n/it/conf.php index 29fa33ca9..23dac5956 100644 --- a/app/i18n/it/conf.php +++ b/app/i18n/it/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => 'Con il tasto <kbd>⇧ Shift</kbd> i comandi di navigazione verranno applicati ai feeds.<br/>Con il tasto <kbd>Alt ⎇</kbd> i comandi di navigazione verranno applicati alle categorie.', 'navigation_no_mod_help' => 'The following navigation shortcuts do not support modifiers.', // TODO - Translation 'next_article' => 'Salta al contenuto successivo', + 'next_unread_article' => 'Open the next unread article', // TODO - Translation 'non_standard' => 'Some keys (<kbd>%s</kbd>) may not work as shortcuts.', // TODO - Translation 'normal_view' => 'Switch to normal view', // TODO - Translation 'other_action' => 'Altre azioni', diff --git a/app/i18n/ja/conf.php b/app/i18n/ja/conf.php index eee5a9f6f..a0d2f6c1f 100644 --- a/app/i18n/ja/conf.php +++ b/app/i18n/ja/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => '<kbd>⇧ Shift</kbd>キーを使うと, フィードにショートカットナビが表示されます。<br/><kbd>Alt ⎇</kbd> キーを使うと、カテゴリにショートカットナビが表示されます。', 'navigation_no_mod_help' => '次のショートカットナビは、キーボードショートカットには対応していません。', 'next_article' => '次の記事を開く', + 'next_unread_article' => 'Open the next unread article', // TODO - Translation 'non_standard' => '(<kbd>%s</kbd>)のキーはショートカットにはなりません。', 'normal_view' => 'ノーマルビューに切り替える', 'other_action' => 'ほかのアクション', diff --git a/app/i18n/kr/conf.php b/app/i18n/kr/conf.php index 2128b1532..6288e1c30 100644 --- a/app/i18n/kr/conf.php +++ b/app/i18n/kr/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => '<kbd>⇧ Shift</kbd> 키를 누른 상태에선 탐색 단축키가 피드에 적용됩니다.<br/><kbd>Alt ⎇</kbd> 키를 누른 상태에선 탐색 단축키가 카테고리에 적용됩니다.', 'navigation_no_mod_help' => '아래 탐색 단축키에는 "Shift"와 "Alt" 키가 적용되지 않습니다.', 'next_article' => '다음 글 보기', + 'next_unread_article' => 'Open the next unread article', // TODO - Translation 'non_standard' => 'Some keys (<kbd>%s</kbd>) may not work as shortcuts.', // TODO - Translation 'normal_view' => '일반 모드로 전환', 'other_action' => '다른 동작', diff --git a/app/i18n/nl/conf.php b/app/i18n/nl/conf.php index b157551cf..0c658f273 100644 --- a/app/i18n/nl/conf.php +++ b/app/i18n/nl/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => 'Met de <kbd>⇧ Shift</kbd> toets worden navigatieverwijzingen op feeds toegepast.<br/>Met de <kbd>Alt ⎇</kbd> toets worden navigatieverwijzingen op categorieën toegepast.', 'navigation_no_mod_help' => 'De volgende navigatiesnelkoppelingen ondersteunen geen toetsencombinaties.', 'next_article' => 'Spring naar volgende artikel', + 'next_unread_article' => 'Spring naar volgende ongelezene artikel', 'non_standard' => 'Sommige toetsen (<kbd>%s</kbd>) werken wellicht niet als snelkoppelingen.', 'normal_view' => 'Schakel naar gewoon aanzicht', 'other_action' => 'Andere acties', diff --git a/app/i18n/oc/conf.php b/app/i18n/oc/conf.php index cbe19f1b5..62105f72d 100644 --- a/app/i18n/oc/conf.php +++ b/app/i18n/oc/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => 'Amb lo modificador <kbd>⇧ Shift</kbd>, los acorchis de navigacion s’aplican als fluxes.<br/>Amb lo modificador <kbd>Alt ⎇</kbd>, los acorchis de navigacion s’aplican a las categorias.', 'navigation_no_mod_help' => 'Los acorchis clavièrs de navigacion son pas compatibles amb los modificadors.', 'next_article' => 'Passar a l’article seguent', + 'next_unread_article' => 'Open the next unread article', // TODO - Translation 'non_standard' => 'Some keys (<kbd>%s</kbd>) may not work as shortcuts.', // TODO - Translation 'normal_view' => 'Passar a la vista normala', 'other_action' => 'Autras accions', diff --git a/app/i18n/pl/conf.php b/app/i18n/pl/conf.php index c38ab80f2..e9ed6ced8 100644 --- a/app/i18n/pl/conf.php +++ b/app/i18n/pl/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => 'Z wykorzystaniem modyfikatora <kbd>⇧ Shift</kbd> skróty nawigacyjne stosowane są dla kanałów.<br/>Z wykorzystaniem modyfikatora <kbd>Alt ⎇</kbd> skróty nawigacyjne stosowane są dla kategorii.', 'navigation_no_mod_help' => 'Pozostałe skróty nawigacyjne nie wspierają modyfikatorów.', 'next_article' => 'Otworzenie następnej wiadomości', + 'next_unread_article' => 'Open the next unread article', // TODO - Translation 'non_standard' => 'Some keys (<kbd>%s</kbd>) may not work as shortcuts.', // TODO - Translation 'normal_view' => 'Przełączenie na widok normalny', 'other_action' => 'Inne akcje', diff --git a/app/i18n/pt-br/conf.php b/app/i18n/pt-br/conf.php index 976820462..3739c1db8 100644 --- a/app/i18n/pt-br/conf.php +++ b/app/i18n/pt-br/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => 'Com o modificador <kbd>⇧ Shift</kbd>, atalhos de navegação aplicam aos feeds.<br/>Com o <kbd>Alt ⎇</kbd> modificador, atalhos de navegação aplicam as categorias.', 'navigation_no_mod_help' => 'Os seguintes atalhos de navegação não suportam modificadores.', 'next_article' => 'Pule para o próximo artigo', + 'next_unread_article' => 'Open the next unread article', // TODO - Translation 'non_standard' => 'Some keys (<kbd>%s</kbd>) may not work as shortcuts.', // TODO - Translation 'normal_view' => 'Mudar para a visualização normal', 'other_action' => 'Outras ações', diff --git a/app/i18n/ru/conf.php b/app/i18n/ru/conf.php index 4bdcdb1c5..789be1ce9 100644 --- a/app/i18n/ru/conf.php +++ b/app/i18n/ru/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => 'С модификатором <kbd>⇧ Shift</kbd> навигационные горячие клавиши применяются к лентам.<br/>С модификатором <kbd>Alt ⎇</kbd> навигационные горячие клавиши применяются к категориям.', 'navigation_no_mod_help' => 'Следующие навигационные горячие клавиши не поддерживают модификаторы.', 'next_article' => 'Открыть следующую статью', + 'next_unread_article' => 'Open the next unread article', // TODO - Translation 'non_standard' => 'Некоторые клавиши (<kbd>%s</kbd>) не могут быть использованы как горячие клавиши.', 'normal_view' => 'Переключиться на обычный вид', 'other_action' => 'Другие действия', diff --git a/app/i18n/sk/conf.php b/app/i18n/sk/conf.php index 21980fe4a..fdc5a48dd 100644 --- a/app/i18n/sk/conf.php +++ b/app/i18n/sk/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => 'Po stlačení skratky s klávesou <kbd>⇧ Shift</kbd>, sa skratky navigácie vzťahujú na kanály.<br/>Po stlačení skratky s klávesou <kbd>Alt ⎇</kbd>, sa skratky navigácie vzťahujú na kategórie.', 'navigation_no_mod_help' => 'Tieto skratky navigácie nepodporujú klávesy "Shift" a "Alt".', 'next_article' => 'Otvorí ďalší článok', + 'next_unread_article' => 'Open the next unread article', // TODO - Translation 'non_standard' => 'Some keys (<kbd>%s</kbd>) may not work as shortcuts.', // TODO - Translation 'normal_view' => 'Prepne do základného zobrazenia', 'other_action' => 'Ostatné akcie', diff --git a/app/i18n/tr/conf.php b/app/i18n/tr/conf.php index 6e1a88b50..1b0192dc1 100644 --- a/app/i18n/tr/conf.php +++ b/app/i18n/tr/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => '<kbd>⇧ Shift</kbd> tuşu ile kısayollar akışlar için geçerli olur.<br/><kbd>Alt ⎇</kbd> tuşu ile kısayollar kategoriler için geçerli olur.', 'navigation_no_mod_help' => 'Aşağıdaki kısayollar değiştiricileri desteklenmemektedir.', 'next_article' => 'Sonraki makaleye geç', + 'next_unread_article' => 'Open the next unread article', // TODO - Translation 'non_standard' => 'Bazı tuşlar (<kbd>%s</kbd>) kullanılamayabilir.', 'normal_view' => 'Normal görünüme geç', 'other_action' => 'Diğer eylemler', diff --git a/app/i18n/zh-cn/conf.php b/app/i18n/zh-cn/conf.php index c24c61199..c1c1452f1 100644 --- a/app/i18n/zh-cn/conf.php +++ b/app/i18n/zh-cn/conf.php @@ -198,6 +198,7 @@ return array( 'navigation_help' => '组合 <kbd>⇧ Shift</kbd> 键,浏览快捷键将生效于订阅源。<br/>组合 <kbd>Alt ⎇</kbd> 键,浏览快捷键将生效于分类。', 'navigation_no_mod_help' => '以下快捷键不支持组合键(Shift 或 Alt)', 'next_article' => '打开下一篇文章', + 'next_unread_article' => 'Open the next unread article', // TODO - Translation 'non_standard' => '这些键 (<kbd>%s</kbd>) 可能不能作为快捷键', 'normal_view' => '切换到普通视图', 'other_action' => '其他操作', diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml index f8eb469e8..ff94fcf56 100644 --- a/app/views/configure/shortcut.phtml +++ b/app/views/configure/shortcut.phtml @@ -76,6 +76,14 @@ </div> <div class="form-group"> + <label class="group-name" for="next_unread_entry"><?= _t('conf.shortcut.next_unread_article') ?></label> + <div class="group-controls"> + <input type="text" id="next_unread_entry" name="shortcuts[next_unread_entry]" list="keys" value="<?= $s['next_unread_entry'] ?>" + data-leave-validation="<?= $s['next_unread_entry'] ?>"/> + </div> + </div> + + <div class="form-group"> <label class="group-name" for="prev_entry"><?= _t('conf.shortcut.previous_article') ?></label> <div class="group-controls"> <input type="text" id="prev_entry" name="shortcuts[prev_entry]" list="keys" value="<?= $s['prev_entry'] ?>" diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index c6600a9a8..232068da1 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -28,6 +28,7 @@ echo htmlspecialchars(json_encode(array( 'go_website' => @$s['go_website'], 'prev_entry' => @$s['prev_entry'], 'next_entry' => @$s['next_entry'], + 'next_unread_entry' => @$s['next_unread_entry'], 'skip_prev_entry' => @$s['skip_prev_entry'], 'skip_next_entry' => @$s['skip_next_entry'], 'first_entry' => @$s['first_entry'], diff --git a/cli/i18n/ignore/en-us.php b/cli/i18n/ignore/en-us.php index 812381b64..5cb3f5281 100644 --- a/cli/i18n/ignore/en-us.php +++ b/cli/i18n/ignore/en-us.php @@ -283,6 +283,7 @@ return array( 'conf.shortcut.navigation_help', 'conf.shortcut.navigation_no_mod_help', 'conf.shortcut.next_article', + 'conf.shortcut.next_unread_article', 'conf.shortcut.non_standard', 'conf.shortcut.normal_view', 'conf.shortcut.other_action', diff --git a/config-user.default.php b/config-user.default.php index ef2218bab..8981bbc1a 100644 --- a/config-user.default.php +++ b/config-user.default.php @@ -62,6 +62,7 @@ return array ( 'mark_favorite' => 'f', 'go_website' => 'space', 'next_entry' => 'j', + 'next_unread_entry' => 'h', 'prev_entry' => 'k', 'skip_next_entry' => 'n', 'skip_prev_entry' => 'p', diff --git a/p/scripts/main.js b/p/scripts/main.js index 1707a09b8..f44692103 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -470,6 +470,21 @@ function next_entry(skipping) { toggleContent(new_active, old_active, skipping); } +function next_unread_entry(skipping) { + const old_active = document.querySelector('.flux.current'); + let new_active = old_active; + if (new_active) { + do new_active = new_active.nextElementSibling; + while (new_active && !new_active.classList.contains('not_read')); + if (!new_active) { + next_feed(); + } + } else { + new_active = document.querySelector('.not_read'); + } + toggleContent(new_active, old_active, skipping); +} + function prev_feed() { let found = false; let adjacent = null; @@ -568,6 +583,20 @@ function next_category() { } } +function next_unread_category() { + const active_cat = document.querySelector('#aside_feed .category.active'); + if (active_cat) { + let cat = active_cat; + do cat = cat.nextElementSibling; + while (cat && cat.getAttribute('data-unread') <= 0); + if (cat) { + delayedClick(cat.querySelector('a.title')); + } + } else { + first_category(); + } +} + function first_category() { const a = document.querySelector('#aside_feed .category:not([data-unread="0"]) a.title'); delayedClick(a); @@ -831,6 +860,16 @@ function init_shortcuts() { } return false; } + if (k === s.next_unread_entry) { + if (ev.altKey) { + next_unread_category(); + } else if (ev.shiftKey) { + next_feed(); + } else { + next_unread_entry(false); + } + return false; + } if (k === s.prev_entry) { if (ev.altKey) { prev_category(); |
