/
WAPS.html
executable file
·116 lines (116 loc) · 3.2 KB
/
WAPS.html
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
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>WAPS Application</title>
<script type="text/javascript">
function quit() {
alert
document.getElementById("main").innerHTML = '<p style="text-align: center;">Application Terminated</p>';
}
function addText(x, y, msg) {
//alert(y);
msg = '<span style="z-index: 5; position: absolute; left: ' + x/2 + 'cm; top: ' + y/4 + 'cm;">' + msg + '</span>';ina[i].indexOf(" ") + 1
document.getElementById("main").innerHTML += msg;
}
function loop() {
getOutput();
window.setTimeout("loop()", 1500);
}
function sends(tosend) {
var xmlHttp2;
try {
xmlHttp2=new XMLHttpRequest();
} catch (e) {
try {
xmlHttp2=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp2=new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp2.onreadystatechange=function()
{
if(xmlHttp2.readyState==4)
{
//alert(xmlHttp2.responseText);
}
}
xmlHttp2.open("GET","input.php?input=" + escape(tosend),true);
xmlHttp2.send(null);
}
function getOutput() {
var xmlHttp;
try {
xmlHttp=new XMLHttpRequest();
} catch (e) {
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
alert("Your browser does not support AJAX!");
return false;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
toparse = xmlHttp.responseText;
ina = new Array();
ina = toparse.split("\n");
//alert(toparse);
for(i = 0; i < ina.length; i++) {
//alert(ina[i]);
if(ina[i].substr(0, 4) == "QUIT") {
quit();
} else if(ina[i].substr(0, 1) == "[") {
msg = ina[i].substr(ina[i].indexOf("] ") + 2);
x = ina[i].substr(1, ina[i].indexOf(" "));
y = ina[i].substr(ina[i].indexOf(" ") + 1, ina[i].indexOf("]") - (ina[i].indexOf(" ") + 1));
//alert(y);
addText(x, y, msg);
} else if(ina[i] == "NEW WINDOW") {
document.getElementById("main").innerHTML = '';
} else if(ina[i].substr(0, 5) == "INPUT") {
type = ina[i].substr(ina[i].indexOf("[") + 1, ina[i].indexOf("]") - (ina[i].indexOf("[") + 1));
var tosend;
if(type == "CH") {
tosend = prompt("Please enter a character: ");
} else {
tosend = prompt("Please enter a string: ");
}
sends(tosend);
}
}
}
}
xmlHttp.open("GET","output.php",true);
xmlHttp.send(null);
}
</script>
<style type="text/css">
div.window {
border: 3px orange solid;
height: 12cm;
width: 17.5cm;
}
h1 {
text-align: center;
}
</style>
</head>
<body onload="loop()">
<div class="window" id="main">
</div>
</body>
</html>