-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatom.tracker.js
78 lines (69 loc) · 1.55 KB
/
atom.tracker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
function build(mode){
$('#log').load('log.php?mode='+mode);
tally();
}
function tally(){
$('#tally').load('log.php?mode=tally');
}
$(document).ready(function(){
build('build');
setInterval(function(){
var mode=$('#btn-mode').data('mode');
if(mode=='restore')
build('build');
else
build('restore');
},60000);
$('#btn-mode').on('click',function(){
var mode=$(this).data('mode');
if(mode=='restore'){
build('restore');
$('#lbl-mode').html('Live');
$(this).data('mode','live');
}
else{
build('build');
$('#lbl-mode').html('Restore');
$(this).data('mode','restore');
}
});
$('#form-new').submit(function(event){
event.preventDefault();
//var form = $(this);
var data = $(this).serialize();
$.ajax({
url:'log.php?mode=new',
data:data,
success:function(){
build('build');
}
});
});
$('#log').on('click','.btn-stop',function(){
var id=$(this).data('id');
$.ajax({
url:'log.php?mode=stop&id='+id,
success:function(){
build('build');
}
});
});
$('#log').on('click','.btn-remove',function(){
var id=$(this).data('id');
$.ajax({
url:'log.php?mode=remove&id='+id,
success:function(){
build('build');
}
});
});
$('#log').on('click','.btn-restore',function(){
var id=$(this).data('id');
$.ajax({
url:'log.php?mode=status&id='+id,
success:function(){
build('restore');
}
});
});
});