2 * (C) Copyright 2010 Desmond O. Chang <dochang@gmail.com>
4 * Use, modification, and distribution are subject to the terms specified in the
8 require("content-buffer.js");
10 define_keymap("github_keymap", $display_name
= "github");
12 interactive("github-keyboard-shortcuts", null, function (I
) {
14 var elem
= buf
.document
.querySelector("#main a.keyboard-shortcuts");
16 browser_object_follow(buf
, FOLLOW_DEFAULT
, elem
);
18 I
.minibuffer
.message("No keyboard shortcuts help link found on this page");
21 interactive("github-focus-site-search", null, function (I
) {
23 var elem
= buf
.document
.querySelector("#top_search_form input[name=q]");
25 browser_element_focus(buf
, elem
);
27 I
.minibuffer
.message("Site search box not found");
30 interactive("github-focus-issues-search", null, function (I
) {
32 var elem
= buf
.document
.querySelector("#issues span.search input[name=q]");
34 browser_element_focus(buf
, elem
);
36 I
.minibuffer
.message("Issues search box not found");
39 [// Site-wide shortcuts
40 "s", // Focus site search
41 "?", // Bring up this help dialog
43 "j", // Move selected down
44 "k", // Move selected up
47 "c", "o", "return", // Open commit
49 "j", // Move selected down
50 "k", // Move selected up
51 "o", "return", // Open issue
53 "j", // Move selected down
54 "k", // Move selected up
55 "x", // Toggle select target
56 "o", "return", // Open issue
57 "I", // Mark selected as read
58 "U", // Mark selected as unread
59 "e", // Close selected
60 "y", // Remove selected from view
64 "u", // Back to issues
65 "/", // Focus issues search
67 "left", "h", // Scroll left
68 "right", "l", // Scroll right
69 "up", "k", // Scroll up
70 "down", "j", // Scroll down
71 "t", // Toggle visibility of head labels
72 "S-left", "H", // Scroll all the way left
73 "S-right", "L", // Scroll all the way right
74 "S-up", "K", // Scroll all the way up
75 "S-down", "J"] // Scroll all the way down
76 .map(function (x
) define_key(github_keymap
, x
, null, $fallthrough
));
78 define_key(github_keymap
, "?", "github-keyboard-shortcuts");
79 define_key(github_keymap
, "s", "github-focus-site-search");
80 define_key(github_keymap
, "/", "github-focus-issues-search");
82 define_keymaps_page_mode("github-mode",
83 build_url_regexp($domain
= "github", $allow_www
= true),
84 { normal
: github_keymap
},
85 $display_name
= "Github");
87 page_mode_activate(github_mode
);