forked from blhack/cyberPunkGenerator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
55 lines (46 loc) · 1.58 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
<html>
<head>
<title>Cyberpunk Generator</title>
<link rel=stylesheet type=text/css href=/cyberPunkGenerator/css/pi.css>
<link href='https://fonts.googleapis.com/css?family=Press+Start+2P' rel='stylesheet' type='text/css'>
</head>
<script type=text/javascript>
var grammar = {
"sentence": ['<verb> the <noun>'],
"tens": ['', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
"ones": ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
"percentage": ["<tens><ones>%"],
"noun": ["1%","Capitalism","truth","lies","world","blockchain","paradigm","patriarchy","narrative","government","system","source code","blockchain","hash", "<percentage>","gender"],
"verb": ["download","blockchain","smash","eat","hack","debate","distribute","decentralize","centralize","topple","fight","hammer","reprogram","subvert"]
}
function expand(formula, grammar) {
while (m = formula.match(/<([^>]+)>/)) {
var choices = grammar[m[1]];
var aChoice = choices[Math.floor(Math.random()*choices.length)]
formula = formula.replace(m[0], aChoice)
}
return formula;
}
function changeMessage() {
var phrase = expand("<sentence>", grammar);
phrase = phrase.toUpperCase();
document.getElementById("message").innerHTML= "<h1>" + phrase + "</h1>";
var timeoutID = window.setTimeout(changeMessage, Math.floor(Math.random()*10000));
}
</script>
<div class="vhs-message">
<span id=message>
<h1>BLOCKCHAIN THE PATRIACHY</h1>
</span>
</div>
<div class="screen-bottom">
<div class="line">
<div class="red"></div>
<div class="white"></div>
<div class="green"></div>
</div>
</div>
<script>
changeMessage();
</script>
</html>