-
Notifications
You must be signed in to change notification settings - Fork 5
/
beta.html
2382 lines (2096 loc) · 128 KB
/
beta.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
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
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!--
Hey, Pit players! This is the un-obfuscated source code for brookeafk.com.
Please feel free to ask me questions at https://discord.gg/nuUms8r9Ke or brooke-gill on GitHub.
-->
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
<meta id="viewport" name="viewport" content="initial-scale=1, user-scalable=0, minimum-scale=1">
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>
<link rel="apple-touch-icon" sizes="180x180" href="favicon_icons/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon_icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon_icons/favicon-16x16.png">
<link rel="shortcut icon" type="image/x-icon" href="favicon_icons/favicon.ico">
<title>Hypixel Pit Events Tracker - brookeafk.com</title>
<meta name="theme-color" content="#ffbbff">
<meta name="description" content="This site allows you to view the upcoming events in the Hypixel Pit in real time.">
<meta name="keywords" content="Hypixel Pit, Hypixel, Hypixel Pit Events Tracker, Pit Events, BrookeAFK, Pit, brookeafk.com">
<script src="languages.js"></script>
</head>
<body class="unselectable">
<div id="wrapper">
<div id="current-event" style="position: absolute; top: 35px; font-size: 25px; width: 475px; word-wrap: break-word; left: 35%; vertical-align: middle; padding: 1px; display: none;" class="flashtext unselectable" align="center"></div>
<div><p class="topcontainer"><img src="./3457688aa57c4d71ab9d22b04f9160db.png" width="20" style="position: relative; bottom: 4px;" id="face"><span id="facebreak"> </span><span class="wordmark w600" id="brookeafk-com" onclick="funLogo()">brookeafk.com</span><span class="mobilebreak"> </span><span id="settings" onclick="SettingsMenu()" class="hand_cursor icon">Settings</span> <span id="help" onclick="Help()" class="hand_cursor icon">Help</span> <span id="palette-generator" onclick="paletteGenerator()" class="hand_cursor icon">Palette</span></p>
</div>
<p class="palette-announcement" id="palette-announcement" style="display: none">
<span id="lt-126">A Pit player would like you to try out their custom palette.</span><br>
<span style="font-size: 15px; font-weight: 600;" id="palette-colors"></span><br>
<span id="custom-palette-user-assistance-0">Would you like to use it?</span><br>
<span id="regular-selection"><span class="button" onclick="changeToURLPalette('yes')" id="lt-128">Yes!</span> <span class="button" onclick="changeToURLPalette('no')" id="lt-129">No</span><br></span>
<span id="sneaky-rename" style="display: none"><span class="button button-smooth button-blue"><input type="text" class="button-input" id="custom-palette-name-input" onkeydown="changeToURLPalette('checkevent', event)" placeholder="Enter a name here..."></span> <span class="button button-green" onclick="changeToURLPalette('confirm')" id="lt-133">Confirm</span><br></span>
<sub><span id="custom-palette-user-assistance-1">Clicking "Yes!" will remove your current custom palette, if any.</sub>
</p>
<noscript><b style="font-size: 80px; color: #ce1010">JavaScript is disabled. This site can't function without it.</b><br><span style="font-size: 30px; color: #7d2323">If you think you're seeing this in error, send me a ticket at the <a href="https://discord.gg/nuUms8r9Ke" target="_blank">Pit Resource Support Discord Server</a>.</span></noscript>
<div style="background: linear-gradient(90deg, rgb(181, 175, 55) 0%, rgb(18, 129, 173) 100%); padding: 15px; position: relative; top: -55px; z-index: 5" onclick="dismissAnnouncement()" id="announcement_1_1_0" class="announcement update-announcement"><b>brookeafk.com now supports custom palettes!</b> Make your own by <a style="color: #ccc; cursor: pointer;" href="palette" target="_blank"><u>clicking here</u></a>.<br>(Dismiss this announcement by clicking anywhere else on it.)<div style="width: 100%; background-color: #FFFFFF80; height: 5px; position: relative; top: 5px;" id="dismissalprogress"></div></div>
<div id="day-night-border" class="timers dnb"><div id="day-night" style="vertical-align: middle; display: table-cell;" align="center">00:00 </div><svg id="day-svg" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24px" viewBox="0 0 24 24" width="24px" fill="#FFFFFF"><path d="M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0 c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2 c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1 C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06 c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41 l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41 c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36 c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"/></svg> — <span id="maprot" class="hand_cursor" onclick="mapClick()"></span></div>
<span class="mobilebreak" id="current-event-mobilebreak"></span>
<div class="mobileanno" id="mobileanno" style="display: none"></div>
<div id="settings-section"><br>
<p class="option"><span class="settingsheader" id="lt-2">— Style —</span></p>
<p class="option"><span><b id="lt-3">Theme</b>: </span><span id="settings-theme-dark" onclick='changeTheme("dark")'>Dark</span><span> / </span><span id="settings-theme-light" onclick='changeTheme("light")'>Light</span></p>
<p class="option" id="option-palette"><span><b id="lt-6">Palette</b>: </span><span id="settings-palette-gradients0" onclick="changePalette('gradients0')" class="hand_cursor">Gradient</span> <span id="settings-palette-gradients1" onclick="changePalette('gradients1')" class="hand_cursor">(alt)</span> / <span id="settings-palette-0" onclick='changePalette(0)' class="hand_cursor">Theme 0</span> / <span id="settings-palette-1" onclick='changePalette(1)' class="hand_cursor">Theme 1</span> / <span id="settings-palette-2" onclick='changePalette(2)' class="hand_cursor">Theme 2</span> / <span id="settings-palette-3" onclick='changePalette(3)' class="hand_cursor">Theme 3</span> / <span id="settings-palette-4" onclick='changePalette(4)' class="hand_cursor">Theme 4</span> / <span id="custom-palette-exists" style="display: none"><span id="settings-palette-custom" onclick='changePalette("Custom")' class="hand_cursor"><span id="settings-palette-custom-name" class="nocolorchange" style="font-style: oblique">Custom</span></span> / </span><span id="settings-palette-create" onclick='changePalette(9999)' class="hand_cursor"><b id="lt-18">Custom</b> <span style="font-family: Material">palette</span></span></p>
<p class="option"><span><b id="lt-26">Font</b>: </span><span id="settings-font-default" class="hand_cursor" onclick='changeFont("Inter")'>Default</span><span> / <span id="settings-font-minecraft" class="hand_cursor" onclick='changeFont("minecraft")'>Minecraft</span><span> / </span><span id="settings-font-sans-serif" class="hand_cursor" onclick='changeFont("sans-serif")'>Sans-serif</span></p>
<p class="option"><span><b id="lt-30">Icons</b>: </span><span id="settings-icons-on" class="hand_cursor" onclick='changeIcons(1)'>On</span><span> / <span id="settings-icons-off" class="hand_cursor" onclick='changeIcons(0)'>Off</span></p>
<p class="option"><span><b id="lt-33">Tab timer</b>: </span><span id="settings-tabtimer-on" class="hand_cursor" onclick='changeTabTimer(1)'>On</span><span> / <span id="settings-tabtimer-off" class="hand_cursor" onclick='changeTabTimer(0)'>Off</span></p>
<p class="option"><span><b id="lt-34">Major event font style</b>: </span><span id="settings-majorstyle-border" class="hand_cursor" onclick='changeMajorStyle("border", "toggle")'>Border</span><span> / <span id="settings-majorstyle-shadow" class="hand_cursor" onclick='changeMajorStyle("shadow", "toggle")'>Shadow</span></p>
<p class="option"><span><b id="lt-37">Event spacing</b>: </span><span id="settings-spacing-5" class="hand_cursor" onclick='changeSpacing(5)'>Big</span><span> / <span id="settings-spacing-3" class="hand_cursor" onclick='changeSpacing(3)'>Small</span> / <span id="settings-spacing-0" class="hand_cursor" onclick='changeSpacing(0)'>None</span></p>
<p class="option"><span class="settingsheader" id="lt-41">— Quality of Life —</span></p>
<p class="option"><span><span style="font-family: Material">Language</span> <b id="lt-66">Language</b>: </span><span id="settings-language-en_CA" class="hand_cursor" onclick='changeLanguage("en_CA")'>English</span><span> / <span id="settings-language-es_AR" class="hand_cursor" onclick='changeLanguage("es_AR")'>Español</span></p>
<p class="option"><span id="tut-notif" style="color: #ffff80"><b id="lt-42">Pre-event notifications</b></span><span>: </span><span id="settings-audio"><span id="audio-300" onclick='SetAudio(300);' class="hand_cursor">5m</span><span> / </span><span id="audio-180" onclick='SetAudio(180);' class="hand_cursor">3m</span><span> / </span><span id="audio-60" onclick='SetAudio(60);' class="hand_cursor">1m</span><span> / </span><span id="audio-0" onclick='SetAudio(-10);' class="hand_cursor">Never</span></span></p>
<p id="anotif" class="option"><span>• <b id="lt-46">Audio notifications</b>: </span><span id="desktop-notifs"><span id="audio-on" onclick='ANotif(1);' class="hand_cursor">On</span><span> / </span><span id="audio-off" onclick='ANotif(0);' class="hand_cursor">Off</span></span></p>
<p id="dnotif" class="option"><span>• <b id="lt-47">Desktop notifications</b>: </span><span id="desktop-notifs"><span id="desktop-on" onclick='DNotif(1);' class="hand_cursor">On</span><span> / </span><span id="desktop-off" onclick='DNotif(0);' class="hand_cursor">Off</span></span></p>
<p class="option"><span id="alert-nobells" style="color: #ff7777; display: none">You're not being reminded for any events!<br>Click the bells in the top-right corner to receive notifications.</span></p>
<p class="option"><span id="alert-notypes" style="color: #ff7777; display: none">Make sure to turn either "Audio notifications"<br>or "Desktop notifications" on to receive alerts.</span></p>
<p class="option"><span><b id="lt-49">Timestamps</b>: </span><span id="settings-ts-tod" onclick='setTimestamps("tod");' class="hand_cursor">Time of Day</span><span> / </span><span id="settings-ts-tue" onclick='setTimestamps("tue");' class="hand_cursor">Time Until Event</span> / <span id="settings-ts-dnc" onclick='setTimestamps("dnc");' class="hand_cursor">Day and Map</span></p>
<p class="option" id="setting-clock-style"><span><b id="lt-53">Clock style</b>: </span><span id="settings-clock-24" onclick='changeClock("24");' class="hand_cursor">24-hour</span><span> / </span><span id="settings-clock-12" onclick='changeClock("12");' class="hand_cursor">12-hour</span></p>
<p class="option"><span id="settings-flashing"><b id="lt-56">Flashing text</b>: </span><span id="settings-flash"><span id="settings-flash-60" onclick='setFlash(60);' class="hand_cursor">60s</span><span> / </span><span id="settings-flash-30" onclick='setFlash(30);' class="hand_cursor">30s</span><span> / </span><span id="settings-flash-10" onclick='setFlash(10);' class="hand_cursor">10s</span><span> / </span><span id="settings-flash-0" onclick='setFlash(-10);' class="hand_cursor">Never</span></span></p>
<p class="option"><span><b id="lt-60">Event text</b>: </span><span id="settings-classic-off" class="hand_cursor" onclick='changeClassic(0)'>Modern</span><span> / <span id="settings-classic-on" class="hand_cursor" onclick='changeClassic(1)'>Classic</span></p>
<p class="option"><span><b id="lt-63">Version</b>: </span><span id="lt-64">New</span><span> / </span><span onclick='window.location = "2022"' style="color: #808080; cursor: pointer" id="lt-65">Old</span></p>
<div id="notifications-major">
<div><span id="visible-Pizza" onclick='VisibilityToggle("Pizza")' class="hand_cursor">Pizza</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-Pizza" onclick='NotifToggle("Pizza")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-Raffle" onclick='VisibilityToggle("Raffle")' class="hand_cursor">Raffle</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-Raffle" onclick='NotifToggle("Raffle")'class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-Squads" onclick='VisibilityToggle("Squads")' class="hand_cursor">Squads</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-Squads" onclick='NotifToggle("Squads")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-Blockhead" onclick='VisibilityToggle("Blockhead")' class="hand_cursor">Blockhead</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-Blockhead" onclick='NotifToggle("Blockhead")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-Spire" onclick='VisibilityToggle("Spire")' class="hand_cursor">Spire</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-Spire" onclick='NotifToggle("Spire")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-Robbery" onclick='VisibilityToggle("Robbery")' class="hand_cursor">Robbery</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-Robbery" onclick='NotifToggle("Robbery")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-TeamDeathmatch" onclick='VisibilityToggle("Team Deathmatch")' class="hand_cursor">Team Deathmatch</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-TeamDeathmatch" onclick='NotifToggle("Team Deathmatch")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-RagePit" onclick='VisibilityToggle("Rage Pit")' class="hand_cursor">Rage Pit</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-RagePit" onclick='NotifToggle("Rage Pit")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-Beast" onclick='VisibilityToggle("Beast")' class="hand_cursor">Beast</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-Beast" onclick='NotifToggle("Beast")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<br><div id="test-audio" style="color: #ffffff;" onclick='TestAudio()' class="hand_cursor">Preview Audio</div><div id="view-offset" style="color: #fff;" onclick='resetOffset()' class="hand_cursor"></div><div id="select-all" style="color: #ffffff;" onclick='SelectOnly("everything")' class="hand_cursor">Select All</div>
</div>
<div id="notifications-minor">
<div><span id="visible-DragonEgg" onclick='VisibilityToggle("Dragon Egg")' class="hand_cursor">Dragon Egg</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-DragonEgg" onclick='NotifToggle("Dragon Egg")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-KOTH" onclick='VisibilityToggle("KOTH")' class="hand_cursor">KOTH</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-KOTH" onclick='NotifToggle("KOTH")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-KOTL" onclick='VisibilityToggle("KOTL")' class="hand_cursor">KOTL</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-KOTL" onclick='NotifToggle("KOTL")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-2xRewards" onclick='VisibilityToggle("2x Rewards")' class="hand_cursor">2x Rewards</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-2xRewards" onclick='NotifToggle("2x Rewards")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-CarePackage" onclick='VisibilityToggle("Care Package")' class="hand_cursor">Care Package</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-CarePackage" onclick='NotifToggle("Care Package")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-Auction" onclick='VisibilityToggle("Auction")' class="hand_cursor">Auction</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-Auction" onclick='NotifToggle("Auction")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-QuickMaths" onclick='VisibilityToggle("Quick Maths")' class="hand_cursor">Quick Maths</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-QuickMaths" onclick='NotifToggle("Quick Maths")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-GiantCake" onclick='VisibilityToggle("Giant Cake")' class="hand_cursor">Giant Cake</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-GiantCake" onclick='NotifToggle("Giant Cake")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<div><span id="visible-Allbounty" onclick='VisibilityToggle("All bounty")' class="hand_cursor">All bounty</span><svg xmlns="http://www.w3.org/2000/svg" height="12px" viewBox="0 0 24 24" width="24px" fill="#ffffff" id="notif-Allbounty" onclick='NotifToggle("All bounty")' class="hand_cursor"><path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/></svg></div>
<br><div id="select-major" style="color: #fff;" onclick='SelectOnly("major")' class="hand_cursor">Majors Only</div>
<div id="select-minor" style="color: #fff;" onclick='SelectOnly("minor")' class="hand_cursor">Minors Only</div>
<div id="select-none" style="color: #f77;" onclick='SelectOnly("nothing")' class="hand_cursor">Deselect All</div>
<br><div id="lt-90" style="color: #aac; font-style: italic;" onclick='SaveSettings()' class="hand_cursor">Settings save<br> automatically!</div><div id="clear-settings" style="color: #f77;" onclick="SaveSettings('clear')" class="hand_cursor">Clear Settings</div><div id="settings-clear-literally-everything" style="color: #b35151; font-weight: bold; display: none;" onclick="SaveSettings('cleareverything')" class="hand_cursor">Clear Settings and URL</div>
</div>
</div>
<p class="option"><span id="alert-noevents" style="color: #ff7777; display: none; text-align: center;"><br>You don't have any events selected!<br>Click the <span style="font-family: Material">settings</span> gear to open the settings. Then, click the event names in the top-right corner to make some visible.<br>Alternatively, click <span onclick="SelectOnly('everything')" style="cursor: pointer; color: #ae4e8e">here</span> to select all events.</span></p>
<span id="noevents" class="bigtext" style="display: none"><br><b>Hey, where'd all the events go?</b><br>It looks like the site ran out of events. This shouldn't happen anymore!<br>Try the following things in order:<ul><li>Wait a few seconds.</li><li>Reload the page by using <kbd>Control</kbd> + <kbd>Shift</kbd> + <kbd>R</kbd>.</li><li>Test <a href="https://raw.githubusercontent.com/BrookeAFK/brookeafk-api/main/events.js" target="blank">this link</a> to see if the site has any events or text on it. If it doesn't (or if you get an error), the site's down. Contact me using the <a href="https://discord.gg/nuUms8r9Ke" target="_blank">Pit Resource Support Discord server</a> or <a href="https://github.com/brooke-gill">on GitHub</a>.</li></ul></span>
<span id="events"></span>
<hr>
<span class="credits">
<p id="madewithlove">Made with love and tears by <a href="https://brookie.dev" target="_blank" rel="noopener">BrookeAFK</a><span id="mcpqndq"> with help from <a href="https://pitpanda.rocks" target="_blank" rel="noopener">McPqndq</a></p>
<p id="translator-credit"></p>
<p id="current-palette" style="display: none"></p>
<p><a href="https://pit.wiki" target="_blank" rel="noopener noreferrer"><span style="color: #ae55c3; font-weight: 600" id="wikiad">Check out the <span style="color: #da85a7">Hypixel Pit Wiki</span>!</a></p>
<p id="special_thanks"></p>
<p id="version" class="ver"></p> <span>— July 2, 2023</span>
<p id="need-help">Need help using this site? Join the <a href="https://discord.gg/nuUms8r9Ke" target="_blank">Pit Resource Support Discord Server</a>.
</span>
</span>
</div>
<script>
var successfulExternalConnections = [false, false]; // critical brookeafk.com JS files that have loaded (control, emergency)
function importScript(url) {
var script = document.createElement('script');
script.src = url;
document.head.appendChild(script);
}
importScript("emergency.js?v=" + Date.now());
importScript("control.js?v=" + Date.now());
function doEverything(loadedSite) {
console.log("External API #" + loadedSite + " has loaded!")
successfulExternalConnections[loadedSite] = true;
if(successfulExternalConnections[0] == true && successfulExternalConnections[1] == true) {
data_backup = MakeAPIAndHTML();
cycle1();
cycle5();
cycle25();
console.log("The data's been called!");
setInterval(cycle1, 40);
setInterval(cycle5, 300);
setInterval(cycle25, 1000);
}
}
console.log("The site has loaded.")
var HiddenEventCount = 0; // number of hidden events
var EventsToLoad = 1; // number of events in the JSON. this is used a LOT!
var version_number = `v1.1.3`
var counter = 4; // counter that counts up every 40ms
var settingsOpened = false; // self explanatory
var mapClicked = false; // whether the user's clicked the map timer to show its spooky extended info
var NormalText = "#000000"; // what colour text should be
var EventFlashSec = 60; // how many seconds events flash before starting
var NotifTimer = -10;
var flipsComplete = false; // whether the event animations' initial flips are done
var DoesStuffExist = false; // if things are loaded and it's safe to start querying event <div>s
var HasStuffLoaded = false; // an even more strict version of DoesStuffExist.
var currentTime; // the current unix timestamp
var Palette = 'gradients0'; // current palette. not sure why it's capitalized. really ought to change it sometime
var SettingsSelectedEvents = 262143; // binary array of user's selected events (in decimal). sorry
var SettingsNotifyEvents = 0; // same as above but for events that the user's getting notified for
var SettingsDesktopNotifs = 0;
var SettingsAudioNotifs = 0;
var CorrectFont = "Inter";
var CorrectBold = "Inter";
var svgDaytime = ""; // used to change the day/night SVG when the time of day changes
var iconsVisible = 1; // whether the user has icons enabled
var tabTimerVisible = 1; // whether the user has the tab timer on
var classicMode = 0; // whether the user uses the older timestamps for the site
var clockStyle = 24; // number of hours in a day if you're strange and American
var noevents = false; // if there's no events
var offset = 0; // offset, in minutes, of a person's clock. useful for people with really weird OSes that can't set their clocks for some reason
var samplemaprotation = 1661835600; // used for the map rotation timer. stolen from pit.wiki
var maps = ["Genesis","Corals","Castle","Elements","Four Seasons"] // for map rotation
var mapid = 0; // id of the current map
var majorStyles = [1, 1] // whether the major event border and shadow distinguisher are visible
var spacingPx = 5; // spacing between each event in CSS pixels
var playedNotifications = []; // array of all event IDs of played notifications. [0] is 1-minute, [1] is 3-minute, [2] is 5-minute. in the future. when i'm not busy
var language = "en_CA"; // the user's language. it's canadian english. you're canadian now
var languagePack = window["languagePack_" + language];
var counterWhenEventsLoaded = -1; // the counter time (intervals of 40ms) when the events loaded in. used for debugging (lag performance) and flipping events
var securityError = false; // whether the events page didn't load due to a security error
var announcementName = document.getElementsByClassName('update-announcement')[0].id // the name of the annoying banner at the top of the screen
var announcementVisible = true;
document.body.style.fontFamily = CorrectFont;
document.getElementById('version').innerHTML = version_number;
var optionPaletteContent = document.getElementById("option-palette").innerHTML; // in case cancelCustomPalette() is called
var isCustomSelectorOpen = false; // whether the user's custom palette selector is open
var time1 = 0; // time since last desktop notif
var theme = "dark";
var paletteNames = [["Origins", "Sunrise", "Ocean", "Business", "Phoenix"], ["Origins", "Sunset", "Beachside", "Bubblegum", "Sienna"]];
var showEventToD = true; //Time of Day
var showEventTuE = true; //Time until Event
var showEventDNC = true; //Day-night cycle and map timer
var VisibleEvents = ["Quick Maths","Dragon Egg","2x Rewards","Care Package","KOTL","KOTH","Auction","Giant Cake","All bounty","Squads","Beast","Pizza","Rage Pit","Spire","Robbery","Blockhead","Raffle","Team Deathmatch"];
var AudioEvents = [];
var eventOpacities = []; // list of opacities of every event ID (Chrome tends to skip items in arrays??? why????)
var visibleEventIds = []; // list of event IDs that are currently visually visible
var upcomingEventIds = []; // list of event IDs that could possibly be visible in the future but may or may not be visible due to the user hiding events
var praise_quotes = [`You're crazy.`,"So good brooke.","Cool but seek help please","Brookeafk.com so good","she's insane in the head","brooke your so smart in my opnion","brooke is such a good pit player","your site is incredible","this is actually amazing wtf","brooke is awesome","great site, I get to see every event I love happen while I'm at school!","omg brooke i am so big fan of u hi","ty for ur amazing website ❤","best pit website","the site looks good.","brooke is poger","i lvoe bgorokecrazfft.com",`v1.0.0 on feb 27... i mean feb 28... i mean march 11.. i mean march 12... i mean march 13.... nono i mean i mean april 14`,"Your website is quite useful actually","wow this is such a good website i love brookeafk.","brooke is so talented","The storm in my heart clears when I open the brookeafk website","the site looks very cool btw","Brooke is one of the smartest, kindest, most talented people I have ever met. She is not holding me at gunpoint to say this.",`BrookeAFK.com fixed my marriage!`]
var praise_names = ["Andrew","Ellie","oSnapL","1Mad","Emma","catweapon","Twen","C4PS","vnmm","Vermasium","Stampy_fan2","swux","TheSKYeagle","julikabum","McPqndq","clouby","Brano","Ticha","Working","SAVANN4H","IDAKOI","faelicia","litphoenix","adjective",`anoxysm`]
var praise_urls = ["http://deviantart.com/hextant","https://twitter.com/ellwixd","https://twitter.com/oSnapLLL","https://youtu.be/dQw4w9WgXcQ","https://twitter.com/cutekitty271","https://namemc.com/profile/354aa68a43694ba29ff23c705dfc11e6","https://twitter.com/KinderFissa","https://twitter.com/c4pshypixel","https://vnmm.dev/","https://namemc.com/profile/9f65cdd1-81d7-49f3-8d41-fef76a7a8768","https://hypixel.net/members/probot.1901786/","https://www.tiktok.com/@swuxify_","https://twitter.com/leskyeagle","https://twitter.com/julikabum_0","https://pitpanda.rocks","https://brookeafk.com","https://twitter.com/branodon","https://pitpanda.rocks/players/18fe5844ce244d11ad3435c96435900f","https://twitter.com/WorkingMC","https://namemc.com/profile/343c717bb51d4dc3a9341d0908ee02e7","https://discord.gg/rebel","https://namemc.com/profile/9a259d6e408742819a2f901a91db9111","https://hypixel.net/members/litphoenix.533148/","https://adjectiven0un.github.io/holeinthewall/",`https://statsify.net/`]
//jojo was here
var allSettings = ['visible','notifs','palette','timestamps','theme','flashing','reminder','desktop','audio','font','icons', 'clock', 'classic', 'tabtimer', 'majorstyle', 'spacing', 'language'] // all of the settings except for "offset". it's a special case
var siteLoadSettingValues = Array(allSettings.length); // list of the user's settings when the site loads.
var event_sound = new Audio("event_arriving.mp3"); // everyone's favourite jingle
event_sound.volume = 0.2;
var ok_ids = []
var WithoutVar = "";
var isMapHover = false; // whether the user is hovering over the map timer
var robot = true; // whether you, the user, are secretly a search engine crawler in disguise!!
var customPaletteName = "";
var placeholderPalette = []; // where to put the palette that the user's popup box is about
var events = ["Quick Maths","Dragon Egg","2x Rewards","Care Package","KOTL","KOTH","Auction","Giant Cake","All bounty","Squads","Beast","Pizza","Rage Pit","Spire","Robbery","Blockhead","Raffle","Team Deathmatch"] // the important one.
var eventsNoSpaces = ["QuickMaths","DragonEgg","2xRewards","CarePackage","KOTL","KOTH","Auction","GiantCake","Allbounty","Squads","Beast","Pizza","RagePit","Spire","Robbery","Blockhead","Raffle","TeamDeathmatch"]
var shortEvents = ["MATH","EGG","2X","CARE","KOTL","KOTH","AUC","CAKE","BNTY","SQD","BST","PZA","RAGE","SPI","ROB","BLK","RAF","TDM"]
var eventsEmoji = ["🧮", "🐲", "2️⃣\u{FE0F}", "📦", "🪜", "👑", "💵", "🍰", "🪙", "🏳️", "🐻", "🍕", "🥔", "🏯", "💸", "🧱", "🎟️", "🆚"] // for the tab title. i'm not just messing with you... maybe
var nicknames = ["Quick Maths","Dragon Egg","2x Rewards","Care Package","King of the Ladder","King of the Hill","Auction","Giant Cake","Everyone Gets a Bounty","Squads","Beast","Pizza","Rage Pit","Spire","Robbery","Blockhead","Raffle","Team Deathmatch"]
var pit_wiki_links = ["Quick_Maths","Dragon_Egg","2x_Rewards","Care_Package","King_of_the_Ladder","King_of_the_Hill","Auction","Giant_Cake","Everyone_Gets_a_Bounty","Squads","Beast","Pizza","Rage_Pit","Spire","Robbery","Blockhead","Raffle","Team_Deathmatch"]
var trueEventColors = ["#FF55FF","#AA00AA","#00AA00","#FFAA00","#55FF55","#55FFFF","#FFFF55","#FF55FF","#FFAA00","#55FFFF","#55FF55","#FF5555","#FF5555","#AA00AA","#FFAA00","#5555FF","#FFAA00","#AA00AA"]
var panicevents = []; // list of events that are red and flashy
var VisibilityLength = [15,90,240,30,180,240,30,120,15,480,480,480,420,480,420,480,480,480]
var IsItACountdown = [`<span style="color: #ff55ff"><b>QUICK MATHS!</b></span> <span style="color: #AAAAAA;">First 5 players to answer gain</span> <span style="color: #55ffff;">+250XP</span> <span style="color: #ffaa00;">+500g</span>`,`<span style="color: #ff55ff"><b>MINOR EVENT!</b></span> <span style="color: #aa00aa"><b>DRAGON EGG</b></span><span style="color: #aaaaaa;"> in </span><span style="color: #ffff55"><b>Pit Area</b></span>`,"yes",`<span style="color: #ff55ff"><b>MINOR EVENT!</b></span> <span style="color: #ffaa00"><b>CARE PACKAGE</b></span><span style="color: #aaaaaa;"> in </span><span style="color: #ffff55"><b>Pit Area</b></span>`,"yes","yes",`<span style="color: #ff55ff"><b>MINOR EVENT!</b></span> <span style="color: #ffaa00"><b>AUCTION!</b></span> <span style="color: #AAAAAA">Check auctioneer or chat!</span>`,"yes",`<span style="color: #ff55ff"><b>MINOR EVENT!</b></span> <span style="color: #ffAA00;"><b>EVERYONE GETS A BOUNTY!</b></span>`,"yes","yes","yes","yes","yes","yes","yes","yes","yes"]
var DemolitionTime = 15;
var TimeOfEventStart = 0;
var all_text = ["MINOR EVENT!","MAJOR EVENT!","Starting in ","Ending in "];
if(document.body.clientWidth < 800) { // should make the site mobile when needed
console.log("busy accommodating to the user's hilariously tiny screen")
document.getElementById("mobileanno").style.display = "";
document.getElementById("current-event").setAttribute("id","replacement") // swaps the IDs
document.getElementById("mobileanno").setAttribute("id","current-event")
document.getElementById("replacement").setAttribute("id","mobileanno")
var mobilebreaks = document.getElementsByClassName('mobilebreak');
for (var i = 0; i < mobilebreaks.length; i++) {
var item = mobilebreaks[i];
item.innerHTML = '<br>';
}
document.getElementById("current-event").style.width = "90%";
document.getElementById("mobileanno").style.display = "none";
document.getElementById("facebreak").innerHTML = "";
document.getElementById("face").style.display = "none";
}
document.getElementById('settings').style.color = "NormalText";
function MakeFunTimestamps(convertible, currentTime = (Date.now() + offset)) {
if (convertible - currentTime <= 0) {
convertible = "Passed!";
}
if (convertible - currentTime <= 60000) {
convertible = (((Math.floor(((convertible - currentTime)*100))/100000).toFixed(2)) + "s");
} else if (convertible - currentTime <= 3600000) {
convertible = ((Math.floor(((convertible - currentTime))/60000) + "m" + (classicMode == false?" ":"") + (Math.floor(((convertible - currentTime))/1000) % 60) + "s"));
} else if (convertible - currentTime > 1) {
convertible = ((Math.floor(((convertible - currentTime))/3600000) + "h" + (classicMode == false?" ":"") + (Math.floor(((convertible - currentTime))/60000) % 60) + "m"));
}
return convertible;
}
function setFlash(seconds) {
window.EventFlashSec = seconds;
if(DoesStuffExist == true) {
for(var i = window.HiddenEventCount; i < EventsToLoad; i++) {
document.getElementById('event_'+ String(i)).classList.remove("blinktext-light");
document.getElementById('event_'+ String(i)).classList.remove("blinktext-dark");
}
}
document.getElementById('settings-flash-60').style.color = "#888888";
document.getElementById('settings-flash-30').style.color = "#888888";
document.getElementById('settings-flash-10').style.color = "#888888";
document.getElementById('settings-flash-0').style.color = "#888888";
if(seconds == 60) document.getElementById('settings-flash-60').style.color = NormalText;
if(seconds == 30) document.getElementById('settings-flash-30').style.color = NormalText;
if(seconds == 10) document.getElementById('settings-flash-10').style.color = NormalText;
if(seconds == -10) document.getElementById('settings-flash-0').style.color = NormalText;
SaveSettings('noreload');
panicevents = []; // clears the panic events
CuteColors(data); // used to remove the red colour from the event
changeColor(); // prevents eyestrain
}
function changeFont(font) {
if(font != undefined) {
console.log("A request was just sent to change the font to " + font)
document.getElementById('settings-font-default').style.color = "#888888";
document.getElementById('settings-font-sans-serif').style.color = "#888888";
document.getElementById('settings-font-minecraft').style.color = "#888888";
if(font == "minecraft") {
document.getElementById('settings-font-minecraft').style.color = NormalText;
CorrectFont = "minecraft";
CorrectBold = "minecraft; font-weight: bold";
document.getElementById("brookeafk-com").style.fontWeight = "400";
}
else {
document.getElementById("brookeafk-com").style.fontWeight = "600";
if(font == "sans-serif") {
document.getElementById('settings-font-sans-serif').style.color = NormalText;
CorrectFont = "sans-serif";
CorrectBold = "sans-serif; font-weight: bold";
}
if(font == "Inter") {
document.getElementById('settings-font-default').style.color = NormalText;
CorrectFont = "Inter";
CorrectBold = "Inter; font-weight: bold";
}
}
document.documentElement.style.setProperty("--userfont", font);
document.body.style.fontFamily = CorrectFont;
SaveSettings('noreload');
}
}
function changeIcons(icons) { // enables and disables the icons
document.getElementById('settings-icons-on').style.color = "#888888";
document.getElementById('settings-icons-off').style.color = "#888888";
iconsVisible = icons;
if(icons == true) document.getElementById('settings-icons-on').style.color = NormalText;
else if(icons == false) document.getElementById('settings-icons-off').style.color = NormalText;
console.log("Icon visibility set to " + iconsVisible);
addNamesandImages(window.data);
SaveSettings('noreload');
}
function changeTabTimer(tabtimer) { // enables and disables the tab timer
document.getElementById('settings-tabtimer-on').style.color = "#888888";
document.getElementById('settings-tabtimer-off').style.color = "#888888";
tabTimerVisible = tabtimer;
if(tabtimer == true) document.getElementById('settings-tabtimer-on').style.color = NormalText;
else if(tabtimer == false) document.getElementById('settings-tabtimer-off').style.color = NormalText;
console.log("Tab timer visibility set to " + tabTimerVisible);
addNamesandImages(window.data);
SaveSettings('noreload');
}
function changeLanguage(icuLocale) {
document.getElementById('settings-language-en_CA').style.color = "#888888";
document.getElementById('settings-language-es_AR').style.color = "#888888";
language = icuLocale;
languagePack = window["languagePack_" + language];
document.getElementById("settings-language-" + icuLocale).style.color = NormalText;
if(language == "en_CA") document.getElementById("translator-credit").style.display = "none";
else document.getElementById("translator-credit").style.display = "";
for(al = 0; al < languagePackIds.length; al++) {
var languagePackText = languagePack[al];
for(am = 0; am < languagePackIds[al].length; am++) {
document.getElementById(languagePackIds[al][am]).innerHTML = languagePack[al];
}
}
for(al = 0; al < 18; al++) {
nicknames[al] = languagePack[al + 68]; // Quick Maths
shortEvents[al] = languagePack[al + 153]; // MATH
}
for(al = 0; al < 5; al++) {
paletteNames[0][al] = languagePack[al + 9];
paletteNames[1][al] = (al==0 ? languagePack[9] : languagePack[al + 13]);
}
changePaletteNames();
var countdownReplacements = [0, 1, 3, 6, 8]
for(al = 0; al < 5; al++) {
maps[al] = languagePack[al + 96]; // Genesis
IsItACountdown[countdownReplacements[al]] = languagePack[al + 112] // <span style="color: #ff55ff"><b>QUICK MATHS!</b></span> <span style="color: #AAAAAA;">First 5 players to answer gain</span> <span style="color: #55ffff;">+250XP</span> <span style="color: #ffaa00;">+500g</span>
}
document.getElementById("custom-palette-name-input").placeholder = languagePack[133]; // Enter a name here...
if(offset != 0) document.getElementById('view-offset').innerHTML = languagePack[171].replace("%%minutes%%", ("<b>" + Math.floor(offset / 60000) + "</b>")); // Offset set to %%minutes%% minutes – Click here to reset
addNamesandImages(window.data);
SaveSettings('noreload');
}
function changeClassic(classic) { // makes the text look like how it did in the older version of brookeafk.com
document.getElementById('settings-classic-on').style.color = "#888888";
document.getElementById('settings-classic-off').style.color = "#888888";
classicMode = classic;
if(classic == true) document.getElementById('settings-classic-on').style.color = NormalText;
else if(classic == false) document.getElementById('settings-classic-off').style.color = NormalText;
console.log("Classic mode is now set to " + classic);
addNamesandImages(window.data);
SaveSettings('noreload');
}
function changeClock(clock) { // changes the clock from 24-hour "17:40" to 12-hour "5:40 pm" or vice versa
document.getElementById('settings-clock-24').style.color = "#888888";
document.getElementById('settings-clock-12').style.color = "#888888";
clockStyle = clock;
if(clockStyle == 24) document.getElementById('settings-clock-24').style.color = NormalText;
else if(clockStyle == 12) document.getElementById('settings-clock-12').style.color = NormalText;
console.log("The number of hours in a day has been set to " + clock);
addNamesandImages(window.data);
SaveSettings('noreload');
}
function changeMajorStyle(style, toggle) { // toggles whether the major event border and shadow distinguisher are visible
// toggle's either going to be "toggle" or a number.
if (style == "border") styleId = 0;
if (style == "shadow") styleId = 1;
if (toggle == "toggle") {
if (majorStyles[styleId] == true) {
document.getElementById('settings-majorstyle-' + style).style.color = "#888888";
majorStyles[styleId] = 0;
} else {
document.getElementById('settings-majorstyle-' + style).style.color = NormalText;
majorStyles[styleId] = 1;
}
} else {
console.log("toggle isn't 'toggle', it's " + toggle)
majorStyles[styleId] = toggle;
if (majorStyles[styleId] == true) document.getElementById('settings-majorstyle-' + style).style.color = NormalText;
else document.getElementById('settings-majorstyle-' + style).style.color = "#888888";
}
console.log("Major event styles have been set to: " + majorStyles);
addNamesandImages(window.data);
CuteColors(window.data);
SaveSettings('noreload');
}
function changeSpacing(space) { // changes the spacing between events
document.getElementById('settings-spacing-0').style.color = "#888888";
document.getElementById('settings-spacing-3').style.color = "#888888";
document.getElementById('settings-spacing-5').style.color = "#888888";
var allEvents = document.getElementsByClassName('event');
for (var i = 0; i < allEvents.length; i++) {
allEvents[i].style.margin = space + "px";
}
spacingPx = space;
document.getElementById('settings-spacing-' + space).style.color = NormalText;
console.log("Spacing has been set to " + majorStyles + " px");
SaveSettings('noreload');
}
function dismissAnnouncement() { // dismisses an announcement and doesn't let the user see it again
localStorage.setItem(announcementName, "seen")
document.getElementById(announcementName).style.display = "none";
announcementVisible = false;
}
if(localStorage.getItem(announcementName) == "seen") {
document.getElementById(announcementName).style.display = "none";
announcementVisible = false;
}
function DayNightCycle() { // i finally optimized it!
currentTime = Date.now() + offset;
let DayTime = ((currentTime + 10000) % 2160000)/1000; //10-second offset
if(DayTime < 1440) {
document.getElementById("day-night").innerHTML = (AboutMe((1440 - DayTime)*1000) + " ");
if(svgDaytime = "night") document.getElementById('day-svg').innerHTML = `<path d="M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0 c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2 c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1 C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06 c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41 l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41 c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36 c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"/>`
svgDaytime = "day";
} else {
//console.log("The night ends in " + (2160 - DayTime) + " seconds.")
document.getElementById("day-night").innerHTML = (AboutMe((2160 - DayTime)*1000) + " ");
if(svgDaytime = "day") document.getElementById('day-svg').innerHTML = `<path d="M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36c-0.98,1.37-2.58,2.26-4.4,2.26 c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"/>`
svgDaytime = "night";
}
}
function SetAudio(seconds) {
window.NotifTimer = seconds;
console.log("Notification timer set to " + NotifTimer + " seconds.")
document.getElementById('anotif').style.display = "block"
document.getElementById('dnotif').style.display = "block"
if(seconds > 0) {
for(var i = 0; i < 18; i++) {
if(DoesStuffExist == true) {
document.getElementById('notif-' + eventsNoSpaces[i]).style.display = "inline";
}}
if(window.AudioEvents.length == 0 && HasStuffLoaded == true) {
console.log(window.AudioEvents + " audioevents")
document.getElementById('alert-nobells').style.display = "block";
}
if(SettingsDesktopNotifs == 0 && SettingsAudioNotifs == 0) {
document.getElementById('alert-notypes').style.display = "block"
}
}
document.getElementById('audio-300').style.color = "#888888";
document.getElementById('audio-180').style.color = "#888888";
document.getElementById('audio-60').style.color = "#888888";
document.getElementById('audio-0').style.color = "#888888";
if(seconds == 300) document.getElementById('audio-300').style.color = NormalText;
if(seconds == 180) document.getElementById('audio-180').style.color = NormalText;
if(seconds == 60) document.getElementById('audio-60').style.color = NormalText;
if(seconds <= 0) {
document.getElementById('audio-0').style.color = NormalText;
document.getElementById('anotif').style.display = "none"
document.getElementById('dnotif').style.display = "none"
document.getElementById('alert-nobells').style.display = "none";
document.getElementById('alert-notypes').style.display = "none";
for(var i = 0; i < 18; i++) {
if(DoesStuffExist == true) {
document.getElementById('notif-' + eventsNoSpaces[i]).style.display = "none";
}}
}
SaveSettings('noreload');
}
function ANotif(tog) {
window.SettingsAudioNotifs = tog;
console.log("Audio notifications setting: " + tog);
if(tog == 1) {
document.getElementById('audio-on').style.color = NormalText;
document.getElementById('audio-off').style.color = "#888888";
document.getElementById('alert-notypes').style.display = 'none';
}
if(tog == 0) {
document.getElementById('audio-off').style.color = NormalText;
document.getElementById('audio-on').style.color = "#888888";
if(SettingsDesktopNotifs == 0 && NotifTimer > 0) {
document.getElementById('alert-notypes').style.display = 'block';
}
}
SaveSettings('noreload');
}
function changeToURLPalette(shouldI, event = "N/A") { // eventually moves the palette stored in the URL to localStorage and code
if(shouldI == "checkevent") {
if(event.key == "Enter") shouldI = "confirm"
}
if(shouldI == "confirm" || shouldI == "no") {
if(shouldI == "confirm") {
Palette = "Custom";
localStorage.setItem("custom-palette", placeholderPalette);
customPaletteName = escapeString(document.getElementById("custom-palette-name-input").value)
localStorage.setItem("custom-palette-name", customPaletteName);
submitCustomPalette(false, true, false);
}
document.getElementById("palette-announcement").style.display = "none";
let here = new URL(window.location.href);
here.searchParams.delete("palette");
window.location = here;
} else if(shouldI == "yes") {
document.getElementById("regular-selection").style.display = "none";
document.getElementById("sneaky-rename").style.display = "";
document.getElementById("custom-palette-user-assistance-0").innerHTML = languagePack[131];
document.getElementById("custom-palette-user-assistance-1").innerHTML = languagePack[132];
document.getElementById("custom-palette-name-input").focus();
document.getElementById("custom-palette-name-input").select();
}
}
function DNotif(tog) { //Short for "Desktop Notification" and "toggle"
window.SettingsDesktopNotifs = tog;
console.log("Desktop notifications setting: " + tog);
if(tog == 1) {
document.getElementById('desktop-on').style.color = NormalText;
document.getElementById('desktop-off').style.color = "#888888";
document.getElementById('alert-notypes').style.display = 'none';
if (!("Notification" in window)) {
document.getElementById('desktop-on').innerHTML = languagePack[177];
}
else if (Notification.permission === "denied") {
document.getElementById('desktop-on').innerHTML = languagePack[176];
window.SettingsDesktopNotifs = 0;
tog = 0;
}
else if (Notification.permission === "granted") {
console.log("Notifications were already enabled!")
}
else if (Notification.permission !== "denied") {
document.getElementById('desktop-on').innerHTML = languagePack[175];
Notification.requestPermission().then(function (permission) {
if (permission === "granted") {
console.log("Notifications enabled!")
document.getElementById('desktop-on').innerHTML = languagePack[31];
}
else {
document.getElementById('desktop-on').innerHTML = languagePack[176];
window.SettingsDesktopNotifs = 0;
tog = 0;
}
});
}
}
if(tog == 0) {
document.getElementById('desktop-off').style.color = NormalText;
document.getElementById('desktop-on').style.color = "#888888";
if(SettingsAudioNotifs == 0 && NotifTimer > 0) {
document.getElementById('alert-notypes').style.display = 'block';
}
}
SaveSettings('noreload');
}
function TestAudio() { // plays the audio. simple!
event_sound.play();
event_sound.currentTime = 0;
}
function TimestampIt(sec = 0) { // creates a timestamp (y, d, h, m, s). used for the map rotation timer
if(sec > 31536000) {
return Math.floor(sec / 31536000) + "y " + Math.floor((sec % 31536000) / 86400) + "d " + Math.floor((sec % 86400) / 3600) + "h " + Math.floor((sec % 3600) / 60) + "m " + Math.floor(sec % 60) + "s"
} else if(sec > 86400 /*1 day*/) {
return Math.floor(sec / 86400) + "d " + Math.floor((sec % 86400) / 3600) + "h " + Math.floor((sec % 3600) / 60) + "m " + Math.floor(sec % 60) + "s"
} else if(sec > 3600) {
return Math.floor((sec % 86400) / 3600) + "h " + Math.floor((sec % 3600) / 60) + "m " + Math.floor(sec % 60) + "s"
} else if(sec > 60) {
return Math.floor((sec % 3600) / 60) + "m " + Math.floor(sec % 60) + "s"
} else {
return Math.floor(sec % 60) + "s"
}
}
function mod(n, m) { // the actual mod operation. why isn't this in vanilla JS
return ((n % m) + m) % m;
}
function mapRotation() { // calculates and updates the map rotation timer
let CurrentUnix = (Date.now() + offset) / 1000;
mapid = Math.floor(mod((samplemaprotation - CurrentUnix), 3024000) / 604800);
var rawUpdateDayNight = languagePack[117];
if(!mapClicked) document.getElementById('maprot').innerHTML = rawUpdateDayNight.replace("%%map%%", "<b>" + maps[mod(mapid - 1, 5)] + "</b>").replace("%%time%%", TimestampIt(mod((samplemaprotation - CurrentUnix), 604800)));
//if(!mapClicked) document.getElementById('maprot').innerHTML = "<b>" + maps[mod(mapid - 1, 5)] + "</b> in " + TimestampIt(mod((samplemaprotation - CurrentUnix), 604800));
}
function mapClick() {
if(!mapClicked) {
mapClicked = true;
document.getElementById('maprot').innerHTML = `<span style="color: #edbe1f"><b><span class="tip">` + maps[mapid] + `<span class="tiptext">` + languagePack[94] /*The current map.*/ + `</span></span></b></span> → <span style="color: #2bbddb"><b><span class="tip">` + maps[mod(mapid - 1, 5)] + `<span class="tiptext">` + languagePack[95] /*The upcoming map.*/ + `</span></span></b></span> → <span style="color: #666"><b>` + maps[mod(mapid - 2, 5)] + `</b></span> → <span style="color: #666"><b>` + maps[mod(mapid - 3, 5)] + `</b></span> → <span style="color: #666"><b>` + maps[mod(mapid - 4, 5)];
} else {
mapClicked = false;
}
}
function changeDefOver(e) {
e.target.classList.toggle('opacity-toggle');
}
function changeDefOut(e) {
e.target.classList.toggle('opacity-toggle');
}
function changePaletteNames() { // changes the visual display of the palette names. used for ChangeLanguage and stuff
var themeSelector;
if (window.theme == "light") themeSelector = 1;
else themeSelector = 0;
for(a9 = 0; a9 < 5; a9++) {
document.getElementById('settings-palette-' + a9).innerHTML = paletteNames[themeSelector][a9];
}
}
function changeTheme(themecolor) { // changes the theme from dark to light mode (or vice versa)
window.theme = themecolor;
console.log ("Changed theme to " + window.theme);
if(isCustomSelectorOpen) cancelCustomPalette(false); // cancel the custom palette menu if it's open
if(themecolor == "light") {
NormalText = "#000000";
document.getElementById('settings-theme-dark').style.color = "#888888";
document.getElementById('settings-theme-light').style.color = NormalText;
document.body.style.background = "#FFFFFF";
document.querySelectorAll('p').forEach(e => e.style.color = "black");
document.getElementById('settings-theme-dark').classList.add("hand_cursor");
document.getElementById('settings-theme-light').classList.remove("hand_cursor");
document.getElementById('tut-notif').style.color = "#BD8E02"
} else if (window.theme == "dark") {
NormalText = "#FFFFFF";
document.getElementById('settings-theme-light').style.color = "#888888";
document.getElementById('settings-theme-dark').style.color = NormalText;
document.body.style.background = "#222222";
document.querySelectorAll('p').forEach(e => e.style.color = "white");
document.getElementById('settings-theme-dark').classList.remove("hand_cursor");
document.getElementById('settings-theme-light').classList.add("hand_cursor");
document.getElementById('tut-notif').style.color = "#FFFF80"
}
document.documentElement.style.setProperty("--normaltext", NormalText);
document.getElementById('day-svg').style.fill = NormalText;
document.getElementById('day-night-border').style.color = NormalText;
changePaletteNames();
if (DoesStuffExist == true) {
changeLanguage(window.language);
changeFont(window.font);
setFlash(window.EventFlashSec);
SetAudio(window.NotifTimer);
DNotif(window.SettingsDesktopNotifs);
ANotif(window.SettingsAudioNotifs);
changeIcons(window.iconsVisible);
changeClock(window.clockStyle);
changeClassic(window.classicMode);
changeTabTimer(window.tabTimerVisible);
changePalette(window.Palette);
changeMajorStyle("border", window.majorStyles[0]);
changeMajorStyle("shadow", window.majorStyles[1]);
console.log("Stuff exists. Updating event flashes and audio.");
CuteColors(window.data);
}
for(var i = 1; i <= window.eventsNoSpaces.length; i++) {
if(AudioEvents.includes(events[i - 1])) { //if the event is audible...
document.getElementById('notif-'+ eventsNoSpaces[i - 1]).style.fill = NormalText;
} else {
document.getElementById('notif-'+ eventsNoSpaces[i - 1]).style.fill = "#888888";
}
}
for(var i = 1; i <= window.eventsNoSpaces.length; i++) {
if(VisibleEvents.includes(events[i - 1])) { //if the event is visible...
document.getElementById('visible-'+ eventsNoSpaces[i - 1]).style.color = NormalText;
} else {
document.getElementById('visible-'+ eventsNoSpaces[i - 1]).style.color = "#888888";
}
}
if(themecolor == "light") {
[...document.querySelectorAll('*:not(.nocolorchange)')]
.filter(el => getComputedStyle(el).color === 'rgb(255, 255, 255)')
.forEach(el => el.style.color = '#000000')
}
if(themecolor == "dark") {
[...document.querySelectorAll('*:not(.nocolorchange)')]
.filter(el => getComputedStyle(el).color === 'rgb(0, 0, 0)')
.forEach(el => el.style.color = '#ffffff')
}
if(DoesStuffExist) addNamesandImages(window.data);
SaveSettings('noreload');
}
changeTheme(theme); // It's called here to load the events in as black to begin with. I don't want to give people seizures.
function setTimestamps(timestamps, toggler = true) { // shows and hides timestamps. "toggler" is whether the event toggles (i.e. swaps the visibility.)
if (timestamps == "tod") {
if((window.showEventToD == false && !toggler) || (window.showEventToD == true && toggler)) {
document.getElementById('settings-ts-tod').style.color = "#888888";
document.getElementById('setting-clock-style').style.display = "none";
window.showEventToD = false;
} else {
document.getElementById('settings-ts-tod').style.color = NormalText;
document.getElementById('setting-clock-style').style.display = "block";
window.showEventToD = true;
}
}
if (timestamps == "tue") {
if((window.showEventTuE == false && !toggler) || (window.showEventTuE == true && toggler)) {
document.getElementById('settings-ts-tue').style.color = "#888888";
window.showEventTuE = false;
} else {
document.getElementById('settings-ts-tue').style.color = NormalText;
window.showEventTuE = true;
}
}
if (timestamps == "dnc") {
if((window.showEventDNC == false && !toggler) || (window.showEventDNC == true && toggler)) {
document.getElementById('settings-ts-dnc').style.color = "#888888";
window.showEventDNC = false;
document.getElementById("day-night-border").style.display = "none";
} else {
document.getElementById('settings-ts-dnc').style.color = NormalText;
window.showEventDNC = true;
document.getElementById("day-night-border").style.display = "";
}
}
addNamesandImages(window.data);
SaveSettings('noreload');
}
function changePalette(changeThePalette, justSelecting = false) { // changes the user's palette. justSelecting is in case you don't want to call the extremely load-heavy functions at the bottom
Palette = changeThePalette;
document.getElementById('current-palette').style.display = "none";
document.getElementById('settings-palette-gradients0').style.color = "#888888";
document.getElementById('settings-palette-gradients1').style.color = "#888888";
document.getElementById('settings-palette-0').style.color = "#888888";
document.getElementById('settings-palette-1').style.color = "#888888";
document.getElementById('settings-palette-2').style.color = "#888888";
document.getElementById('settings-palette-3').style.color = "#888888";
document.getElementById('settings-palette-4').style.color = "#888888";
document.getElementById('settings-palette-create').style.color = "#888888";
document.getElementById('settings-palette-custom').style.color = "#888888";
if(Palette == 9999) {
Palette = 'gradients0';
customPalette();
} else {
if(Palette > -100 || Palette == 'gradients0' || Palette == 'gradients1') {
document.getElementById('settings-palette-' + Palette).style.color = NormalText;
}
if(Palette == "Custom") {
document.getElementById('settings-palette-custom').style.color = NormalText;
document.getElementById('current-palette').style.display = "";
document.getElementById('current-palette').innerHTML = languagePack[173].replace("%%palette%%", `<b class='groovy' style='font-style: normal'><span id="current-palette-name"></span></b>`);
document.getElementById('current-palette-name').innerText = customPaletteName;
}
if(justSelecting == false) {
addNamesandImages(window.data);
CuteColors(window.data);
SaveSettings('noreload');
}
}
}
function customPalette() { // sets up creation for a custom color palette
optionPaletteContent = document.getElementById("option-palette").innerHTML;
isCustomSelectorOpen = true;
document.getElementById("option-palette").innerHTML = `<b>` + languagePack[19] + `</b>: <a style="color: #45b280" href="palette" target="_blank">` + languagePack[20] + `</a> / <span style="color: #f9e822; cursor: pointer" onclick="importCustomPalette()">` + languagePack[21] + `</span> / <span style="color: #e62550; font-weight: bold; cursor: pointer;" onclick="cancelCustomPalette()">` + languagePack[22] + `</span>`
}
function importCustomPalette() {
document.getElementById("option-palette").innerHTML = `<b>` + languagePack[19] + `</b>: <span id="custom-palette-error">` + languagePack[23] + `</span> → <input type="text" onkeypress="reloadWithCustomPalette(event)" id='palette-input' style="font-family: monospace"> / <span style="color: #45e6b2; cursor: pointer" onclick="reloadWithCustomPalette(false ,true)"><b>` + languagePack[24] + `</b></span> / <span style="color: #e62550; font-weight: bold; cursor: pointer;" onclick="cancelCustomPalette()">` + languagePack[22] + `</span>`
document.getElementById('palette-input').focus();
document.getElementById('palette-input').select();
}
function reloadWithCustomPalette(event, bypass = false) { // reloads the page with the custom palette, triggering the pop-up
if(bypass || event.key == "Enter") {
var userPalette = document.getElementById("palette-input").value;
var userPaletteResult = unboxCustomPalette(userPalette);
if(unboxCustomPalette(userPalette)[0] == false) document.getElementById("custom-palette-error").innerHTML = `<span style="color: #f18080">` + languagePack[25].replace("%%errorcode%%", userPaletteResult[1]) + `</span>`;
else {
let here = new URL(window.location.href);
here.searchParams.set("palette", userPalette);
window.location = here;
}
}
}
function unboxCustomPalette(pal) { // converts a base64 palette into an array of human-understandable stuff
try {
rawUserPalette = pal;
userPalette = b64_uni(pal);
var splitUserPalette = userPalette.split("¤")
if(splitUserPalette.length != 2) {
return [false, 1]
}
else {
var userPaletteColors = (splitUserPalette[1].match(/.{1,6}/g));
var mover = [13, 1, 7, 9, 5, 3, 11, 15, 17, 0, 16, 2, 14, 8, 12, 6, 4, 10] // in palette.html, the order doesn't match the order in the events variable, so this moves them around to their right spots
userPaletteColorsCopy = userPaletteColors.slice(0);
if(userPaletteColorsCopy.length != 18) return([false, 2])
for(aa = 0; aa < 18; aa++) {
if(userPaletteColorsCopy[mover[aa]].match(/[0-9a-fA-F]{6}/g) != null) { // makes sure evil user hasn't manipulated the input for an XSS attack
userPaletteColors[aa] = "#" + userPaletteColorsCopy[mover[aa]];
} else return([false, 3])
}
return [true, userPaletteColors];
}
}
catch(err) {
console.log(err);
return [false, 0]
}
}
function submitCustomPalette(event, bypass = false, isUserInput = false) {
if (bypass || event.key == "Enter") {
if(isUserInput == true) var userPalette = document.getElementById("palette-input").value;
else var userPalette = localStorage.getItem("custom-palette");
rawUserPalette = userPalette;
var userPaletteResult = unboxCustomPalette(userPalette);
if(userPaletteResult[0] == false) {
if(isUserInput == true) document.getElementById("custom-palette-error").innerHTML = `<span style="color: #f18080">` + languagePack[25].replace("%%errorcode%%", userPaletteResult[1]) + `</span>`;
else console.log(userPaletteResult[1]);
}
else {
localStorage.setItem("custom-palette", rawUserPalette)
cancelCustomPalette();
document.getElementById("custom-palette-exists").style.display = "";
localStorageCustomPaletteName = localStorage.getItem("custom-palette-name");
document.getElementById("settings-palette-custom-name").innerText = unescapeString(localStorageCustomPaletteName == null ? "Custom Palette" : localStorageCustomPaletteName);
if(localStorageCustomPaletteName != null) customPaletteName = localStorageCustomPaletteName;
darkColorsCustom = userPaletteResult[1];
if(isUserInput == true || Palette == "Custom") changePalette("Custom")
}
}
}
function uni_b64(str) { // modified version of btoa() provided by MDN Web Docs (thank you <3<3): #solution_1_%E2%80%93_escaping_the_string_before_encoding_it
return btoa(encodeURIComponent(str));
}
function b64_uni(str) {
return decodeURIComponent(atob(str));
}
function escapeString(text) { // replaces possible harmful user-inputted text with harmless HTML elements
var map = {
'&': '&', '<': '<', '>': '>', '"': '"', "'": '''
};
return text.replace(/[&<>"']/g, function(m) { return map[m]; });
}
function unescapeString(text) {
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, "\"").replace(/'/g, "'");
}
function cancelCustomPalette(changeThemeToo = true) { // user didn't actually want this!! abort!!
document.getElementById("option-palette").innerHTML = optionPaletteContent;
if(changeThemeToo) changeTheme(theme);
isCustomSelectorOpen = false;
}
function SelectOnly(event_type) { // allows the user to select certain events, all, or none
if(event_type == "minor") {
for(var i = window.HiddenEventCount; i < EventsToLoad; i++) {
if (window.data[i]['type'] == "major") {
document.getElementById('event_' + String(i)).style.display = "none";
console.log("Major event hidden.");
}
if (window.data[i]['type'] == "minor") {
document.getElementById('event_' + String(i)).style.display = "block";
console.log("Minor event made visible.");
}
window.VisibleEvents = ["Quick Maths","Dragon Egg","2x Rewards","Care Package","KOTL","KOTH","Auction","Giant Cake","All bounty"];
SettingsSelectedEvents = 511;
document.getElementById('alert-noevents').style.display = "none";
}
} else if(event_type == "major") {
for(var i = window.HiddenEventCount; i < EventsToLoad; i++) {
if (window.data[i]['type'] == "minor") {
document.getElementById('event_' + String(i)).style.display = "none";
console.log("Minor event hidden.");
}
if (window.data[i]['type'] == "major") {
document.getElementById('event_' + String(i)).style.display = "block";
console.log("Major event made visible.");
}
window.VisibleEvents = ["Squads","Beast","Pizza","Rage Pit","Spire","Robbery","Blockhead","Raffle","Team Deathmatch"];
SettingsSelectedEvents = 261632;
}
document.getElementById('alert-noevents').style.display = "none";
} else if(event_type == "nothing") {
window.VisibleEvents = [];
window.AudioEvents = [];
SettingsSelectedEvents = 0;
SettingsNotifyEvents = 0;
document.getElementById('alert-noevents').style.display = "block"
if(NotifTimer > 0) {
document.getElementById('alert-nobells').style.display = "block";
}
for(var i = window.HiddenEventCount; i < EventsToLoad; i++) {
document.getElementById('event_' + String(i)).style.display = "none";
}
} else if(event_type == "everything") {
window.VisibleEvents = ["Quick Maths","Dragon Egg","2x Rewards","Care Package","KOTL","KOTH","Auction","Giant Cake","All bounty","Squads","Beast","Pizza","Rage Pit","Spire","Robbery","Blockhead","Raffle","Team Deathmatch"]
SettingsSelectedEvents = 262143;
for(var i = window.HiddenEventCount; i < EventsToLoad; i++) {
document.getElementById('event_' + String(i)).style.display = "block";
}
document.getElementById('alert-noevents').style.display = "none";
}
changeTheme(theme);
checkVisibleEvents();
console.log(SettingsSelectedEvents);
}
function GeneratePraise() { // generates a quote (used on the bottom of the site)
const randomElement = [Math.floor(Math.random() * (praise_quotes.length + 4)) - 4]; //adds very slight bias to quote #0
console.log("Item " + randomElement + " chosen for praise!");
if(randomElement <= -1) {
randomElement[0] = 0;
}
return (`"` + praise_quotes[randomElement] + `" — <a href="` + praise_urls[randomElement] + `" target="_blank">` + praise_names[randomElement] + `</a>`);
}
function TimeOfDay(s) { // gets the local time of day from a Unix timestamp.
var toffset = (new Date().getTimezoneOffset())*-60000;
if(clockStyle == 12) { // if the user is WEIRD and wants a twelve hour time
var twelvetime = new Date(s + offset);