11var _DEBUG = true ;
22
3+ window . jsonParse = function ( ) { var r = "(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)" , k = '(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))' ; k = '(?:"' + k + '*")' ; var s = new RegExp ( "(?:false|true|null|[\\{\\}\\[\\]]|" + r + "|" + k + ")" , "g" ) , t = new RegExp ( "\\\\(?:([^u])|u(.{4}))" , "g" ) , u = { '"' :'"' , "/" :"/" , "\\" :"\\" , b :"\u0008" , f :"\u000c" , n :"\n" , r :"\r" , t :"\t" } ; function v ( h , j , e ) { return j ?u [ j ] :String . fromCharCode ( parseInt ( e , 16 ) ) } var w = new String ( "" ) , x = Object . hasOwnProperty ; return function ( h ,
4+ j ) { h = h . match ( s ) ; var e , c = h [ 0 ] , l = false ; if ( "{" === c ) e = { } ; else if ( "[" === c ) e = [ ] ; else { e = [ ] ; l = true } for ( var b , d = [ e ] , m = 1 - l , y = h . length ; m < y ; ++ m ) { c = h [ m ] ; var a ; switch ( c . charCodeAt ( 0 ) ) { default :a = d [ 0 ] ; a [ b || a . length ] = + c ; b = void 0 ; break ; case 34 :c = c . substring ( 1 , c . length - 1 ) ; if ( c . indexOf ( "\\" ) !== - 1 ) c = c . replace ( t , v ) ; a = d [ 0 ] ; if ( ! b ) if ( a instanceof Array ) b = a . length ; else { b = c || w ; break } a [ b ] = c ; b = void 0 ; break ; case 91 :a = d [ 0 ] ; d . unshift ( a [ b || a . length ] = [ ] ) ; b = void 0 ; break ; case 93 :d . shift ( ) ; break ; case 102 :a = d [ 0 ] ; a [ b || a . length ] = false ;
5+ b = void 0 ; break ; case 110 :a = d [ 0 ] ; a [ b || a . length ] = null ; b = void 0 ; break ; case 116 :a = d [ 0 ] ; a [ b || a . length ] = true ; b = void 0 ; break ; case 123 :a = d [ 0 ] ; d . unshift ( a [ b || a . length ] = { } ) ; b = void 0 ; break ; case 125 :d . shift ( ) ; break } } if ( l ) { if ( d . length !== 1 ) throw new Error ; e = e [ 0 ] } else if ( d . length ) throw new Error ; if ( j ) { var p = function ( n , o ) { var f = n [ o ] ; if ( f && typeof f === "object" ) { var i = null ; for ( var g in f ) if ( x . call ( f , g ) && f !== n ) { var q = p ( f , g ) ; if ( q !== void 0 ) f [ g ] = q ; else { i || ( i = [ ] ) ; i . push ( g ) } } if ( i ) for ( g = i . length ; -- g >= 0 ; ) delete f [ i [ g ] ] } return j . call ( n ,
6+ o , f ) } ; e = p ( { "" :e } , "" ) } return e } } ( ) ;
7+
38
49( function ( $ ) { $ . toJSON = function ( o )
510{ if ( typeof ( JSON ) == 'object' && JSON . stringify )
@@ -86,7 +91,7 @@ var App = {
8691 // pages related views
8792 Pages : {
8893 USER : { } ,
89- WEBDOMAIN : { } ,
94+ WEB_DOMAIN : { } ,
9095 MAIL : { } ,
9196 DB : { } ,
9297 DNS : { } ,
@@ -97,7 +102,7 @@ var App = {
97102 Messages : { } ,
98103 Model : {
99104 USER : { } ,
100- WEBDOMAIN : { } ,
105+ WEB_DOMAIN : { } ,
101106 MAIL : { } ,
102107 DB : { } ,
103108 DNS : { } ,
@@ -109,7 +114,7 @@ var App = {
109114 } ,
110115 Pages : {
111116 USER : { } ,
112- WEBDOMAIN : { } ,
117+ WEB_DOMAIN : { } ,
113118 MAIL : { } ,
114119 DB : { } ,
115120 DNS : { } ,
@@ -119,8 +124,10 @@ var App = {
119124 Ref : { } ,
120125 Tmp : { } ,
121126 Thread : {
122- run : function ( delay , ref ) {
123- setTimeout ( function ( ) {
127+ run : function ( delay , ref )
128+ {
129+ setTimeout ( function ( )
130+ {
124131 ref ( ) ;
125132 } , delay * 10 ) ;
126133 }
@@ -136,31 +143,36 @@ var App = {
136143} ;
137144
138145// Internals
139- Array . prototype . set = function ( key , value ) {
146+ Array . prototype . set = function ( key , value )
147+ {
140148 var index = this [ 0 ] [ key ] ;
141149 this [ 1 ] [ index ] = value ;
142150}
143151Array . prototype . get = function ( key ) {
144152 var index = this [ 0 ] [ key ] ;
145153 return this [ 1 ] [ index ] ;
146154}
147- Array . prototype . finalize = function ( ) {
155+ Array . prototype . finalize = function ( )
156+ {
148157 this . shift ( ) ;
149158 this [ 0 ] = this [ 0 ] . join ( '' ) ;
150159 return this [ 0 ] ;
151160}
152- Array . prototype . done = function ( ) {
161+ Array . prototype . done = function ( )
162+ {
153163 return this . join ( '' ) ;
154164}
155165
156- String . prototype . wrapperize = function ( key , ns ) {
166+ String . prototype . wrapperize = function ( key , ns )
167+ {
157168 var tpl = App . Templates . get ( key , ns ) ;
158169 tpl . set ( ':content' , this ) ;
159170
160171 return tpl . finalize ( ) ;
161172}
162173
163- App . Ajax . request = function ( jedi_method , data , callback ) {
174+ App . Ajax . request = function ( jedi_method , data , callback )
175+ {
164176 App . Helpers . beforeAjax ( jedi_method ) ;
165177 $ . ajax ( {
166178 url : function ( ) {
@@ -176,13 +188,17 @@ App.Ajax.request = function(jedi_method, data, callback){
176188 global : false ,
177189 type : data . request_method || "POST" ,
178190 data : $ . extend ( data , { 'jedi_method' : jedi_method } ) ,
179- dataType : "json " ,
191+ dataType : "text " ,
180192 async :true ,
181- success : function ( reply ) {
193+ success : function ( reply )
194+ {
195+ timer . start ( ) ;
196+ callback && callback ( jsonParse ( reply ) ) ;
182197 App . Helpers . afterAjax ( ) ;
183- callback && callback ( reply ) ;
198+ timer . stop ( jedi_method ) ;
184199 } ,
185- error : function ( ) {
200+ error : function ( )
201+ {
186202 App . View . popup ( 'error' ) ;
187203 }
188204 } ) ;
@@ -207,7 +223,7 @@ timer.stop = function( msg )
207223timer . print = function ( msg )
208224{
209225 var passed = timer . stop_time - timer . start_time ;
210- fb . info ( msg || '' + passed / 1000 ) ;
226+ fb . info ( ( msg || '' ) + ': ' + passed / 1000 ) ;
211227}
212228
213229
0 commit comments