-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
213 lines (166 loc) · 7.29 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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Garkov</title>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
<script type="text/javascript" src="js/Strip.js"></script>
<script type="text/javascript" src="js/TextGenerator.js"></script>
<script type="text/javascript" src="js/sourcetext.js"></script>
</head>
<body>
<header>
<h1>Garkov</h1>
<p>2015, by WYE</p>
<p>Inspiration and source text files by Josh Millard (<a href="http://www.joshmillard.com/garkov">www.joshmillard.com/garkov</a>)
</p>
</header>
<div id="strip-container"></div>
<form>
<input type="button" id="generate-btn" value="Generate"/>
<table>
<tr>
<td class="prompt">
<strong>Strip:</strong>
</td>
<td id="strip-options">
<input type="radio" name="strip" value="random" id="strip-random" checked="checked"/><label
for="strip-random">random</label>
</td>
</tr>
<tr>
<td class="prompt">
<strong>Order:</strong><br/>
<small>When generating text, this determines how many characters are looked at to decide the
next character.<br/>Greater value = more coherent results.
</small>
</td>
<td>
<input type="number" id="order" min="0" value="5"/>
</td>
</tr>
</table>
</form>
<div id="info">
<div style="text-align: center;">
<a href="results.html" style="font-size: 24px;">→ results</a>
</div>
<p> </p>
<p>Some of the more interesting strips that were generated. If you come across a good one, <a
href="https://www.eric-kaiser.net/contact">let me know</a> and I'll add it!</p>
<p> </p>
<p> </p>
<p>
Strips used:<br/>
(1) <a href="http://images.ucomics.com/comics/ga/2015/ga150124.gif">2015-24-01</a>,
(2) <a href="http://images.ucomics.com/comics/ga/2006/ga060719.gif">2006-07-19</a>,
(3) <a href="http://images.ucomics.com/comics/ga/2014/ga141004.gif">2014-10-04</a>,
(4) <a href="http://images.ucomics.com/comics/ga/2004/ga040122.gif">2004-01-22</a>,
(5) <a href="http://images.ucomics.com/comics/ga/1991/ga910803.gif">1991-08-03</a>,
(6) <a href="http://images.ucomics.com/comics/ga/2014/ga141201.gif">2014-12-01</a>,
(7) <a href="http://images.ucomics.com/comics/ga/2014/ga140606.gif">2014-06-06</a>
</p>
</div>
<script type="text/javascript">
var strips = [
new Strip('img/strip1.png', [
{jon: true, maxLength: 40, top: 7, left: 50, width: 110, height: 30},
{jon: true, maxLength: 30, top: 7, left: 250, width: 100, height: 30},
{jon: false, maxLength: 80, top: 7, left: 425, width: 155, height: 42}
]),
new Strip('img/strip2.png', [
{jon: true, maxLength: 80, top: 12, left: 14, width: 187, height: 30},
{jon: true, maxLength: 30, top: 11, left: 220, width: 81, height: 30},
{jon: true, maxLength: 40, top: 10, left: 406, width: 124, height: 30},
{jon: false, maxLength: 40, top: 42, left: 506, width: 91, height: 46}
]),
new Strip('img/strip3.png', [
{jon: true, maxLength: 70, top: 7, left: 33, width: 160, height: 42},
{jon: true, maxLength: 80, top: 6, left: 225, width: 167, height: 42},
{jon: true, maxLength: 80, top: 6, left: 421, width: 151, height: 42},
{jon: false, maxLength: 20, top: 60, left: 544, width: 60, height: 53}
]),
new Strip('img/strip4.png', [
{jon: true, maxLength: 50, top: 12, left: 21, width: 167, height: 30},
{jon: true, maxLength: 30, top: 11, left: 464, width: 92, height: 30},
{jon: false, maxLength: 30, top: 55, left: 531, width: 67, height: 32}
]),
new Strip('img/strip5.png', [
{jon: true, maxLength: 60, top: 12, left: 13, width: 190, height: 30},
{jon: false, maxLength: 40, top: 10, left: 409, width: 84, height: 47},
{jon: true, maxLength: 10, top: 10, left: 516, width: 67, height: 30}
]),
new Strip('img/strip6.png', [
{jon: false, maxLength: 80, top: 7, left: 28, width: 164, height: 42},
{jon: false, maxLength: 50, top: 8, left: 251, width: 115, height: 33},
{jon: false, maxLength: 10, top: 8, left: 415, width: 79, height: 30},
{jon: true, maxLength: 10, top: 53, left: 477, width: 57, height: 30}
]),
new Strip('img/strip7.png', [
{jon: true, maxLength: 60, top: 7, left: 20, width: 162, height: 43},
{jon: true, maxLength: 60, top: 7, left: 224, width: 157, height: 43},
{jon: true, maxLength: 40, top: 8, left: 418, width: 171, height: 33},
{jon: false, maxLength: 20, top: 47, left: 517, width: 79, height: 32}
])
];
var order = parseInt(document.getElementById('order').value);
var jonGarkov = new TextGenerator(getJonText(), order);
var garfieldGarkov = new TextGenerator(getGarfieldText(), order);
function recalculateOrder() {
// how does it feel
// to treat me like you do
// when you've laid your hands upon me
// and told me who you are
var newOrder = parseInt(document.getElementById('order').value);
if (order !== newOrder) {
order = newOrder;
jonGarkov = new TextGenerator(getJonText(), order);
garfieldGarkov = new TextGenerator(getGarfieldText(), order);
}
}
function renderRadioButtons() {
document.getElementById('strip-random').checked = true;
for (var i = 0, length = strips.length; i < length; i++) {
var stripNumber = i + 1;
var id = 'strip-' + stripNumber;
var radioButton = document.createElement('input');
radioButton.type = 'radio';
radioButton.id = id;
radioButton.name = 'strip';
radioButton.value = i;
radioButton.checked = false;
var label = document.createElement('label');
label.htmlFor = id;
label.innerHTML = stripNumber.toString();
var optionCell = document.getElementById('strip-options');
optionCell.appendChild(radioButton);
optionCell.appendChild(label);
}
}
function chooseStrip() {
var radioButtons = document.getElementsByName('strip');
if (radioButtons[0].checked) {
var numStrips = strips.length;
var randIndex = Math.floor(Math.random() * numStrips);
return strips[randIndex];
}
for (var i = 1, length = radioButtons.length; i < length; i++) {
if (radioButtons[i].checked) {
var index = radioButtons[i].value;
return strips[index];
}
}
}
function generateStrip() {
recalculateOrder();
var strip = chooseStrip();
strip.render();
}
document.body.onload = function () {
renderRadioButtons();
generateStrip();
};
document.getElementById('generate-btn').onclick = generateStrip;
</script>
</body>
</html>