@@ -6,11 +6,17 @@ module.metadata = {
6
6
"stability" : "stable"
7
7
} ;
8
8
9
+ // Add-on SDK
9
10
const { Cu, Ci } = require ( "chrome" ) ;
10
- const { Trace, TraceError } = require ( "firebug.sdk/lib/core/trace.js" ) . get ( module . id ) ;
11
11
const { Class } = require ( "sdk/core/heritage" ) ;
12
+
13
+ // Firebug SDK
14
+ const { Trace, TraceError } = require ( "firebug.sdk/lib/core/trace.js" ) . get ( module . id ) ;
12
15
const { PanelOverlay } = require ( "firebug.sdk/lib/panel-overlay.js" ) ;
13
16
17
+ // Constants
18
+ const XHTML_NS = "http://www.w3.org/1999/xhtml" ;
19
+
14
20
/**
15
21
* @overlay This object represents an overlay for the existing
16
22
* Inspector panel it's responsible for the panel customization.
@@ -22,14 +28,17 @@ const InspectorOverlay = Class(
22
28
extends : PanelOverlay ,
23
29
24
30
overlayId : "fireQueryInspectorOverlay" ,
25
- panelId : "webconsole " ,
31
+ panelId : "inspector " ,
26
32
27
33
// Initialization
28
34
29
35
initialize : function ( options ) {
30
36
PanelOverlay . prototype . initialize . apply ( this , arguments ) ;
31
37
32
38
Trace . sysout ( "InspectorOverlay.initialize;" , options ) ;
39
+
40
+ this . onMarkupViewRender = this . onMarkupViewRender . bind ( this ) ;
41
+ this . onMarkupViewLoaded = this . onMarkupViewLoaded . bind ( this ) ;
33
42
} ,
34
43
35
44
destroy : function ( ) {
@@ -42,13 +51,47 @@ const InspectorOverlay = Class(
42
51
PanelOverlay . prototype . onBuild . apply ( this , arguments ) ;
43
52
44
53
Trace . sysout ( "InspectorOverlay.onBuild;" , options ) ;
54
+
55
+ // Handle MarkupView events.
56
+ this . panel . on ( "markupview-render" , this . onMarkupViewRender ) ;
57
+ this . panel . on ( "markuploaded" , this . onMarkupViewLoaded ) ;
45
58
} ,
46
59
47
60
onReady : function ( options ) {
48
61
PanelOverlay . prototype . onReady . apply ( this , arguments ) ;
49
62
50
63
Trace . sysout ( "InspectorOverlay.onReady;" , options ) ;
51
64
} ,
65
+
66
+ // MarkupView Event Handlers
67
+
68
+ onMarkupViewRender : function ( eventId , node , type , data , options ) {
69
+ if ( type != "element" ) {
70
+ return ;
71
+ }
72
+
73
+ let value ;
74
+ let nodeFront = data . node ;
75
+ let cache = nodeFront . _form . jQueryCacheData ;
76
+
77
+ if ( ! cache ) {
78
+ return ;
79
+ }
80
+
81
+ let doc = node . ownerDocument ;
82
+
83
+ for ( var data in cache ) {
84
+ if ( cache . hasOwnProperty ( data ) ) {
85
+ let label = doc . createElementNS ( XHTML_NS , "span" ) ;
86
+ label . innerHTML = cache [ data ] ;
87
+ node . appendChild ( label ) ;
88
+ }
89
+ }
90
+ } ,
91
+
92
+ onMarkupViewLoaded : function ( ) {
93
+ Trace . sysout ( "inspectorOverlay.onMarkupViewLoaded;" ) ;
94
+ } ,
52
95
} ) ;
53
96
54
97
// Exports from this module
0 commit comments