File: dom-inspector.js

package info (click to toggle)
conkeror 1.0.3%2Bgit170123-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,988 kB
  • sloc: ansic: 280; sh: 255; xml: 173; makefile: 69
file content (50 lines) | stat: -rw-r--r-- 1,500 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
 * (C) Copyright 2008 Jeremy Maitin-Shepard
 *
 * Use, modification, and distribution are subject to the terms specified in the
 * COPYING file.
**/

function open_dom_inspector () {
    make_chrome_window("chrome://inspector/content/");
}

function inspect_dom_document (document) {
    make_chrome_window("chrome://inspector/content/", document);
}

function inspect_dom_node (node) {
    make_chrome_window("chrome://inspector/content/", node);
}

function inspect_javascript_object (obj) {
    make_chrome_window("chrome://inspector/content/object.xul", obj);
}

interactive("inspector",
    "Open the DOM Inspector in a new window.",
    open_dom_inspector);

interactive("inspect-chrome",
    "Inspect the chrome document for the current Conkeror window.",
    function (I) { inspect_dom_document(I.window.document); });

interactive("inspect-page",
    "Inspect the current content document.",
    function (I) { inspect_dom_document(I.buffer.document); });

interactive("inspect-click",
    "Inspect the target of the next mouse click.",
    function (I) {
        var window = I.window;
        function handler (e) {
            e.preventDefault();
            e.stopPropagation();
            window.removeEventListener("click", arguments.callee, true);
            inspect_dom_node(e.target);
        }
        window.addEventListener("click", handler, true);
        I.minibuffer.message("Click in this window to select the DOM node to inspect.");
    });

provide("dom-inspector");