-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.html
97 lines (82 loc) · 2.35 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<title>VBScript in JS</title>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/1.4.0/bootstrap.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="vbs4.js"></script>
<script src="compiler.js"></script>
<style type="text/css">
#try div {
margin: 10px 0;
}
#try select {
width: 540px;
}
#try textarea {
width: 540px;
height: 150px;
}
</style>
</head>
<body>
<div class="container">
<div class="content">
<div class="page-header">
<h1>VBScript in Javascript... WTF?</h1>
</div>
<section id="about">
<p>
Get the code on github at <a href="https://github.com/kastner/vbscript_in_js">kastner/vbscript_in_js</a>
</p>
<p>
Read more about the <a href="https://github.com/kastner/vbscript_in_js/blob/master/README.md">project</a>
</p>
<p>
I should have called this vbs.js or vbscript.js... oh well
</p>
</section>
<section id="try">
<h2>Try it out!</h2>
<div>
<select id="prebaked">
<option>Type / paste your own or use one of the examples here</option>
<option value='test.vbs'>test.vbs - create and call a function</option>
<option value='test3.vbs'>test3.vbs - Sub with if/else/etc</option>
</select>
</div>
<div>
<textarea id='vbscript'></textarea>
</div>
<div>
<button class="btn" id="go">Compile</button>
</div>
<div>
<textarea id='javascript'></textarea>
</div>
<div>
<button class="btn" id="eval">Evaluate JS</button>
</div>
</section>
</div>
</div>
<script>
$("#prebaked").live("change", function (evt) {
var selected = $("option:selected", this);
if (selected.val().match(/\.vbs$/)) {
$.get(selected.val(), function(script) {
$("#vbscript").val(script);
});
} else {
$("#vbscript").val("");
}
});
$("#go").live("click", function () {
$("#javascript").val(compiler.compile($("#vbscript").val(), vbs4));
});
$("#eval").live("click", function () {
alert(eval($("#javascript").val()));
})
</script>
</body>
</html>