aboutsummaryrefslogtreecommitdiff
path: root/index.html
blob: d09b8f26f3c7012ec23bc3c6c8cc1db4fad26b28 (plain)
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="Skyblock.Bingo lets you view your Hypixel Skyblock bingo stats, leaderboard, and guide for this month's goals!">
    <meta name="keywords" content="bingo, hypixel, skyblock, hypixel skyblock">
    <meta name="robots" content="index, follow">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="language" content="English">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:wght@400;700&display=swap" rel="stylesheet">
    <script src="https://skyblock.bingo/MinecraftColorCodes.min.3.7.js"></script>
    <title>skyblock.bingo</title>
</head>
<style>
    body {
        font-family: 'Atkinson Hyperlegible', sans-serif;
        margin: 0px;
        background-color: #070F15;
        color: #bebebe;
    }
    #header {
        background-color: #000000;
        display: flex;
        text-align: left;
        padding: 5px;
        position: sticky;
        top: 0px;
        height: 24px;
    }
    #header a {
        outline: none;
        border-radius: 32px;
        border: none;
        padding-top: 3px;
        padding-bottom: 3px;
        padding-left: 8px;
        padding-right: 8px;
        margin-left: 8px;
        line-height: 18px;
        background-color: #383838;
        text-decoration: none;
        color: #ffffff;
    }
    #header a:hover {
        background-color: #bebebe;
        color: #070F15;
    }
    #card {
        display: flex;
        width: 400px;
        height: 400px;
        margin-top: 16px;
        margin-left: 16px;
        border-radius: 5px;
        flex-direction: column;
        background-color: #000000;
    }
    .row {
        display: flex;
        flex-direction: row;
    }
    .goal {
        width: 79px;
        height: 79px;
        border-right: 1px solid #383838;
        border-bottom: 1px solid #383838;
    }
    .goal button {
        width: 100%;
        height: 100%;
        background-color: transparent;
        border: none;
        color: rgb(0, 0, 0);
        cursor: pointer;
        font-size: 12px;
    }
    .goal button:active {
        background-color: #00000050;
    }
    .container{
        width: 100%;
        display: flex;
        flex-direction: row;
    }
    #player-container {
        margin-top: 16px;
        margin-left: 16px;
        margin-right: 16px;
        height: calc(400px - 16px);
        width: 100%;
        background-color: #383838;
        border-radius: 5px;
        padding-bottom: 16px;
        display: flex;
        flex-direction: row;
    }
    #player {
        border-radius: 5px 0px 0px 5px;
        min-width: 180px;
        width: fit-content;
        padding-top: 16px;
        padding-left: 16px;
        padding-right: 16px;
        height: 100%;
        background-color: #424242;
    }
    #player-content {
        display: none;
    }
    #username {
        margin-bottom: 48px;
    }
    #guide {
        display: none;
        width: 100%;
        height: calc(100% - 16px);
        color: white;
        padding: 32px;
        padding-top: 16px;
        border-radius: 0px 5px 5px 0px;
    }
    #guide h3 {
        font-size: 24px;
    }
    #guide a {
        text-decoration: underline; 
        color: #1e78e0;
    }
    #goals {
        margin-top: 16px;
        margin-left: 16px;
        margin-right: 16px;
        height: auto;
        min-height: 754px;
        width: 100%;
        background-color: #383838;
        border-radius: 5px;
        padding-left: 16px;
        padding-right: 16px;
        padding-bottom: 16px;
        margin-bottom: 16px;
    }
    #goals-content {
        display: none;
    }
    #blackout-string {
        font-family: 'Atkinson Hyperlegible', sans-serif;
        font-weight: 700;
        text-align: center;
        color: white;
        font-size: 36px;
        padding-top: 182px;
        width: 400px;
    }
    #disclaimer {
        margin-left: 32px;
    }
    #attribution {
        float: right; 
        margin-right: 32px;
    }
    #instructions {
        color: #bebebe;
        padding: 16px;
        border-radius: 5px;
        background-color: #424242;
        overflow-y: auto;
        max-height: calc(300px - 78px);
    }
    @media only screen and (max-width: 600px) {
        .container {
            flex-direction: column-reverse;
        }
        #card {
            width: calc(100% - 32px);
            height: calc(100vw - 32px);
            margin-bottom: 16px;
        }
        .goal {
            width: -webkit-calc(100% / 5);
            height: calc((100vw - 32px) / 5);
        }
        #player-container {
            width: calc(100% - 32px);
            height: calc(100vw - 32px);
            margin-bottom: 16px;
        }
        #player {
            width: calc(100% - 32px);
            min-height: auto;
            height: 100%;
            border-radius: 5px;
            padding-top: 16px;
            padding-left: 16px;
            padding-right: 16px;
            background-color: #383838;
            padding-bottom: 16px;
        }
        #player img {
            width: 180px;
            height: 180px;
        }
        #guide {
            display: none;
        }
        #username {
            margin-bottom: 0px;
        }
        #goals {
            margin-top: 5px;
            width: calc(100% - 64px);
        }
        #blackout-string {
            width: 100%;
            padding-top: calc(50% - 18px);
        }
        #footer {
            text-align: center;
            margin-top: 0px;
            margin-bottom: 16px;
        }
        #disclaimer {
            margin-left: 0px;
            text-align: center;
        }
        #attribution {
            display: none;
        }
    }
