-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1127 lines (1010 loc) · 54.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Poppins&display=swap" rel="stylesheet" />
<link href="style_concat.css" rel="stylesheet" />
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" />
<!-- Icon CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<title>PlanEATary Home</title>
</head>
<body>
<div class="main-container">
</div>
<div class="Header">
<!-- Sidebar -->
<nav class="navbar navbar-dark navbar-expand-xl sticky-top" style="background-color: #02897A;">
<div class="container-fluid">
<a class="navbar-brand d-flex align-items-center" href="index.html">
<img src="./images/transparent_logo.png" width="40" height="auto" class="d-inline-block align-text-top"/>
<strong>PlanEATary</strong>
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasNavbar" aria-controls="offcanvasNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasNavbar" aria-labelledby="offcanvasNavbarLabel">
<div class="offcanvas-header" style="background-color: #096358;">
<h5 class="offcanvas-title d-flex align-items-center text-white" id="offcanvasNavbarLabel"><img src="./images/transparent_logo.png" width="40" height="auto" class="d-inline-block align-text-top"/><strong>PlanEATary</strong></h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body" style="background-color: #02897A;">
<ul class="navbar-nav justify-content-end align-items-center flex-grow-1 pe-3 gap-3">
<li class="nav-item">
<a class="nav-link active" aria-current="page" data-bs-dismiss="offcanvas" href="index.html">Home</a>
</li>
<li class="nav-item dropdown home-hide">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa fa-edit"></i> <strong>Quiz</strong>
</a>
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-lg-end" style="background-color: #25b3a2;">
<li><a class="dropdown-item" href="qualtrics.html" data-bs-dismiss="offcanvas">Pre-quiz</a></li>
<li><a class="dropdown-item first-timer" aria-disabled="false" data-bs-dismiss="offcanvas" href="qualtrics_post.html">Post-quiz</a></li>
</ul>
</li>
<li class="nav-item home-hide">
<a class="nav-link first-timer" aria-disabled="false" href="manifesto_page.html" data-bs-dismiss="offcanvas"><i class="fa fa-rocket"></i> Challenge</a>
</li>
<li class="nav-item home-hide">
<a class="nav-link first-timer" aria-disabled="false" data-bs-dismiss="offcanvas" href="result_page.html"><i class="fa fa-line-chart"></i> Dashboard</a>
</li>
<li class="nav-item home-hide">
<a class="nav-link first-timer" aria-disabled="false" data-bs-dismiss="offcanvas" href="history_page.html"><i class="fa fa-calendar-check-o"></i> History</a>
</li>
<li class="nav-item dropdown home-hide">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false"><i class="fa fa-user-circle-o"></i> User</a>
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-lg-end" style="background-color: #25b3a2;">
<li><a class="dropdown-item" href="account manage.html" data-bs-dismiss="offcanvas">My account</a></li>
<li><a class="dropdown-item" id="logOut">Log out</a></li>
</ul>
</li>
<li class="nav-item button-hide">
<button type="button" class="btn btn-success" style="width: 150px;" data-bs-toggle="modal" data-bs-dismiss="offcanvas" data-bs-target="#signInModal">Sign in</button>
</li>
<li class="nav-item button-hide">
<button type="button" class="btn btn-success" style="width: 150px;" data-bs-toggle="modal" data-bs-dismiss="offcanvas" data-bs-target="#signUpModal">Sign up</button>
</li>
</ul>
</div>
</div>
</div>
</nav>
</div>
<!--Hero section at the top-->
<div class="hero">
<div class="herocontent">
<div class="hero-text">
<h1>Welcome to the PlanEATary Quest!</h1>
<p>
Embark on a delicious adventure to learn how we can create a more sustainable food system
and improve our planet's health for current and future generations.
</p>
<button type="button" class="btn btn-success"><a class="herobtn">Get started</a></button>
</div>
<div class="hero-image">
<img src="./images/welcome-removebg.png"/>
</div>
</div>
</div>
<section class="container p-3">
<div class="row d-flex justify-content-center">
<h2 style="text-align: center;">Promoting planetary health, one bite at a time</h2>
<div class="col-md-12 d-flex
justify-content-center">
<div class="carousel slide" id="carousel-section">
<div class="carousel-indicators d-lg-none">
<button type="button" data-bs-target="#carousel-section" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Complete the Quiz"></button>
<button type="button" data-bs-target="#carousel-section" data-bs-slide-to="1" aria-label="Design your Challenge"></button>
<button type="button" data-bs-target="#carousel-section" data-bs-slide-to="2" aria-label="Complete your Challenge"></button>
<button type="button" data-bs-target="#carousel-section" data-bs-slide-to="3" aria-label="Complete Post Quiz"></button>
</div>
<div class="carousel-inner" id="c-steps">
<div class="carousel-item active c-items">
<div class="card atep" style="background-color: #D0F0C0;">
<img src="./images/plug.png" class="card-img-top">
<div class="card-body">
<h5 class="card-title">Complete the Quiz</h5>
<p class="card-text">Let's see where you're kicking goals. Start the journey now!</p>
</div>
</div>
</div>
<div class="carousel-item c-items">
<div class="card" style="background-color: #aad693;">
<img src="./images/bulb.png" class="card-img-top">
<div class="card-body">
<h5 class="card-title">Design your Challenge</h5>
<p class="card-text">Complete 10 tasks to improve your score</p>
</div>
</div>
</div>
<div class="carousel-item c-items">
<div class="card" style="background-color: #95d376;">
<img src="./images/leaveBulb.png" class="card-img-top">
<div class="card-body">
<h5 class="card-title">Complete the Challenge</h5>
<p class="card-text">Spend 2-3 weeks to complete your goal</p>
</div>
</div>
</div>
<div class="carousel-item c-items">
<div class="card" style="background-color: #729760;">
<img src="./images/hanger.png" class="card-img-top">
<div class="card-body">
<h5 class="card-title">Complete Post Quiz</h5>
<p class="card-text">Check how your score has been improved</p>
</div>
</div>
</div>
</div>
<button class="carousel-control-prev d-lg-none" type="button" style="color: #445839;" data-bs-target="#carousel-section" data-bs-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next d-lg-none" type="button" style="color: #445839;" data-bs-target="#carousel-section" data-bs-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
</div>
</div>
</section>
<div class="b-example-divider"></div>
<!--do you know section-->
<section class="do-you-know">
<div class="content">
<h2>DO YOU KNOW...?</h2>
<p>(1) Our global food system is contributing approximately one-third of greenhouse gas emissions.<br/>
(2) Experts have called for an urgent transformation to the way food is produced and consumed, including a population-wide shift to healthy and sustainable diets.</p>
The PlanEATary Quest is a fun, interactive intervention that aims to help you:
<ul>
<li>Identify how you can improve the way you’re interacting with our food system to promote human and planetary health.</li>
<li>Adopt new healthy and environmentally sustainable food habits, inspired by a supportive and collegial approach.</li>
<li>Reflect on the factors that help or hinder your environmentally sustainable food habits.</li>
</ul>
</div>
<div class="video">
<div class="ratio ratio-16x9">
<iframe
src="https://www.youtube.com/embed/nYe-ibIFxW4"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen>
</iframe>
</div>
</div>
</section>
<div class="citation">
<p>(1) Intergovernmental Panel on Climate Change (IPCC), Summary for Policymakers. Climate Change and Land: an IPCC special report on climate change, desertification, land degradation, sustainable land management, food security, and greenhouse gas fluxes in terrestrial ecosystems. 2019. Accessed: https://www.ipcc.ch/srccl/ (September, 2023).</p>
<p>(2) Willett, W., et al., Food in the Anthropocene: the EAT–Lancet Commission on healthy diets from sustainable food systems. The Lancet. 2019. 393(10170): p. 447-492.</p>
</div>
<!--Feedback section-->
<section class="reflect-section">
<h2><b>REFLECT: Tell us how you went!</b></h2>
<hr>
<h5><b>We'd love to learn about your journey on the PlanEATary Quest!</b></h4>
<p>
Please write a short reflection, thinking about the factors that helped or hindered your ability to complete the challenge. For example:
</p>
<ul>
<li>Your own motivation to change?</li>
<li>Your household - the people and living environment?</li>
<li>Your community?</li>
<li>Your Local Government Authority? (e.g., Any initiatives that promote more environmentally sustainable eating practices)</li>
<li>Your State or Territory Government?</li>
</ul>
<p>
If you would like to share your short reflection with us, we'd love to read it. Please submit your writing
<a href="https://docs.google.com/forms/d/e/1FAIpQLSdKqX8bxsmJlcy1mKSnv9kN2JyyElmt7ZC4-PICtAcMLANwQg/viewform?usp=sf_link" target="_blank">HERE</a>.
</p>
</section>
<!--Last section - development team-->
<!-- <div class="background-content">
</div> -->
<div class="b-example-divider"></div>
<section class="container-fluid p-5">
<h2>BACKGROUND: How was the PlanEATary Quest developed?</h2>
<hr>
<div class="row d-flex">
<div class="people">
<div class="person">
<img src="./images/bulb.png" alt="Dr Liza Barbour">
<p><strong>Dr Liza Barbour</strong><br>Monash University</p>
</div>
<div class="person">
<img src="./images/bulb.png" alt="Sandy Murray">
<p><strong>Sandy Murray</strong><br>University of Tasmania</p>
</div>
</div>
<div class="d-block">
<div id="carouselInterval" class="carousel slide carousel-dark p-carousel" data-bs-ride="carousel" data-bs-interval="7000">
<div class="carousel-inner rounded-5 shadow-4-strong">
<div class="carousel-item active">
<img src="./images/bulb.png" class="d-block w-80"/>
<div class="carousel-caption d-block">
<h5><strong>Dr Liza Barbour</strong></h5>
<p>Monash University</p>
</div>
</div>
<div class="carousel-item">
<img src="./images/bulb.png" class="d-block w-80"/>
<div class="carousel-caption d-block">
<h5><strong>Sandy Murray</strong></h5>
<p>University of Tasmania</p>
</div>
</div>
</div>
</div>
</div>
<hr>
<div class="team">
<div class="team-member">
<img src="./images/bulb.png" alt="Nicole Senior">
<p><strong>Nicole Senior</strong></p>
</div>
<div class="team-member">
<img src="./images/bulb.png" alt="Sara Forbes">
<p><strong>Sara Forbes</strong></p>
</div>
<div class="team-member">
<img src="./images/bulb.png" alt="Nathan Cook">
<p><strong>Nathan Cook</strong></p>
</div>
<div class="team-member">
<img src="./images/bulb.png" alt="Aimee Bowles">
<p><strong>Aimee Bowles</strong></p>
</div>
<div class="team-member">
<img src="./images/bulb.png" alt="Grace Zadow">
<p><strong>Grace Zadow</strong></p>
</div>
</div>
<div>
<div id="carouselTeam" class="carousel slide">
<div class="carousel-inner">
<div class="carousel-item active">
<div class="row">
<div class="col-sm-4 team-member">
<img src="./images/info.png" alt="Nicole Senior">
<p><strong>Nicole Senior</strong></p>
</div>
<div class="col-sm-4 team-member">
<img src="./images/info.png" alt="Sara Forbes">
<p><strong>Sara Forbes</strong></p>
</div>
<div class="col-sm-4 team-member">
<img src="./images/info.png" alt="Nathan Cook">
<p><strong>Nathan Cook</strong></p>
</div>
</div>
</div>
<div class="carousel-item">
<div class="row">
<div class="col-sm-4 team-member">
<img src="./images/info.png" alt="Aimee Bowles">
<p><strong>Aimee Bowles</strong></p>
</div>
<div class="col-sm-4 team-member">
<img src="./images/info.png" alt="Grace Zadow">
<p><strong>Grace Zadow</strong></p>
</div>
<div class="col-sm-4 team-member">
<img src="./images/info.png" alt="Nicole Senior">
<p><strong>Nicole Senior</strong></p>
</div>
</div>
</div>
</div>
<button class="carousel-control-prev" type="button" data-bs-target="#carouselTeam" data-bs-slide="prev" style="color: #445839;">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="visually-hidden">Previous</span>
</button>
<button class="carousel-control-next" type="button" data-bs-target="#carouselTeam" data-bs-slide="next" style="color: #445839;">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="visually-hidden">Next</span>
</button>
</div>
</div>
<div class="d-inline-flex flex-column mt-5 p-3 bd-highlight">
<p>
This resource was developed by this dedicated Working Group of seven volunteers, all dietitians and members of DA’s Food & Environment Leadership Committee. This project was funded by a grant from the International Congress of Dietetic Associations (ICDA) and led by grant applicants Dr Liza Barbour and Sandy Murray.
</p>
<p>
We would like to acknowledge and thank Monash University dietetic students, Zi Wong, Jingjun (Phoebe) Wu, Wancin (Wendy) Tan, Halle Yip and Jessica Gleeson, and their supervisors Kathy Faulkner, Stacey Holden and Stefanie Carino for piloting this intervention with the wonderful team at Eastern Health in Victoria.
</p>
<p>
For further information about the resources, intervention and evaluation, please contact:
<a href="mailto:liza.barbour@monash.edu" style="color: #007bff;">liza.barbour@monash.edu</a>.
</p>
</div>
</div>
<footer class="acknowledgment">
<p>The PlanEATary Quest is brought to you by Dietitians Australia’s (DA) Food & Environment Interest group with support from the International Confederation of Dietetic Associations (ICDA).</p>
<p>We acknowledge the Traditional Owners of Country throughout Australia. We pay our respects to Elders past and present, and this respect extends to the knowledge and value systems required to maintain a truly sustainable food system here in Australia for over 60,000 years.</p>
</footer>
</section>
</div>
<!-- Sign In Modal-->
<div class="modal fade" id="signInModal" tabindex="-1" aria-labelledby="signInModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="signInModalLabel">Sign In</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<!-- Sign-In Form -->
<form id="signInForm" novalidate>
<div class="mb-3">
<label for="emailInput2" class="form-label">Email address</label>
<input type="email" class="form-control" id="emailInput2" placeholder="Enter email" required>
<div class="invalid-feedback">This email is invalid.</div>
</div>
<div class="mb-3">
<label for="passwordInput" class="form-label">Password</label>
<input type="password" class="form-control" id="passwordInput" placeholder="Enter password" required>
<div class="invalid-feedback">Password must be at least 6 characters long.</div>
</div>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
<br/>
<a class="psw" data-bs-toggle="modal" data-bs-target="#forgotPasswordModal">Forgot password?</a>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary" id="signInButton">Sign In</button>
</div>
</form>
</div>
</div>
</div>
<!-- Forgot Password Modal -->
<div class="modal fade" id="forgotPasswordModal" tabindex="-1" aria-labelledby="forgotPasswordModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="forgotPasswordModalLabel">Reset Password</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form id="forgotPasswordForm" novalidate>
<div class="mb-3">
<label for="resetEmailInput" class="form-label">Email address</label>
<input type="email" class="form-control" id="resetEmailInput" placeholder="Enter your email to reset password" required>
<div class="invalid-feedback">Please enter a valid email.</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" id="resetPasswordButton">Reset Password</button>
</div>
</div>
</div>
</div>
<!-- Sign Up Modal-->
<div class="modal fade" id="signUpModal" tabindex="-1" aria-labelledby="signUpModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="signUpModalLabel">Sign Up</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<!-- Sign-Up Form -->
<form class="account-form" id="signUpForm" onsubmit="return validate_form()">
<div class="mb-3">
<label for="name">Name:</label>
<input type="text" class="form-control" id="name" placeholder="Enter your name">
</div>
<div class="mb-3">
<label for="age">Age:</label>
<input type="number" class="form-control" id="age" placeholder="Enter your age" min="0">
</div>
<div class="mb-3">
<label for="gender">Gender:</label>
<select class="form-select" id="gender">
<option value="male">Male</option>
<option value="female">Female</option>
<option value="other">Other</option>
</select>
</div>
<div class="mb-3">
<label for="email">Additional Email Address:</label>
<input type="email" class="form-control" id="email" placeholder="Enter your email">
</div>
<div class="mb-3">
<label for="user-type">User Type:</label>
<select class="form-select" id="user-type">
<option value="student">Student</option>
<option value="dietician">Dietician</option>
<option value="academic">Academic Staff</option>
<option value="other">Other</option>
</select>
</div>
<div class="mb-3">
<label for="password">Password:</label>
<input type="password" class="form-control" id="password" placeholder="Enter new password">
</div>
<div id="password-message" class="mb-3">
<span>Password must contain:</span>
<div class="password-message-item invalid">At least <b>one lowercase letter</b></div>
<div class="password-message-item invalid">At least <b>one uppercase letter</b></div>
<div class="password-message-item invalid">At least <b>one number</b></div>
<div class="password-message-item invalid">Minimum <b>8 characters</b></div>
</div>
<div class="mb-3 text-danger" id="form_validate_msg"></div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" id="signUpButton">Sign Up</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Error Warning Toast -->
<div class="toast-container">
<div id="liveToast" class="toast m-3 p-3" role="alert" aria-live="assertive" aria-atomic="true" data-bs-autohide="false">
<div class="toast-header">
<strong class="me-auto">PlanEatary</strong>
<!-- <small class="text-muted">just now</small> -->
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div class="toast-body" id="e-toast"></div>
</div>
</div>
<!-- Warning Toast -->
<div class="toast-container">
<div id="first-timer-toast" class="toast align-items-center text-white bg-warning border-0 m-3 p-3" role="alert" aria-live="assertive" aria-atomic="true">
<div class="d-flex">
<div class="toast-body">
Please finish your very first quiz before further proceeding.
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
</div>
</div>
<!-- spinner overlay-->
<section class="overlay hidden" id="spinnerOverlay">
<div class="spinner hidden" id="spinner">
</div>
<div>
<span>Loading</span>
</div>
</section>
<script type="text/javascript" src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
<script>
document.getElementById('resetPasswordButton').addEventListener('click', function () {
const resetEmailInput = document.getElementById('resetEmailInput');
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
// Validate email
if (!emailRegex.test(resetEmailInput.value)) {
resetEmailInput.classList.add('is-invalid');
return;
} else {
resetEmailInput.classList.remove('is-invalid');
}
// Call Netlify Identity's password recovery API
const email = resetEmailInput.value;
netlifyIdentity.gotrue
.requestPasswordRecovery(email)
.then((response) => {
console.log('Recovery email sent', { response });
alert('Recovery email sent successfully. Please check your inbox.');
// Close the modal after success
const modalElement = document.getElementById('forgotPasswordModal');
const modalInstance = bootstrap.Modal.getInstance(modalElement);
modalInstance.hide();
})
.catch((error) => {
console.error('Error sending recovery email:', error);
alert('There was an error sending the recovery email. Please try again later.');
});
});
</script>
<script type="module">
import { fetchResponse, fetchData, reformatResponseData, mergeTaskArrays, fetchTaskStatus } from './scripts/helpers.mjs';
const spinner = document.getElementById('spinner');
const spOver = document.getElementById("spinnerOverlay");
let chosen_tasks = [];
let status_tasks = [];
let isLoading = false;
const minDisplayTime = 1000;
let spinnerStartTime;
document.addEventListener("DOMContentLoaded", async function() {
//ensure the data's cycle selected from history page is always removed
sessionStorage.removeItem('selectedCycle');
const greetingDiv = document.querySelector('.greeting');
const heroButton = document.querySelector('.herobtn');
const offcanvasNavbar = document.getElementById('offcanvasNavbar');
const offcanvasLinks = document.querySelectorAll('#offcanvasNavbar .nav-link');
const offcanvasDropdown = document.querySelectorAll('#offcanvasNavbar .dropdown-item');
const offcanvasListItems = document.querySelectorAll('#offcanvasNavbar li.nav-item');
const offcanvasDropdownItems = document.querySelectorAll('#offcanvasNavbar .dropdown-menu > li');
//For first-timer to see a reminder to do a very first quiz
function showToast() {
const toasty = document.getElementById('first-timer-toast');
const myToast = new bootstrap.Toast(toasty);
myToast.show();
}
offcanvasLinks.forEach(li => {
li.addEventListener('click', event => {
const targetHref = li.getAttribute('href');
const offcanvas = new bootstrap.Offcanvas(offcanvasNavbar);
offcanvas.hide();
if (targetHref && targetHref !== "#") {
window.location.href = targetHref;
}
});
});
offcanvasDropdown.forEach(li => {
li.addEventListener('click', event => {
const targetHref = li.getAttribute('href');
const offcanvas = new bootstrap.Offcanvas(offcanvasNavbar);
offcanvas.hide();
if (targetHref && targetHref !== "#") {
window.location.href = targetHref;
}
});
});
// Function to handle navigation or showing toast
offcanvasListItems.forEach(li => {
li.addEventListener('click', event => {
const link = li.querySelector('a.nav-link');
if (link) {
if (link.classList.contains('Disabled')) {
showToast();
} else {
const targetHref = link.getAttribute('href');
if (targetHref && targetHref !== '#') {
window.location.href = targetHref;
}
}
}
const offcanvas = new bootstrap.Offcanvas(offcanvasNavbar);
offcanvas.hide();
});
});
// Function to handle navigation or showing toast
offcanvasDropdownItems.forEach(li => {
li.addEventListener('click', event => {
const link = li.querySelector('a.dropdown-item');
if (link) {
if (link.classList.contains('Disabled')) {
showToast();
} else {
const targetHref = link.getAttribute('href');
if (targetHref && targetHref !== '#') {
window.location.href = targetHref;
}
}
}
const offcanvas = new bootstrap.Offcanvas(offcanvasNavbar);
offcanvas.hide();
});
})
const disableFirstTimers = () => {
document.querySelectorAll("a.first-timer").forEach(a => {
a.classList.add('Disabled');
a.setAttribute("href", "#");
a.setAttribute("data-bs-toggle", "tooltips");
a.setAttribute("data-bs-placement", "bottom");
a.setAttribute("title", "Complete the pre-quiz first.");
console.log("Disabling tabs");
});
};
const enableFirstTimers = () => {
const anchor = ["qualtrics_post.html", "manifesto_page.html", "result_page.html", "history_page.html"];
document.querySelectorAll("a.first-timer").forEach((a, index) => {
a.classList.remove('Disabled');
a.removeAttribute("data-bs-toggle");
a.removeAttribute("data-bs-placement");
a.href = anchor[index];
console.log("Enabling tabs");
})
}
var preObject = JSON.parse(localStorage.getItem('preResult'));
if(netlifyIdentity.gotrue.currentUser() !== null) {
document.querySelectorAll(".home-hide").forEach(element => {
element.style.display = "flex";
});
document.querySelectorAll(".button-hide").forEach(element => {
element.style.display = "none";
});
if(preObject) {
enableFirstTimers();
} else {
disableFirstTimers();
}
}
function showSpinner() {
spinner.classList.remove('hidden');
spOver.classList.remove('hidden');
isLoading = true;
spinnerStartTime = Date.now();
}
function hideSpinner() {
const elapsedTime = Date.now() - spinnerStartTime;
if (elapsedTime < minDisplayTime) {
setTimeout(() => {
spinner.classList.add('hidden');
spOver.classList.add('hidden');
isLoading = false;
}, minDisplayTime - elapsedTime);
} else {
spinner.classList.add('hidden');
spOver.classList.add('hidden');
isLoading = false;
}
}
// Retrieve tasks from localStorage or fetch if not available
async function fetchTasks(preResponseId) {
const taskData = localStorage.getItem(`${preResponseId}:tasks`);
if (!taskData) {
try {
const response = await fetch('updated_tasks_final.json');
if (!response.ok) {
throw new Error('Network response was not ok ' + response.statusText);
}
const data = await response.json();
return data;
} catch (error) {
console.error('Fetch error:', error);
alert('Failed to load tasks. Please try again later.');
return null;
};
}
return JSON.parse(taskData);
}
function disableButton(button) {
button.disabled = true;
button.classList.add('disabled');
}
function enableButton(button, href=null) {
button.disabled = false;
button.classList.remove('disabled');
if (href) {
button.innerHTML = `<a href="${href}">${button.textContent}</a>`;
}
}
function isTokenExpired(token) {
if (!token) return true;
const base64Payload = token.split('.')[1];
const decodedPayload = JSON.parse(atob(base64Payload));
const exp = decodedPayload.exp;
// Compare current time with expiration time
const now = Math.floor(Date.now()/1000);
return exp < now; // Returns true if token is expired
}
heroButton.addEventListener('click', function () {
if (netlifyIdentity.gotrue.currentUser()) {
let preObject = localStorage.getItem('preResult')
if(preObject) {
alert("Let's see your latest result");
window.location.href = "result_page.html";
} else {
alert("Let's do your very first pre-quiz!");
window.location.href = "qualtrics.html";
}
} else {
document.getElementById('e-toast').textContent = 'Please sign in or sign up first';
const toastEl = document.getElementById('liveToast');
const myToast = new bootstrap.Toast(toastEl);
myToast.show();
}
});
function ExtractUserMetadata() {
const user = netlifyIdentity.gotrue.currentUser();
if (user) {
user.jwt().then(token => {
if (isTokenExpired(token)) {
console.log("Token expired. Prompting user to re-login...");
netlifyIdentity.logout();
} else {
console.log("Token is valid.");
}
});
}
const metadata = user.user_metadata;
const responseHistory = metadata.responseHistory;
let latest_pre = "";
let latest_post = "";
let history = [];
let id = user.id;
//handle first-time user
if (!metadata.responseHistory) {
console.warn("No responseHistory found for this user.");
return { quizObj: { lastPre: "", lastPost: "" }, historyObj: [] };
} else {
Object.keys(responseHistory).forEach((cycleKey) =>{
const entry = responseHistory[cycleKey];
history.push(entry);
if (entry.preId && entry.postId) {
latest_pre = entry.preId;
latest_post = entry.postId;
}
if (!entry.postId) {
latest_pre = entry.preId;
latest_post = "";
}
})
}
const quizPair = {lastPre: latest_pre, lastPost: latest_post};
console.log("responseId pre", quizPair.lastPre);
console.log("responseId post", quizPair.lastPost);
return {quizObj: quizPair, historyObj: history, userId: id}
}
async function fetchResponses(userId) {
try {
const response = await fetch('/api/fetch-responses', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Q-RESPONSE-ID': userId,
}
});
const { ok, status } = response;
if (!ok) {
throw new Error(JSON.stringify({
status: status,
response: await response.text(),
}));
}
const data = await response.json();
console.log('Responses fetched!\n', data);
localStorage.setItem(`${userId}:allResponses`, JSON.stringify(data));
return data;
} catch (error) {
console.warn('Caught', error, '\nin fetchResponse');
return null;
}
}
async function ExtractQuizInfo() {
const {quizObj, historyObj, userId} = ExtractUserMetadata();
var allRes = await fetchResponses(userId);
let allResponses = JSON.parse(localStorage.getItem(`${userId}:allResponses`));
if (quizObj.lastPost !== "" || allResponses) {
allResponses.forEach((cycleKey) => {
const preQuiz = cycleKey?.preResponse ?? null;
const postQuiz = cycleKey?.postResponse ?? null;
//for debugging purpose
console.log("Cycle Key:", cycleKey);
console.log("allResponses[cycleKey]:", allResponses[cycleKey]);
if (preQuiz?.responseId && preQuiz?.responseId == quizObj.lastPre) {
localStorage.setItem("preResult", JSON.stringify(preQuiz));
}
if (postQuiz?.responseId && postQuiz?.responseId == quizObj.lastPost) {
localStorage.setItem("postResult", JSON.stringify(postQuiz));
}
});
} else if (quizObj.lastPre !== "" || allResponses) {
allResponses.forEach((cycleKey) => {
const preQuiz = cycleKey.preResponse;
if (preQuiz.responseId && preQuiz.responseId == quizObj.lastPre) {
localStorage.setItem("preResult", JSON.stringify(preQuiz));
}
});
} else {
//handle a potentially first-time user
if(confirm("Seems like you've not done any quiz before. Are you a first-timer?") == true) {
//clear unwanted existings in local storage.
localStorage.removeItem('preResult');
localStorage.removeItem('postResult');
localStorage.removeItem(`${userId}:allResponses`);
return false;
}
}
return true;
}
function showSignInModal() {
const signInModal = new bootstrap.Modal(document.getElementById('signInModal'));
signInModal.show();
}
function hideSignInModal() {
const signInModal = document.getElementById('signInModal');
const modalInstance = bootstrap.Modal.getInstance(signInModal);
modalInstance.hide();
}
async function signInAndRedirect() {
try {
const emailInput2 = document.getElementById('emailInput2');
const passwordInput2 = document.getElementById('passwordInput');
const loginResult = await netlifyIdentity.gotrue.login(
emailInput2.value,
passwordInput2.value,
true
);
// Wait for Netlify to update user data
await new Promise(resolve => setTimeout(resolve, 1000));
const user = netlifyIdentity.currentUser();
if (!user) throw new Error("Login failed: No user object found");
console.log("Successful login!", emailInput2.value);
hideSignInModal();
// Wait for quiz info
let r = await ExtractQuizInfo();
if (r === true) {
enableFirstTimers();
//Need lana to test and edit the flow here if neccessary
alert("Form is valid, proceeding");
window.location.href = "result_page.html";
} else {
disableFirstTimers();
alert("Form is valid, proceeding");
// Delay navigation slightly
setTimeout(() => {
//Needs confirmation from Linh about the flow here
window.location.href = "index.html";
}, 500);
}
} catch (error) {
console.error("Caught error:", error);
document.getElementById("e-toast").textContent = error;
const toastEl = document.getElementById("liveToast");
const myToast = new bootstrap.Toast(toastEl);
myToast.show();
}
}
document.getElementById('signInButton').addEventListener('click', () => {
const emailInput2 = document.getElementById('emailInput2');
const passwordInput2 = document.getElementById('passwordInput');
const emailRegex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
let isValid = true;
// Email validation
if (!emailRegex.test(emailInput2.value) || emailInput2.value === 'harry@m.com') {
emailInput2.classList.add('is-invalid');
isValid = false;
} else {
emailInput2.classList.remove('is-invalid');
}
// Password validation (minimum 6 characters)
if (passwordInput2.value.length < 6) {
passwordInput2.classList.add('is-invalid');
isValid = false;
} else {
passwordInput2.classList.remove('is-invalid');
}
if (isValid) {
signInAndRedirect();
}
});
//allow a user to log out
function logOut() {
const offcanvas = new bootstrap.Offcanvas(offcanvasNavbar);
offcanvas.hide();
if (netlifyIdentity.gotrue.currentUser() !== null) {
let user = netlifyIdentity.gotrue.currentUser();
user.logout().then(() => {
console.log('User has been logged out!');
window.location.href = "index.html";
});
} else {
window.location.href = "index.html";
console.log("No user is logged in!");
}
}
document.getElementById('logOut').addEventListener('click', () => {
if(confirm("Do you really want to sign out?") == true) {
showSpinner();
logOut();
hideSpinner();
}
});
})
</script>
<!--forget password script-->
<script>
document.getElementById('resetPasswordButton').addEventListener('click', function () {
const email = document.getElementById('resetEmailInput').value.trim();