2 * (C) Copyright 2009-2011 John J. Foerch
4 * Use, modification, and distribution are subject to the terms specified in the
8 require("content-buffer.js");
10 function dom_click_xpath (doc, xpath) {
11 var iter = doc.evaluate(xpath,
13 xpath_lookup_namespace,
14 Ci.nsIDOMXPathResult.FIRST_ORDERED_NODE_TYPE ,
16 var node = iter.singleNodeValue;
18 var rect = node.getBoundingClientRect();
19 dom_node_click(node, rect.left + 1, rect.top + 1);
23 interactive("google-maps-zoom-in",
24 "Zoom in on a google map",
26 dom_click_xpath(I.buffer.document,
27 "//div[@guidedhelpid='zoom_in']/div[@title]");
30 interactive("google-maps-zoom-out",
31 "Zoom out on a google map",
33 dom_click_xpath(I.buffer.document,
34 "//div[@guidedhelpid='zoom_out']/div[@title]");
37 interactive("google-maps-pan-left",
38 "Pan a google map left",
40 dom_click_xpath(I.buffer.document,
41 "//div[@log='pan_lt']");
44 interactive("google-maps-pan-right",
45 "Pan a google map right",
47 dom_click_xpath(I.buffer.document,
48 "//div[@log='pan_rt']");
51 interactive("google-maps-pan-up",
52 "Pan a google map up",
54 dom_click_xpath(I.buffer.document,
55 "//div[@log='pan_up']");
58 interactive("google-maps-pan-down",
59 "Pan a google map down",
61 dom_click_xpath(I.buffer.document,
62 "//div[@log='pan_down']");
65 define_keymap("google_maps_keymap", $display_name = "google-maps");
66 define_key(google_maps_keymap, "C-c +", "google-maps-zoom-in");
67 define_key(google_maps_keymap, "C-c -", "google-maps-zoom-out");
68 define_key(google_maps_keymap, "C-f", "google-maps-pan-right");
69 define_key(google_maps_keymap, "C-b", "google-maps-pan-left");
70 define_key(google_maps_keymap, "C-n", "google-maps-pan-down");
71 define_key(google_maps_keymap, "C-p", "google-maps-pan-up");
73 define_keymaps_page_mode("google-maps-mode",
74 build_url_regexp($domain = "maps.google"),
75 { normal: google_maps_keymap },
76 $display_name = "Google Maps");
78 page_mode_activate(google_maps_mode);
80 provide("google-maps");