From b9939bdaac75233ab52c7c7a483d5e4feb4921a4 Mon Sep 17 00:00:00 2001 From: Ben Passmore Date: Thu, 9 Nov 2023 20:12:04 +1000 Subject: Added ability to mark articles as read on focus. (#5812) * Added ability to mark entries as read on focus. Feature proposed in issue #5723. * make-fix-all + i18n fr * Use batch to save resources and increase performance * Use "keep_unread" * typo --------- Co-authored-by: Alexandre Alapetite --- CHANGELOG.md | 3 ++- app/Controllers/configureController.php | 2 ++ app/i18n/cz/conf.php | 1 + app/i18n/de/conf.php | 1 + app/i18n/el/conf.php | 1 + app/i18n/en-us/conf.php | 1 + app/i18n/en/conf.php | 1 + app/i18n/es/conf.php | 1 + app/i18n/fa/conf.php | 1 + app/i18n/fr/conf.php | 1 + app/i18n/he/conf.php | 1 + app/i18n/hu/conf.php | 1 + app/i18n/id/conf.php | 1 + app/i18n/it/conf.php | 1 + app/i18n/ja/conf.php | 1 + app/i18n/ko/conf.php | 1 + app/i18n/lv/conf.php | 1 + app/i18n/nl/conf.php | 1 + app/i18n/oc/conf.php | 1 + app/i18n/pl/conf.php | 1 + app/i18n/pt-br/conf.php | 1 + app/i18n/ru/conf.php | 1 + app/i18n/sk/conf.php | 1 + app/i18n/tr/conf.php | 1 + app/i18n/zh-cn/conf.php | 1 + app/i18n/zh-tw/conf.php | 1 + app/views/configure/reading.phtml | 12 ++++++++++++ app/views/helpers/javascript_vars.phtml | 1 + config-user.default.php | 1 + p/scripts/main.js | 9 +++++++++ 30 files changed, 51 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b966b497..b5c9c236c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,8 @@ * Features * New *Important feeds* group in the main view, with corresponding new priority level for feeds [#5782](https://github.com/FreshRSS/FreshRSS/pull/5782) - * Entries from important feeds are not marked as read during scroll, nor during *Mark all as read* + * Entries from important feeds are not marked as read during *scroll*, during *focus*, nor during *Mark all as read* + * New option to mark entries as read when focused from keyboard shortcut [5812](https://github.com/FreshRSS/FreshRSS/pull/5812) * Add support for more thumbnail types [#5806](https://github.com/FreshRSS/FreshRSS/pull/5806) * Increase SQL (`VARCHAR`) text fields length to maximum possible [#5788](https://github.com/FreshRSS/FreshRSS/pull/5788) * Increase SQL date fields to 64-bit to be ready for year 2038+ [#5570](https://github.com/FreshRSS/FreshRSS/pull/5570) diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index ef16f6b60..ccdad1baf 100644 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -103,6 +103,7 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController { * - opened on site * - scrolled * - received + * - focus * Default values are false unless specified. */ public function readingAction(): void { @@ -136,6 +137,7 @@ class FreshRSS_configure_Controller extends FreshRSS_ActionController { Minz_Request::paramBoolean('enable_read_when_same_title_in_feed') && Minz_Request::paramBoolean('read_when_same_title_in_feed'), 'scroll' => Minz_Request::paramBoolean('mark_scroll'), 'site' => Minz_Request::paramBoolean('mark_open_site'), + 'focus' => Minz_Request::paramBoolean('mark_focus'), ]; FreshRSS_Context::$user_conf->save(); invalidateHttpCache(); diff --git a/app/i18n/cz/conf.php b/app/i18n/cz/conf.php index ae5dd83aa..e928f287c 100644 --- a/app/i18n/cz/conf.php +++ b/app/i18n/cz/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'když je článek otevřen na své původní webové stránce', 'article_viewed' => 'když je článek zobrazen', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Maximální počet článků, které ponechat jako nepřečtené', 'scroll' => 'během posouvání (except for important feeds)', // DIRTY 'upon_gone' => 'když se již nenachází v upstreamu zpráv.', diff --git a/app/i18n/de/conf.php b/app/i18n/de/conf.php index 9152d2bdf..db4e8b7ad 100644 --- a/app/i18n/de/conf.php +++ b/app/i18n/de/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'wenn der Artikel auf der Original-Webseite geöffnet wird', 'article_viewed' => 'wenn der Artikel angesehen wird', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Max. Anzahl von ungelesenen Artikeln', 'scroll' => 'beim Scrollen bzw. Überspringen (except for important feeds)', // DIRTY 'upon_gone' => 'wenn der Artikel nicht mehr im Feed enthalten ist', diff --git a/app/i18n/el/conf.php b/app/i18n/el/conf.php index ea4c28457..bbd90e3f4 100644 --- a/app/i18n/el/conf.php +++ b/app/i18n/el/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'when the article is opened on its original website', // TODO 'article_viewed' => 'when the article is viewed', // TODO + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Max number of articles to keep unread', // TODO 'scroll' => 'while scrolling (except for important feeds)', // TODO 'upon_gone' => 'when it is no longer in the upstream news feed', // TODO diff --git a/app/i18n/en-us/conf.php b/app/i18n/en-us/conf.php index 4736812f4..7b87d5b28 100644 --- a/app/i18n/en-us/conf.php +++ b/app/i18n/en-us/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'when the article is opened on its original website', // IGNORE 'article_viewed' => 'when the article is viewed', // IGNORE + 'focus' => 'when focused (except for important feeds)', // IGNORE 'keep_max_n_unread' => 'Max number of articles to keep unread', // IGNORE 'scroll' => 'while scrolling (except for important feeds)', // IGNORE 'upon_gone' => 'when it is no longer in the upstream news feed', // IGNORE diff --git a/app/i18n/en/conf.php b/app/i18n/en/conf.php index 5cb8af04f..1b3c14391 100644 --- a/app/i18n/en/conf.php +++ b/app/i18n/en/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'when the article is opened on its original website', 'article_viewed' => 'when the article is viewed', + 'focus' => 'when focused (except for important feeds)', 'keep_max_n_unread' => 'Max number of articles to keep unread', 'scroll' => 'while scrolling (except for important feeds)', 'upon_gone' => 'when it is no longer in the upstream news feed', diff --git a/app/i18n/es/conf.php b/app/i18n/es/conf.php index e8f8fc4a3..282f8e6c1 100644 --- a/app/i18n/es/conf.php +++ b/app/i18n/es/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'cuando el artículo se abra en su web original', 'article_viewed' => 'cuando se muestre el artículo', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Número máximo de artículos para mantener sin leer', 'scroll' => 'durante el desplazamiento (except for important feeds)', // DIRTY 'upon_gone' => 'cuando ya no está disponible en el feed de noticias previo', diff --git a/app/i18n/fa/conf.php b/app/i18n/fa/conf.php index 898f68385..0daa2d34f 100644 --- a/app/i18n/fa/conf.php +++ b/app/i18n/fa/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => ' هنگامی که مقاله در وب سایت اصلی خود باز می شود', 'article_viewed' => ' هنگام مشاهده مقاله', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => ' حداکثر تعداد مقالات خوانده نشده', 'scroll' => '(except for important feeds) در حین پیمایش', // DIRTY 'upon_gone' => ' زمانی که دیگر در فید اخبار بالادستی نیست', diff --git a/app/i18n/fr/conf.php b/app/i18n/fr/conf.php index 37ca60117..00d0332c3 100644 --- a/app/i18n/fr/conf.php +++ b/app/i18n/fr/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'lorsque l’article est ouvert sur le site d’origine', 'article_viewed' => 'lorsque l’article est affiché', + 'focus' => 'lorsque l’article est selectionné (sauf pour les flux importants)', 'keep_max_n_unread' => 'Nombre maximum d’articles conservés non lus', 'scroll' => 'au défilement de la page (sauf pour les flux importants)', 'upon_gone' => 'lorsqu’il n’est plus dans le flux d’actualités en amont', diff --git a/app/i18n/he/conf.php b/app/i18n/he/conf.php index eb40f1862..d2142b1fd 100644 --- a/app/i18n/he/conf.php +++ b/app/i18n/he/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'כאשר מאמר נפתח באתר המקורי', 'article_viewed' => 'כאשר מאמר נצפה', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Max number of articles to keep unread', // TODO 'scroll' => '(except for important feeds) כאשר גוללים', // DIRTY 'upon_gone' => 'when it is no longer in the upstream news feed', // TODO diff --git a/app/i18n/hu/conf.php b/app/i18n/hu/conf.php index 83adcb76b..6e1cfd0bd 100644 --- a/app/i18n/hu/conf.php +++ b/app/i18n/hu/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'ha a cikk megnyitásra került az eredeti weblapon', 'article_viewed' => 'ha a cikk megtekintésre került', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Cikkek maximális száma olvasatlanként tartva', 'scroll' => 'görgetés közben (except for important feeds)', // DIRTY 'upon_gone' => 'ha már nincs benne a hírforrásban', diff --git a/app/i18n/id/conf.php b/app/i18n/id/conf.php index c875407b7..f780140ba 100644 --- a/app/i18n/id/conf.php +++ b/app/i18n/id/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'when the article is opened on its original website', // TODO 'article_viewed' => 'when the article is viewed', // TODO + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Max number of articles to keep unread', // TODO 'scroll' => 'while scrolling (except for important feeds)', // TODO 'upon_gone' => 'when it is no longer in the upstream news feed', // TODO diff --git a/app/i18n/it/conf.php b/app/i18n/it/conf.php index c00e9056e..2e4771bb3 100644 --- a/app/i18n/it/conf.php +++ b/app/i18n/it/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'Quando un articolo è aperto nel suo sito di origine', 'article_viewed' => 'Quando un articolo viene letto', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Massimo numero di articoli da mantenere come non letti', 'scroll' => 'Scorrendo la pagina (except for important feeds)', // DIRTY 'upon_gone' => 'quando non si trova più nel feed di notizie in alto', diff --git a/app/i18n/ja/conf.php b/app/i18n/ja/conf.php index b76444ebc..0a77b106c 100644 --- a/app/i18n/ja/conf.php +++ b/app/i18n/ja/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => '記事を元のwebサイトで開いたとき', 'article_viewed' => '記事を読んだとき', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => '未読の記事として残す最大数', 'scroll' => 'スクロールしているとき (except for important feeds)', // DIRTY 'upon_gone' => 'ニュースフィードの提供元がなくなったとき', diff --git a/app/i18n/ko/conf.php b/app/i18n/ko/conf.php index bba75096f..e6952feeb 100644 --- a/app/i18n/ko/conf.php +++ b/app/i18n/ko/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => '글이 게재된 웹사이트를 방문했을 때', 'article_viewed' => '글을 읽었을 때', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => '읽지 않은 상태로 유지할 최대 글 개수', 'scroll' => '스크롤을 하며 지나갈 때 (except for important feeds)', // DIRTY 'upon_gone' => '원본 뉴스 피드에서 글 삭제 되었을 때', diff --git a/app/i18n/lv/conf.php b/app/i18n/lv/conf.php index 1c98bb52a..1237f1d15 100644 --- a/app/i18n/lv/conf.php +++ b/app/i18n/lv/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'kad raksts tiek atvērts tā sākotnējā mājaslapā', 'article_viewed' => 'kad raksts tiek skatīts', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Maksimālais nelasīto rakstu skaits', 'scroll' => 'ritināšanas laikā (except for important feeds)', // DIRTY 'upon_gone' => 'kad tas vairs nav augšupējā ziņu barotnē', diff --git a/app/i18n/nl/conf.php b/app/i18n/nl/conf.php index 31291fe54..b164a8361 100644 --- a/app/i18n/nl/conf.php +++ b/app/i18n/nl/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'als het artikel wordt geopend op de originele website', 'article_viewed' => 'als het artikel wordt bekeken', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Max aantal artikelen ongelezen houden', 'scroll' => 'tijdens het scrollen (except for important feeds)', // DIRTY 'upon_gone' => 'als het niet langer in de nieuwsfeed staat', diff --git a/app/i18n/oc/conf.php b/app/i18n/oc/conf.php index a06697459..159b46e7d 100644 --- a/app/i18n/oc/conf.php +++ b/app/i18n/oc/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'quand l’article es dobèrt sul site d’origina', 'article_viewed' => 'quand l’article es mostrat', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Nombre max d’articles a gardar pas legits', 'scroll' => 'en davalant la pagina (except for important feeds)', // DIRTY 'upon_gone' => 'quand es pas mai dins lo flux de novèla font', diff --git a/app/i18n/pl/conf.php b/app/i18n/pl/conf.php index 9485d91fc..ee1c2b21e 100644 --- a/app/i18n/pl/conf.php +++ b/app/i18n/pl/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'gdy wiadomość jest otworzona na pierwotnej stronie', 'article_viewed' => 'gdy wiadomość jest otworzona', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Maksymalna liczba nieprzeczytanych wiadomości', 'scroll' => 'podczas przewijania (except for important feeds)', // DIRTY 'upon_gone' => 'gdy nie jest już listowana w źródle kanału', diff --git a/app/i18n/pt-br/conf.php b/app/i18n/pt-br/conf.php index c115c80dc..b21ce5bb4 100644 --- a/app/i18n/pt-br/conf.php +++ b/app/i18n/pt-br/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'quando o artigo é aberto no site original', 'article_viewed' => 'Quando o artigo é visualizado', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Número máximo de artigos para manter como não lido', 'scroll' => 'enquanto scrolling (except for important feeds)', // DIRTY 'upon_gone' => 'QUuando não estiver mais no feed de noticiais principais', diff --git a/app/i18n/ru/conf.php b/app/i18n/ru/conf.php index dd7849f40..5e3fdbd23 100644 --- a/app/i18n/ru/conf.php +++ b/app/i18n/ru/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'когда статья открывается на её сайте', 'article_viewed' => 'когда статья просматривается', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Максимальное количество непрочитанных статей', 'scroll' => 'во время прокрутки (except for important feeds)', // DIRTY 'upon_gone' => 'когда это больше не в новостной ленте', diff --git a/app/i18n/sk/conf.php b/app/i18n/sk/conf.php index 9835591d4..0f01d09b8 100644 --- a/app/i18n/sk/conf.php +++ b/app/i18n/sk/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'keď je článok otvorený na svojej webovej stránke', 'article_viewed' => 'keď je článok zobrazený', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Maximálny počet článkov ponechať ako neprečítané', 'scroll' => 'počas skrolovania (except for important feeds)', // DIRTY 'upon_gone' => 'keď už nie je v hlavnom kanály noviniek', diff --git a/app/i18n/tr/conf.php b/app/i18n/tr/conf.php index e34f8b02f..4cebac293 100644 --- a/app/i18n/tr/conf.php +++ b/app/i18n/tr/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => 'orijinal makale sitesi açıldığında', 'article_viewed' => 'makale görüntülendiğinde', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => 'Okunmadı tutulacak maksimum metin sayısı', 'scroll' => 'kaydırma yapılırken (except for important feeds)', // DIRTY 'upon_gone' => 'Yeni akışta üst sıralarda değilken', diff --git a/app/i18n/zh-cn/conf.php b/app/i18n/zh-cn/conf.php index 4f98fc90f..1e533fb54 100644 --- a/app/i18n/zh-cn/conf.php +++ b/app/i18n/zh-cn/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => '在打开原文章后', 'article_viewed' => '在文章被浏览后', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => '未读最多保留 n 条', 'scroll' => '在滚动浏览后 (except for important feeds)', // DIRTY 'upon_gone' => '在被原订阅源被移除后', diff --git a/app/i18n/zh-tw/conf.php b/app/i18n/zh-tw/conf.php index 440fe499f..16e0cc5ed 100644 --- a/app/i18n/zh-tw/conf.php +++ b/app/i18n/zh-tw/conf.php @@ -204,6 +204,7 @@ return array( 'read' => array( 'article_open_on_website' => '在打開原文章後', 'article_viewed' => '在文章被瀏覽後', + 'focus' => 'when focused (except for important feeds)', // TODO 'keep_max_n_unread' => '未讀最多保留 n 條', 'scroll' => '在滾動瀏覽後 (except for important feeds)', // DIRTY 'upon_gone' => '在被原訂閱源移除後', diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtml index 38219e7b2..669fa7a16 100644 --- a/app/views/configure/reading.phtml +++ b/app/views/configure/reading.phtml @@ -280,6 +280,18 @@ +
+ +
+ +
+
+
diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index 1aaa377d1..8ee8a7e21 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -13,6 +13,7 @@ echo htmlspecialchars(json_encode(array( 'auto_mark_article' => !!$mark['article'], 'auto_mark_site' => !!$mark['site'], 'auto_mark_scroll' => !!$mark['scroll'], + 'auto_mark_focus' => !!$mark['focus'], 'auto_load_more' => !!FreshRSS_Context::$user_conf->auto_load_more, 'auto_actualize_feeds' => !!Minz_Session::param('actualize_feeds', false), 'does_lazyload' => !!FreshRSS_Context::$user_conf->lazyload , diff --git a/config-user.default.php b/config-user.default.php index c45fb60f5..2fbdad241 100644 --- a/config-user.default.php +++ b/config-user.default.php @@ -61,6 +61,7 @@ return array ( 'reception' => false, 'same_title_in_feed' => false, 'scroll' => false, + 'focus' => false, 'site' => true, ), 'theme' => 'Origine', diff --git a/p/scripts/main.js b/p/scripts/main.js index b3876f628..ca52bac56 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -481,6 +481,9 @@ function prev_entry(skipping) { } else { new_active = document.querySelector('.flux'); } + if (context.auto_mark_focus && !new_active.classList.contains('keep_unread')) { + mark_read(new_active, true, true); + } toggleContent(new_active, old_active, skipping); } @@ -496,6 +499,9 @@ function next_entry(skipping) { } else { new_active = document.querySelector('.flux'); } + if (context.auto_mark_focus && !new_active.classList.contains('keep_unread')) { + mark_read(new_active, true, true); + } toggleContent(new_active, old_active, skipping); } @@ -511,6 +517,9 @@ function next_unread_entry(skipping) { } else { new_active = document.querySelector('.not_read'); } + if (context.auto_mark_focus && !new_active.classList.contains('keep_unread')) { + mark_read(new_active, true, true); + } toggleContent(new_active, old_active, skipping); } -- cgit v1.2.3