-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.html
executable file
·159 lines (143 loc) · 4.44 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Sweet Virtual Values</title>
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/bootstrap.min.css" >
<link rel="stylesheet" href="css/codemirror.css" >
<style>
body {
margin: 20px;
}
.CodeMirror {
border: 1px solid #DDD;
height: 450px;
}
.bg-danger {
padding: 12px;
}
.bg-success {
padding: 12px;
}
.row {
margin-bottom: 10px;
}
.code-label {
color: #BBB;
}
.success-label {
color: #5cb85c;
}
.editor-box hr {
margin-top: 15px;
margin-bottom: 15px;
}
</style>
</head>
<body>
<script type="text/x-handlebars">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Sweet Virtual Values</a>
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="https://github.com/disnet/sweet-virtual-values">Github Repo</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
{{outlet}}
</script>
<script type="text/x-handlebars" id="examples">
<div class="container-fluid">
<div class="row">
<div class="col-sm-6 editor-box">
<h4 class="code-label">Original</h4>
<hr />
<textarea id="editor">/*
* This is the Sweet Virtual Values editor.
* You can try out writing your own virtual values here. The
* compiled result will be displayed on the right and calls
* to `console.log` will be displayed in the page below.
*/
var p = new Proxy(4, {
// trap when the proxy is the left-hand operand
// `target` is the original proxied value (eg `4` in this case)
// `op` is a string representing the operation (eg `"+"`)
// `right` is the right hand operand
left: function(target, op, right) {
if (op === "+") {
return target + right;
}
}
}, {});
console.log(p + 10);</textarea>
</div>
<div class="col-sm-6 editor-box">
<h4 class="code-label">Compiled</h4>
<hr />
<textarea id="compiled"></textarea>
</div>
</div>
<div class="row">
<div class="col-md-12">
<button type="button" id="btn-run" class="btn btn-default" {{action 'run'}}>Run</button>
<div class="btn-group" id="btn-examples">
<button type="button" id="btn-examples" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
{{currentTitle}} <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
{{#each model}}
<li>
<a {{action 'select' this}}>{{title}}</a>
</li>
{{/each}}
</ul>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
{{#if errors}}
<div id="error-box" class="bg-danger">
<pre>{{errors}}</pre>
</div>
{{/if}}
{{#if run}}
<div id="run-box" class="bg-success">
<h4 class="success-label">Success</h4>
{{#each logs}}
<p>Log: {{ l }}</p>
{{/each}}
</div>
{{/if}}
</div>
</div>
</div>
</div><!-- /.container -->
</script>
<script src="js/libs/jquery-1.10.2.js"></script>
<script src="js/libs/handlebars-1.1.2.js"></script>
<script src="js/libs/ember-1.5.1.js"></script>
<script src="js/libs/ember-data.js"></script>
<script src="js/libs/bootstrap.min.js"></script>
<script src="js/libs/codemirror.js"></script>
<script src="js/libs/mode/javascript/javascript.js"></script>
<script src="js/libs/reflect.js"></script>
<script src="js/libs/sweet.js"></script>
<script src="lib/vvalues.js"></script>
<script src="js/app.js"></script>
</body>
</html>