-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbingo.html
More file actions
212 lines (181 loc) · 9.73 KB
/
bingo.html
File metadata and controls
212 lines (181 loc) · 9.73 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-142108931-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-142108931-1');
</script>
<title>AC Birthdays | BINGO!</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width"/>
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/bingo.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<meta property="og:title" content="AC Birthdays | BINGO!" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://ac-birthdays.com/bingo.html" />
<meta property="og:image" content="https://ac-birthdays.com/img/acbirthdays_final.png" />
<link href='https://fonts.googleapis.com/css?family=Dekko' rel='stylesheet'>
<script src="js/jquery-3.4.1.min.js"></script>
<meta name="description" content="Study Animal Crossing Birthdays">
</head>
<body style="font-family: 'Dekko';">
<header>
</header>
<main>
<section id="setupSection">
<h3 class="h3">AC: New Horizons BINGO</h3>
<p class="body">To get started, select which season you are currently playing. Then select solo or select team if you want to play with friends as a group. The BINGO board will be randomly generated.</p>
<br/>
<div class="rowDiv rowDivHeight">
<button id="Season0Button" onclick="setSeason(0)" class="largeButton">No Season</button>
<button id="Season1Button" onclick="setSeason(1)" class="largeButton">Spring</button>
<button id="Season2Button" onclick="setSeason(2)" class="largeButton">Summer</button>
<button id="Season3Button" onclick="setSeason(3)" class="largeButton">Fall</button>
<button id="Season4Button" onclick="setSeason(4)" class="largeButton">Winter</button>
<button id="Season5Button" onclick="setSeason(5)" class="largeButton">All</button>
</div>
<div class="rowDiv">
<button id="Mode0Button" onclick="setMode(0)" class="largeButton">Solo</button>
<button id="Mode1Button" onclick="setMode(1)" class="largeButton">Team</button>
</div>
<br/>
<div class="rowDiv">
<button onclick="play()" class="largeButton">Play</button>
</div>
<hr class="rounded">
<div class="rowDiv">
<button onclick="playOriginal()" class="largeButton">Play Original Nintedo Minute BINGO</button>
</div>
<p class="body">AC Birthday's AC: New Horizons BINGO was inspired by Nintendo Minute. You can play the original BINGO board shown in their YouTube video <a class="bodyLink" href="https://www.youtube.com/watch?v=cwz5KRvqBwI">here</a></p>
<hr class="rounded">
<h3 class="h3">Challenge Suggestions?</h3>
<p class="body">Have an AC: New Horizons challenge BINGO idea? Email it here:</p>
<p class="body centerBody"><a class="bodyLink" href="mailto:acbirthdays1@gmail.com">acbirthdays1@gmail.com</a></p>
</section>
<section id="gameSection">
<br/>
<button onclick="backToSetup()" class="thinButton"><i class="fas fa-chevron-left fa-fw fa-lg" style="vertical-align: middle;"></i></button>
<br/>
<br/>
<table id="gameTable" class="gameTable">
</table>
</section>
<script type="text/javascript">
var state = {
challenges: [],
activeChallenges: [],
curIndex: 0,
season: 0,
mode: 0
}
$.getJSON("bingo.json", function(json) {
$.each(json, function () {
var obj = this;
var challenge = {
id: obj["id"],
mode: obj["mode"],
season: obj["season"],
type: obj["type"],
challenge: obj["challenge"],
completed: false
};
state.challenges.push(challenge);
});
});
setup();
function setup() {
setSeason(state.season)
setMode(state.mode)
$('#gameSection').hide();
}
function play() {
state.activeChallenges = getRandomChallenges();
startGame()
}
function playOriginal() {
state.activeChallenges = getNintendoMinuteOriginalBINGO();
startGame()
}
function startGame() {
var gameTable = document.getElementById('gameTable');
gameTable.innerHTML = "";
var i, j;
var count = 0;
for (i = 0; i < 5; i++) {
var row = gameTable.insertRow();
for (j = 0; j < 5; j++) {
state.activeChallenges[count].completed = false;
var cell = row.insertCell(j);
cell.innerHTML = makeCellButtonHTML(count, state.activeChallenges[count].challenge);
count++;
}
}
$('#setupSection').hide();
$('#gameSection').show();
}
function makeCellButtonHTML(id, text) {
var html = '<button id="Challenge' + id + 'Button" class="challengeButton" onclick="toggleChallenge(' + id + ')"><p class="challengeText">' + text + '</p></button>';
return html;
}
function toggleChallenge(id) {
var completed = state.activeChallenges[id].completed;
$('#Challenge'+id+'Button').addClass(completed == true ? 'challengeButton' :'challengeButtonSelected');
$('#Challenge'+id+'Button').removeClass(completed == true ? 'challengeButtonSelected' :'challengeButton');
state.activeChallenges[id].completed = !completed;
}
function backToSetup() {
$('#setupSection').show();
$('#gameSection').hide();
}
function setFocus(name, focus) {
$('#'+name).addClass(focus == true ? 'largeButton' :'largeButtonDisabled');
$('#'+name).removeClass(focus == true ? 'largeButtonDisabled' :'largeButton');
}
function setSeason(id) {
state.season = id;
setFocus("Season0Button", id == 0);
setFocus("Season1Button", id == 1);
setFocus("Season2Button", id == 2);
setFocus("Season3Button", id == 3);
setFocus("Season4Button", id == 4);
setFocus("Season5Button", id == 5);
}
function setMode(id) {
state.mode = id;
setFocus("Mode0Button", id == 0);
setFocus("Mode1Button", id == 1);
}
function getNintendoMinuteOriginalBINGO() {
var challenges = [];
challenges = state.challenges.slice(0, 25);
return challenges;
}
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;
}
}
function getRandomChallenges() {
var challenges = [];
var challenges = state.challenges.filter(challenge => (state.mode == 1 || challenge.mode == 0) && (challenge.season == 0 || challenge.season == state.season || state.season == 5));
shuffleArray(challenges);
challenges = challenges.slice(0, 25);
return challenges;
}
</script>
</main>
<footer>
<br/>
<br/>
<p class="footer"><a class="footerLink" href="https://creativecommons.org/licenses/by-sa/3.0/legalcode">CC BY-SA 3.0</a> ac-birthdays is neither owned by nor affiliated with Nintendo or the creators of Animal Crossing. © 2001 - 2020 Nintendo. Nintendo properties are trademarks of Nintendo. Images and data from <a class="footerLink" href="https://animal-crossing.com">https://animal-crossing.com</a> and <a class="footerLink" href="https://nookipedia.com">https://nookipedia.com</a>. Created by <a class="footerLink"href="https://jefhai.com">jefhai.com</a></p>
</footer>
</body>
</html>