A free, self-hostable news aggregator…
Modification des raccourcis de navigation
Alexis Degrugilliera201450b5817
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.phpindex 645f9eabf..a5d99c508 100755--- a/app/Controllers/configureController.php+++ b/app/Controllers/configureController.php@@ -286,7 +286,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController {public function shortcutAction () {$list_keys = array ('a', 'b', 'backspace', 'c', 'd', 'delete', 'down', 'e', 'end', 'enter',- 'escape', 'f', 'g', 'h', 'i', 'insert', 'j', 'k', 'l', 'left',+ 'escape', 'f', 'g', 'h', 'home', 'i', 'insert', 'j', 'k', 'l', 'left','m', 'n', 'o', 'p', 'page_down', 'page_up', 'q', 'r', 'return', 'right','s', 'space', 't', 'tab', 'u', 'up', 'v', 'w', 'x', 'y','z', '0', '1', '2', '3', '4', '5', '6', '7', '8',diff --git a/app/Models/Configuration.php b/app/Models/Configuration.phpindex 2a7fe95aa..2b719c370 100644--- a/app/Models/Configuration.php+++ b/app/Models/Configuration.php@@ -32,6 +32,8 @@ class FreshRSS_Configuration {'go_website' => 'space','next_entry' => 'j','prev_entry' => 'k',+ 'first_entry' => 'home',+ 'last_entry' => 'end','collapse_entry' => 'c','load_more' => 'm','auto_share' => 's',diff --git a/app/i18n/en.php b/app/i18n/en.phpindex a2cc461c5..66386f0ed 100644--- a/app/i18n/en.php+++ b/app/i18n/en.php@@ -78,6 +78,10 @@ return array ('bad_opml_file' => 'Your OPML file is invalid','shortcuts_updated' => 'Shortcuts have been updated','shortcuts_management' => 'Shortcuts management',+ 'shortcuts_navigation' => 'Navigation',+ 'shortcuts_navigation_help' => 'With the "Shift" modifier, navigation shortcuts apply on feeds.<br/>With the "Ctrl" modifier, navigation shortcuts apply on categories.',+ 'shortcuts_article_action' => 'Article actions',+ 'shortcuts_other_action' => 'Other actions','feeds_marked_read' => 'Feeds have been marked as read','updated' => 'Modifications have been updated',@@ -121,15 +125,16 @@ return array ('javascript_for_shortcuts' => 'JavaScript must be enabled in order to use shortcuts','javascript_should_be_activated'=> 'JavaScript must be enabled','shift_for_all_read' => '+ <code>shift</code> to mark all articles as read',- 'see_on_website' => 'See article on its original website',+ 'see_on_website' => 'See on original website','next_article' => 'Skip to the next article',- 'shift_for_last' => '+ <code>shift</code> to skip to the last article of page',+ 'last_article' => 'Skip to the last article','previous_article' => 'Skip to the previous article',- 'shift_for_first' => '+ <code>shift</code> to skip to the first article of page',+ 'first_article' => 'Skip to the first article','next_page' => 'Skip to the next page','previous_page' => 'Skip to the previous page',- 'collapse_article' => 'Collapse current article',- 'auto_share' => 'Share current article',+ 'collapse_article' => 'Collapse',+ 'auto_share' => 'Share',+ 'auto_share_help' => 'If there is only one sharing mode, it is used. Else modes are accessible by their number.','file_to_import' => 'File to import','import' => 'Import',diff --git a/app/i18n/fr.php b/app/i18n/fr.phpindex 9ab06ba26..edf2fb19f 100644--- a/app/i18n/fr.php+++ b/app/i18n/fr.php@@ -78,6 +78,10 @@ return array ('bad_opml_file' => 'Votre fichier OPML n’est pas valide','shortcuts_updated' => 'Les raccourcis ont été mis à jour','shortcuts_management' => 'Gestion des raccourcis',+ 'shortcuts_navigation' => 'Navigation',+ 'shortcuts_navigation_help' => 'Avec le modificateur "Shift", les raccourcis de navigation s’appliquent aux flux.<br/>Avec le modificateur "Ctrl", les raccourcis de navigation s’appliquent aux catégories.',+ 'shortcuts_article_action' => 'Actions associées à l’article courant',+ 'shortcuts_other_action' => 'Autres actions','feeds_marked_read' => 'Les flux ont été marqués comme lus','updated' => 'Modifications enregistrées',@@ -121,15 +125,16 @@ return array ('javascript_for_shortcuts' => 'Le JavaScript doit être activé pour pouvoir profiter des raccourcis','javascript_should_be_activated'=> 'Le JavaScript doit être activé','shift_for_all_read' => '+ <code>shift</code> pour marquer tous les articles comme lus',- 'see_on_website' => 'Voir l’article sur le site d’origine',+ 'see_on_website' => 'Voir sur le site d’origine','next_article' => 'Passer à l’article suivant',- 'shift_for_last' => '+ <code>shift</code> pour passer au dernier article de la page',+ 'last_article' => 'Passer au dernier article','previous_article' => 'Passer à l’article précédent',- 'shift_for_first' => '+ <code>shift</code> pour passer au premier article de la page',+ 'first_article' => 'Passer au premier article','next_page' => 'Passer à la page suivante','previous_page' => 'Passer à la page précédente',- 'collapse_article' => 'Refermer l’article courant',- 'auto_share' => 'Partager l’article courant',+ 'collapse_article' => 'Refermer',+ 'auto_share' => 'Partager',+ 'auto_share_help' => 'Si il n’y a qu’un mode de partage, celui ci est utilisé automatiquement. Sinon ils sont accessibles par leur numéro.','file_to_import' => 'Fichier à importer','import' => 'Importer',diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtmlindex b0867f711..748a65d17 100644--- a/app/views/configure/shortcut.phtml+++ b/app/views/configure/shortcut.phtml@@ -16,55 +16,59 @@<noscript><p class="alert alert-error"><?php echo Minz_Translate::t ('javascript_for_shortcuts'); ?></p></noscript>+ <legend><?php echo Minz_Translate::t ('shortcuts_navigation'); ?></legend>+<div class="form-group">- <label class="group-name" for="mark_read"><?php echo Minz_Translate::t ('mark_read'); ?></label>+ <label class="group-name" for="next_entry"><?php echo Minz_Translate::t ('next_article'); ?></label><div class="group-controls">- <input type="text" id="mark_read" name="shortcuts[mark_read]" list="keys" value="<?php echo $s['mark_read']; ?>" />- <?php echo Minz_Translate::t ('shift_for_all_read'); ?>+ <input type="text" id="next_entry" name="shortcuts[next_entry]" list="keys" value="<?php echo $s['next_entry']; ?>" /></div></div><div class="form-group">- <label class="group-name" for="mark_favorite"><?php echo Minz_Translate::t ('mark_favorite'); ?></label>+ <label class="group-name" for="prev_entry"><?php echo Minz_Translate::t ('previous_article'); ?></label><div class="group-controls">- <input type="text" id="mark_favorite" name="shortcuts[mark_favorite]" list="keys" value="<?php echo $s['mark_favorite']; ?>" />+ <input type="text" id="prev_entry" name="shortcuts[prev_entry]" list="keys" value="<?php echo $s['prev_entry']; ?>" /></div></div><div class="form-group">- <label class="group-name" for="go_website"><?php echo Minz_Translate::t ('see_on_website'); ?></label>+ <label class="group-name" for="first_entry"><?php echo Minz_Translate::t ('first_article'); ?></label><div class="group-controls">- <input type="text" id="go_website" name="shortcuts[go_website]" list="keys" value="<?php echo $s['go_website']; ?>" />+ <input type="text" id="first_entry" name="shortcuts[first_entry]" list="keys" value="<?php echo $s['first_entry']; ?>" /></div></div><div class="form-group">- <label class="group-name" for="next_entry"><?php echo Minz_Translate::t ('next_article'); ?></label>+ <label class="group-name" for="last_entry"><?php echo Minz_Translate::t ('last_article'); ?></label><div class="group-controls">- <input type="text" id="next_entry" name="shortcuts[next_entry]" list="keys" value="<?php echo $s['next_entry']; ?>" />- <?php echo Minz_Translate::t ('shift_for_last'); ?>+ <input type="text" id="last_entry" name="shortcuts[last_entry]" list="keys" value="<?php echo $s['last_entry']; ?>" /></div></div>+ <div><?php echo Minz_Translate::t ('shortcuts_navigation_help');?></div>++ <legend><?php echo Minz_Translate::t ('shortcuts_article_action');?></legend>+<div class="form-group">- <label class="group-name" for="prev_entry"><?php echo Minz_Translate::t ('previous_article'); ?></label>+ <label class="group-name" for="mark_read"><?php echo Minz_Translate::t ('mark_read'); ?></label><div class="group-controls">- <input type="text" id="prev_entry" name="shortcuts[prev_entry]" list="keys" value="<?php echo $s['prev_entry']; ?>" />- <?php echo Minz_Translate::t ('shift_for_first'); ?>+ <input type="text" id="mark_read" name="shortcuts[mark_read]" list="keys" value="<?php echo $s['mark_read']; ?>" />+ <?php echo Minz_Translate::t ('shift_for_all_read'); ?></div></div><div class="form-group">- <label class="group-name" for="collapse_entry"><?php echo Minz_Translate::t ('collapse_article'); ?></label>+ <label class="group-name" for="mark_favorite"><?php echo Minz_Translate::t ('mark_favorite'); ?></label><div class="group-controls">- <input type="text" id="collapse_entry" name="shortcuts[collapse_entry]" list="keys" value="<?php echo $s['collapse_entry']; ?>" />+ <input type="text" id="mark_favorite" name="shortcuts[mark_favorite]" list="keys" value="<?php echo $s['mark_favorite']; ?>" /></div></div><div class="form-group">- <label class="group-name" for="load_more_shortcut"><?php echo Minz_Translate::t ('load_more'); ?></label>+ <label class="group-name" for="go_website"><?php echo Minz_Translate::t ('see_on_website'); ?></label><div class="group-controls">- <input type="text" id="load_more_shortcut" name="shortcuts[load_more]" list="keys" value="<?php echo $s['load_more']; ?>" />+ <input type="text" id="go_website" name="shortcuts[go_website]" list="keys" value="<?php echo $s['go_website']; ?>" /></div></div>@@ -72,6 +76,23 @@<label class="group-name" for="auto_share_shortcut"><?php echo Minz_Translate::t ('auto_share'); ?></label><div class="group-controls"><input type="text" id="auto_share_shortcut" name="shortcuts[auto_share]" list="keys" value="<?php echo $s['auto_share']; ?>" />+ <?php echo Minz_Translate::t ('auto_share_help'); ?>+ </div>+ </div>++ <div class="form-group">+ <label class="group-name" for="collapse_entry"><?php echo Minz_Translate::t ('collapse_article'); ?></label>+ <div class="group-controls">+ <input type="text" id="collapse_entry" name="shortcuts[collapse_entry]" list="keys" value="<?php echo $s['collapse_entry']; ?>" />+ </div>+ </div>++ <legend><?php echo Minz_Translate::t ('shortcuts_other_action');?></legend>++ <div class="form-group">+ <label class="group-name" for="load_more_shortcut"><?php echo Minz_Translate::t ('load_more'); ?></label>+ <div class="group-controls">+ <input type="text" id="load_more_shortcut" name="shortcuts[load_more]" list="keys" value="<?php echo $s['load_more']; ?>" /></div></div>diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtmlindex 0ecdc1bca..42312bc97 100644--- a/app/views/helpers/javascript_vars.phtml+++ b/app/views/helpers/javascript_vars.phtml@@ -19,6 +19,8 @@ echo ',shortcuts={','go_website:"', $s['go_website'], '",','prev_entry:"', $s['prev_entry'], '",','next_entry:"', $s['next_entry'], '",',+ 'first_entry:"', $s['first_entry'], '",',+ 'last_entry:"', $s['last_entry'], '",','collapse_entry:"', $s['collapse_entry'], '",','load_more:"', $s['load_more'], '",','auto_share:"', $s['auto_share'], '"',diff --git a/p/scripts/main.js b/p/scripts/main.jsindex ee729b9e5..e9d6c40da 100644--- a/p/scripts/main.js+++ b/p/scripts/main.js@@ -247,6 +247,67 @@ function next_entry() {}}+function prev_feed() {+ if ($('li.active').length > 0) {+ var pf = $('li.active').prev().find('a.feed');+ if (pf.length > 0) {+ pf[0].click();+ }+ } else {+ first_feed();+ }+}++function next_feed() {+ if ($('li.active').length > 0) {+ var nf = $('li.active').next().find('a.feed');+ if (nf.length > 0) {+ nf[0].click();+ }+ } else {+ last_feed();+ }+}++function first_feed() {+ $('.feeds.active li').first().find('a')[1].click();+}++function last_feed() {+ $('.feeds.active li').last().find('a')[1].click();+}++function prev_category() {+ if ($('div.active').length > 0) {+ var pc = $('div.active').parent('li').prev().find('div.stick a.btn');+ if (pc.length > 0) {+ pc[0].click();+ return;+ }+ } else {+ first_category();+ }+}++function next_category() {+ if ($('div.active').length > 0) {+ var nc = $('div.active').parent('li').next().find('div.stick a.btn');+ if (nc.length > 0) {+ nc[0].click();+ }+ } else {+ last_category();+ }+}++function first_category() {+ $('div.category.stick').first().find('a.btn')[0].click();+}++function last_category() {+ $('div.category.stick').last().find('a.btn')[0].click();+}+function collapse_entry() {isCollapsed = !isCollapsed;$(".flux.current").toggleClass("active");@@ -415,11 +476,11 @@ function init_shortcuts() {});}- // Touches de navigation+ // Touches de navigation pour les articlesshortcut.add(shortcuts.prev_entry, prev_entry, {'disable_in_input': true});- shortcut.add("shift+" + shortcuts.prev_entry, function () {+ shortcut.add(shortcuts.first_entry, function () {var old_active = $(".flux.current"),first = $(".flux:first");@@ -432,7 +493,7 @@ function init_shortcuts() {shortcut.add(shortcuts.next_entry, next_entry, {'disable_in_input': true});- shortcut.add("shift+" + shortcuts.next_entry, function () {+ shortcut.add(shortcuts.last_entry, function () {var old_active = $(".flux.current"),last = $(".flux:last");@@ -442,6 +503,33 @@ function init_shortcuts() {}, {'disable_in_input': true});+ // Touches de navigation pour les flux+ shortcut.add("shift+" + shortcuts.prev_entry, prev_feed, {+ 'disable_in_input': true+ });+ shortcut.add("shift+" + shortcuts.next_entry, next_feed, {+ 'disable_in_input': true+ });+ shortcut.add("shift+" + shortcuts.first_entry, first_feed, {+ 'disable_in_input': true+ });+ shortcut.add("shift+" + shortcuts.last_entry, last_feed, {+ 'disable_in_input': true+ });+ // Touches de navigation pour les categories+ shortcut.add("ctrl+" + shortcuts.prev_entry, prev_category, {+ 'disable_in_input': true+ });+ shortcut.add("ctrl+" + shortcuts.next_entry, next_category, {+ 'disable_in_input': true+ });+ shortcut.add("ctrl+" + shortcuts.first_entry, first_category, {+ 'disable_in_input': true+ });+ shortcut.add("ctrl+" + shortcuts.last_entry, last_category, {+ 'disable_in_input': true+ });+shortcut.add(shortcuts.go_website, function () {var url_website = $(".flux.active .link a").attr("href");