grooveshark.js: update button selectors because website was updated
[conkeror.git] / modules / page-modes / github.js
blobcb09e45ede1281b7540158b06c1f7339a4b8224f
1 /**
2  * (C) Copyright 2010 Desmond O. Chang <dochang@gmail.com>
3  *
4  * Use, modification, and distribution are subject to the terms specified in the
5  * COPYING file.
6 **/
8 require("content-buffer.js");
10 define_keymap("github_keymap", $display_name = "github");
12 interactive("github-keyboard-shortcuts", null, function (I) {
13     var buf = I.buffer;
14     var elem = buf.document.querySelector("#main a.keyboard-shortcuts");
15     if (elem)
16         browser_object_follow(buf, FOLLOW_DEFAULT, elem);
17     else
18         I.minibuffer.message("No keyboard shortcuts help link found on this page");
19 });
21 interactive("github-focus-site-search", null, function (I) {
22     var buf = I.buffer;
23     var elem = buf.document.querySelector("#top_search_form input[name=q]");
24     if (elem)
25         browser_element_focus(buf, elem);
26     else
27         I.minibuffer.message("Site search box not found");
28 });
30 interactive("github-focus-issues-search", null, function (I) {
31     var buf = I.buffer;
32     var elem = buf.document.querySelector("#issues span.search input[name=q]");
33     if (elem)
34         browser_element_focus(buf, elem);
35     else
36         I.minibuffer.message("Issues search box not found");
37 });
39 [// Site-wide shortcuts
40  "s",                        // Focus site search
41  "?",                        // Bring up this help dialog
42  // Commit list
43  "j",                        // Move selected down
44  "k",                        // Move selected up
45  "t",                        // Open tree
46  "p",                        // Open parent
47  "c", "o", "return",         // Open commit
48  // Pull request list
49  "j",                        // Move selected down
50  "k",                        // Move selected up
51  "o", "return",              // Open issue
52  // Issues
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
61  "c",                        // Create issue
62  "l",                        // Create label
63  "i",                        // Back to inbox
64  "u",                        // Back to issues
65  "/",                        // Focus issues search
66  // Network Graph
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);
89 provide("github");