-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom-playground.html
73 lines (54 loc) · 2 KB
/
custom-playground.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
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Example with a custom playground.js</title>
<link type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet"/>
<link type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap-responsive.min.css" rel="stylesheet"/>
</head>
<body>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<h1>Using a custom playground javascript</h1>
<p>Example of editable and runnable program :</p>
<textarea id="code" style="width: 100%; font-family: monospace;">
package main
import "time"
func main() {
println("One")
timer := time.NewTimer(time.Second * 2)
<- timer.C
println("Timer expired")
}
</textarea>
<p>
<button type="button" id="run" class="btn btn-primary"><i class="icon-play icon-white"></i> Executer</button>
<button type="button" id="fmt" class="btn btn-info"><i class="icon-indent-left icon-white"></i> Format</button>
</p>
<pre id="output" style="visibility:hidden"></pre>
<p>Another example with a <tt>PRE</tt> tag :</p>
<pre id="code2" style="width: 100%; font-family: monospace;">
package main
import "fmt"
func main() {
fmt.Println("Hello, playground")
}
</pre>
<p>
<button type="button" id="run2" class="btn btn-primary"><i class="icon-play icon-white"></i> Execute</button>
</p>
<pre id="output2" style="visibility:hidden"></pre>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/myplayground.js"></script>
<script>
$(function() {
initEditor($('#code'), $('#output'), $('#run'), $('#fmt'));
initEditor($('#code2'), $('#output2'), $('#run2'));
});
</script>
</div>
</div>
</div>