1
- /*
1
+ /**
2
2
* DUSTPRESS DEBUGGER
3
3
*/
4
4
window . DustPressDebugger = ( function ( window , document , $ ) {
@@ -51,32 +51,36 @@ window.DustPressDebugger = ( function( window, document, $ ) {
51
51
"action" : "dustpress_debugger" ,
52
52
"hash" : dustpress_debugger . hash
53
53
} ,
54
- success :function ( data ) {
54
+ success : function ( data ) {
55
55
if ( typeof data !== "object" ) {
56
56
data = JSON . parse ( data ) ;
57
57
}
58
58
app . jsonData = data . data ;
59
59
60
+ if ( "undefined" === typeof app . jsonData . Debugs ) {
61
+ app . jsonData . Debugs = { } ;
62
+ }
63
+
60
64
app . jsonData . Debugs . Ajax = app . waiting ;
61
65
delete app . waiting ;
62
66
63
67
// Log also into the console
64
68
console . log ( "Debugger" , app . jsonData ) ;
65
69
66
70
app . jsonView = app . $jsonDiv . JSONView (
67
- app . jsonData ,
68
- app . jsonSettings
71
+ app . jsonData ,
72
+ app . jsonSettings
69
73
) ;
70
74
} ,
71
75
error : function ( e ) {
72
- console . log ( "DustPress Debugger Error" , e ) ;
76
+ console . error ( "DustPress Debugger Error" , e ) ;
73
77
}
74
78
} ) ;
75
79
} ;
76
80
77
81
app . closeByEsc = function ( e ) {
78
82
// Escape key maps to keycode 27
79
- if ( e . keyCode == 27 ) {
83
+ if ( e . keyCode === 27 ) {
80
84
if ( ! $ ( ".jsonview_data_debug" ) . hasClass ( "jsonview_data_debug_closed" ) ) {
81
85
app . toggleDebugger ( ) ;
82
86
}
@@ -95,26 +99,31 @@ window.DustPressDebugger = ( function( window, document, $ ) {
95
99
}
96
100
97
101
// Catch the data before the JSONView is rendered
98
- if ( undefined == app . jsonData ) {
102
+ if ( " undefined" === typeof app . jsonData ) {
99
103
if ( "undefined" === typeof app . waiting [ key ] ) {
100
104
app . waiting [ key ] = [ ] ;
101
105
}
102
106
app . waiting [ key ] . push ( data ) ;
103
107
}
104
108
// Add the extended data and rerender the JSONView
105
109
else {
106
- if ( undefined === app . jsonData . Debugs . Ajax ) {
110
+ if ( "undefined" === typeof app . jsonData . Debugs ) {
111
+ app . jsonData . Debugs = { } ;
112
+ }
113
+
114
+ if ( "undefined" === typeof app . jsonData . Debugs . Ajax ) {
107
115
app . jsonData . Debugs . Ajax = { } ;
108
116
}
109
117
110
118
if ( undefined === app . jsonData . Debugs . Ajax [ key ] ) {
111
119
app . jsonData . Debugs . Ajax [ key ] = [ ] ;
112
120
}
121
+
113
122
app . jsonData . Debugs . Ajax [ key ] . push ( data ) ;
114
123
115
124
app . $jsonDiv . JSONView (
116
- app . jsonData ,
117
- app . jsonSettings
125
+ app . jsonData ,
126
+ app . jsonSettings
118
127
) ;
119
128
}
120
129
} ;
@@ -124,4 +133,4 @@ window.DustPressDebugger = ( function( window, document, $ ) {
124
133
125
134
return app ;
126
135
127
- } ) ( window , document , jQuery ) ;
136
+ } ) ( window , document , jQuery ) ;
0 commit comments