-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
73 lines (45 loc) · 1.63 KB
/
main.js
File metadata and controls
73 lines (45 loc) · 1.63 KB
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
var url;
var button;
const port = 8459;
function main() {
url = document.getElementById("install");
button = document.getElementById("installbutton");
const Http = new XMLHttpRequest();
const ULR = 'http://localhost:'+port+'/';
Http.onreadystatechange = function() {
console.log(Http);
if (Http.readyState == 4 && Http.status == 0) {
document.location = "InteritusOffline.html";
}
};
Http.open("GET",ULR);
Http.send();
}
function doTestInstall() {
requestInstall(url.value,"test",1.0,"Des","TestAuthor","Long Des")
}
function installStatistics() {
requestInstall("https://github.com/FT-Interitus/Interitus-Plugins/blob/master/statistics/Statistics.itpl?raw=true","Statistics",1.0,"Zeigt dir Statistiken über dein Projekt an!","Tim & Felix","")
}
function requestInstall(url, name, version, description, author, detailed_description) {
const params = {
name: name,
version: version,
description: description,
author: author,
detailed_description: detailed_description
}
const Jsoninformation = JSON.stringify(params);
const Http = new XMLHttpRequest();
const URL = 'http://localhost:'+port+'/install?'+'url='+url+'&jsoninformation='+encodeURIComponent(Jsoninformation);
console.log('url='+url+'&jsoninformation='+encodeURIComponent(Jsoninformation));
Http.onreadystatechange = function() {
console.log(Http);
if (Http.readyState == 4 && Http.status == 0) {
document.location = "InteritusOffline.html";
}
};
Http.open("GET",URL,true);
Http.send();
}
main();