-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
68 lines (65 loc) · 1.56 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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Babble</title>
<style>
html, body {
width: 100%;
height: 100%;
border: 5px;
padding: 5px;
margin: 5px;
background: #FFF;
color: #000;
font-family: Helvetica, sans-serif;
}
h1 {
margin: 5px;
}
</style>
</head>
<body>
<h1>Babble</h1>
<p>
In node: <code>var babble = require("babble");</code>
<br>
In browser: <code><script src="babble.js"></script></code>
</p>
<p>
See the <a href="tts/">TTS demo</a>
</p>
<div id="generated"></div>
<script src="babble.js"></script>
<script>
var max_length = 6;
var codes = [
"babble.sentence()",
"babble.paragraph()",
"babble.text(max_length)",
];
var $gen = document.getElementById("generated");
for(var i=0; i<codes.length; i++){
for(var j=0; j<5; j++){
var code = codes[i];
var is_text = code.match("max_length");
if(is_text){
if(max_length++ < 50){
j=1;
}
}
var $p = document.createElement("p"); $gen.appendChild($p);
var $code__ = document.createElement("span"); $p.appendChild($code__);
var $code = document.createElement("code"); $code__.appendChild($code);
var $output = document.createElement("output"); $p.appendChild($output);
$code__.appendChild(document.createTextNode(" => "));
if(is_text){
code = code.replace("max_length", max_length);
}
$code.innerText = $code.textContent = code;
$output.innerHTML = eval(code);
}
}
</script>
</body>
</html>