2015-12-24 05:29:04 +00:00
var app = angular . module ( "easyctf" , [ "ngRoute" ] ) ;
2016-01-16 21:12:32 +00:00
app . config ( [ "$compileProvider" , function ( $compileProvider ) {
$compileProvider . aHrefSanitizationWhitelist ( /^\s*(https?|ftp|mailto|file|javascript):/ ) ;
} ] ) ;
2015-12-25 03:38:00 +00:00
app . config ( function ( $routeProvider , $locationProvider ) {
2016-01-06 06:15:57 +00:00
$routeProvider . when ( "/" , {
templateUrl : "pages/home.html" ,
controller : "mainController"
} )
. when ( "/about" , {
templateUrl : "pages/about.html" ,
controller : "mainController"
} )
2016-01-07 00:23:43 +00:00
. when ( "/chat" , {
templateUrl : "pages/chat.html" ,
controller : "mainController"
} )
2016-01-07 06:23:00 +00:00
. when ( "/learn" , {
templateUrl : "pages/learn.html" ,
2016-01-06 06:15:57 +00:00
controller : "mainController"
} )
. when ( "/login" , {
templateUrl : "pages/login.html" ,
controller : "mainController"
} )
2016-01-07 06:23:00 +00:00
. when ( "/logout" , {
templateUrl : "pages/blank.html" ,
controller : "logoutController"
} )
2016-01-06 06:15:57 +00:00
. when ( "/profile" , {
templateUrl : "pages/profile.html" ,
2016-01-07 00:23:43 +00:00
controller : "profileController"
2016-01-06 06:15:57 +00:00
} )
2016-01-07 06:23:00 +00:00
. when ( "/profile/:username" , {
templateUrl : "pages/profile.html" ,
controller : "profileController"
} )
. when ( "/register" , {
templateUrl : "pages/register.html" ,
controller : "mainController"
} )
. when ( "/scoreboard" , {
templateUrl : "pages/scoreboard.html" ,
2016-01-18 06:41:11 +00:00
controller : "scoreboardController"
2016-01-07 06:23:00 +00:00
} )
. when ( "/settings" , {
templateUrl : "pages/settings.html" ,
2016-03-03 05:36:51 +00:00
controller : "settingsController"
2016-01-07 00:23:43 +00:00
} )
2016-04-17 02:15:57 +00:00
. when ( "/problems" , {
templateUrl : "pages/problems.html" ,
controller : "problemsController"
} )
2016-04-18 21:59:36 +00:00
. when ( "/programming" , {
templateUrl : "pages/programming.html" ,
controller : "programmingController"
} )
2016-01-16 22:36:30 +00:00
. when ( "/forgot" , {
templateUrl : "pages/forgot.html" ,
controller : "resetController"
} )
. when ( "/forgot/:token" , {
templateUrl : "pages/forgot.html" ,
controller : "resetController"
} )
2016-01-12 03:54:26 +00:00
. when ( "/team" , {
templateUrl : "pages/team.html" ,
controller : "teamController"
} )
. when ( "/team/:teamname" , {
templateUrl : "pages/team.html" ,
controller : "teamController"
} )
2016-01-07 00:23:43 +00:00
. when ( "/admin/problems" , {
templateUrl : "pages/admin/problems.html" ,
controller : "adminProblemsController"
} )
2016-04-17 00:01:21 +00:00
. when ( "/admin/settings" , {
templateUrl : "pages/admin/settings.html" ,
controller : "adminSettingsController"
} )
2016-01-07 00:23:43 +00:00
. otherwise ( {
templateUrl : "pages/404.html" ,
controller : "mainController"
2016-01-06 06:15:57 +00:00
} ) ;
$locationProvider . html5Mode ( true ) ;
2015-12-23 22:34:22 +00:00
} ) ;
2015-12-24 05:29:04 +00:00
2016-03-12 07:34:26 +00:00
function api _call ( method , url , data , callback _success , callback _fail ) {
if ( method . toLowerCase ( ) == "post" ) {
data [ "csrf_token" ] = $ . cookie ( "csrf_token" ) ;
}
$ . ajax ( {
"type" : method ,
"datatype" : "json" ,
"data" : data ,
"url" : url ,
"cache" : false
} ) . done ( callback _success ) . fail ( callback _fail ) ;
}
function permanent _message ( containerId , alertType , message , callback ) {
$ ( "#" + containerId ) . html ( "<div class=\"alert alert-" + alertType + "\" style=\"margin:0;\">" + message + "</div>" ) ;
$ ( "#" + containerId ) . hide ( ) . slideDown ( "fast" , "swing" ) ;
} ;
function display _message ( containerId , alertType , message , callback ) {
$ ( "#" + containerId ) . html ( "<div class=\"alert alert-" + alertType + "\">" + message + "</div>" ) ;
$ ( "#" + containerId ) . hide ( ) . slideDown ( "fast" , "swing" , function ( ) {
window . setTimeout ( function ( ) {
$ ( "#" + containerId ) . slideUp ( "fast" , "swing" , callback ) ;
} , message . length * 55 ) ;
} ) ;
} ;
2016-01-06 06:15:57 +00:00
app . controller ( "mainController" , [ "$scope" , "$http" , function ( $scope , $http ) {
$scope . config = { navbar : { } } ;
2016-03-04 00:27:10 +00:00
$scope . timestamp = Date . now ( ) ;
2016-03-12 07:34:26 +00:00
api _call ( "GET" , "/api/user/status" , { } , function ( result ) {
2016-01-06 06:15:57 +00:00
if ( result [ "success" ] == 1 ) {
2016-01-12 03:54:26 +00:00
delete result [ "success" ] ;
$scope . config . navbar = result ;
$scope . $emit ( "loginStatus" ) ;
2016-01-06 06:15:57 +00:00
} else {
$scope . config . navbar . logged _in = false ;
}
2016-01-07 00:23:43 +00:00
$scope . $apply ( ) ;
2016-03-12 07:34:26 +00:00
} , function ( ) {
2016-01-06 06:15:57 +00:00
$scope . config . navbar . logged _in = false ;
2016-01-07 00:23:43 +00:00
$scope . $apply ( ) ;
2016-03-12 07:34:26 +00:00
permanent _message ( "site-message" , "danger" , "<div class='container'>The EasyCTF API server is currently down. We're working to fix this error right away. Follow <a href='http://twitter.com/easyctf' target='_blank'>@easyctf</a> for status updates.</div>" ) ;
2016-01-06 06:15:57 +00:00
} ) ;
} ] ) ;
app . controller ( "logoutController" , function ( ) {
2016-03-12 07:34:26 +00:00
api _call ( "GET" , "/api/user/logout" , { } , function ( result ) {
2016-01-06 06:15:57 +00:00
location . href = "/" ;
} ) ;
2015-12-26 06:36:55 +00:00
} ) ;
2016-01-02 18:20:12 +00:00
2016-01-07 06:23:00 +00:00
app . controller ( "profileController" , [ "$controller" , "$scope" , "$http" , "$routeParams" , function ( $controller , $scope , $http , $routeParams ) {
var data = { } ;
if ( "username" in $routeParams ) data [ "username" ] = $routeParams [ "username" ] ;
2016-01-07 00:23:43 +00:00
$controller ( "mainController" , { $scope : $scope } ) ;
2016-03-12 07:34:26 +00:00
api _call ( "GET" , "/api/user/info" , data , function ( result ) {
2016-01-07 00:23:43 +00:00
if ( result [ "success" ] == 1 ) {
$scope . user = result [ "user" ] ;
}
$scope . $apply ( ) ;
$ ( ".timeago" ) . timeago ( ) ;
} ) ;
} ] ) ;
2016-01-12 03:54:26 +00:00
app . controller ( "loginController" , [ "$controller" , "$scope" , "$http" , function ( $controller , $scope , $http ) {
$controller ( "mainController" , { $scope : $scope } ) ;
$scope . $on ( "loginStatus" , function ( ) {
if ( $scope . config [ "navbar" ] . logged _in != true ) {
location . href = "/login" ;
return ;
}
} ) ;
} ] ) ;
app . controller ( "teamController" , [ "$controller" , "$scope" , "$http" , "$routeParams" , function ( $controller , $scope , $http , $routeParams ) {
var data = { } ;
if ( "teamname" in $routeParams ) {
data [ "teamname" ] = $routeParams [ "teamname" ] ;
} else {
$controller ( "loginController" , { $scope : $scope } ) ;
}
2016-03-12 07:34:26 +00:00
api _call ( "GET" , "/api/team/info" , data , function ( result ) {
2016-01-18 06:41:11 +00:00
if ( result [ "success" ] == 1 ) {
$scope . team = result [ "team" ] ;
}
$scope . $apply ( ) ;
$ ( ".timeago" ) . timeago ( ) ;
} ) ;
} ] ) ;
app . controller ( "scoreboardController" , [ "$controller" , "$scope" , "$http" , function ( $controller , $scope , $http ) {
$controller ( "mainController" , { $scope : $scope } ) ;
api _call ( "GET" , "/api/stats/scoreboard" , { } , function ( result ) {
if ( result [ "success" ] == 1 ) {
$scope . scoreboard = result [ "scoreboard" ] ;
$scope . $apply ( ) ;
}
} ) ;
2016-01-16 22:36:30 +00:00
} ] ) ;
app . controller ( "resetController" , [ "$controller" , "$scope" , "$http" , "$routeParams" , function ( $controller , $scope , $http , $routeParams ) {
var data = { } ;
2016-01-27 02:30:30 +00:00
$scope . token = false ;
data [ "csrf_token" ] = $ . cookie ( "csrf_token" ) ;
2016-01-16 22:36:30 +00:00
if ( "token" in $routeParams ) {
2016-01-27 02:30:30 +00:00
$scope . token = true ;
2016-01-16 22:36:30 +00:00
token = $routeParams [ "token" ] ;
2016-03-12 07:34:26 +00:00
api _call ( "GET" , "/api/user/forgot/" + token , data , function ( data ) {
2016-01-27 02:30:30 +00:00
$scope . body = data [ "message" ] ;
$scope . success = data [ "success" ]
$scope . $apply ( ) ;
2016-01-16 22:36:30 +00:00
} ) ;
} else {
$controller ( "mainController" , { $scope : $scope } ) ;
}
2016-01-12 03:54:26 +00:00
} ] ) ;
2016-01-07 08:40:19 +00:00
app . controller ( "adminController" , [ "$controller" , "$scope" , "$http" , function ( $controller , $scope , $http ) {
2016-01-07 00:23:43 +00:00
$controller ( "mainController" , { $scope : $scope } ) ;
2016-01-12 03:54:26 +00:00
$scope . $on ( "loginStatus" , function ( ) {
2016-01-07 08:40:19 +00:00
if ( $scope . config [ "navbar" ] . logged _in != true ) {
location . href = "/login" ;
return ;
}
if ( $scope . config [ "navbar" ] . admin != true ) {
location . href = "/profile" ;
return ;
}
} ) ;
} ] ) ;
app . controller ( "adminProblemsController" , [ "$controller" , "$scope" , "$http" , function ( $controller , $scope , $http ) {
$controller ( "adminController" , { $scope : $scope } ) ;
2016-03-12 07:34:26 +00:00
api _call ( "GET" , "/api/admin/problems/list" , { } , function ( result ) {
2016-01-07 08:01:18 +00:00
if ( result [ "success" ] == 1 ) {
$scope . problems = result [ "problems" ] ;
2016-03-12 07:34:26 +00:00
} else {
$scope . problems = [ ] ;
2016-01-07 08:01:18 +00:00
}
$scope . $apply ( ) ;
2016-04-08 02:48:12 +00:00
$scope . problems . forEach ( function ( problem ) {
var grader = ace . edit ( problem . pid + "_grader" ) ;
grader . setTheme ( "ace/theme/tomorrow" ) ;
grader . getSession ( ) . setMode ( "ace/mode/python" ) ;
grader . setValue ( problem . grader _contents ) ;
} ) ;
2016-01-07 08:01:18 +00:00
} ) ;
2016-01-07 00:23:43 +00:00
} ] ) ;
2016-04-17 00:01:21 +00:00
app . controller ( "adminSettingsController" , [ "$controller" , "$scope" , "$http" , function ( $controller , $scope , $http ) {
$controller ( "adminController" , { $scope : $scope } ) ;
api _call ( "GET" , "/api/admin/settings" , { } , function ( result ) {
if ( result [ "success" ] == 1 ) {
$scope . settings = result [ "settings" ] ;
}
$scope . $apply ( ) ;
} ) ;
} ] ) ;
2016-03-03 05:36:51 +00:00
app . controller ( "settingsController" , [ "$controller" , "$scope" , "$http" , function ( $controller , $scope , $http ) {
2016-03-04 00:53:49 +00:00
$controller ( "loginController" , { $scope : $scope } ) ;
2016-03-12 07:34:26 +00:00
api _call ( "GET" , "/api/user/info" , { } , function ( result ) {
2016-03-03 05:36:51 +00:00
if ( result [ "success" ] == 1 ) {
$scope . user = result [ "user" ] ;
}
$scope . $apply ( ) ;
} ) ;
} ] ) ;
2016-04-17 02:15:57 +00:00
app . controller ( "problemsController" , [ "$controller" , "$scope" , "$http" , function ( $controller , $scope , $http ) {
$controller ( "loginController" , { $scope : $scope } ) ;
api _call ( "GET" , "/api/problem/data" , { } , function ( result ) {
if ( result [ "success" ] == 1 ) {
$scope . problems = result [ "problems" ] ;
}
$scope . $apply ( ) ;
} ) ;
} ] ) ;
2016-04-18 21:59:36 +00:00
app . controller ( "programmingController" , [ "$controller" , "$scope" , "$http" , function ( $controller , $scope , $http ) {
$controller ( "loginController" , { $scope : $scope } ) ;
$ ( "#editor" ) . height ( $ ( window ) . height ( ) / 2 ) ;
var grader = ace . edit ( "editor" ) ;
grader . setTheme ( "ace/theme/tomorrow" ) ;
grader . getSession ( ) . setMode ( "ace/mode/python" ) ;
grader . setOptions ( {
fontFamily : "monospace" ,
fontSize : "12pt"
} ) ;
grader . setValue ( "" ) ;
} ] ) ;
2016-01-06 06:15:57 +00:00
$ . fn . serializeObject = function ( ) {
var a , o ;
o = { } ;
a = this . serializeArray ( ) ;
$ . each ( a , function ( ) {
if ( o [ this . name ] ) {
if ( ! o [ this . name ] . push ) {
o [ this . name ] = [ o [ this . name ] ] ;
}
return o [ this . name ] . push ( this . value || "" ) ;
} else {
return o [ this . name ] = this . value || "" ;
}
} ) ;
return o ;
} ;
// register page
2016-01-02 19:30:42 +00:00
2016-01-06 06:15:57 +00:00
var register _form = function ( ) {
var input = "#register_form input" ;
var data = $ ( "#register_form" ) . serializeObject ( ) ;
2016-01-18 06:41:11 +00:00
$ ( input ) . attr ( "disabled" , "disabled" ) ;
2016-01-16 21:12:32 +00:00
api _call ( "POST" , "/api/user/register" , data , function ( result ) {
2016-01-06 06:15:57 +00:00
if ( result [ "success" ] == 1 ) {
location . href = "/profile" ;
} else {
2016-01-17 00:15:37 +00:00
display _message ( "register_msg" , "danger" , result [ "message" ] , function ( ) {
2016-01-27 02:30:30 +00:00
$ ( input ) . removeAttr ( "disabled" ) ;
2016-01-17 00:15:37 +00:00
} ) ;
2016-01-06 06:15:57 +00:00
}
2016-01-27 02:30:30 +00:00
} , function ( jqXHR , status , error ) {
2016-01-27 02:33:35 +00:00
var result = jqXHR [ "responseText" ] ;
2016-01-17 00:15:37 +00:00
display _message ( "register_msg" , "danger" , "Error " + jqXHR [ "status" ] + ": " + result [ "message" ] , function ( ) {
2016-01-27 02:30:30 +00:00
$ ( input ) . removeAttr ( "disabled" ) ;
2016-01-17 00:15:37 +00:00
} ) ;
2016-01-06 06:15:57 +00:00
} ) ;
} ;
2016-01-02 19:30:42 +00:00
2016-01-16 22:36:30 +00:00
// password reset
var request _reset _form = function ( ) {
2016-01-27 02:30:30 +00:00
var data = $ ( "#request_reset_form" ) . serializeObject ( ) ;
$ ( input ) . attr ( "disabled" , "disabled" ) ;
api _call ( "POST" , "/api/user/forgot" , data , function ( result ) {
if ( result [ "success" ] == 1 ) {
display _message ( "reset_msg" , "success" , result [ "message" ] ) ;
} else {
display _message ( "reset_msg" , "danger" , result [ "message" ] , function ( ) {
$ ( input ) . removeAttr ( "disabled" ) ;
} ) ;
}
} , function ( jqXHR , status , error ) {
2016-01-27 02:33:35 +00:00
var result = jqXHR [ "responseText" ] ;
2016-01-17 00:15:37 +00:00
display _message ( "reset_msg" , "danger" , "Error " + jqXHR [ "status" ] + ": " + result [ "message" ] , function ( ) {
2016-01-27 02:30:30 +00:00
$ ( input ) . removeAttr ( "disabled" ) ;
2016-01-17 00:15:37 +00:00
} ) ;
2016-01-27 02:30:30 +00:00
} ) ;
2016-01-16 22:36:30 +00:00
}
var reset _form = function ( ) {
2016-01-27 02:30:30 +00:00
var data = $ ( "#reset_form" ) . serializeObject ( ) ;
data [ "csrf_token" ] = $ . cookie ( "csrf_token" ) ;
var url = window . location . href ;
var token = url . substr ( url . lastIndexOf ( "/" ) + 1 ) ;
$ ( input ) . attr ( "disabled" , "disabled" ) ;
api _call ( "POST" , "/api/user/forgot/" + token , data , function ( result ) {
if ( result [ "success" ] == 1 ) {
display _message ( "reset_msg" , "success" , result [ "message" ] , function ( ) {
location . href = "/login" ;
} ) ;
} else {
display _message ( "reset_msg" , "danger" , result [ "message" ] , function ( ) {
$ ( input ) . removeAttr ( "disabled" ) ;
} ) ;
}
} , function ( jqXHR , status , error ) {
2016-01-27 02:33:35 +00:00
var result = jqXHR [ "responseText" ] ;
2016-01-17 00:15:37 +00:00
display _message ( "reset_msg" , "danger" , "Error " + jqXHR [ "status" ] + ": " + result [ "message" ] , function ( ) {
2016-01-27 02:30:30 +00:00
$ ( input ) . removeAttr ( "disabled" ) ;
2016-01-17 00:15:37 +00:00
} ) ;
2016-01-27 02:30:30 +00:00
} ) ;
2016-01-16 22:36:30 +00:00
}
2016-01-06 06:15:57 +00:00
// login page
2016-01-02 19:30:42 +00:00
2016-01-06 06:15:57 +00:00
var login _form = function ( ) {
var input = "#login_form input" ;
var data = $ ( "#login_form" ) . serializeObject ( ) ;
2016-01-18 06:41:11 +00:00
$ ( input ) . attr ( "disabled" , "disabled" ) ;
2016-01-16 21:12:32 +00:00
api _call ( "POST" , "/api/user/login" , data , function ( result ) {
2016-01-06 06:15:57 +00:00
if ( result [ "success" ] == 1 ) {
location . href = "/profile" ;
} else {
2016-01-17 00:15:37 +00:00
display _message ( "login_msg" , "danger" , result [ "message" ] , function ( ) {
2016-01-27 02:30:30 +00:00
$ ( input ) . removeAttr ( "disabled" ) ;
2016-01-17 00:15:37 +00:00
} ) ;
2016-01-06 06:15:57 +00:00
}
2016-01-27 02:30:30 +00:00
} , function ( jqXHR , status , error ) {
2016-01-27 02:33:35 +00:00
var result = jqXHR [ "responseText" ] ;
2016-01-17 00:15:37 +00:00
display _message ( "login_msg" , "danger" , "Error " + jqXHR [ "status" ] + ": " + result [ "message" ] , function ( ) {
2016-01-27 02:30:30 +00:00
$ ( input ) . removeAttr ( "disabled" ) ;
2016-01-17 00:15:37 +00:00
} ) ;
2016-01-06 06:15:57 +00:00
} ) ;
2016-01-12 03:54:26 +00:00
} ;
// team page
var create _team = function ( ) {
var input = "#create_team input" ;
var data = $ ( "#create_team" ) . serializeObject ( ) ;
2016-01-18 06:41:11 +00:00
$ ( input ) . attr ( "disabled" , "disabled" ) ;
2016-01-16 21:12:32 +00:00
api _call ( "POST" , "/api/team/create" , data , function ( result ) {
2016-01-12 03:54:26 +00:00
if ( result [ "success" ] == 1 ) {
location . reload ( true ) ;
} else {
2016-01-17 00:15:37 +00:00
display _message ( "create_team_msg" , "danger" , result [ "message" ] , function ( ) {
2016-01-27 02:30:30 +00:00
$ ( input ) . removeAttr ( "disabled" ) ;
2016-01-17 00:15:37 +00:00
} ) ;
2016-01-12 03:54:26 +00:00
}
2016-01-27 02:30:30 +00:00
} , function ( jqXHR , status , error ) {
2016-01-12 03:54:26 +00:00
var result = JSON . parse ( jqXHR [ "responseText" ] ) ;
2016-01-17 00:15:37 +00:00
display _message ( "create_team_msg" , "danger" , "Error " + jqXHR [ "status" ] + ": " + result [ "message" ] , function ( ) {
2016-01-27 02:30:30 +00:00
$ ( input ) . removeAttr ( "disabled" ) ;
2016-01-17 00:15:37 +00:00
} ) ;
2016-01-12 03:54:26 +00:00
} ) ;
2016-01-16 21:12:32 +00:00
} ;
var add _member = function ( ) {
var input = "#add_member input" ;
var data = $ ( "#add_member" ) . serializeObject ( ) ;
2016-01-18 06:41:11 +00:00
$ ( input ) . attr ( "disabled" , "disabled" ) ;
2016-01-16 21:12:32 +00:00
api _call ( "POST" , "/api/team/invite" , data , function ( result ) {
if ( result [ "success" ] == 1 ) {
location . reload ( true ) ;
2016-01-17 00:15:37 +00:00
} else {
2016-01-27 02:30:30 +00:00
$ ( input ) . removeAttr ( "disabled" ) ;
2016-01-16 21:12:32 +00:00
}
2016-01-27 02:30:30 +00:00
} , function ( jqXHR , status , error ) {
2016-01-17 00:15:37 +00:00
var result = JSON . parse ( jqXHR [ "responseText" ] ) ;
display _message ( "create_team_msg" , "danger" , "Error " + jqXHR [ "status" ] + ": " + result [ "message" ] , function ( ) {
2016-01-27 02:30:30 +00:00
$ ( input ) . removeAttr ( "disabled" ) ;
2016-01-17 00:15:37 +00:00
} ) ;
2016-01-16 21:12:32 +00:00
} ) ;
2016-01-27 02:33:35 +00:00
} ;
2016-02-29 18:35:40 +00:00
var rescind _invitation = function ( uid ) {
2016-01-27 02:33:35 +00:00
var input = "#add_member input" ;
2016-02-29 18:35:40 +00:00
var data = { "uid" : uid } ;
api _call ( "POST" , "/api/team/invite/rescind" , data , function ( result ) {
2016-01-27 02:33:35 +00:00
if ( result [ "success" ] == 1 ) {
location . reload ( true ) ;
}
} ) ;
2016-01-17 02:23:34 +00:00
} ;
2016-02-29 18:35:40 +00:00
var request _invitation = function ( tid ) {
2016-01-17 02:23:34 +00:00
var input = "#add_member input" ;
2016-02-29 18:35:40 +00:00
var data = { "tid" : tid } ;
api _call ( "POST" , "/api/team/invite/request" , data , function ( result ) {
2016-01-17 02:23:34 +00:00
if ( result [ "success" ] == 1 ) {
location . reload ( true ) ;
}
} ) ;
} ;
2016-02-29 18:35:40 +00:00
var accept _invitation = function ( tid ) {
2016-01-17 02:23:34 +00:00
var data = { "tid" : tid } ;
2016-02-29 18:35:40 +00:00
api _call ( "POST" , "/api/team/invite/accept" , data , function ( result ) {
2016-01-17 02:23:34 +00:00
if ( result [ "success" ] == 1 ) {
location . reload ( true ) ;
}
} ) ;
2016-01-17 02:39:25 +00:00
} ;
2016-03-03 05:36:51 +00:00
var accept _invitation _request = function ( uid ) {
var data = { "uid" : uid } ;
api _call ( "POST" , "/api/team/invite/request/accept" , data , function ( result ) {
if ( result [ "success" ] == 1 ) {
location . reload ( true ) ;
}
} ) ;
} ;
2016-03-04 00:27:10 +00:00
// settings page
var remove _profile _picture = function ( ) {
api _call ( "POST" , "/api/user/avatar/remove" , { } , function ( result ) {
if ( result [ "success" ] == 1 ) {
location . reload ( true ) ;
}
} ) ;
2016-04-07 22:01:17 +00:00
} ;