forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebhost.html
87 lines (82 loc) · 2.65 KB
/
webhost.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
<html>
<head>
<title>WebTSC</title>
<style>
textarea {
width: 95%;
height: 120px;
border: 3px solid #cccccc;
padding: 5px;
font-family: Tahoma, sans-serif;
}
#container {
width: 100%;
}
#header {
height:50px;
text-align:center;
}
#content {
text-align:left;
width:950px;
min-height:300px;
margin:0px auto;
}
#main {
float:left;
width:700px;
}
#side{
float:right;
width:250px;
text-align:left;
padding-top:75px;
}
</style>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.js"></script>
<script language="javascript" src="wscript.js"></script>
<script language="javascript" src="webtsc.js"></script>
<script>
var idx = location.href.lastIndexOf("/");
var currentDir = location.href.substring("file:///".length, idx);
function appendText(str) {
var outputPane = $("#outputPane");
outputPane.val(outputPane.val() + str);
}
var stdOut = {
WriteLine: function (str) {
appendText(str + "\n");
},
Write: function (str) {
appendText(str);
},
Close: function() {}
};
var compile = TypeScript.WebTsc.prepareCompiler(currentDir, stdOut, stdOut);
function doCompile() {
$("#outputPane").val("");
var commandLine = $("#commandLine").val();
compile(commandLine);
appendText("===done===");
}
</script>
</head>
<body>
<div id="container">
<div id="header">
<h1>WebTSC</h1>
</div>
<div id="content">
<div id="main">
<h1>Command line:</h1>
<textarea id="commandLine"></textarea>
<h1>Output:</h1>
<textarea id="outputPane"></textarea>
</div>
<div id="side">
<button onclick="doCompile()">Compile</button>
</div>
</div>
</div>
</body>
</html>