forked from worrydream/Tangle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TangleTemplate.html
48 lines (37 loc) · 1.25 KB
/
TangleTemplate.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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Tangle document</title>
<!-- Tangle -->
<script type="text/javascript" src="Tangle.js"></script>
<!-- TangleKit (optional) -->
<link rel="stylesheet" href="TangleKit/TangleKit.css" type="text/css">
<script type="text/javascript" src="TangleKit/mootools.js"></script>
<script type="text/javascript" src="TangleKit/sprintf.js"></script>
<script type="text/javascript" src="TangleKit/BVTouchable.js"></script>
<script type="text/javascript" src="TangleKit/TangleKit.js"></script>
<!-- example -->
<script type="text/javascript">
function setUpTangle () {
var element = document.getElementById("example");
var tangle = new Tangle(element, {
initialize: function () {
this.cookies = 4;
this.caloriesPerCookie = 50;
},
update: function () {
this.calories = this.cookies * this.caloriesPerCookie;
}
});
}
</script>
</head>
<body onload="setUpTangle();">
<p>This is a simple reactive document.</p>
<p id="example">
When you eat <span data-var="cookies" class="TKAdjustableNumber" data-min="2" data-max="100"> cookies</span>, you
will consume <span data-var="calories"></span> calories.
</p>
</body>
</html>