summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2012-12-28 10:46:53 +0400
committerAndrew Dolgov <[email protected]>2012-12-28 10:46:53 +0400
commite218c5f56fa6b4cc31510071163791627d067e9d (patch)
treec94d12732a1e411506c2830d70452f4a484acf12 /include
parent43e706238a78633edb684c2e3b08260b1a91b149 (diff)
main ui: action-based hotkey system, add swap_jk plugin
Diffstat (limited to 'include')
-rw-r--r--include/functions.php112
1 files changed, 65 insertions, 47 deletions
diff --git a/include/functions.php b/include/functions.php
index 68271ff73..18fadd864 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -1972,55 +1972,73 @@
function get_hotkeys($link) {
$hotkeys = array(
- "navigation" => array(
- "next_feed" => "k",
- "prev_feed" => "j",
- "next_article" => "n",
- "prev_article" => "p",
- "search_dialog" => "/"),
- "article" => array(
- "toggle_mark" => "s",
- "toggle_publ" => "S",
- "toggle_unread" => "u",
- "edit_tags" => "T",
- "dismiss_selected" => "D",
- "dismiss_read" => "X",
- "open_in_new_window" => "o",
- "catchup_below" => "c p",
- "catchup_above" => "c n",
- "email_article" => "e"),
- "article_selection" => array(
- "select_all" => "a a",
- "select_unread" => "a u",
- "select_marked" => "a U",
- "select_published" => "a p",
- "select_invert" => "a i",
- "select_none" => "a n"),
- "feed" => array(
- "feed_refresh" => "f r",
- "feed_unhide_read" => "f a",
- "feed_subscribe" => "f s",
- "feed_edit" => "f e",
- "feed_catchup" => "f q",
- "feed_reverse" => "f x",
- "catchup_all" => "Q",
- "cat_toggle_collapse" => "x"),
- "goto" => array(
- "goto_all" => "g a",
- "goto_fresh" => "g f",
- "goto_marked" => "g s",
- "goto_published" => "g p",
- "goto_tagcloud" => "g t",
- "goto_prefs" => "g P"),
- "other" => array(
- "select_article_cursor" => "(9)", // tab
- "create_label" => "c l",
- "create_filter" => "c f",
- "collapse_sidebar" => "c s",
- "help_dialog" => "(191)")
+// "navigation" => array(
+ "k" => "next_feed",
+ "j" => "prev_feed",
+ "n" => "next_article",
+ "p" => "prev_article",
+ "/" => "search_dialog",
+// "article" => array(
+ "s" => "toggle_mark",
+ "S" => "toggle_publ",
+ "u" => "toggle_unread",
+ "T" => "edit_tags",
+ "D" => "dismiss_selected",
+ "X" => "dismiss_read",
+ "o" => "open_in_new_window",
+ "c p" => "catchup_below",
+ "c n" => "catchup_above",
+ "N" => "article_scroll_down",
+ "P" => "article_scroll_up",
+ "e" => "email_article",
+// "article_selection" => array(
+ "a a" => "select_all",
+ "a u" => "select_unread",
+ "a U" => "select_marked",
+ "a p" => "select_published",
+ "a i" => "select_invert",
+ "a n" => "select_none",
+// "feed" => array(
+ "f r" => "feed_refresh",
+ "f a" => "feed_unhide_read",
+ "f s" => "feed_subscribe",
+ "f e" => "feed_edit",
+ "f q" => "feed_catchup",
+ "f x" => "feed_reverse",
+ "f D" => "feed_debug_update",
+ "Q" => "catchup_all",
+ "x" => "cat_toggle_collapse",
+// "goto" => array(
+ "g a" => "goto_all",
+ "g f" => "goto_fresh",
+ "g s" => "goto_marked",
+ "g p" => "goto_published",
+ "g t" => "goto_tagcloud",
+ "g P" => "goto_prefs",
+// "other" => array(
+ "(9)" => "select_article_cursor", // tab
+ "c l" => "create_label",
+ "c f" => "create_filter",
+ "c s" => "collapse_sidebar",
+ "(191)" => "help_dialog",
);
- return $hotkeys;
+ global $pluginhost;
+ foreach ($pluginhost->get_hooks($pluginhost::HOOK_HOTKEY_MAP) as $plugin) {
+ $hotkeys = $plugin->hook_hotkey_map($hotkeys);
+ }
+
+ $prefixes = array();
+
+ foreach (array_keys($hotkeys) as $hotkey) {
+ $pair = explode(" ", $hotkey, 2);
+
+ if (count($pair) > 1 && !in_array($pair[0], $prefixes)) {
+ array_push($prefixes, $pair[0]);
+ }
+ }
+
+ return array($prefixes, $hotkeys);
}
function make_runtime_info($link) {