Improve browser object class prompts
[conkeror.git] / modules / page-modes / google-search-results.js
blobe186135fd78cdf93fea0146213b361eb134f5c20
1 /**
2  * (C) Copyright 2008 Jeremy Maitin-Shepard
3  *
4  * Use, modification, and distribution are subject to the terms specified in the
5  * COPYING file.
6 **/
8 require("content-buffer.js");
9 require("bindings/default/content-buffer/normal.js");
11 define_keymap("google_search_results_keymap", $parent = content_buffer_normal_keymap);
13 // Keys for the "experimental" keyboard search
14 define_key(google_search_results_keymap, "j", "ensure-content-focused", $fallthrough);
15 define_key(google_search_results_keymap, "k", "ensure-content-focused", $fallthrough);
16 define_key(google_search_results_keymap, "o", "ensure-content-focused", $fallthrough);
17 define_key(google_search_results_keymap, "/", "ensure-content-focused", $fallthrough);
18 define_key(google_search_results_keymap, "return", "ensure-content-focused", $fallthrough);
20 /**
21  * Note: escape already does the same thing as the Google key binding.
22  */
24 define_browser_object_class("google_search_results_links", $label = "Google search result",
25                             $xpath_expression = "//a[@class='l']");
27 define_page_mode("google_search_results_mode", "Google Search Results",
28                  $enable = function (buffer) {
29                      buffer.local_variables.content_buffer_normal_keymap = google_search_results_keymap;
30                      buffer.local_variables.default_browser_object_classes = {
31                          __proto__: default_browser_object_classes,
32                          follow: "google_search_results_links",
33                          copy: "google_search_results_links",
34                          save: "google_search_results_links",
35                          shell_command: "google_search_results_links",
36                          shell_command_url: "google_search_results_links" };
37                  });
39 auto_mode_list.push([/^http:\/\/www\.google\.com\/search\?/, google_search_results_mode]);