-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
129 lines (116 loc) · 3.69 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
<html>
<head>
<link href="vanilla-raptorize.css" rel="stylesheet"/>
<style type="text/css">
* {
box-sizing: border-box;
}
body {
font-family: sans-serif;
text-align: center;
}
.bingo {
display; block;
width: 80vmin;
height: 80vmin;
margin: auto;
}
.bingo__inner {
width: 100%;
height: 100%;
border: 2px solid black;
}
.bingo-square {
font-size: 2vmin;
padding: 1vmin;
float: left;
width: 20%;
height: 20%;
border: 1px solid darkGray;
display: flex;
align-items: center;
cursor: pointer;
}
.pick {
background-color: aquamarine;
}
#center-square {
background-color: lightPink;
font-weight: 900;
}
.btn {
cursor: pointer;
background-color: lightGray;
display: inline-block;
padding: 1rem 2rem;
margin: 1em;
}
</style>
</head>
<body>
<div class="bingo">
<div class="bingo__inner">
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square" id="center-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
<div class="bingo-square"></div>
</div>
</div>
<div class="bingo-win btn">I WON</div>
<script type="text/javascript" src="vanilla-raptorize.js"></script>
<script type="text/javascript">
function shuffleArray(array) {
for (var i = array.length - 1; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
var bingoRandomize = function(cliches) {
var squares = document.querySelectorAll('.bingo-square');
shuffleArray(cliches);
for (var i = 0; i < squares.length ; i++) {
squares[i].innerText = cliches[i % cliches.length];
}
var centerSquare = document.getElementById('center-square');
centerSquare.innerText = freeSpaceText;
};
var freeSpaceText = "FREE SPACE\r\n\r\nNot mentioning Code & Supply";
fetch('data/cliches.json')
.then(response => response.json())
.then(jsonResponse => bingoRandomize(jsonResponse.cliches))
var myRaptor = Raptorize();
document.querySelector('.bingo-win').addEventListener('click', myRaptor.go);
function classToggle() {
this.classList.toggle('pick');
}
var squares = document.querySelectorAll('.bingo-square')
squares.forEach(function(sq) {
sq.addEventListener('click', classToggle);
})
</script>
<a href="https://github.com/codeandsupply/pittsburgh-publicity-bingo"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
</body>
</html>