Prepare new Debian package
[conkeror.git] / modules / extensions / dom-inspector.js
blob96b7d4eead3ce2b0915bdbe0cc36340d085e0f7d
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("window.js");
9 require("utils.js");
11 if (!extension_is_enabled("inspector@mozilla.org"))
12     throw skip_module_load;
14 function open_dom_inspector() {
15     make_chrome_window("chrome://inspector/content/");
18 function inspect_dom_document(document) {
19     make_chrome_window("chrome://inspector/content/", document);
22 function inspect_dom_node(node) {
23     make_chrome_window("chrome://inspector/content/", node);
26 function inspect_javascript_object(obj) {
27     make_chrome_window("chrome://inspector/content/object.xul", obj);
30 interactive("inspector", "Open the DOM Inspector in a new window.",
31             function (I) { open_dom_inspector(); });
33 interactive("inspect-chrome", "Inspect the chrome document for the current Conkeror window.",
34             function (I) {inspect_dom_document(I.window.document);});
36 interactive("inspect-page", "Inspect the current content document.",
37             function (I) {inspect_dom_document(I.buffer.document);});
39 interactive("inspect-click", "Inspect the target of the next mouse click.",
40             function (I) {
41                 var window = I.window;
42                 function handler(e) {
43                     e.preventDefault();
44                     e.stopPropagation();
45                     window.removeEventListener("click", arguments.callee, true);
46                     inspect_dom_node(e.target);
47                 }
48                 window.addEventListener("click", handler, true);
49                 I.minibuffer.message("Click in this window to select the DOM node to inspect.");
50             });