</style>
<body>
    <div id="header">
        <a style="margin-left: 0px; background-color: #000000; color: white; font-weight: 600;" href="https://skyblock.bingo">skyblock.bingo</a>
        <a href="https://skyblock.bingo/guide" target="_blank">Guide</a>
        <a href="https://skyblock.bingo/leaderboard" target="_blank">Leaderboard</a>
        <a href="https://skyblock.bingo/api" target="_blank">API</a>
    </div>
    <div class="container">
        <div id="card">
            <div class="row">
                <div id="goal0" class="goal" style="border-radius: 5px 0px 0px 0px;">
                    <button class="card-btn" aria-label="Display Goal One" onclick="displayGoal(0)" style="border-radius: 5px 0px 0px 0px;"></button>
                </div>
                <div id="goal1" class="goal">
                    <button class="card-btn" aria-label="Display Goal Two" onclick="displayGoal(1)"></button>
                </div>
                <div id="goal2" class="goal">
                    <button class="card-btn" aria-label="Display Goal Three" onclick="displayGoal(2)"></button>
                </div>
                <div id="goal3" class="goal">
                    <button class="card-btn" aria-label="Display Goal Four" onclick="displayGoal(3)"></button>
                </div>
                <div id="goal4" class="goal" style="border-radius: 0px 5px 0px 0px; border-right: 0px;">
                    <button class="card-btn" aria-label="Display Goal Five" onclick="displayGoal(4)" style="border-radius: 0px 5px 0px 0px;"></button>
                </div>
            </div>
            <div class="row">
                <div id="goal5" class="goal">
                    <button class="card-btn" aria-label="Display Goal Six" onclick="displayGoal(5)"></button>
                </div>
                <div id="goal6" class="goal">
                    <button class="card-btn" aria-label="Display Goal Seven" onclick="displayGoal(6)"></button>
                </div>
                <div id="goal7" class="goal">
                    <button class="card-btn" aria-label="Display Goal Eight" onclick="displayGoal(7)"></button>
                </div>
                <div id="goal8" class="goal">
                    <button class="card-btn" aria-label="Display Goal Nine" onclick="displayGoal(8)"></button>
                </div>
                <div id="goal9" class="goal" style="border-right: 0px;">
                    <button class="card-btn" aria-label="Display Goal Ten" onclick="displayGoal(9)"></button>
                </div>
            </div>
            <div class="row">
                <div id="goal10" class="goal">
                    <button class="card-btn" aria-label="Display Goal Eleven" onclick="displayGoal(10)"></button>
                </div>
                <div id="goal11" class="goal">
                    <button class="card-btn" aria-label="Display Goal Twelve" onclick="displayGoal(11)"></button>
                </div>
                <div id="goal12" class="goal">
                    <button class="card-btn" aria-label="Display Goal Thirteen" onclick="displayGoal(12)"></button>
                </div>
                <div id="goal13" class="goal">
                    <button class="card-btn" aria-label="Display Goal Fourteen" onclick="displayGoal(13)"></button>
                </div>
                <div id="goal14" class="goal" style="border-right: 0px;">
                    <button class="card-btn" aria-label="Display Goal Fifteen" onclick="displayGoal(14)"></button>
                </div>
            </div>
            <div class="row">
                <div id="goal15" class="goal">
                    <button class="card-btn" aria-label="Display Goal Sixteen" onclick="displayGoal(15)"></button>
                </div>
                <div id="goal16" class="goal">
                    <button class="card-btn" aria-label="Display Goal Seventeen" onclick="displayGoal(16)"></button>
                </div>
                <div id="goal17" class="goal">
                    <button class="card-btn" aria-label="Display Goal Eighteen" onclick="displayGoal(17)"></button>
                </div>
                <div id="goal18" class="goal">
                    <button class="card-btn" aria-label="Display Goal Ninteen" onclick="displayGoal(18)"></button>
                </div>
                <div id="goal19" class="goal" style="border-right: 0px;">
                    <button class="card-btn" aria-label="Display Goal Twenty" onclick="displayGoal(19)"></button>
                </div>
            </div>
            <div class="row">
                <div id="goal20" class="goal" style="border-radius: 0px 0px 0px 5px; border-bottom: 0px;">
                    <button class="card-btn" aria-label="Display Goal Twentyone" onclick="displayGoal(20)" style="border-radius: 0px 0px 0px 5px;"></button>
                </div>
                <div id="goal21" class="goal" style="border-bottom: 0px;">
                    <button class="card-btn" aria-label="Display Goal Twentytwo" onclick="displayGoal(21)"></button>
                </div>
                <div id="goal22" class="goal" style="border-bottom: 0px;">
                    <button class="card-btn" aria-label="Display Goal Twentythree" onclick="displayGoal(22)"></button>
                </div>
                <div id="goal23" class="goal" style="border-bottom: 0px;">
                    <button class="card-btn" aria-label="Display Goal Twentyfour" onclick="displayGoal(23)"></button>
                </div>
                <div id="goal24" class="goal" style="border-radius: 0px 0px 5px 0px; border-right: 0px; border-bottom: 0px;">
                    <button class="card-btn" aria-label="Display Goal Twentyfive" onclick="displayGoal(24)" style="border-radius: 0px 0px 5px 0px;"></button>
                </div>
            </div>
        </div>

        <div id="player-container">
            <div id="player">
                <div id="player-content">
                    <img style="border-radius: 3px;" id='playerhead' src="" alt="Playerhead Image">
                    <h3 id="username"></h3>
                    <p><span style="font-weight: 700;">*Bingo Rank: </span><span id='rank' style="color: #bebebe;">none</span></p>
                    <p><span style="font-weight: 700;">Points: </span><span id="points_display" style="color: #ECB22E;">0</span></p>
                    <p><span style="font-weight: 700;">Completed: </span><span id="completed_goals" style="color:#55FF55;">0</span><span style="color: #ECB22E;">/20</span></p>
                </div>
            </div>
            <div id="guide" style="padding-bottom: 16px;"></div>
        </div>
    </div>
    
    <div class="container">
        <div id="goals">
            <div id="goals-content">
                <h3 style="color: #2EB67D; margin-bottom: 0px;">Tier 1</h3>
                <div id="tier1"> </div>

                <h3 style="color: #1ee0c0; margin-bottom: 0px;">Tier 2</h3>
                <div id="tier2"></div>

                <h3 style="color: #1e78e0; margin-bottom: 0px;">Tier 3</h3>
                <div id="tier3"></div>

                <h3 style="color: #d01ee0; margin-bottom: 0px;">Tier 4</h3>
                <div id="tier4"></div>

                <h3 style="color: #E01E5A; margin-bottom: 0px;">Tier 5</h3>
                <div id="tier5"></div>

                <h3 style="color: #ECB22E; margin-bottom: 0px;">Community</h3>
                <div id="community"></div>
            </div>
        </div>
    </div>

    <p id="footer">
        <span id="disclaimer">*Bingo rank is based on your active bingo pet</span><span id="attribution">Made by <a style="text-decoration: none; color: #1e78e0;" href="https://github.com/awesomepandapig/skyblock.bingo" target="_blank">awesomepandapig</a></span>
    </p>
