-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackend.js
124 lines (124 loc) · 5.27 KB
/
backend.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
function get(action,host='',pkg,repo,branch='',user,bulk=false) {
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest();
} else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function() {
if (this.readyState==4&&this.status==200) {
if (bulk!==true) { document.location.reload(); }
}
}; xmlhttp.open("GET","get.php?action="+action+"&raw=0&host="+host+"&pkg="+pkg+"&repo="+repo+"&branch="+branch+"&user="+user,false);
xmlhttp.send();
}
function getdir(action,host='',pkg,repo,branch='',user,bulk=false) {
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest();
} else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function() {
if (this.readyState==4&&this.status==200) {
if (bulk!==true) { document.location.reload(); }
}
}; xmlhttp.open("GET","get.php?action="+action+"&raw=1&host="+host+"&pkg="+pkg+"&repo="+repo+"&branch="+branch+"&user="+user,false);
xmlhttp.send();
}
function set(name,content,bulk=false) {
var dataString='name='+name+'&content='+content;
$.ajax({
type: "POST", url: "write.php",
data: dataString, cache: false,
success: function(html) {
if (bulk!==true) { window.location.reload(); }
}
}); return false;
}
function change(id,to,pass,bulk=false) {
var dataString='id='+id+'&to='+to+'&pass='+pass;
$.ajax({
type: "POST", url: "change.php",
data: dataString, cache: false,
success: function(html) {
if (bulk!==true) { window.location.reload(); }
}
}); return false;
}
function poll(name,select,bulk) {
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest();
} else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function() {
if (this.readyState==4&&this.status==200) {
if (bulk!==true) { window.location.reload(); }
}
}; xmlhttp.open("GET","poll.php?name="+name+"&select="+select,false);
xmlhttp.send();
}
function playAudio(obj,name) { obj.src=name; obj.play(); }
function pauseAudio(obj) { obj.pause(); }
function playMIDI(id) { MIDIjs.play(id); }
function pauseMIDI() { MIDIjs.pause(); }
function ordarr(name,oper,path='',val='',bulk=false) {
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest();
} else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function() {
if (this.readyState==4&&this.status==200) {
if (bulk!==true) { window.location.reload(); }
}
}; xmlhttp.open("GET","arr.php?name="+name+"&oper="+oper+"&path="+encodeURIComponent(path)+"&val="+val,false);
xmlhttp.send();
}
function recycle(name,bulk=false) {
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest();
} else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function() {
if (this.readyState==4&&this.status==200) {
if (bulk!==true) { window.location.reload(); }
}
}; xmlhttp.open("GET","recycle.php?name="+name,false);
xmlhttp.send();
}
function restore(id,bulk=false) {
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest();
} else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function() {
if (this.readyState==4&&this.status==200) {
if (bulk!==true) { window.location.reload(); }
}
}; xmlhttp.open("GET","restore.php?id="+id,false);
xmlhttp.send();
}
function del(name,bulk=false) {
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest();
} else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function() {
if (this.readyState==4&&this.status==200) {
if (bulk!==true) { window.location.reload(); }
}
}; xmlhttp.open("GET","delete.php?name="+name,false);
xmlhttp.send();
}
function mkdir(name,bulk=false,merge=0) {
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest();
} else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function() {
if (this.readyState==4&&this.status==200) {
if (bulk!==true) { window.location.reload(); }
}
}; xmlhttp.open("GET","mkdir.php?name="+name+"&merge="+merge,false);
xmlhttp.send();
}
function move(name,to,bulk=false,merge=0) {
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest();
} else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function() {
if (this.readyState==4&&this.status==200) {
if (bulk!==true) { window.location.reload(); }
}
}; xmlhttp.open("GET","move.php?name="+name+"&to="+to+"&merge="+merge,false);
xmlhttp.send();
}
function copy(name,to,bulk=false,merge=0) {
if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest();
} else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }
xmlhttp.onreadystatechange=function() {
if (this.readyState==4&&this.status==200) {
if (bulk!==true) { window.location.reload(); }
}
}; xmlhttp.open("GET","copy.php?name="+name+"&to="+to+"&merge="+merge,false);
xmlhttp.send();
}