-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
106 lines (80 loc) · 2.86 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTMLEcho</title>
<style>
body {
font-family: 'Poppins';
margin: 20px;
}
h1 {
text-align: center;
font-size: 3rem;
}
span {
color: red;
}
button {
background: lime;
margin: 1rem 0;
border: none;
padding: 0.5rem;
cursor: pointer;
font-size: 1.4rem;
}
.html-output {
background: #F6F6F6;
padding: 1rem;
}
</style>
</head>
<body>
<h1>HTMLEcho</h1>
<p>Generate random HTML markup with text sourced from various books in the project Gutenberg library.</p>
<h2>Here are five random paragraphs with text sourced from Dracula.</h2>
<div id="output-a" class="html-output"></div>
<button onclick="generateOutputA()">Generate Again</button>
<h2>Here are five ordered list items with text sourced from Absurd Sentences.</h2>
<div id="output-b" class="html-output"></div>
<button onclick="generateOutputB()">Generate Again</button>
<h2>Here is some random HTML text sourced from Alice in Wonderland.</h2>
<div id="output-c" class="html-output"></div>
<button onclick="generateOutputC()">Generate Again</button>
<h2>Finally, some HTML text based on Lorem Ipsum if that's what you want.</h2>
<div id="output-d" class="html-output"></div>
<button onclick="generateOutputD()">Generate Again</button>
<script src="HTMLEcho.js"></script>
<script>
const DraculaEcho = new HTMLEcho("files/dracula.txt");
const AbsurdEcho = new HTMLEcho("files/absurd.txt");
const AliceEcho = new HTMLEcho("files/alice-in-wonderland.txt");
const LoremEcho = new HTMLEcho("files/lorem-ipsum.txt");
function generateOutputA() {
DraculaEcho.generateHTML('p-5').then(html => {
document.getElementById("output-a").innerHTML = html;
});
}
function generateOutputB() {
AbsurdEcho.generateHTML('ol-5').then(html => {
document.getElementById("output-b").innerHTML = html;
});
}
function generateOutputC() {
AliceEcho.generateHTML('h2-1,p-2,h3-1,p-1,h3-1,p-1,ol-3').then(html => {
document.getElementById("output-c").innerHTML = html;
});
}
function generateOutputD() {
LoremEcho.generateHTML('h2-1,p-1,ul-3,p-1,h3-1,p-1,ol-3').then(html => {
document.getElementById("output-d").innerHTML = html;
});
}
generateOutputA();
generateOutputB();
generateOutputC();
generateOutputD();
</script>
</body>
</html>