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 "C-return", // submit comments/issues
45 "j", // Move selected down
46 "k", // Move selected up
49 "c", "o", "return", // Open commit
51 "j", // Move selected down
52 "k", // Move selected up
53 "o", "return", // Open issue
55 "i", // g i, goes to issues
56 "j", // Move selected down
57 "k", // Move selected up
58 "x", // Toggle select target
59 "o", "return", // Open issue
60 "I", // Mark selected as read
61 "U", // Mark selected as unread
62 "e", // Close selected
63 "y", // Remove selected from view
67 "u", // Back to issues
68 "/", // Focus issues search
70 "left", "h", // Scroll left
71 "right", "l", // Scroll right
72 "up", "k", // Scroll up
73 "down", "j", // Scroll down
74 "t", // Toggle visibility of head labels
75 "S-left", "H", // Scroll all the way left
76 "S-right", "L", // Scroll all the way right
77 "S-up", "K", // Scroll all the way up
78 "S-down", "J"] // Scroll all the way down
79 .map(function (x) define_key(github_keymap, x, null, $fallthrough));
81 define_key(github_keymap, "?", "github-keyboard-shortcuts");
82 define_key(github_keymap, "s", "github-focus-site-search");
83 define_key(github_keymap, "/", "github-focus-issues-search");
85 define_keymaps_page_mode("github-mode",
86 build_url_regexp($domain = "github", $allow_www = true),
87 { normal: github_keymap },
88 $display_name = "Github");
90 page_mode_activate(github_mode);