From f820f428ef92a87c2d2083fa3a239b10f5c31129 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sun, 27 Apr 2014 11:00:25 -0400 Subject: Add a shortcut to access the search field --- app/Models/Configuration.php | 1 + app/i18n/en.php | 1 + app/i18n/fr.php | 1 + app/views/configure/shortcut.phtml | 7 +++++++ app/views/helpers/javascript_vars.phtml | 3 ++- p/scripts/main.js | 10 ++++++++++ 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index 4b52fa05b..8d3e69a1c 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -39,6 +39,7 @@ class FreshRSS_Configuration { 'collapse_entry' => 'c', 'load_more' => 'm', 'auto_share' => 's', + 'focus_search' => 'a', ), 'topline_read' => true, 'topline_favorite' => true, diff --git a/app/i18n/en.php b/app/i18n/en.php index f9be04549..21d37f475 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -137,6 +137,7 @@ return array ( '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.', + 'focus_search' => 'Access search box', 'file_to_import' => 'File to import
(OPML, Json or Zip)', 'import' => 'Import', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index f40750b92..f42115fcd 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -137,6 +137,7 @@ return array ( '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.', + 'focus_search' => 'Accéder à la recherche', 'file_to_import' => 'Fichier à importer
(OPML, Json ou Zip)', 'import' => 'Importer', diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml index 7ba14c1d8..bfb13f003 100644 --- a/app/views/configure/shortcut.phtml +++ b/app/views/configure/shortcut.phtml @@ -96,6 +96,13 @@ +
+ +
+ +
+
+
diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index 2ce11d7d7..6e0a20de3 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -25,7 +25,8 @@ echo ',shortcuts={', 'last_entry:"', $s['last_entry'], '",', 'collapse_entry:"', $s['collapse_entry'], '",', 'load_more:"', $s['load_more'], '",', - 'auto_share:"', $s['auto_share'], '"', + 'auto_share:"', $s['auto_share'], '",', + 'focus_search:"', $s['focus_search'], '"', "},\n"; if (Minz_Request::param ('output') === 'global') { diff --git a/p/scripts/main.js b/p/scripts/main.js index 7d1864b42..aeb044e88 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -599,6 +599,12 @@ function init_shortcuts() { }, { 'disable_in_input': true }); + + shortcut.add(shortcuts.focus_search, function () { + focus_search(); + }, { + 'disable_in_input': true + }); } function init_stream(divStream) { @@ -791,6 +797,10 @@ function load_more_posts() { }); } +function focus_search() { + $('#search').focus(); +} + function init_load_more(box) { box_load_more = box; -- cgit v1.2.3