From 943822385a0eeea21839457634c7e10db9dbf6ad Mon Sep 17 00:00:00 2001 From: Toby Simmons Date: Thu, 10 Feb 2022 22:40:47 +0000 Subject: [PATCH] first commit --- README.md | 0 init.php | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 README.md create mode 100644 init.php diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/init.php b/init.php new file mode 100644 index 0000000..bce322e --- /dev/null +++ b/init.php @@ -0,0 +1,90 @@ + Preferences -> Plugins -> User Plugins. +// + +// What if you want per-user hotkeys? +// There's currently no way for a user to customize their own keys. +// You can provide multiple hotkey plugins, if you like. +// To do so: +// make a new plugins/user1_keys directory +// copy this init.php file to that directory +// change this class name to a unique name, e.g. "User1_Custom_Keys" +class my_custom_keys extends Plugin { + + private $host; + + function about() { + return array(1.0, + "Enable site-specific hotkey maps", + "tsimmons"); + } + + function init($host) { + $this->host = $host; + + $host->add_hook($host::HOOK_HOTKEY_MAP, $this); + } + +// This is where the hotkey maps are defined. You can uncomment +// the example codes below, or add your own. +// +// Each map looks like this: +// $hotkeys[KEYS] = "KEY_FUNCTION"; +// +// KEYS can be: +// "n" = a single key character +// "*n" = Shift + key character (Shift-n) +// "^n" = Ctrl + key character (Ctrl-n) +// "f q" = a sequence of two keys +// "(37)|left" = a javascript key code and label +// "^(38)|Ctrl-Up" = can use * Shift or ^ Ctrl with key codes +// (search the web for "javascript key codes" for more examples) +// +// KEY_FUNCTION can be any of the functions defined by +// get_hotkeys_info() located in the file include/functions.php +// +// The default hotkey bindings are defined by +// get_hotkeys_map() also located in the file include/functions.php + + function hook_hotkey_map($hotkeys) { + + // Example: Swap the functions of the j/k keys for vim users + + // $hotkeys["j"] = "next_feed"; + // $hotkeys["k"] = "prev_feed"; + + // Example: Arrow key navigation + + // $hotkeys["(37)|left"] = "prev_article"; + // $hotkeys["(39)|right"] = "next_article"; + // $hotkeys["(38)|up"] = "article_scroll_up"; + // $hotkeys["(40)|down"] = "article_scroll_down"; + + $hotkeys["f f"] = "feed_catchup"; + + return $hotkeys; + + } + + function api_version() { + return 2; + } + +} + +?> \ No newline at end of file