media_scrape_default: use js object instead of string_hashset
[conkeror/arlinius.git] / modules / page-modes / gmail.js
blob930de2bf517e88992b607b5398cb52ee03e5b63d
1 /**
2  * (C) Copyright 2008 David Glasser
3  * (C) Copyright 2008 Will Farrington
4  * (C) Copyright 2008 Jeremy Maitin-Shepard
5  * (C) Copyright 2009-2010 John J. Foerch
6  *
7  * Use, modification, and distribution are subject to the terms specified in the
8  * COPYING file.
9 **/
11 require("content-buffer.js");
13 define_keymap("gmail_keymap", $display_name = "gmail");
15 // Jumping
16 define_key(gmail_keymap, "g", null, $fallthrough);
17 define_key(gmail_keymap, "i", null, $fallthrough);
18 define_key(gmail_keymap, "t", null, $fallthrough);
19 define_key(gmail_keymap, "d", null, $fallthrough);
20 define_key(gmail_keymap, "a", null, $fallthrough);
21 define_key(gmail_keymap, "b", null, $fallthrough);
23 // Threadlist
24 define_key(gmail_keymap, "*", null, $fallthrough);
26 // Navigation
27 define_key(gmail_keymap, "u", null, $fallthrough);
28 define_key(gmail_keymap, "j", null, $fallthrough);
29 define_key(gmail_keymap, "k", null, $fallthrough);
30 define_key(gmail_keymap, "o", null, $fallthrough);
31 define_key(gmail_keymap, "n", null, $fallthrough);
32 define_key(gmail_keymap, "p", null, $fallthrough);
34 // Application
35 define_key(gmail_keymap, "c", null, $fallthrough);
36 define_key(gmail_keymap, "C", null, $fallthrough);
37 define_key(gmail_keymap, "/", null, $fallthrough);
38 define_key(gmail_keymap, "q", null, $fallthrough);
39 define_key(gmail_keymap, "?", null, $fallthrough);
41 // Actions
42 define_key(gmail_keymap, "s", null, $fallthrough);
43 define_key(gmail_keymap, "e", null, $fallthrough);
44 define_key(gmail_keymap, "x", null, $fallthrough);
45 define_key(gmail_keymap, "y", null, $fallthrough);
46 define_key(gmail_keymap, "!", null, $fallthrough);
47 define_key(gmail_keymap, "m", null, $fallthrough);
48 define_key(gmail_keymap, "#", null, $fallthrough);
49 define_key(gmail_keymap, "r", null, $fallthrough);
50 define_key(gmail_keymap, "f", null, $fallthrough);
51 define_key(gmail_keymap, "N", null, $fallthrough);
52 define_key(gmail_keymap, ".", null, $fallthrough);
53 define_key(gmail_keymap, "I", null, $fallthrough);
54 define_key(gmail_keymap, "U", null, $fallthrough);
55 define_key(gmail_keymap, "]", null, $fallthrough);
56 define_key(gmail_keymap, "[", null, $fallthrough);
57 define_key(gmail_keymap, "l", null, $fallthrough);
58 define_key(gmail_keymap, "return", null, $fallthrough);
59 define_key(gmail_keymap, "tab", null, $fallthrough);
62 var gmail_modality = {
63     normal: gmail_keymap
66 function gmail_focus_primary_frame (buffer) {
67     var frames = buffer.top_frame.frames;
68     if (frames.length >= 4)
69         buffer.top_frame.frames[3].focus();
72 define_page_mode("gmail-mode",
73     build_url_regexp($domain = "mail.google",
74                      $path = new RegExp('(?!support)')),
75     function enable (buffer) {
76         add_hook.call(buffer, "buffer_dom_content_loaded_hook",
77                       gmail_focus_primary_frame);
78         add_hook.call(buffer, "unfocus_hook", gmail_focus_primary_frame);
79         buffer.content_modalities.push(gmail_modality);
80     },
81     function disable (buffer) {
82         remove_hook.call(buffer, "buffer_dom_content_loaded_hook",
83                          gmail_focus_primary_frame);
84         remove_hook.call(buffer, "unfocus_hook", gmail_focus_primary_frame);
85         var i = buffer.content_modalities.indexOf(gmail_modality);
86         if (i > -1)
87             buffer.content_modalities.splice(i, 1);
88     },
89     $display_name = "GMail");
91 page_mode_activate(gmail_mode);
93 provide("gmail");