11$ ( function ( ) {
2- $ ( '#sidebar a' ) . click ( function ( e ) {
3- if ( e . currentTarget . href . indexOf ( '/?' ) == - 1 ) {
4- return ;
5- }
6-
7- e . preventDefault ( ) ;
2+ $ ( '#sidebar' ) . on ( 'click' , 'a' , function ( e ) {
3+ if ( e . currentTarget . className . indexOf ( 'deltree' ) !== - 1 ) {
4+ e . preventDefault ( ) ;
85
9- var href ;
10-
11- if ( ( e . currentTarget . href . indexOf ( '?' ) == - 1 ) ||
12- ( e . currentTarget . href . indexOf ( '?' ) == ( e . currentTarget . href . length - 1 ) ) ) {
13- href = 'overview.php' ;
14- } else {
15- href = e . currentTarget . href . substr ( e . currentTarget . href . indexOf ( '?' ) + 1 ) ;
16-
17- if ( href . indexOf ( '&' ) != - 1 ) {
18- href = href . replace ( '&' , '.php?' ) ;
19- } else {
20- href += '.php' ;
21- }
22- }
23-
24- if ( href . indexOf ( 'flush.php' ) == 0 ) {
25- if ( confirm ( 'Are you sure you want to delete this key and all it\'s values?' ) ) {
6+ if ( confirm ( 'Are you sure you want to delete this whole tree and all it\'s keys?' ) ) {
267 $ . ajax ( {
278 type : "POST" ,
28- url : href ,
9+ url : this . href ,
2910 data : 'post=1' ,
30- success : function ( ) {
31- window . location . reload ( ) ;
11+ success : function ( url ) {
12+ top . location . href = top . location . pathname + url ;
3213 }
3314 } ) ;
3415 }
3516 } else {
36- $ ( '#iframe' ) . attr ( 'src' , href ) ;
17+ if ( e . currentTarget . href . indexOf ( '/?' ) == - 1 ) {
18+ return ;
19+ }
20+
21+ e . preventDefault ( ) ;
22+
23+ var href ;
24+
25+ if ( ( e . currentTarget . href . indexOf ( '?' ) == - 1 ) ||
26+ ( e . currentTarget . href . indexOf ( '?' ) == ( e . currentTarget . href . length - 1 ) ) ) {
27+ href = 'overview.php' ;
28+ } else {
29+ href = e . currentTarget . href . substr ( e . currentTarget . href . indexOf ( '?' ) + 1 ) ;
30+
31+ if ( href . indexOf ( '&' ) != - 1 ) {
32+ href = href . replace ( '&' , '.php?' ) ;
33+ } else {
34+ href += '.php' ;
35+ }
36+ }
37+
38+ if ( href . indexOf ( 'flush.php' ) == 0 ) {
39+ if ( confirm ( 'Are you sure you want to delete this key and all it\'s values?' ) ) {
40+ $ . ajax ( {
41+ type : "POST" ,
42+ url : href ,
43+ data : 'post=1' ,
44+ success : function ( ) {
45+ window . location . reload ( ) ;
46+ }
47+ } ) ;
48+ }
49+ } else {
50+ $ ( '#iframe' ) . attr ( 'src' , href ) ;
51+ }
3752 }
3853 } ) ;
3954
40-
4155 $ ( '#server' ) . change ( function ( e ) {
4256 if ( location . href . indexOf ( '?' ) == - 1 ) {
4357 location . href = location . href + '?s=' + e . target . value ;
@@ -62,7 +76,7 @@ $(function() {
6276
6377 $ ( 'li.current' ) . parents ( 'li.folder' ) . removeClass ( 'collapsed' ) ;
6478
65- $ ( 'li.folder ' ) . click ( function ( e ) {
79+ $ ( '#sidebar ' ) . on ( 'click' , 'li.folder' , function ( e ) {
6680 var t = $ ( this ) ;
6781
6882 if ( ( e . pageY >= t . offset ( ) . top ) &&
@@ -72,14 +86,6 @@ $(function() {
7286 }
7387 } ) ;
7488
75- $ ( 'a' ) . click ( function ( ) {
76- $ ( 'li.current' ) . removeClass ( 'current' ) ;
77- } ) ;
78-
79- $ ( 'li a' ) . click ( function ( ) {
80- $ ( this ) . parent ( ) . addClass ( 'current' ) ;
81- } ) ;
82-
8389 $ ( '#btn_server_filter' ) . click ( function ( ) {
8490 var filter = $ ( '#server_filter' ) . val ( ) ;
8591 location . href = top . location . pathname + '?overview&s=' + $ ( '#server' ) . val ( ) + '&d=' + ( $ ( '#database' ) . val ( ) || '' ) + '&filter=' + filter ;
@@ -118,22 +124,6 @@ $(function() {
118124 } ) ;
119125 } ) ;
120126
121- $ ( '.deltree' ) . click ( function ( e ) {
122- e . preventDefault ( ) ;
123-
124- if ( confirm ( 'Are you sure you want to delete this whole tree and all it\'s keys?' ) ) {
125- $ . ajax ( {
126- type : "POST" ,
127- url : this . href ,
128- data : 'post=1' ,
129- success : function ( url ) {
130- top . location . href = top . location . pathname + url ;
131- }
132- } ) ;
133- }
134- } ) ;
135-
136-
137127 var isResizing = false ;
138128 var lastDownX = 0 ;
139129 var lastWidth = 0 ;
0 commit comments