2010-07-12 22:04:42 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								$ ( document ) . ready ( function ( )  {  
						 
					
						
							
								
									
										
										
										
											2019-07-15 17:16:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( enable _uaa )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        get ( uaa _location  +  "/info" ,  "application/json" ,  function ( req )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( req . status  !==  200 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                replace _content ( 'outer' ,  format ( 'login_uaa' ,  { } ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-03 00:12:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                replace _content ( 'login-status' ,  '<p class="warning">'  +  uaa _location  +  " does not appear to be a running UAA instance or may not have a trusted SSL certificate"   +  '</p> <button id="loginWindow" onclick="uaa_login_window()">Single Sign On</button>' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 17:16:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                replace _content ( 'outer' ,  format ( 'login_uaa' ,  { } ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        replace _content ( 'outer' ,  format ( 'login' ,  { } ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        start _app _login ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-06 01:30:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ) ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-06 21:39:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  dispatcher _add ( fun )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    dispatcher _modules . push ( fun ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-06 23:01:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( dispatcher _modules . length  ==  extension _count )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-06 21:39:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        start _app ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  dispatcher ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( var  i  in  dispatcher _modules )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        dispatcher _modules [ i ] ( this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-09-23 00:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  set _auth _pref ( userinfo )  {  
						 
					
						
							
								
									
										
										
										
											2017-03-22 20:44:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // clear a local storage value used by earlier versions
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    clear _local _pref ( 'auth' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-10-31 19:22:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  b64  =  b64 _encode _utf8 ( userinfo ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-22 20:44:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  date   =  new  Date ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 22:23:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  login _session _timeout  =  get _login _session _timeout ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 22:39:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( login _session _timeout )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-22 05:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        date . setMinutes ( date . getMinutes ( )  +  login _session _timeout ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 22:23:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // 8 hours from now
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        date . setHours ( date . getHours ( )  +  8 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-22 20:44:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    store _cookie _value _with _expiration ( 'auth' ,  encodeURIComponent ( b64 ) ,  date ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-10-10 00:55:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-06 23:51:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  login _route  ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  userpass  =  ''  +  this . params [ 'username' ]  +  ':'  +  this . params [ 'password' ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        location  =  window . location . href , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        hash  =  window . location . hash ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-23 00:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set _auth _pref ( decodeURIComponent ( userpass ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-06 23:51:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    location  =  location . substr ( 0 ,  location . length  -  hash . length ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    window . location . replace ( location ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // because we change url, we don't need to hit check_login as
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // we'll end up doing that at the bottom of start_app_login after
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // we've changed url.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-09-28 19:45:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  login _route _with _path ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  var  params  =  ( ''  +  this . params [ 'splat' ] ) . split ( '/' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-19 20:14:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  var  user  =  params . shift ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  var  pass  =  params . shift ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  var  userpass  =  ''  +  user  +  ':'  +  pass , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        location  =  window . location . href , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        hash  =  window . location . hash ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    set _auth _pref ( decodeURIComponent ( userpass ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    location  =  location . substr ( 0 ,  location . length  -  hash . length )  +  '#/'  +  params . join ( '/' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    check _login ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    window . location . replace ( location ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 17:16:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  getParameterByName ( name )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  match  =  RegExp ( '[#&]'  +  name  +  '=([^&]*)' ) . exec ( window . location . hash ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  match  &&  decodeURIComponent ( match [ 1 ] . replace ( /\+/g ,  ' ' ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  getAccessToken ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  getParameterByName ( 'access_token' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-10-23 23:35:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  start _app _login ( )  {  
						 
					
						
							
								
									
										
										
										
											2012-11-14 21:51:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    app  =  new  Sammy . Application ( function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-14 01:20:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . get ( '#/' ,  function ( )  { } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-23 23:35:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . put ( '#/login' ,  function ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            username  =  this . params [ 'username' ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            password  =  this . params [ 'password' ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-23 00:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            set _auth _pref ( username  +  ':'  +  password ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-03 00:31:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            check _login ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-23 23:35:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-14 05:22:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . get ( '#/login/:username/:password' ,  login _route ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-09-28 19:45:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        this . get ( /\#\/login\/(.*)/ ,  login _route _with _path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-23 23:35:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 17:16:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( enable _uaa )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  token  =  getAccessToken ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( token  !=  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            set _auth _pref ( uaa _client _id  +  ':'  +  token ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-26 21:58:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            store _pref ( 'uaa_token' ,  token ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 17:16:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            check _login ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  if ( has _auth _cookie _value ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            check _login ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        app . run ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( get _cookie _value ( 'auth' )  !=  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            check _login ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-03 00:31:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 17:16:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  uaa _logout _window ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    uaa _invalid  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    uaa _login _window ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  uaa _login _window ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  redirect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( window . location . hash  !=  "" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        redirect  =  window . location . href . split ( window . location . hash ) [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        redirect  =  window . location . href 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  loginRedirectUrl ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( uaa _invalid )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        loginRedirectUrl  =  Singular . properties . uaaLocation  +  '/logout.do?client_id='  +  Singular . properties . clientId  +  '&redirect='  +  redirect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        loginRedirectUrl  =  Singular . properties . uaaLocation  +  '/oauth/authorize?response_type=token&client_id='  +  Singular . properties . clientId  +  '&redirect_uri='  +  redirect ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    window . open ( loginRedirectUrl ,  "LOGIN_WINDOW" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-03 00:31:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  check _login ( )  {  
						 
					
						
							
								
									
										
										
										
											2014-01-31 21:40:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    user  =  JSON . parse ( sync _get ( '/whoami' ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-03 00:31:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( user  ==  false )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-22 20:44:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        // clear a local storage value used by earlier versions
 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-23 00:45:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        clear _pref ( 'auth' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-26 21:58:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        clear _pref ( 'uaa_token' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-22 20:44:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        clear _cookie _value ( 'auth' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 17:16:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( enable _uaa )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            uaa _invalid  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-08-03 00:12:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            replace _content ( 'login-status' ,  '<button id="loginWindow" onclick="uaa_login_window()">Log out</button>' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 17:16:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            replace _content ( 'login-status' ,  '<p>Login failed</p>' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-03 00:31:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-19 22:02:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        hide _popup _warn ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-06 23:58:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        replace _content ( 'outer' ,  format ( 'layout' ,  { } ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 22:23:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  user _login _session _timeout  =  parseInt ( user . login _session _timeout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // Update auth login_session_timeout if changed
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( has _auth _cookie _value ( )  &&  ! isNaN ( user _login _session _timeout )  && 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            user _login _session _timeout  !==  get _login _session _timeout ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            update _login _session _timeout ( user _login _session _timeout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-31 21:40:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        setup _global _vars ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-03 00:31:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        setup _constant _events ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        update _vhosts ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        update _interval ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        setup _extensions ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-23 23:35:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 22:23:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  get _login _session _timeout ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    parseInt ( get _cookie _value ( 'login_session_timeout' ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  update _login _session _timeout ( login _session _timeout )  {  
						 
					
						
							
								
									
										
										
										
											2018-06-22 05:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  auth _info  =  get _cookie _value ( 'auth' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 22:23:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  date   =  new  Date ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-22 05:18:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // `login_session_timeout` minutes from now
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    date . setMinutes ( date . getMinutes ( )  +  login _session _timeout ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 22:23:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    store _cookie _value ( 'login_session_timeout' ,  login _session _timeout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    store _cookie _value _with _expiration ( 'auth' ,  auth _info ,  date ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-06 01:30:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  start _app ( )  {  
						 
					
						
							
								
									
										
										
										
											2013-10-10 00:24:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( app  !==  undefined )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-10-10 00:16:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        app . unload ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-14 21:51:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // Oh boy. Sammy uses various different methods to determine if
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // the URL hash has changed. Unsurprisingly this is a native event
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // in modern browsers, and falls back to an icky polling function
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // in MSIE. But it looks like there's a bug. The polling function
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // should get installed when the app is started. But it's guarded
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // behind if (Sammy.HashLocationProxy._interval != null). And of
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // course that's not specific to the application; it's pretty
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // global. So we need to manually clear that in order for links to
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // work in MSIE.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Filed as https://github.com/quirkey/sammy/issues/171
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    //
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Note for when we upgrade: HashLocationProxy has become
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // DefaultLocationProxy in later versions, but otherwise the issue
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // remains.
 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-17 13:31:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-01-28 06:00:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // updated to the version  0.7.6 this _interval = null is fixed
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // just leave the history here.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    //Sammy.HashLocationProxy._interval = null;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-14 21:51:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    app  =  new  Sammy . Application ( dispatcher ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-23 23:32:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    app . run ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 17:16:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-03 01:41:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  url  =  this . location . toString ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 17:16:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  hash  =  this . location . hash ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  pathname  =  this . location . pathname ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-03 01:41:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( url . indexOf ( '#' )  ==  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . location  =  url  +  '#/' ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 17:16:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    }  else  if  ( hash . indexOf ( '#token_type' )  !=  -  1  &&  pathname  ==  '/' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // This is equivalent to previous `if` clause when uaa authorisation is used.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // Tokens are passed in the url hash, so the url always contains a #.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // We need to check the current path is `/` and token is present,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // so we can redirect to `/#/`
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        this . location  =  url . replace ( /#token_type.+/gi ,  "#/" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-03 01:41:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-06 01:30:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2010-07-12 22:04:42 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 00:23:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  setup _constant _events ( )  {  
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '#update-every' ) . on ( 'change' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 00:23:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  interval  =  $ ( this ) . val ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 02:06:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            store _pref ( 'interval' ,  interval ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-14 19:33:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( interval  ==  '' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                interval  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                interval  =  parseInt ( interval ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 00:23:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            set _timer _interval ( interval ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '#show-vhost' ) . on ( 'change' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 00:23:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            current _vhost  =  $ ( this ) . val ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 01:23:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            store _pref ( 'vhost' ,  current _vhost ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 00:23:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            update ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-09 19:42:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ! vhosts _interesting )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $ ( '#vhost-form' ) . hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 00:23:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  update _vhosts ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  vhosts  =  JSON . parse ( sync _get ( '/vhosts' ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-11-09 19:42:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    vhosts _interesting  =  vhosts . length  >  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( vhosts _interesting ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $ ( '#vhost-form' ) . show ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $ ( '#vhost-form' ) . hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 00:23:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  select  =  $ ( '#show-vhost' ) . get ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    select . options . length  =  vhosts . length  +  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  index  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( var  i  =  0 ;  i  <  vhosts . length ;  i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  vhost  =  vhosts [ i ] . name ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 21:32:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        select . options [ i  +  1 ]  =  new  Option ( vhost ,  vhost ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 00:23:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( vhost  ==  current _vhost )  index  =  i  +  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    select . selectedIndex  =  index ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 21:32:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    current _vhost  =  select . options [ index ] . value ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 01:32:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    store _pref ( 'vhost' ,  current _vhost ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 00:23:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-06 01:30:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  setup _extensions ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  extensions  =  JSON . parse ( sync _get ( '/extensions' ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 05:35:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    extension _count  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-06 01:30:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    for  ( var  i  in  extensions )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  extension  =  extensions [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-07-15 05:35:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( $ . isPlainObject ( extension )  &&  extension . hasOwnProperty ( "javascript" ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            dynamic _load ( extension . javascript ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            extension _count ++ ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-06 01:30:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  dynamic _load ( filename )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  element  =  document . createElement ( 'script' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    element . setAttribute ( 'type' ,  'text/javascript' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    element . setAttribute ( 'src' ,  'js/'  +  filename ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    document . getElementsByTagName ( "head" ) [ 0 ] . appendChild ( element ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 02:06:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  update _interval ( )  {  
						 
					
						
							
								
									
										
										
										
											2011-01-21 19:20:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  intervalStr  =  get _pref ( 'interval' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  interval ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( intervalStr  ==  null )     interval  =  5000 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else  if  ( intervalStr  ==  '' )  interval  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else                         interval  =  parseInt ( intervalStr ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( isNaN ( interval ) )  interval  =  null ;  // Prevent DoS if cookie malformed
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 02:06:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    set _timer _interval ( interval ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  select  =  $ ( '#update-every' ) . get ( 0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  opts  =  select . options ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( var  i  =  0 ;  i  <  opts . length ;  i ++ )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-21 19:20:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( opts [ i ] . value  ==  intervalStr )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 02:06:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            select . selectedIndex  =  i ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 00:23:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-24 01:32:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  go _to ( url )  {  
						 
					
						
							
								
									
										
										
										
											2012-11-21 01:02:41 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    this . location  =  url ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-24 01:32:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 22:59:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  set _timer _interval ( interval )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    timer _interval  =  interval ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-14 20:15:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    reset _timer ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  reset _timer ( )  {  
						 
					
						
							
								
									
										
										
										
											2010-09-29 22:59:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    clearInterval ( timer ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( timer _interval  !=  null )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        timer  =  setInterval ( partial _update ,  timer _interval ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 22:59:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2010-07-13 00:11:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-10-09 20:17:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  update _manual ( div ,  query )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  template ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-03 00:09:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( query  ==  'memory'  ||  query  ==  'binary' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        path  =  current _reqs [ 'node' ] [ 'path' ]  +  '?'  +  query  +  '=true' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        template  =  query ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-09 20:17:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-03 05:02:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-10-09 20:17:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  data  =  JSON . parse ( sync _get ( path ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    replace _content ( div ,  format ( template ,  data ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-09 23:33:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    postprocess _partial ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-09 20:17:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-23 23:32:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  render ( reqs ,  template ,  highlight )  {  
						 
					
						
							
								
									
										
										
										
											2018-07-20 17:53:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  old _template  =  current _template ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-23 23:32:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    current _template  =  template ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    current _reqs  =  reqs ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-05 20:03:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    for  ( var  i  in  outstanding _reqs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        outstanding _reqs [ i ] . abort ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    outstanding _reqs  =  [ ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-23 23:32:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    current _highlight  =  highlight ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-20 22:04:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( old _template  !==  current _template )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-20 17:53:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        window . scrollTo ( 0 ,  0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 23:56:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    update ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 22:59:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 23:56:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  update ( )  {  
						 
					
						
							
								
									
										
										
										
											2012-12-07 19:35:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    replace _content ( 'debug' ,  '' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 22:59:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    clearInterval ( timer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 00:23:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    with _update ( function ( html )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-13 00:36:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            update _navigation ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 22:59:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            replace _content ( 'main' ,  html ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            postprocess ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 00:05:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            postprocess _partial ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-16 21:27:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            render _charts ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-27 20:15:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            maybe _scroll ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-14 20:15:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            reset _timer ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 22:59:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-13 20:03:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 23:56:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  partial _update ( )  {  
						 
					
						
							
								
									
										
										
										
											2015-10-13 21:53:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ! $ ( ".pagination_class" ) . is ( ":focus" ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $ ( '.updatable' ) . length  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( update _counter  >=  200 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                update _counter  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                full _refresh ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                return ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 22:59:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-13 21:53:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            with _update ( function ( html )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                update _counter ++ ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                replace _content ( 'scratch' ,  html ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                var  befores  =  $ ( '#main .updatable' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                var  afters  =  $ ( '#scratch .updatable' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if  ( befores . length  !=  afters . length )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-28 19:40:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    console . log ( "before/after mismatch! Doing a full reload..." ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    full _refresh ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-13 21:53:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                for  ( var  i  =  0 ;  i  <  befores . length ;  i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    $ ( befores [ i ] ) . empty ( ) . append ( $ ( afters [ i ] ) . contents ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                replace _content ( 'scratch' ,  '' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                postprocess _partial ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                render _charts ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 22:59:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-06-13 00:36:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  update _navigation ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  l1  =  '' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  l2  =  '' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  descend  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( var  k  in  NAVIGATION )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  val  =  NAVIGATION [ k ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  path  =  val ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        while  ( ! leaf ( path ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-19 20:29:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            path  =  first _showable _child ( path ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-13 00:36:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  selected  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( contains _current _highlight ( val ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            selected  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( ! leaf ( val ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                descend  =  nav ( val ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( show ( path ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            l1  +=  '<li><a href="'  +  nav ( path )  +  '"'  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                ( selected  ?  ' class="selected"'  :  '' )  +  '>'  +  k  +  '</a></li>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( descend )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        l2  =  obj _to _ul ( descend ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $ ( '#main' ) . addClass ( 'with-rhs' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $ ( '#main' ) . removeClass ( 'with-rhs' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    replace _content ( 'tabs' ,  l1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    replace _content ( 'rhs' ,  l2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  nav ( pair )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  pair [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  show ( pair )  {  
						 
					
						
							
								
									
										
										
										
											2013-09-19 20:29:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  jQuery . inArray ( pair [ 1 ] ,  user _tags )  !=  - 1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-13 00:36:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  leaf ( pair )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  typeof ( nav ( pair ) )  ==  'string' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-09-19 20:29:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  first _showable _child ( pair )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  items  =  pair [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  ks  =  keys ( items ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( var  i  =  0 ;  i  <  ks . length ;  i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  child  =  items [ ks [ i ] ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( show ( child ) )  return  child ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  items [ ks [ 0 ] ] ;  // We'll end up not showing it anyway
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-06-13 00:36:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  contains _current _highlight ( val )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( leaf ( val ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  current _highlight  ==  nav ( val ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  b  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        for  ( var  k  in  val )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            b  |=  contains _current _highlight ( val [ k ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  b ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  obj _to _ul ( val )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  res  =  '<ul>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( var  k  in  val )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  obj  =  val [ k ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-19 20:29:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( show ( obj ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            res  +=  '<li>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( leaf ( obj ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                res  +=  '<a href="'  +  nav ( obj )  +  '"'  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    ( current _highlight  ==  nav ( obj )  ?  ' class="selected"'  :  '' )  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    '>'  +  k  +  '</a>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                res  +=  obj _to _ul ( nav ( obj ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            res  +=  '</li>' ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-13 00:36:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  res  +  '</ul>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-27 20:15:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  full _refresh ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    store _pref ( 'position' ,  x _position ( )  +  ','  +  y _position ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    location . reload ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  maybe _scroll ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  pos  =  get _pref ( 'position' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( pos )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        clear _pref ( 'position' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  xy  =  pos . split ( "," ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        window . scrollTo ( parseInt ( xy [ 0 ] ) ,  parseInt ( xy [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  x _position ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  window . pageXOffset  ? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        window . pageXOffset  : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        document . documentElement . scrollLeft  ? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        document . documentElement . scrollLeft  : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        document . body . scrollLeft ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  y _position ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  window . pageYOffset  ? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        window . pageYOffset  : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        document . documentElement . scrollTop  ? 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        document . documentElement . scrollTop  : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        document . body . scrollTop ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 00:23:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  with _update ( fun )  {  
						 
					
						
							
								
									
										
										
										
											2016-10-05 23:50:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if ( outstanding _reqs . length  >  0 ) { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 00:05:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    with _reqs ( apply _state ( current _reqs ) ,  [ ] ,  function ( json )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-23 23:32:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  html  =  format ( current _template ,  json ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 22:59:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            fun ( html ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-31 23:44:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            update _status ( 'ok' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-24 01:32:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-05 23:50:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-24 01:32:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 00:05:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  apply _state ( reqs )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  reqs2  =  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( k  in  reqs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  req  =  reqs [ k ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-25 22:57:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  options  =  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( typeof ( req )  ==  "object" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            options  =  req . options ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            req  =  req . path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 00:05:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  req2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-25 22:57:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( options [ 'vhost' ]  !=  undefined  &&  current _vhost  !=  '' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-22 18:46:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  indexPage  =  req . indexOf ( "?page=" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( indexPage  > -  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-13 21:53:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												pageUrl  =  req . substr ( indexPage ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-22 20:35:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
												req2  =  req . substr ( 0 , indexPage )  +  '/'  +  esc ( current _vhost )  +  pageUrl ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-13 21:53:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            }  else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              req2  =  req  +  '/'  +  esc ( current _vhost ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 00:05:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            req2  =  req ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 00:23:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-20 01:58:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  qs  =  [ ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-25 22:57:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( options [ 'sort' ]  !=  undefined  &&  current _sort  !=  null )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-20 01:58:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            qs . push ( 'sort='  +  current _sort ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            qs . push ( 'sort_reverse='  +  current _sort _reverse ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 00:05:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-01 02:27:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( options [ 'ranges' ]  !=  undefined )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            for  ( i  in  options [ 'ranges' ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                var  type  =  options [ 'ranges' ] [ i ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-25 18:44:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                var  range  =  get _pref ( 'chart-range' ) . split ( '|' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-01 02:27:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                var  prefix ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if  ( type . substring ( 0 ,  8 )  ==  'lengths-' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    prefix  =  'lengths' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                else  if  ( type . substring ( 0 ,  10 )  ==  'msg-rates-' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    prefix  =  'msg_rates' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                else  if  ( type . substring ( 0 ,  11 )  ==  'data-rates-' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    prefix  =  'data_rates' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-11 23:33:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                else  if  ( type  ==  'node-stats' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    prefix  =  'node_stats' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-01 02:27:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                qs . push ( prefix  +  '_age='  +  parseInt ( range [ 0 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                qs . push ( prefix  +  '_incr='  +  parseInt ( range [ 1 ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 00:05:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2016-06-16 18:31:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        /* Unknown options are used as query parameters as is. */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        Object . keys ( options ) . forEach ( function  ( key )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          /* Skip known keys we already handled and undefined parameters. */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          if  ( key  ==  'vhost'  ||  key  ==  'sort'  ||  key  ==  'ranges' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          if  ( ! key  ||  options [ key ]  ==  undefined ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          qs . push ( esc ( key )  +  '='  +  esc ( options [ key ] ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-20 01:58:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        qs  =  qs . join ( '&' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-03 16:23:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( qs  !=  '' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( req2 . indexOf ( "?page=" )  > -  1 ) 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-22 15:55:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            qs  =  '&'  +  qs ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								             else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            qs  =  '?'  +  qs ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-03 16:23:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 00:05:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        reqs2 [ k ]  =  req2  +  qs ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 00:23:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 00:05:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  reqs2 ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-08 00:23:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-27 00:17:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  show _popup ( type ,  text ,  _mode )  {  
						 
					
						
							
								
									
										
										
										
											2010-10-16 01:11:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  cssClass  =  '.form-popup-'  +  type ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-15 01:09:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  hide ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-11 00:57:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $ ( cssClass ) . fadeOut ( 100 ,  function ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $ ( this ) . remove ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-15 01:09:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    hide ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-27 00:17:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '#outer' ) . after ( format ( 'popup' ,  { 'type' :  type ,  'text' :  text } ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-11 00:57:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( cssClass ) . fadeIn ( 100 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 17:34:25 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( cssClass  +  ' span' ) . on ( 'click' ,  function  ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-28 21:23:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $ ( '.popup-owner' ) . removeClass ( 'popup-owner' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        hide ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-09 01:00:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-19 22:02:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  hide _popup _warn ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  cssClass  =  '.form-popup-warn' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $ ( '.popup-owner' ) . removeClass ( 'popup-owner' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $ ( cssClass ) . fadeOut ( 100 ,  function ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $ ( this ) . remove ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-05-18 06:27:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  submit _import ( form )  {  
						 
					
						
							
								
									
										
										
										
											2017-05-18 06:47:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( form . file . value )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-18 22:33:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  confirm _upload  =  confirm ( 'Are you sure you want to import a definitions file? Some entities (vhosts, users, queues, etc) may be overwritten!' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-18 22:22:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( confirm _upload  ===  true )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-26 06:29:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  file  =  form . file . files [ 0 ] ;  // FUTURE: limit upload file size (?)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  vhost _upload  =  $ ( "select[name='vhost-upload'] option:selected" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  vhost _selected  =  vhost _upload . index ( )  >  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  vhost _name  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( vhost _selected )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                vhost _name  =  vhost _upload . val ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  vhost _part  =  '' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( vhost _name )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                vhost _part  =  '/'  +  esc ( vhost _name ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-30 04:07:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( enable _uaa )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                var  form _action  =  "/definitions"  +  vhost _part  +  '?token='  +  get _pref ( 'uaa_token' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                var  form _action  =  "/definitions"  +  vhost _part  +  '?auth='  +  get _cookie _value ( 'auth' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-26 06:29:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  fd  =  new  FormData ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            fd . append ( 'file' ,  file ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            with _req ( 'POST' ,  form _action ,  fd ,  function ( resp )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                show _popup ( 'info' ,  'Your definitions were imported successfully.' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-18 06:47:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-18 06:27:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-26 06:29:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-18 06:27:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ;  
						 
					
						
							
								
									
										
										
										
											2016-02-16 18:50:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-24 01:32:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  postprocess ( )  {  
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( 'form.confirm-queue' ) . on ( 'submit' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-30 23:52:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  confirm ( "Are you sure? The queue is going to be deleted. "  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                       "Messages cannot be recovered after deletion." ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( 'form.confirm-purge-queue' ) . on ( 'submit' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-12-30 23:52:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  confirm ( "Are you sure? Messages cannot be recovered after purging." ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( 'form.confirm' ) . on ( 'submit' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-24 17:24:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            return  confirm ( "Are you sure? This object cannot be recovered "  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                           "after deletion." ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-25 17:46:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( 'label' ) . map ( function ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( $ ( this ) . attr ( 'for' )  ==  '' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                var  id  =  'auto-label-'  +  Math . floor ( Math . random ( ) * 1000000000 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                var  input  =  $ ( this ) . parents ( 'tr' ) . first ( ) . find ( 'input, select' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 20:22:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                if  ( input . attr ( 'id' )  ==  '' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    $ ( this ) . attr ( 'for' ,  id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    input . attr ( 'id' ,  id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-25 17:46:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '#download-definitions' ) . on ( 'click' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-22 20:44:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  idx  =  $ ( "select[name='vhost-download'] option:selected" ) . index ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-16 00:33:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  vhost  =  ( ( idx  <= 0  )  ?  ""  :  "/"  +  esc ( $ ( "select[name='vhost-download'] option:selected" ) . val ( ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-30 04:07:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( enable _uaa )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-16 00:21:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  path  =  'api/definitions'  +  vhost  +  '?download='  + 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-10 00:26:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                esc ( $ ( '#download-filename' ) . val ( ) )  + 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-30 04:07:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                '&token='  +  get _pref ( 'uaa_token' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                var  path  =  'api/definitions'  +  vhost  +  '?download='  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    esc ( $ ( '#download-filename' ) . val ( ) )  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    '&auth='  +  get _cookie _value ( 'auth' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-01 01:28:28 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            window . location  =  path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            setTimeout ( 'app.run()' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 20:22:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-16 18:50:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '.update-manual' ) . on ( 'click' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-09 20:17:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            update _manual ( $ ( this ) . attr ( 'for' ) ,  $ ( this ) . attr ( 'query' ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-11-28 01:09:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( document ) . on ( 'keyup' ,  '.multifield input' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-14 01:10:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            update _multifields ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-11-28 01:09:58 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( document ) . on ( 'change' ,  '.multifield select' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:08:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            update _multifields ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '.controls-appearance' ) . on ( 'change' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-22 23:32:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  params  =  $ ( this ) . get ( 0 ) . options ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  selected  =  $ ( this ) . val ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        for  ( i  =  0 ;  i  <  params . length ;  i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  param  =  params [ i ] . value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( param  ==  selected )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $ ( '#'  +  param  +  '-div' ) . slideDown ( 100 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $ ( '#'  +  param  +  '-div' ) . slideUp ( 100 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 01:40:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-27 00:17:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( document ) . on ( 'click' ,  '.help' ,  function ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      show _popup ( 'help' ,  HELP [ $ ( this ) . attr ( 'id' ) ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-17 21:25:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-27 00:17:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( document ) . on ( 'click' ,  '.popup-options-link' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-28 21:23:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $ ( '.popup-owner' ) . removeClass ( 'popup-owner' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-27 00:17:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $ ( this ) . addClass ( 'popup-owner' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  template  =  $ ( this ) . attr ( 'type' )  +  '-options' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        show _popup ( 'options' ,  format ( template ,  { span :  $ ( this ) } ) ,  'fade' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-16 21:27:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-27 00:17:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( document ) . on ( 'click' ,  '.rate-visibility-option' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-05 00:44:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  k  =  $ ( this ) . attr ( 'data-pref' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  show  =  get _pref ( k )  !==  'true' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        store _pref ( k ,  ''  +  show ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        partial _update ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-27 00:17:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( document ) . on ( 'focus' ,  'input, select' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-28 01:18:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        update _counter  =  0 ;  // If there's interaction, reset the counter.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '.tag-link' ) . on ( 'click' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-12-11 19:22:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $ ( '#tags' ) . val ( $ ( this ) . attr ( 'tag' ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '.argument-link' ) . on ( 'click' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-11 23:27:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  field  =  $ ( this ) . attr ( 'field' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  row  =  $ ( '#'  +  field ) . find ( '.mf' ) . last ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  key  =  row . find ( 'input' ) . first ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-03 15:49:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  value  =  row . find ( 'input' ) . last ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-11 23:27:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  type  =  row . find ( 'select' ) . last ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        key . val ( $ ( this ) . attr ( 'key' ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-01-03 15:49:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        value . val ( $ ( this ) . attr ( 'value' ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-11 23:27:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        type . val ( $ ( this ) . attr ( 'type' ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        update _multifields ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-27 00:17:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( document ) . on ( 'click' ,  'form.auto-submit select, form.auto-submit input' ,  function ( ) { 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-16 21:27:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $ ( this ) . parents ( 'form' ) . submit ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-27 00:17:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '#filter' ) . on ( 'keyup' ,  debounce ( update _filter ,  500 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '#filter-regex-mode' ) . on ( 'change' ,  update _filter _regex _mode ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-10-27 00:17:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '#truncate' ) . on ( 'keyup' ,  debounce ( update _truncate ,  500 ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-09-30 20:19:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( !  user _administrator )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $ ( '.administrator-only' ) . remove ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-03 16:23:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:08:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    update _multifields ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-07 00:52:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-10-22 18:46:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  url _pagination _template ( template ,  defaultPage ,  defaultPageSize ) {  
						 
					
						
							
								
									
										
										
										
											2017-06-21 02:08:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  page _number _request  =  fmt _page _number _request ( template ,  defaultPage ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  page _size  =  fmt _page _size _request ( template ,  defaultPageSize ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  name _request  =  fmt _filter _name _request ( template ,  "" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  use _regex  =  fmt _regex _request ( template ,  "" )  ==  "checked" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( use _regex )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        name _request  =  esc ( name _request ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return   '/'  +  template  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        '?page='  +   page _number _request  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        '&page_size='  +  page _size  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        '&name='  +  name _request  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        '&use_regex='  +  use _regex ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-15 18:44:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  stored _page _info ( template ,  page _start ) {  
						 
					
						
							
								
									
										
										
										
											2017-03-24 23:59:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  pageSize  =  fmt _strip _tags ( $ ( '#'  +  template + '-pagesize' ) . val ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  filterName  =  fmt _strip _tags ( $ ( '#'  +  template + '-name' ) . val ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-26 06:51:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    store _pref ( template  +  '_current_page_number' ,  page _start ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-13 05:25:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( filterName  !=  null  &&  filterName  !=  undefined )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        store _pref ( template  +  '_current_filter_name' ,  filterName ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-13 05:25:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  regex _on  =   $ ( "#"  +  template  +  "-filter-regex-mode" ) . is ( ':checked' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( regex _on  !=  null  &&  regex _on  !=  undefined )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        store _pref ( template  +  '_current_regex' ,  regex _on  ?  "checked"  :  " "  ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-10-22 18:46:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( pageSize  !=  null  &&  pageSize  !=  undefined )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        store _pref ( template  +  '_current_page_size' ,  pageSize ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-13 21:53:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  update _pages ( template ,  page _start ) {  
						 
					
						
							
								
									
										
										
										
											2015-11-18 00:31:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     stored _page _info ( template ,  page _start ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								     switch  ( template )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         case  'queues'  :  renderQueues ( ) ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         case  'exchanges'  :  renderExchanges ( ) ;  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-20 16:57:22 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								         case  'connections'  :  renderConnections ( ) ;  break ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								         case  'channels'  :  renderChannels ( ) ;  break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								     } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2015-10-13 21:53:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  renderQueues ( )  {  
						 
					
						
							
								
									
										
										
										
											2018-12-13 08:03:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    ensure _queues _chart _range ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    render ( { 'queues' :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        path :  url _pagination _template ( 'queues' ,  1 ,  100 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        options :  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            sort :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            vhost :  true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            pagination :  true 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ,  'vhosts' :  '/vhosts' } ,  'queues' ,  '#/queues' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  renderExchanges ( )  {  
						 
					
						
							
								
									
										
										
										
											2018-12-13 08:03:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    render ( { 'exchanges' :  { path :  url _pagination _template ( 'exchanges' ,  1 ,  100 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                          options :  { sort : true ,  vhost : true ,  pagination : true } } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                         'vhosts' :  '/vhosts' } ,  'exchanges' ,  '#/exchanges' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  renderConnections ( )  {  
						 
					
						
							
								
									
										
										
										
											2016-01-26 06:51:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    render ( { 'connections' :  { path :   url _pagination _template ( 'connections' ,  1 ,  100 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            options :  { sort : true } } } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            'connections' ,  '#/connections' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  renderChannels ( )  {  
						 
					
						
							
								
									
										
										
										
											2016-01-26 06:51:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    render ( { 'channels' :  { path :   url _pagination _template ( 'channels' ,  1 ,  100 ) , 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        options :  { sort : true } } } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        'channels' ,  '#/channels' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-01-24 18:28:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  update _pages _from _ui ( sender )  {  
						 
					
						
							
								
									
										
										
										
											2017-03-24 23:59:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  val  =  $ ( sender ) . val ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  raw  =  ! ! $ ( sender ) . attr ( 'data-page-start' )  ?  $ ( sender ) . attr ( 'data-page-start' )  :  val ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-03 05:50:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  s    =  fmt _escape _html ( fmt _strip _tags ( raw ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-24 23:59:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    update _pages ( current _template ,  s ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-24 18:28:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  postprocess _partial ( )  {  
						 
					
						
							
								
									
										
										
										
											2019-07-17 20:22:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '.pagination_class_input' ) . on ( 'keypress' ,  function ( e )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-24 18:28:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( e . keyCode  ==  13 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            update _pages _from _ui ( this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '.pagination_class_checkbox' ) . on ( 'click' ,  function ( e )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-24 18:28:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        update _pages _from _ui ( this ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '.pagination_class_select' ) . on ( 'change' ,  function ( e )  { 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-24 18:28:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        update _pages _from _ui ( this ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-13 05:25:01 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-02-27 20:34:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    setup _visibility ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-11-28 03:51:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '#main' ) . off ( 'click' ,  'div.section h2, div.section-hidden h2' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $ ( '#main' ) . on ( 'click' ,  'div.section h2, div.section-hidden h2' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            toggle _visibility ( $ ( this ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( '.sort' ) . on ( 'click' ,  function ( )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 00:05:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  sort  =  $ ( this ) . attr ( 'sort' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( current _sort  ==  sort )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                current _sort _reverse  =  !  current _sort _reverse ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                current _sort  =  sort ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                current _sort _reverse  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            update ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-04-26 19:30:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // TODO remove this hack when we get rid of "updatable"
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( $ ( '#filter-warning-show' ) . length  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $ ( '#filter-truncate' ) . addClass ( 'filter-warning' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $ ( '#filter-truncate' ) . removeClass ( 'filter-warning' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 00:05:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:08:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  update _multifields ( )  {  
						 
					
						
							
								
									
										
										
										
											2013-05-14 01:10:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( 'div.multifield' ) . each ( function ( index )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        update _multifield ( $ ( this ) ,  true ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  update _multifield ( multifield ,  dict )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  largest _id  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  empty _found  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  name  =  multifield . attr ( 'id' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-11 23:27:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  type _inputs  =  $ ( '#'  +  name  +  ' *[name$="_mftype"]' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    type _inputs . each ( function ( index )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-14 01:10:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  re  =  new  RegExp ( name  +  '_([0-9]*)_mftype' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  match  =  $ ( this ) . attr ( 'name' ) . match ( re ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( ! match )  return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  id  =  parseInt ( match [ 1 ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        largest _id  =  Math . max ( id ,  largest _id ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  prefix  =  name  +  '_'  +  id ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  type  =  $ ( this ) . val ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  input  =  $ ( '#'  +  prefix  +  '_mfvalue' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( type  ==  'list' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( input . length  ==  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-14 01:10:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                input . replaceWith ( '<div class="multifield-sub" id="'  +  prefix  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                  '"></div>' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            update _multifield ( $ ( '#'  +  prefix ) ,  false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( input . length  ==  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-14 01:10:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                var  key  =  dict  ?  $ ( '#'  +  prefix  +  '_mfkey' ) . val ( )  :  '' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                var  value  =  input . val ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if  ( key  ==  ''  &&  value  ==  '' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-11 23:27:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    if  ( index  ==  type _inputs . length  -  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        empty _found  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        $ ( this ) . parents ( '.mf' ) . first ( ) . remove ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:08:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-02 00:52:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:08:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-14 01:10:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $ ( '#'  +  prefix ) . replaceWith ( multifield _input ( prefix ,  'value' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                                             'text' ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! empty _found )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  prefix  =  name  +  '_'  +  ( largest _id  +  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  t  =  multifield . hasClass ( 'string-only' )  ?  'hidden'  :  'select' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  val _type  =  multifield _input ( prefix ,  'value' ,  'text' )  +  ' '  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            multifield _input ( prefix ,  'type' ,  t ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( dict )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-11 23:27:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            multifield . append ( '<table class="mf"><tr><td>'  + 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-14 01:10:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                              multifield _input ( prefix ,  'key' ,  'text' )  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                              '</td><td class="equals"> = </td><td>'  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                              val _type  +  '</td></tr></table>' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-09-11 23:27:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            multifield . append ( '<div class="mf">'  +  val _type  +  '</div>' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-14 01:10:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  multifield _input ( prefix ,  suffix ,  type )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( type  ==  'hidden'  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  '<input type="hidden" id="'  +  prefix  +  '_mf'  +  suffix  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            '" name="'  +  prefix  +  '_mf'  +  suffix  +  '" value="string"/>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else  if  ( type  ==  'text'  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  '<input type="text" id="'  +  prefix  +  '_mf'  +  suffix  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            '" name="'  +  prefix  +  '_mf'  +  suffix  +  '" value=""/>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else  if  ( type  ==  'select'  )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  '<select id="'  +  prefix  +  '_mf'  +  suffix  +  '" name="'  +  prefix  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            '_mf'  +  suffix  +  '">'  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            '<option value="string">String</option>'  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            '<option value="number">Number</option>'  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            '<option value="boolean">Boolean</option>'  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            '<option value="list">List</option>'  + 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            '</select>' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:08:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-11-13 19:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  update _filter _regex ( jElem )  {  
						 
					
						
							
								
									
										
										
										
											2013-11-13 00:41:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    current _filter _regex  =  null ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-13 19:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    jElem . parents ( '.filter' ) . children ( '.status-error' ) . remove ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( current _filter _regex _on  &&  $ . trim ( current _filter ) . length  >  0 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-13 00:41:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        try  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            current _filter _regex  =  new  RegExp ( current _filter , 'i' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-13 19:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        }  catch  ( e )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            jElem . parents ( '.filter' ) . append ( '<p class="status-error">'  + 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-24 23:59:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                            fmt _escape _html ( e . message )  +  '</p>' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-13 19:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-13 00:41:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  update _filter _regex _mode ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    current _filter _regex _on  =  $ ( this ) . is ( ':checked' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-13 19:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    update _filter _regex ( $ ( this ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-13 00:41:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    partial _update ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-04-08 21:00:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  update _filter ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    current _filter  =  $ ( this ) . val ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-13 01:09:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  table  =  $ ( this ) . parents ( 'table' ) . first ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    table . removeClass ( 'filter-active' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( $ ( this ) . val ( )  !=  '' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        table . addClass ( 'filter-active' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-26 17:50:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-13 19:09:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    update _filter _regex ( $ ( this ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-26 17:50:46 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    partial _update ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-25 23:13:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  update _truncate ( )  {  
						 
					
						
							
								
									
										
										
										
											2013-04-26 19:59:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  current _truncate _str  = 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $ ( this ) . val ( ) . replace ( new  RegExp ( '\\D' ,  'g' ) ,  '' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-03 06:20:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( current _truncate _str  ==  '' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-26 19:59:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        current _truncate _str  =  '0' ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-03 06:20:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( $ ( this ) . val ( )  !=  current _truncate _str )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-26 19:59:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $ ( this ) . val ( current _truncate _str ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-01-03 06:20:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  current _truncate  =  parseInt ( current _truncate _str ,  10 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-25 23:13:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    store _pref ( 'truncate' ,  current _truncate ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-04-08 21:00:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    partial _update ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 01:12:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  setup _visibility ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $ ( 'div.section,div.section-hidden' ) . each ( function ( _index )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  pref  =  section _pref ( current _template , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                $ ( this ) . children ( 'h2' ) . text ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  show  =  get _pref ( pref ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( show  ==  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            show  =  $ ( this ) . hasClass ( 'section' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 02:13:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            show  =  show  ==  't' ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 01:12:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( show )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $ ( this ) . addClass ( 'section-visible' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-02 22:41:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            // Workaround for... something. Although div.hider is
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            // display:block anyway, not explicitly setting this
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            // prevents the first slideToggle() from animating
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            // successfully; instead the element just vanishes.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $ ( this ) . find ( '.hider' ) . attr ( 'style' ,  'display:block;' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 01:12:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            $ ( this ) . addClass ( 'section-invisible' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  toggle _visibility ( item )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  hider  =  item . next ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  all  =  item . parent ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  pref  =  section _pref ( current _template ,  item . text ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    item . next ( ) . slideToggle ( 100 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( all . hasClass ( 'section-visible' ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( all . hasClass ( 'section' ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 02:13:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            store _pref ( pref ,  'f' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 01:12:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            clear _pref ( pref ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        all . removeClass ( 'section-visible' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        all . addClass ( 'section-invisible' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( all . hasClass ( 'section-hidden' ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 02:13:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            store _pref ( pref ,  't' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 01:12:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            clear _pref ( pref ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-18 01:12:03 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        all . removeClass ( 'section-invisible' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        all . addClass ( 'section-visible' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-25 22:17:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  publish _msg ( params0 )  {  
						 
					
						
							
								
									
										
										
										
											2017-03-23 19:07:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    try  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  params  =  params _magic ( params0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        publish _msg0 ( params ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  catch  ( e )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-23 20:43:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        show _popup ( 'warn' ,  fmt _escape _html ( e ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-23 19:07:47 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  publish _msg0 ( params )  {  
						 
					
						
							
								
									
										
										
										
											2011-02-24 01:59:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  path  =  fill _path _template ( '/exchanges/:vhost/:name/publish' ,  params ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-25 22:17:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    params [ 'payload_encoding' ]  =  'string' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    params [ 'properties' ]  =  { } ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-25 22:27:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    params [ 'properties' ] [ 'delivery_mode' ]  =  parseInt ( params [ 'delivery_mode' ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-25 22:17:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( params [ 'headers' ]  !=  '' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        params [ 'properties' ] [ 'headers' ]  =  params [ 'headers' ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-24 20:20:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  props  =  [ [ 'content_type' ,      'str' ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 [ 'content_encoding' ,  'str' ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 [ 'correlation_id' ,    'str' ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 [ 'reply_to' ,          'str' ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 [ 'expiration' ,        'str' ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 [ 'message_id' ,        'str' ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 [ 'type' ,              'str' ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 [ 'user_id' ,           'str' ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 [ 'app_id' ,            'str' ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 [ 'cluster_id' ,        'str' ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 [ 'priority' ,          'int' ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 [ 'timestamp' ,         'int' ] ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-25 22:17:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    for  ( var  i  in  props )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-24 20:20:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  name  =  props [ i ] [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  type  =  props [ i ] [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( params [ 'props' ] [ name ]  !=  undefined  &&  params [ 'props' ] [ name ]  !=  '' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  value  =  params [ 'props' ] [ name ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( type  ==  'int' )  value  =  parseInt ( value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            params [ 'properties' ] [ name ]  =  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-25 22:17:27 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-24 01:59:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    with _req ( 'POST' ,  path ,  JSON . stringify ( params ) ,  function ( resp )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  result  =  JSON . parse ( resp . responseText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-24 01:59:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( result . routed )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                show _popup ( 'info' ,  'Message published.' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                show _popup ( 'warn' ,  'Message published, but not routed.' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-22 22:00:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  get _msgs ( params )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  path  =  fill _path _template ( '/queues/:vhost/:name/get' ,  params ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    with _req ( 'POST' ,  path ,  JSON . stringify ( params ) ,  function ( resp )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  msgs  =  JSON . parse ( resp . responseText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-22 22:00:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( msgs . length  ==  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                show _popup ( 'info' ,  'Queue is empty' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $ ( '#msg-wrapper' ) . slideUp ( 200 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                replace _content ( 'msg-wrapper' ,  format ( 'messages' ,  { 'msgs' :  msgs } ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $ ( '#msg-wrapper' ) . slideDown ( 200 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-22 02:20:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-07 00:52:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  with _reqs ( reqs ,  acc ,  fun )  {  
						 
					
						
							
								
									
										
										
										
											2010-09-02 19:58:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( keys ( reqs ) . length  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  key  =  keys ( reqs ) [ 0 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-22 22:00:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        with _req ( 'GET' ,  reqs [ key ] ,  null ,  function ( resp )  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-17 15:08:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                acc [ key ]  =  JSON . parse ( resp . responseText ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-31 23:44:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                var  remainder  =  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                for  ( var  k  in  reqs )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    if  ( k  !=  key )  remainder [ k ]  =  reqs [ k ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                with _reqs ( remainder ,  acc ,  fun ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-07 00:52:26 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        fun ( acc ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-13 00:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  replace _content ( id ,  html )  {  
						 
					
						
							
								
									
										
										
										
											2011-01-28 19:12:29 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ ( "#"  +  id ) . html ( html ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-13 00:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-09-20 21:31:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								var  ejs _cached  =  { } ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-12 22:04:42 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								function  format ( template ,  json )  {  
						 
					
						
							
								
									
										
										
										
											2014-10-06 20:05:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    try  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-09-20 21:31:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  cache  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( ! ( template  in  ejs _cached ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ejs _cached [ template ]  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            cache  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  tmpl  =  new  EJS ( { url :  'js/tmpl/'  +  template  +  '.ejs' ,  cache :  cache } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-17 00:38:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  tmpl . render ( json ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 20:05:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    }  catch  ( err )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        clearInterval ( timer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-28 19:40:08 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        console . log ( "Uncaught error: "  +  err ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        console . log ( "Stack: "  +  err [ 'stack' ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        debug ( err [ 'name' ]  +  ": "  +  err [ 'message' ]  +  "\n"  +  err [ 'stack' ]  +  "\n" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-10-06 20:05:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-12 22:04:42 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-31 23:44:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  update _status ( status )  {  
						 
					
						
							
								
									
										
										
										
											2010-07-13 00:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  text ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( status  ==  'ok' ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-27 00:17:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        text  =  "Refreshed "  +  fmt _date ( new  Date ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-14 19:33:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    else  if  ( status  ==  'error' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  next _try  =  new  Date ( new  Date ( ) . getTime ( )  +  timer _interval ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        text  =  "Error: could not connect to server since "  + 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-27 00:17:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            fmt _date ( last _successful _connect )  +  ". Will retry at "  + 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-14 19:45:45 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            fmt _date ( next _try )  +  "." ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-14 19:33:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 22:59:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        throw ( "Unknown status "  +  status ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-13 00:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-17 00:38:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  html  =  format ( 'status' ,  { status :  status ,  text :  text } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-13 00:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    replace _content ( 'status' ,  html ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-03-22 20:44:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  has _auth _cookie _value ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  get _cookie _value ( 'auth' )  !=  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-10-23 23:35:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  auth _header ( )  {  
						 
					
						
							
								
									
										
										
										
											2019-07-26 21:58:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if ( has _auth _cookie _value ( )  &&  enable _uaa )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  "Bearer "  +  decodeURIComponent ( get _pref ( 'uaa_token' ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-22 20:44:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    }  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-26 21:58:37 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if ( has _auth _cookie _value ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  "Basic "  +  decodeURIComponent ( get _cookie _value ( 'auth' ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-22 20:44:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-23 23:35:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-02-22 22:00:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  with _req ( method ,  path ,  body ,  fun )  {  
						 
					
						
							
								
									
										
										
										
											2017-03-22 20:44:21 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if ( ! has _auth _cookie _value ( ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // navigate to the login form
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        location . reload ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-12 22:04:42 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    var  json ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-03 20:23:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  req  =  xmlHttpRequest ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-08 00:25:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    req . open ( method ,  'api'  +  path ,  true  ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-23 23:35:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    req . setRequestHeader ( 'authorization' ,  auth _header ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-04-14 05:22:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    req . setRequestHeader ( 'x-vhost' ,  current _vhost ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-12 22:04:42 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								    req . onreadystatechange  =  function  ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( req . readyState  ==  4 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-05 20:03:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  ix  =  jQuery . inArray ( req ,  outstanding _reqs ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( ix  !=  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                outstanding _reqs . splice ( ix ,  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 19:34:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( check _bad _response ( req ,  true ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-01-14 19:33:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                last _successful _connect  =  new  Date ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-31 23:44:12 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                fun ( req ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-12 22:04:42 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-11-05 20:03:54 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    outstanding _reqs . push ( req ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-02-22 22:00:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    req . send ( body ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-07-12 22:04:42 +08:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2010-07-13 20:03:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 17:16:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  get ( url ,  accept ,  callback )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  var  req  =  new  XMLHttpRequest ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  req . open ( "GET" ,  url ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  req . setRequestHeader ( "Accept" ,  accept ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  req . send ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  req . onreadystatechange  =  function ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( req . readyState  ==  XMLHttpRequest . DONE )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      callback ( req ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-09-08 23:27:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  sync _get ( path )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  sync _req ( 'GET' ,  [ ] ,  path ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-25 01:46:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  sync _put ( sammy ,  path _template )  {  
						 
					
						
							
								
									
										
										
										
											2010-09-09 01:00:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  sync _req ( 'PUT' ,  sammy . params ,  path _template ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-25 01:46:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-01-11 20:36:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  sync _delete ( sammy ,  path _template ,  options )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  sync _req ( 'DELETE' ,  sammy . params ,  path _template ,  options ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-25 01:46:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-09-02 00:26:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  sync _post ( sammy ,  path _template )  {  
						 
					
						
							
								
									
										
										
										
											2010-09-09 01:00:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  sync _req ( 'POST' ,  sammy . params ,  path _template ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-02 00:26:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-01-11 20:36:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  sync _req ( type ,  params0 ,  path _template ,  options )  {  
						 
					
						
							
								
									
										
										
										
											2011-03-09 02:43:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  params ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-15 01:09:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  path ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    try  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-09 02:43:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        params  =  params _magic ( params0 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-15 01:09:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        path  =  fill _path _template ( path _template ,  params ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    }  catch  ( e )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-23 20:43:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        show _popup ( 'warn' ,  fmt _escape _html ( e ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-15 01:09:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-03 20:23:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  req  =  xmlHttpRequest ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-06-08 00:25:00 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    req . open ( type ,  'api'  +  path ,  false ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-24 01:32:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    req . setRequestHeader ( 'content-type' ,  'application/json' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-23 23:35:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    req . setRequestHeader ( 'authorization' ,  auth _header ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-11 20:36:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( options  !=  undefined  ||  options  !=  null )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-07 07:20:51 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( options . headers  !=  undefined  ||  options . headers  !=  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            jQuery . each ( options . headers ,  function  ( k ,  v )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            req . setRequestHeader ( k ,  v ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2013-01-11 20:36:15 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-09-03 20:23:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    try  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-29 14:18:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( type  ==  'GET' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            req . send ( null ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            req . send ( JSON . stringify ( params ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-03 20:23:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    catch  ( e )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( e . number  ==  0x80004004 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            // 0x80004004 means "Operation aborted."
 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-20 16:17:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            // https://support.microsoft.com/kb/186063
 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-03 20:23:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            // MSIE6 appears to do this in response to HTTP 204.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-24 01:32:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 19:34:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( check _bad _response ( req ,  false ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 19:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( type  ==  'GET' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  req . responseText ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-09 01:00:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        return  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 19:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2010-09-09 01:00:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 19:34:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  check _bad _response ( req ,  full _page _404 )  {  
						 
					
						
							
								
									
										
										
										
											2019-03-20 16:17:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // 1223 == 204 - see https://www.enhanceie.com/ie/bugs.asp
 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-03 20:23:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    // MSIE7 and 8 appear to do this in response to HTTP 204.
 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 19:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( ( req . status  >=  200  &&  req . status  <  300 )  ||  req . status  ==  1223 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 19:34:55 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    else  if  ( req . status  ==  404  &&  full _page _404 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  html  =  format ( '404' ,  { } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        replace _content ( 'main' ,  html ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-22 18:46:52 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    else  if  ( req . status  >=  400  &&  req . status  <=  404 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 19:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  reason  =  JSON . parse ( req . responseText ) . reason ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( typeof ( reason )  !=  'string' )  reason  =  JSON . stringify ( reason ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-22 15:55:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  error  =  JSON . parse ( req . responseText ) . error ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( typeof ( error )  !=  'string' )  error  =  JSON . stringify ( error ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-03 16:23:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-01-03 18:38:24 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( error  ==  'bad_request'  ||  error  ==  'not_found'  ||  error  ==  'not_authorised' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-03-23 20:43:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            show _popup ( 'warn' ,  fmt _escape _html ( reason ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-20 20:01:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        }  else  if  ( error  ==  'page_out_of_range' )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  seconds  =  60 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( last _page _out _of _range _error  >  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-03 16:23:05 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    seconds  =  ( new  Date ( ) . getTime ( )  -  last _page _out _of _range _error . getTime ( ) ) / 1000 ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( seconds  >  3 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 Sammy . log ( 'server reports page is out of range, redirecting to page 1' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-19 17:33:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                 var  contexts  =  [ "queues" ,  "exchanges" ,  "connections" ,  "channels" ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-19 19:42:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                 var  matches  =  /api\/(.*)\?/ . exec ( req . responseURL ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                 if  ( matches  !=  null  &&  matches . length  >  1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-30 09:29:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                     contexts . forEach ( function ( item )  { 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-19 19:42:35 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                         if  ( matches [ 1 ] . indexOf ( item )  ==  0 )  { update _pages ( item ,  1 ) } ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-12-30 09:29:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                     } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-25 16:58:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                 }  else  update _pages ( current _template ,  1 ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-26 06:51:53 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-12-30 09:29:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                 last _page _out _of _range _error  =  new  Date ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2015-11-17 23:59:49 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2016-01-20 20:01:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2015-10-13 21:53:20 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 19:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    else  if  ( req . status  ==  408 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        update _status ( 'timeout' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else  if  ( req . status  ==  0 )  {  // Non-MSIE: could not connect
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        update _status ( 'error' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    else  if  ( req . status  >  12000 )  {  // MSIE: could not connect
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        update _status ( 'error' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-08-12 01:21:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    else  if  ( req . status  ==  503 )  {  // Proxy: could not connect
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        update _status ( 'error' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 19:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    else  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-27 18:26:40 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        debug ( "Management API returned status code "  +  req . status  +  " - <strong>"  +  fmt _escape _html _one _line ( req . responseText )  +  "</strong>" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 19:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        clearInterval ( timer ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-24 01:32:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-08 23:27:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-16 19:11:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-24 01:32:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2010-07-13 20:03:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-08-25 01:46:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  fill _path _template ( template ,  params )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  re  =  /:[a-zA-Z_]*/g ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  template . replace ( re ,  function ( m )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-15 01:09:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            var  str  =  esc ( params [ m . substring ( 1 ) ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( str  ==  '' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                throw ( m . substring ( 1 )  +  " is required" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  str ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-08-25 01:46:30 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 01:40:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  params _magic ( params )  {  
						 
					
						
							
								
									
										
										
										
											2014-09-11 23:27:39 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  check _password ( maybe _remove _fields ( collapse _multifields ( params ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 01:40:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:08:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  collapse _multifields ( params0 )  {  
						 
					
						
							
								
									
										
										
										
											2013-05-15 22:19:11 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    function  set ( x )  {  return  x  !=  ''  &&  x  !=  undefined  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:08:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  params  =  { } ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-14 20:30:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    var  ks  =  keys ( params0 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  ids  =  [ ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( i  in  ks )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  key  =  ks [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  match  =  key . match ( /([a-z]*)_([0-9_]*)_mftype/ ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  match2  =  key . match ( /[a-z]*_[0-9_]*_mfkey/ ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  match3  =  key . match ( /[a-z]*_[0-9_]*_mfvalue/ ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-06-07 22:25:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( match  ==  null  &&  match2  ==  null  &&  match3  ==  null )  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:08:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            params [ key ]  =  params0 [ key ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  if  ( match  ==  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            // Do nothing, value is handled below
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  name  =  match [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  id  =  match [ 2 ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-14 20:30:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            ids . push ( [ name ,  id ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    ids . sort ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  id _map  =  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( i  in  ids )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  name  =  ids [ i ] [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  id  =  ids [ i ] [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( params [ name ]  ==  undefined )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            params [ name ]  =  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            id _map [ name ]  =  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  id _parts  =  id . split ( '_' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  k  =  params0 [ name  +  '_'  +  id _parts [ 0 ]  +  '_mfkey' ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  v  =  params0 [ name  +  '_'  +  id  +  '_mfvalue' ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  t  =  params0 [ name  +  '_'  +  id  +  '_mftype' ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-15 22:04:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  val  =  null ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-23 21:10:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  top _level  =  id _parts . length  ==  1 ; 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-15 22:04:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( t  ==  'list' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            val  =  [ ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            id _map [ name ] [ id ]  =  val ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-23 21:10:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        else  if  ( ( set ( k )  &&  top _level )  ||  set ( v ) )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-14 20:30:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( t  ==  'boolean' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if  ( v  !=  'true'  &&  v  !=  'false' ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    throw ( k  +  ' must be "true" or "false"; got '  +  v ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                val  =  ( v  ==  'true' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:08:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-14 20:30:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            else  if  ( t  ==  'number' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                var  n  =  parseFloat ( v ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                if  ( isNaN ( n ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    throw ( k  +  ' must be a number; got '  +  v ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                val  =  n ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                val  =  v ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-15 22:04:33 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( val  !=  null )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-04-23 21:10:59 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            if  ( top _level )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-05-14 20:30:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                params [ name ] [ k ]  =  val ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                var  prefix  =  id _parts . slice ( 0 ,  id _parts . length  -  1 ) . join ( '_' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                id _map [ name ] [ prefix ] . push ( val ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:08:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-16 21:30:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( params . hasOwnProperty ( 'queuetype' ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        delete  params [ 'queuetype' ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        params [ 'arguments' ] [ 'x-queue-type' ]  =  queue _type ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( queue _type  ==  'quorum' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            params [ 'durable' ]  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            params [ 'auto_delete' ]  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2010-10-12 21:08:17 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  params ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-03-09 02:43:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  check _password ( params )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( params [ 'password' ]  !=  undefined )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-03-08 21:17:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( params [ 'password' ]  ==  '' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            throw ( "Please specify a password." ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-03-09 02:43:14 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( params [ 'password' ]  !=  params [ 'password_confirm' ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            throw ( "Passwords do not match." ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        delete  params [ 'password_confirm' ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  params ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-05-25 22:50:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  maybe _remove _fields ( params )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $ ( '.controls-appearance' ) . each ( function ( index )  { 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-22 23:32:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        var  options  =  $ ( this ) . get ( 0 ) . options ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  selected  =  $ ( this ) . val ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        for  ( i  =  0 ;  i  <  options . length ;  i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  option  =  options [ i ] . value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( option  !=  selected )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                delete  params [ option ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-25 22:50:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2013-11-22 23:32:44 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        delete  params [ $ ( this ) . attr ( 'name' ) ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-05-25 22:50:31 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-12-09 01:40:10 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  params ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2013-02-02 01:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  put _parameter ( sammy ,  mandatory _keys ,  num _keys ,  bool _keys ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                       arrayable _keys )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-18 22:33:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    for  ( var  i  in  sammy . params )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( i  ===  'length'  ||  ! sammy . params . hasOwnProperty ( i ) )  continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-20 23:51:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( sammy . params [ i ]  ==  ''  &&  jQuery . inArray ( i ,  mandatory _keys )  ==  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-18 22:33:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            delete  sammy . params [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-20 23:51:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        else  if  ( jQuery . inArray ( i ,  num _keys )  !=  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-18 22:33:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            sammy . params [ i ]  =  parseInt ( sammy . params [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-20 23:51:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        else  if  ( jQuery . inArray ( i ,  bool _keys )  !=  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-09-07 20:15:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            sammy . params [ i ]  =  sammy . params [ i ]  ==  'true' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2013-02-02 01:31:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        else  if  ( jQuery . inArray ( i ,  arrayable _keys )  !=  - 1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            sammy . params [ i ]  =  sammy . params [ i ] . split ( ' ' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            if  ( sammy . params [ i ] . length  ==  1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                sammy . params [ i ]  =  sammy . params [ i ] [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-18 22:33:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  params  =  { "component" :  sammy . params . component , 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-08 00:39:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                  "vhost" :      sammy . params . vhost , 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-22 22:07:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                  "name" :       sammy . params . name , 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-18 22:33:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                  "value" :      params _magic ( sammy . params ) } ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-08-08 00:39:09 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    delete  params . value . vhost ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-18 22:33:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    delete  params . value . component ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-22 22:07:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    delete  params . value . name ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-18 22:33:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    sammy . params  =  params ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-22 22:07:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( sync _put ( sammy ,  '/parameters/:component/:vhost/:name' ) )  update ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-18 22:33:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-10-03 20:06:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  put _cast _params ( sammy ,  path ,  mandatory _keys ,  num _keys ,  bool _keys )  {  
						 
					
						
							
								
									
										
										
										
											2012-10-08 22:06:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    for  ( var  i  in  sammy . params )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( i  ===  'length'  ||  ! sammy . params . hasOwnProperty ( i ) )  continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-20 23:51:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( sammy . params [ i ]  ==  ''  &&  jQuery . inArray ( i ,  mandatory _keys )  ==  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-08 22:06:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            delete  sammy . params [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-20 23:51:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        else  if  ( jQuery . inArray ( i ,  num _keys )  !=  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-08 22:06:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            sammy . params [ i ]  =  parseInt ( sammy . params [ i ] ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2012-11-20 23:51:50 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        else  if  ( jQuery . inArray ( i ,  bool _keys )  !=  - 1 )  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-08 22:06:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            sammy . params [ i ]  =  sammy . params [ i ]  ==  'true' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2016-10-03 20:06:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( sync _put ( sammy ,  path ) )  update ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-08 22:06:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2012-05-18 22:33:13 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-09-19 22:19:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  update _column _options ( sammy )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  mode  =  sammy . params [ 'mode' ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( var  group  in  COLUMNS [ mode ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  options  =  COLUMNS [ mode ] [ group ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        for  ( var  i  =  0 ;  i  <  options . length ;  i ++ )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  key  =  options [ i ] [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            var  value  =  sammy . params [ mode  +  '-'  +  key ]  !=  undefined ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            store _pref ( 'column-'  +  mode  +  '-'  +  key ,  value ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    partial _update ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-07-13 20:03:36 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								function  debug ( str )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $ ( '<p>'  +  str  +  '</p>' ) . appendTo ( '#debug' ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-02 19:58:34 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  keys ( obj )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  ks  =  [ ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( var  k  in  obj )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ks . push ( k ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  ks ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-03 20:23:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2015-04-14 05:22:19 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Don't use the jQuery AJAX support, it seems to have trouble reporting
  
						 
					
						
							
								
									
										
										
										
											2010-09-03 20:23:04 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// server-down type errors.
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  xmlHttpRequest ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  res ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    try  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        res  =  new  XMLHttpRequest ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    catch ( e )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        res  =  new  ActiveXObject ( "Microsoft.XMLHttp" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  res ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-09-09 01:00:32 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2010-10-16 01:11:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-11-07 19:39:57 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Our base64 library takes a string that is really a byte sequence,
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// and will throw if given a string with chars > 255 (and hence not
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// DTRT for chars > 127). So encode a unicode string as a UTF-8
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// sequence of "bytes".
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  b64 _encode _utf8 ( str )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  base64 . encode ( encode _utf8 ( str ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								// encodeURIComponent handles utf-8, unescape does not. Neat!
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  encode _utf8 ( str )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  return  unescape ( encodeURIComponent ( str ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-10-16 01:11:42 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								( function ( $ ) {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    $ . fn . extend ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        center :  function  ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            return  this . each ( function ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                var  top  =  ( $ ( window ) . height ( )  -  $ ( this ) . outerHeight ( ) )  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                var  left  =  ( $ ( window ) . width ( )  -  $ ( this ) . outerWidth ( ) )  /  2 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                $ ( this ) . css ( { margin : 0 ,  top :  ( top  >  0  ?  top  :  0 ) + 'px' ,  left :  ( left  >  0  ?  left  :  0 ) + 'px' } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2012-10-08 22:06:56 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								} ) ( jQuery ) ;  
						 
					
						
							
								
									
										
										
										
											2013-04-08 21:00:06 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  debounce ( f ,  delay )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  timeout  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  function ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  obj  =  this ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  args  =  arguments ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        function  delayed  ( )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            f . apply ( obj ,  args ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            timeout  =  null ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( timeout )  clearTimeout ( timeout ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        timeout  =  setTimeout ( delayed ,  delay ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2016-10-03 20:06:16 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  rename _multifield ( params ,  from ,  to )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  new _params  =  { } ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for ( var  key  in  params ) { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  match  =  key . match ( "^"  +  from  +  "_[0-9_]*_mftype$" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  match2  =  key . match ( "^"  +  from  +   "_[0-9_]*_mfkey$" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  match3  =  key . match ( "^"  +  from  +  "_[0-9_]*_mfvalue$" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( match  !=  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            new _params [ match [ 0 ] . replace ( from ,  to ) ]  =  params [ match ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  if  ( match2  !=  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            new _params [ match2 [ 0 ] . replace ( from ,  to ) ]  =  params [ match2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  if  ( match3  !=  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            new _params [ match3 [ 0 ] . replace ( from ,  to ) ]  =  params [ match3 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            new _params [ key ]  =  params [ key ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  new _params ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-07-16 21:30:02 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  select _queue _type ( queuetype )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    queue _type  =  queuetype . value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    update ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-11-09 20:02:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  is _quorum ( queue )  {  
						 
					
						
							
								
									
										
										
										
											2018-11-22 16:38:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  queue [ "arguments" ] [ "x-queue-type" ]  ==  "quorum" ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-09 20:02:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  is _classic ( queue )  {  
						 
					
						
							
								
									
										
										
										
											2018-11-22 16:38:43 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    return  queue [ "arguments" ] [ "x-queue-type" ]  ==  "classic" ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-11-09 20:02:48 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2018-12-13 08:03:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  ensure _queues _chart _range ( )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  range  =  get _pref ( 'chart-range' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    // Note: the queues page uses the 'basic' range type
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  fixup _range ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  valid _range  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  range _type  =  get _chart _range _type ( 'queues' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    var  chart _periods  =  CHART _RANGES [ range _type ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    for  ( var  i  =  0 ;  i  <  chart _periods . length ;  ++ i )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  data  =  chart _periods [ i ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        var  val  =  data [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( range  ===  val )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            valid _range  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // If the range needs to be adjusted, use the last
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        // valid one
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        fixup _range  =  val ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( ! valid _range )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        store _pref ( 'chart-range' ,  fixup _range ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								function  get _chart _range _type ( arg )  {  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   / * 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    *  'arg'  can  be : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    *  lengths - over  for  the  Overview  page 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    *  lengths - q  for  the  per - queue  page 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    *  queues  for  setting  up  the  queues  range 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    * / 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( arg  ===  'lengths-over' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  'global' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-23 19:25:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( arg  ===  'msg-rates-over' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  'global' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-13 08:03:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( arg  ===  'lengths-q' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  'basic' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-23 19:25:23 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( arg  ===  'msg-rates-q' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  'basic' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-13 08:03:38 +08:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( arg  ===  'queues' )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  'basic' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    console . log ( '[WARNING]: range type not found for arg: '  +  arg ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    return  'basic' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}