1
- jQuery . noConflict ( ) ;
2
- jQuery ( function ( $j ) {
3
- var COOKIE_NAME = 'dj_debug_panel' ;
4
- $j . djDebug = function ( data , klass ) {
5
- $j . djDebug . init ( ) ;
1
+ ( function ( window , document , version , callback ) {
2
+ var j , d ;
3
+ var loaded = false ;
4
+ if ( ! ( j = window . jQuery ) || version > j . fn . jquery || callback ( j ) ) {
5
+ var script = document . createElement ( "script" ) ;
6
+ script . type = "text/javascript" ;
7
+ script . src = BASEURL + "/__debug__/m/jquery.js" ;
8
+ script . onload = script . onreadystatechange = function ( ) {
9
+ if ( ! loaded && ( ! ( d = this . readyState ) || d == "loaded" || d == "complete" ) ) {
10
+ callback ( ( j = window . jQuery ) . noConflict ( 1 ) , loaded = true ) ;
11
+ j ( script ) . remove ( ) ;
12
+ }
13
+ } ;
14
+ document . documentElement . childNodes [ 0 ] . appendChild ( script )
6
15
}
7
- $j . extend ( $j . djDebug , {
16
+ } ) ( window , document , "1.3" , function ( $ , jquery_loaded ) {
17
+
18
+ $ . cookie = function ( name , value , options ) { if ( typeof value != 'undefined' ) { options = options || { } ; if ( value === null ) { value = '' ; options . expires = - 1 ; } var expires = '' ; if ( options . expires && ( typeof options . expires == 'number' || options . expires . toUTCString ) ) { var date ; if ( typeof options . expires == 'number' ) { date = new Date ( ) ; date . setTime ( date . getTime ( ) + ( options . expires * 24 * 60 * 60 * 1000 ) ) ; } else { date = options . expires ; } expires = '; expires=' + date . toUTCString ( ) ; } var path = options . path ? '; path=' + ( options . path ) : '' ; var domain = options . domain ? '; domain=' + ( options . domain ) : '' ; var secure = options . secure ? '; secure' : '' ; document . cookie = [ name , '=' , encodeURIComponent ( value ) , expires , path , domain , secure ] . join ( '' ) ; } else { var cookieValue = null ; if ( document . cookie && document . cookie != '' ) { var cookies = document . cookie . split ( ';' ) ; for ( var i = 0 ; i < cookies . length ; i ++ ) { var cookie = $ . trim ( cookies [ i ] ) ; if ( cookie . substring ( 0 , name . length + 1 ) == ( name + '=' ) ) { cookieValue = decodeURIComponent ( cookie . substring ( name . length + 1 ) ) ; break ; } } } return cookieValue ; } } ;
19
+ $ ( 'head' ) . append ( '<link rel="stylesheet" href="' + BASEURL + '/__debug__/m/toolbar.min.css" type="text/css" />' ) ;
20
+ var COOKIE_NAME = 'djdt' ;
21
+ var djdt = {
8
22
init : function ( ) {
9
23
var current = null ;
10
- $j ( '#djDebugPanelList li a' ) . click ( function ( ) {
24
+ $ ( '#djDebugPanelList li a' ) . click ( function ( ) {
11
25
if ( ! this . className ) {
12
26
return false ;
13
27
}
14
- current = $j ( '#djDebug #' + this . className ) ;
28
+ current = $ ( '#djDebug #' + this . className ) ;
15
29
if ( current . is ( ':visible' ) ) {
16
- $j ( document ) . trigger ( 'close.djDebug' ) ;
17
- $j ( this ) . parent ( ) . removeClass ( 'active' ) ;
30
+ $ ( document ) . trigger ( 'close.djDebug' ) ;
31
+ $ ( this ) . parent ( ) . removeClass ( 'active' ) ;
18
32
} else {
19
- $j ( '.panelContent' ) . hide ( ) ; // Hide any that are already open
33
+ $ ( '.panelContent' ) . hide ( ) ; // Hide any that are already open
20
34
current . show ( ) ;
21
- $j . djDebug . open ( ) ;
22
- $j ( '#djDebugToolbar li' ) . removeClass ( 'active' ) ;
23
- $j ( this ) . parent ( ) . addClass ( 'active' ) ;
35
+ $ ( '#djDebugToolbar li' ) . removeClass ( 'active' ) ;
36
+ $ ( this ) . parent ( ) . addClass ( 'active' ) ;
24
37
}
25
38
return false ;
26
39
} ) ;
27
- $j ( '#djDebug a.djDebugClose' ) . click ( function ( ) {
28
- $j ( document ) . trigger ( 'close.djDebug' ) ;
29
- $j ( '#djDebugToolbar li' ) . removeClass ( 'active' ) ;
40
+ $ ( '#djDebug a.djDebugClose' ) . click ( function ( ) {
41
+ $ ( document ) . trigger ( 'close.djDebug' ) ;
42
+ $ ( '#djDebugToolbar li' ) . removeClass ( 'active' ) ;
30
43
return false ;
31
44
} ) ;
32
- $j ( '#djDebug a.remoteCall' ) . click ( function ( ) {
33
- $j ( '#djDebugWindow' ) . load ( this . href , { } , function ( ) {
34
- $j ( '#djDebugWindow a.djDebugBack' ) . click ( function ( ) {
35
- $j ( this ) . parent ( ) . parent ( ) . hide ( ) ;
45
+ $ ( '#djDebug a.remoteCall' ) . click ( function ( ) {
46
+ $ ( '#djDebugWindow' ) . load ( this . href , { } , function ( ) {
47
+ $ ( '#djDebugWindow a.djDebugBack' ) . click ( function ( ) {
48
+ $ ( this ) . parent ( ) . parent ( ) . hide ( ) ;
36
49
return false ;
37
50
} ) ;
38
51
} ) ;
39
- $j ( '#djDebugWindow' ) . show ( ) ;
52
+ $ ( '#djDebugWindow' ) . show ( ) ;
40
53
return false ;
41
54
} ) ;
42
- $j ( '#djDebugTemplatePanel a.djTemplateShowContext' ) . click ( function ( ) {
43
- $j . djDebug . toggle_arrow ( $j ( this ) . children ( '.toggleArrow' ) )
44
- $j . djDebug . toggle_content ( $j ( this ) . parent ( ) . next ( ) ) ;
55
+ $ ( '#djDebugTemplatePanel a.djTemplateShowContext' ) . click ( function ( ) {
56
+ djdt . toggle_arrow ( $ ( this ) . children ( '.toggleArrow' ) )
57
+ djdt . toggle_content ( $ ( this ) . parent ( ) . next ( ) ) ;
45
58
return false ;
46
59
} ) ;
47
- $j ( '#djDebugSQLPanel a.djSQLShowStacktrace' ) . click ( function ( ) {
48
- $j . djDebug . toggle_content ( $j ( '.djSQLHideStacktraceDiv' , $j ( this ) . parents ( 'tr' ) ) ) ;
60
+ $ ( '#djDebugSQLPanel a.djSQLShowStacktrace' ) . click ( function ( ) {
61
+ djdt . toggle_content ( $ ( '.djSQLHideStacktraceDiv' , $ ( this ) . parents ( 'tr' ) ) ) ;
49
62
return false ;
50
63
} ) ;
51
- $j ( '#djHideToolBarButton' ) . click ( function ( ) {
52
- $j . djDebug . hide_toolbar ( true ) ;
64
+ $ ( '#djHideToolBarButton' ) . click ( function ( ) {
65
+ djdt . hide_toolbar ( true ) ;
53
66
return false ;
54
67
} ) ;
55
- $j ( '#djShowToolBarButton' ) . click ( function ( ) {
56
- $j . djDebug . show_toolbar ( ) ;
68
+ $ ( '#djShowToolBarButton' ) . click ( function ( ) {
69
+ djdt . show_toolbar ( ) ;
57
70
return false ;
58
71
} ) ;
59
- if ( $j . cookie ( COOKIE_NAME ) ) {
60
- $j . djDebug . hide_toolbar ( false ) ;
72
+ $ ( document ) . bind ( 'close.djDebug' , function ( ) {
73
+ // If a sub-panel is open, close that
74
+ if ( $ ( '#djDebugWindow' ) . is ( ':visible' ) ) {
75
+ $ ( '#djDebugWindow' ) . hide ( ) ;
76
+ return ;
77
+ }
78
+ // If a panel is open, close that
79
+ if ( $ ( '.panelContent' ) . is ( ':visible' ) ) {
80
+ $ ( '.panelContent' ) . hide ( ) ;
81
+ return ;
82
+ }
83
+ // Otherwise, just minimize the toolbar
84
+ if ( $ ( '#djDebugToolbar' ) . is ( ':visible' ) ) {
85
+ djdt . hide_toolbar ( true ) ;
86
+ return ;
87
+ }
88
+ } ) ;
89
+ if ( $ . cookie ( COOKIE_NAME ) ) {
90
+ djdt . hide_toolbar ( false ) ;
61
91
} else {
62
- $j . djDebug . show_toolbar ( false ) ;
92
+ djdt . show_toolbar ( false ) ;
63
93
}
64
94
} ,
65
- open : function ( ) {
66
- // TODO: Decide if we should remove this
67
- } ,
68
95
toggle_content : function ( elem ) {
69
96
if ( elem . is ( ':visible' ) ) {
70
97
elem . hide ( ) ;
@@ -73,41 +100,41 @@ jQuery(function($j) {
73
100
}
74
101
} ,
75
102
close : function ( ) {
76
- $j ( document ) . trigger ( 'close.djDebug' ) ;
103
+ $ ( document ) . trigger ( 'close.djDebug' ) ;
77
104
return false ;
78
105
} ,
79
106
hide_toolbar : function ( setCookie ) {
80
107
// close any sub panels
81
- $j ( '#djDebugWindow' ) . hide ( ) ;
108
+ $ ( '#djDebugWindow' ) . hide ( ) ;
82
109
// close all panels
83
- $j ( '.panelContent' ) . hide ( ) ;
84
- $j ( '#djDebugToolbar li' ) . removeClass ( 'active' ) ;
110
+ $ ( '.panelContent' ) . hide ( ) ;
111
+ $ ( '#djDebugToolbar li' ) . removeClass ( 'active' ) ;
85
112
// finally close toolbar
86
- $j ( '#djDebugToolbar' ) . hide ( 'fast' ) ;
87
- $j ( '#djDebugToolbarHandle' ) . show ( ) ;
113
+ $ ( '#djDebugToolbar' ) . hide ( 'fast' ) ;
114
+ $ ( '#djDebugToolbarHandle' ) . show ( ) ;
88
115
// Unbind keydown
89
- $j ( document ) . unbind ( 'keydown.djDebug' ) ;
116
+ $ ( document ) . unbind ( 'keydown.djDebug' ) ;
90
117
if ( setCookie ) {
91
- $j . cookie ( COOKIE_NAME , 'hide' , {
118
+ $ . cookie ( COOKIE_NAME , 'hide' , {
92
119
path : '/' ,
93
120
expires : 10
94
121
} ) ;
95
122
}
96
123
} ,
97
124
show_toolbar : function ( animate ) {
98
125
// Set up keybindings
99
- $j ( document ) . bind ( 'keydown.djDebug' , function ( e ) {
126
+ $ ( document ) . bind ( 'keydown.djDebug' , function ( e ) {
100
127
if ( e . keyCode == 27 ) {
101
- $j . djDebug . close ( ) ;
128
+ djdt . close ( ) ;
102
129
}
103
130
} ) ;
104
- $j ( '#djDebugToolbarHandle' ) . hide ( ) ;
131
+ $ ( '#djDebugToolbarHandle' ) . hide ( ) ;
105
132
if ( animate ) {
106
- $j ( '#djDebugToolbar' ) . show ( 'fast' ) ;
133
+ $ ( '#djDebugToolbar' ) . show ( 'fast' ) ;
107
134
} else {
108
- $j ( '#djDebugToolbar' ) . show ( ) ;
135
+ $ ( '#djDebugToolbar' ) . show ( ) ;
109
136
}
110
- $j . cookie ( COOKIE_NAME , null , {
137
+ $ . cookie ( COOKIE_NAME , null , {
111
138
path : '/' ,
112
139
expires : - 1
113
140
} ) ;
@@ -117,25 +144,9 @@ jQuery(function($j) {
117
144
var darr = String . fromCharCode ( 0x25bc ) ;
118
145
elem . html ( elem . html ( ) == uarr ? darr : uarr ) ;
119
146
}
147
+ } ;
148
+ $ ( document ) . ready ( function ( ) {
149
+ djdt . init ( ) ;
120
150
} ) ;
121
- $j ( document ) . bind ( 'close.djDebug' , function ( ) {
122
- // If a sub-panel is open, close that
123
- if ( $j ( '#djDebugWindow' ) . is ( ':visible' ) ) {
124
- $j ( '#djDebugWindow' ) . hide ( ) ;
125
- return ;
126
- }
127
- // If a panel is open, close that
128
- if ( $j ( '.panelContent' ) . is ( ':visible' ) ) {
129
- $j ( '.panelContent' ) . hide ( ) ;
130
- return ;
131
- }
132
- // Otherwise, just minimize the toolbar
133
- if ( $j ( '#djDebugToolbar' ) . is ( ':visible' ) ) {
134
- $j . djDebug . hide_toolbar ( true ) ;
135
- return ;
136
- }
137
- } ) ;
138
- } ) ;
139
- jQuery ( function ( ) {
140
- jQuery . djDebug ( ) ;
141
151
} ) ;
152
+
0 commit comments