</body>
<script>
    window.onload = function() {
        let user =  window.location.href.split('/')[4];
        // Gets the current active bingo goals
        fetch(`https://api.hypixel.net/resources/skyblock/bingo`)
        .then(response => response.json())
        .then(data => {
            console.log(data);
            goals = data.goals;
            var tier_one_goals = [];
            var tier_two_goals = [];
            var tier_three_goals = [];
            var tier_four_goals = [];
            var tier_five_goals = [];
            var community_goals = [];
            // Gets a user's stats for the current bingo event
            fetch(`https://skyblock.bingo/api/stats/${user}`)
            .then(response => response.json())
            .then(userData => {
                console.log(userData);
                if(userData.success == false) { // If the user has no bingo data
                    if(userData.cause == 'This user does not exist') {window.location.replace(`https://skyblock.bingo`);}
                    if(userData.cause == 'No skyblock data could be found') {window.location.replace(`https://skyblock.bingo`);}
                    // Sets the page title to include the user's username
                    document.title = `${userData.username} | skyblock.bingo`;
                    // Sets the username to the user's
                    document.getElementById('username').innerHTML = userData.username;
                    // Sets the favicon to the user's playerhead
                    var link = document.querySelector("link[rel~='icon']");
                    if (!link) {
                        link = document.createElement('link');
                        link.rel = 'icon';
                        document.getElementsByTagName('head')[0].appendChild(link);
                    }
                    link.href = `https://mc-heads.net/avatar/${userData.uuid}`;
                    document.getElementById('playerhead').src = `https://mc-heads.net/avatar/${userData.uuid}`;
                    for (i = 0; i < goals.length; i++) {
                        document.getElementsByClassName('card-btn')[i].innerHTML = goals[i].name;
                        if ((i == 1) || (i == 3) || (i == 14) || (i == 22)) {
                            displayGoals('tier1', goals[i]);
                            document.getElementById(`goal${i}`).style.backgroundColor = '#2EB67D';
                        }
                        if ((i == 5) || (i == 8) || (i == 11) || (i == 15) || (i == 17) || (i == 19)) {
                            displayGoals('tier2', goals[i]);
                            document.getElementById(`goal${i}`).style.backgroundColor = '#1ee0c0';
                        }
                        if ((i == 7) || (i == 9) || (i == 13) || (i == 20) || (i == 21)) {
                            displayGoals('tier3', goals[i]);
                            document.getElementById(`goal${i}`).style.backgroundColor = '#1e78e0';
                        }
                        if ((i == 2) || (i == 10) || (i == 16)) {
                            displayGoals('tier4', goals[i]);
                            document.getElementById(`goal${i}`).style.backgroundColor = '#d01ee0';
                        }
                        if ((i == 4) || (i == 23)) {
                                displayGoals('tier5', goals[i]);
                                document.getElementById(`goal${i}`).style.backgroundColor = '#E01E5A';
                        }
                        if ((i == 0) || (i == 6) || (i == 12) || (i == 18) || (i == 24)) {
                            community_goals.push(goals[i]);
                            document.getElementById(`goal${i}`).style.backgroundColor = '#ECB22E';
                        }
                    }
                    for(j = 0; j < community_goals.length; j++) {
                        document.getElementById('community').innerHTML += (`${community_goals[j].name} - `);
                        for(k = 0; k < community_goals[j].tiers.length; k++) {
                            if(community_goals[j].progress > community_goals[j].tiers[k]) {
                                tempString = document.createElement('span');
                                if (k == community_goals[j].tiers.length-1) {
                                    tempString.innerHTML = community_goals[j].tiers[k];
                                } else {
                                    tempString.innerHTML = community_goals[j].tiers[k] + ', ';
                                }
                                tempString.style.color = '#55FF55'
                                document.getElementById('community').append(tempString);
                            } else {
                                if (k == community_goals[j].tiers.length-1) {
                                    tempString.innerHTML = community_goals[j].tiers[k];
                                } else {
                                    tempString.innerHTML = community_goals[j].tiers[k] + ', ';
                                }
                                tempString.style.color = '#bebebe'
                                document.getElementById('community').append(tempString);
                            }
                        }
                        document.getElementById('community').innerHTML += (`<br/>`);
                    }
                } else { // If the user has bingo data
                    // Sets the page title to include the user's username
                    document.title = `${userData.username} | skyblock.bingo`;
                    // Sets the user's points
                    document.getElementById('points_display').innerHTML = userData.total_points;
                    document.getElementById('completed_goals').innerHTML = userData.completed_goals.length;
                    // Sets the username to the user's
                    document.getElementById('username').innerHTML = userData.username;
                    if (userData.hypixel_rank == 'ADMIN' || userData.hypixel_rank == 'YOUTUBER') {
                        document.getElementById('username').style.color = '#FF5555';
                    } else if (userData.hypixel_rank == 'MODERATOR') {
                        document.getElementById('username').style.color = '#00AA00';
                    } else if (userData.hypixel_rank == 'HELPER') {
                        document.getElementById('username').style.color = '#0000AA';
                    } else if (userData.hypixel_rank == 'SUPERSTAR') {
                        document.getElementById('username').style.color = '#FFAA00';
                    } else if (userData.hypixel_rank == 'MVP_PLUS') {
                        document.getElementById('username').style.color = '#55FFFF';
                    } else if (userData.hypixel_rank == 'MVP') {
                        document.getElementById('username').style.color = '#55FFFF';
                    } else if (userData.hypixel_rank == 'VIP_PLUS') {
                        document.getElementById('username').style.color = '#55FF55';
                    } else if (userData.hypixel_rank == 'VIP') {
                        document.getElementById('username').style.color = '#55FF55';
                    }
                    // Gets the user's bingo rank
                    if(userData.bingo_rank == 1) {
                        document.getElementById('rank').innerHTML = 'I';
                        document.getElementById('rank').style.color = '#55FF55';
                    }
                    if(userData.bingo_rank == 2) {
                        document.getElementById('rank').innerHTML = 'II';
                        document.getElementById('rank').style.color = '#5555FF';
                    }
                    if(userData.bingo_rank == 3) {
                        document.getElementById('rank').innerHTML = 'III';
                        document.getElementById('rank').style.color = '#AA00AA';
                    }
                    // Sets the favicon to the user's playerhead
                    var link = document.querySelector("link[rel~='icon']");
                    if (!link) {
                        link = document.createElement('link');
                        link.rel = 'icon';
                        document.getElementsByTagName('head')[0].appendChild(link);
                    }
                    link.href = `https://mc-heads.net/avatar/${userData.uuid}`;
                    document.getElementById('playerhead').src = `https://mc-heads.net/avatar/${userData.uuid}`;
                    // Blacks-out the card if a user has completed all bingo goals
                    goalDisplayed = false;
                    if (userData.completed_goals.length == 20) {
                        for(n = 0; n < 25; n++) {
                            document.getElementById(`goal${n}`).style.display = 'none';
                        }
                        blackoutString = document.createElement(`span`);
                        blackoutString.id = 'blackout-string';
                        blackoutString.innerHTML = 'BLACKOUT';
                        document.getElementById(`card`).append(blackoutString);
                        goalDisplayed = true;
                        // Display a congratulatory message if a user has completed their card
                        goal_name = document.createElement('h3');
                        goal_name.id = 'goal-name';
                        document.getElementById('guide').append(goal_name);
                        document.getElementById('goal-name').style.fontSize = '20px';
                        document.getElementById('goal-name').style.paddingTop = '142px';
                        document.getElementById('goal-name').style.textAlign = 'center';
                        document.getElementById('goal-name').innerHTML = 'You have completed all of your bingo goals<br>Come back next month for a new bingo challenge!';
                    }
                    for (i = 0; i < goals.length; i++) {
                        //document.getElementsByClassName('card-btn')[i].innerHTML = goals[i].name;
                        completed = false;
                        for(l = 0; l < userData.completed_goals.length; l++) {
                            if(goals[i].id == userData.completed_goals[l]) {
                                completed = true;
                            }
                        }
                        if(!completed && !goalDisplayed) {
                            displayGoal(i); 
                            goalDisplayed = true;
                        }
                        if ((i == 1) || (i == 3) || (i == 14) || (i == 22)) {
                            if(completed) {
                                strikeThroughGoals('tier1', goals[i]);
                                document.getElementById(`goal${i}`).innerHTML = '';
                                document.getElementById(`goal${i}`).style.backgroundColor = 'black';
                            } else {
                                displayGoals('tier1', goals[i]);
                                document.getElementById(`goal${i}`).style.backgroundColor = '#2EB67D';
                            }
                        }
                        if ((i == 5) || (i == 8) || (i == 11) || (i == 15) || (i == 17) || (i == 19)) {
                            if(completed) {
                                strikeThroughGoals('tier2', goals[i]);
                                document.getElementById(`goal${i}`).innerHTML = '';
                                document.getElementById(`goal${i}`).style.backgroundColor = 'black';
                            } else {
                                displayGoals('tier2', goals[i]);
                                document.getElementById(`goal${i}`).style.backgroundColor = '#1ee0c0';
                            }
                        }
                        if ((i == 7) || (i == 9) || (i == 13) || (i == 20) || (i == 21)) {
                            if(completed) {
                                strikeThroughGoals('tier3', goals[i]);
                                document.getElementById(`goal${i}`).innerHTML = '';
                                document.getElementById(`goal${i}`).style.backgroundColor = 'black';
                            } else {
                                displayGoals('tier3', goals[i]);
                                document.getElementById(`goal${i}`).style.backgroundColor = '#1e78e0';
                            }
                        }
                        if ((i == 2) || (i == 10) || (i == 16)) {
                            if(completed) {
                                strikeThroughGoals('tier4', goals[i]);
                                document.getElementById(`goal${i}`).innerHTML = '';
                                document.getElementById(`goal${i}`).style.backgroundColor = 'black';
                            } else {
                                displayGoals('tier4', goals[i]);
                                document.getElementById(`goal${i}`).style.backgroundColor = '#d01ee0';
                            }
                        }
                        if ((i == 4) || (i == 23)) {
                            if(completed) {
                                strikeThroughGoals('tier5', goals[i]);
                                document.getElementById(`goal${i}`).innerHTML = '';
                                document.getElementById(`goal${i}`).style.backgroundColor = 'black';
                            } else {
                                displayGoals('tier5', goals[i]);
                                document.getElementById(`goal${i}`).style.backgroundColor = '#E01E5A';
                            }
                        }
                        if ((i == 0) || (i == 6) || (i == 12) || (i == 18) || (i == 24)) {
                            community_goals.push(goals[i]);
                            document.getElementById(`goal${i}`).style.backgroundColor = '#ECB22E';
                        }
                    }
                    for(j = 0; j < community_goals.length; j++) {
                        document.getElementById('community').innerHTML += (`${community_goals[j].name} - `);
                        for(k = 0; k < community_goals[j].tiers.length; k++) {
                            if(community_goals[j].progress > community_goals[j].tiers[k]) {
                                tempString = document.createElement('span');
                                if (k == community_goals[j].tiers.length-1) {
                                    tempString.innerHTML = community_goals[j].tiers[k];
                                } else {
                                    tempString.innerHTML = community_goals[j].tiers[k] + ', ';
                                }
                                tempString.style.color = '#55FF55'
                                document.getElementById('community').append(tempString);
                            } else {
                                tempString = document.createElement('span');
                                if (k == community_goals[j].tiers.length-1) {
                                    tempString.innerHTML = community_goals[j].tiers[k];
                                } else {
                                    tempString.innerHTML = community_goals[j].tiers[k] + ', ';
                                }
                                tempString.style.color = '#bebebe'
                                document.getElementById('community').append(tempString);
                            }
                        }
                        document.getElementById('community').innerHTML += (`<br/>`);
                    }
                    document.getElementById('goals-content').style.display = 'block';
                    document.getElementById('player-content').style.display = 'block';
                    if(screen.width > 848) {
                        document.getElementById('guide').style.display = 'block';       
                    }
                }
            })
        })
        .catch(error => {
            document.body.innerHTML = JSON.stringify({success: false, cause: 'The Hypixel API is currently unavailable.'});
            document.body.style.padding = '16px';
        });
    }

    function displayGoals(str, arr)  {
        var colorfulString = arr.lore.substring(0, arr.lore.length-1).replaceColorCodes();
        document.getElementById(str).append(colorfulString);
        document.getElementById(str).innerHTML += '<br/>';
    }

    function strikeThroughGoals(str, arr)  {
        var colorfulString = arr.lore.substring(0, arr.lore.length-1).replaceColorCodes();
        var tempSpan = document.createElement('span');
        tempSpan.append(colorfulString);
        tempSpan.innerHTML = `<del>${tempSpan.innerHTML}<del/><br/>`;
        document.getElementById(str).append(tempSpan);
    }

    guide = [];
    fetch(`https://skyblock.bingo/guide.json`)
    .then(response => response.json())
    .then(data => {
        guide = data;
    })

    function displayGoal(num) {
        document.getElementById('guide').innerHTML = '';
        
        goal_name = document.createElement('h3')
        goal_name.id = 'goal-name';
        document.getElementById('guide').append(goal_name);

        if ((num == 1) || (num == 3) || (num == 14) || (num == 22)) {
            document.getElementById('goal-name').style.color = '#2EB67D'; // Tier 1
        } else if ((num == 5) || (num == 8) || (num == 11) || (num == 15) || (num == 17) || (num == 19)) {
            document.getElementById('goal-name').style.color = '#1ee0c0'; // Tier 2
        } else if ((num == 7) || (num == 9) || (num == 13) || (num == 20) || (num == 21)) {
            document.getElementById('goal-name').style.color = '#1e78e0'; // Tier 3
        } else if ((num == 2) || (num == 10) || (num == 16)) {
            document.getElementById('goal-name').style.color = '#d01ee0'; // Tier 4
        } else if ((num == 4) || (num == 23)) {
            document.getElementById('goal-name').style.color = '#E01E5A'; // Tier 5
        } else {
            document.getElementById('goal-name').style.color = '#ECB22E'; // Community
        }
        document.getElementById('goal-name').innerHTML = goals[num].name;
        var colorfulString = (goals[num].lore || guide[num].lore).slice(0, -1).replaceColorCodes();
        var lore = document.createElement('p');
        lore.append(colorfulString);
        document.getElementById('guide').append(lore);

        if(guide[num].method.length != 0) {
            instructions = document.createElement('p');
            instructions.id = 'instructions';
            if (!(guide[num].notes == "None")) {
                instructions.innerHTML = `${guide[num].method}<br><br>${guide[num].notes}`;
            } else {
                instructions.innerHTML = `${guide[num].method}`;
            }
            document.getElementById('guide').append(instructions);
        }
    }
</script>
</html>