-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.html
58 lines (52 loc) · 2.04 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
<!DOCTYPE html>
<html>
<head>
<meta charset= "utf-8" />
<title>DXOpal demo</title>
<link href='https://fonts.googleapis.com/css?family=Arvo:400,700,400italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="vendor/pages-themes-dinky-14e8031/_site/assets/css/style.css">
<script src="vendor/pages-themes-dinky-14e8031/_site/assets/js/scale.fix.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
</head>
<body>
<div class="wrapper">
<header>
<h1 class="header"><a href='index.html'>DXOpal</a></h1>
<p class="header">
<a href='doc/en/index.html'>English</a> | <a href='doc/ja/index.html'>日本語</a>
</p>
</header>
<section>
<canvas id="dxopal-canvas" style='float: left'></canvas>
<div id="editor" style='width: 350px; height: 300px; position: relative'></div>
<input type='button' style='float: right' id='run' value='Run'>
<div id="dxopal-errors"></div>
</section>
</div>
<script type="text/javascript" src="build/dxopal.js"></script>
<script>
eval(Opal.compile("DXOpal::Input.keyevent_target = `document.getElementById('dxopal-canvas')`"));
</script>
<script type="text/ruby" src="examples/top_page/main.rb"></script>
<script type="text/javascript" src="examples/_vendor/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="examples/_vendor/jquery-3.2.1.js"></script>
<script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/github");
editor.getSession().setMode("ace/mode/ruby");
$.get("examples/top_page/main.rb", function(rb) {
editor.setValue(rb, -1); // -1: set cursor to document start
});
$('#run').on("click", function() {
$('#dxopal-errors').empty();
try {
eval(Opal.compile(editor.getValue()));
}
catch(e) {
alert(e);
throw e;
}
});
</script>
</body>
</html>