Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
871 lines (792 loc) · 49.6 KB
/
Copy pathindex.html
File metadata and controls
871 lines (792 loc) · 49.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Instructional Journey Mapping Tool</title>
<script src="https://cdn.tailwindcss.com"></script>
<style>
@media print {
* { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
.no-print { display: none !important; }
body { background: white !important; padding: 0 !important; margin: 0 !important; }
.max-w-7xl { box-shadow: none !important; border: none !important; width: 100% !important; max-width: 100% !important; }
.scroll-container { overflow: visible !important; }
#journey-container {
display: flex !important;
flex-direction: row !important;
min-width: 100% !important;
width: 100% !important;
divide-x: 1px solid #e2e8f0 !important;
}
.step-column {
border: 1px solid #e2e8f0 !important;
width: auto !important;
flex: 1 1 0 !important;
min-width: 0 !important;
page-break-inside: avoid;
}
.graph-area { height: 160px !important; display: block !important; opacity: 1 !important; visibility: visible !important; }
.graph-canvas { display: block !important; position: absolute !important; }
textarea { border: none !important; height: auto !important; min-height: 50px !important; overflow: visible !important; }
.solution-editor { height: auto !important; overflow: visible !important; }
}
.scroll-container {
overflow-x: auto;
position: relative;
background: white;
scroll-behavior: smooth;
}
.graph-area {
position: relative;
height: 0;
overflow: hidden;
background: #fdfdfd;
transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.graph-area.expanded {
height: 180px;
}
.graph-header {
cursor: pointer;
transition: background-color 0.2s;
}
.graph-header:hover {
background-color: #eef2ff !important;
}
.graph-canvas {
position: absolute;
top: 0;
left: 0;
pointer-events: none;
z-index: 20;
display: none;
}
.graph-area.expanded ~ .graph-canvas,
.expanded .graph-canvas {
display: block;
}
.graph-grid-line {
position: absolute;
left: 0;
right: 0;
border-top: 1px dashed #e2e8f0;
pointer-events: none;
}
.emotion-slider {
-webkit-appearance: none;
width: 100%;
height: 4px;
border-radius: 2px;
background: #cbd5e1;
outline: none;
margin: 0;
display: block;
}
.emotion-slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 14px;
height: 14px;
border-radius: 50%;
background: white;
cursor: pointer;
border: 2px solid currentColor;
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
position: relative;
z-index: 10;
}
.slider-ticks {
display: flex;
justify-content: space-between;
padding: 0 4px;
margin-top: -4px;
pointer-events: none;
}
.slider-ticks span { width: 1px; height: 6px; background: #94a3b8; }
.section-header {
background-color: #f8fafc; font-weight: bold; text-transform: uppercase;
font-size: 0.7rem; padding: 0.5rem 0.75rem; border-bottom: 1px solid #e2e8f0;
display: flex; align-items: center; justify-content: space-between;
letter-spacing: 0.025em; color: #475569;
}
.dragging { opacity: 0.4; border: 2px dashed #6366f1 !important; background: #f5f3ff; }
.drag-handle { cursor: grab; padding-right: 8px; color: #94a3b8; }
.learner-dot {
width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px;
}
.chevron {
transition: transform 0.3s;
display: inline-block;
}
.expanded .chevron { transform: rotate(180deg); }
.add-learner-btn {
width: 100%; padding: 6px; border: 1px dashed #cbd5e1; border-radius: 6px;
color: #64748b; font-size: 10px; font-weight: bold; text-transform: uppercase;
letter-spacing: 0.05em; transition: all 0.2s; margin-top: 10px;
}
.tooltip-text {
visibility: hidden; width: 280px; background-color: #1e293b; color: #fff;
text-align: left; border-radius: 8px; padding: 12px; position: absolute;
z-index: 100; top: 130%; right: 0; opacity: 0; transition: opacity 0.2s;
font-size: 0.75rem; pointer-events: none;
font-weight: normal; text-transform: none; letter-spacing: normal;
}
.step-column:first-child .tooltip-text {
right: auto;
left: 0;
}
.tooltip-container:hover .tooltip-text { visibility: visible; opacity: 1; }
.udl-menu {
display: none; position: absolute; bottom: 100%; left: 0; width: 100%;
max-height: 450px; overflow-y: auto; background: white; border: 1px solid #e2e8f0;
box-shadow: 0 -10px 25px -5px rgba(0,0,0,0.1); z-index: 100; border-radius: 12px 12px 0 0;
}
.udl-menu.active { display: block; }
.principle-header {
font-weight: 800; text-transform: uppercase; font-size: 10px;
padding: 12px; position: sticky; top: 0; color: white; z-index: 20;
}
.guideline-subheader {
font-weight: 700; font-size: 9px; padding: 6px 12px;
background: #f8fafc; border-bottom: 1px solid #e2e8f0; color: #475569;
text-transform: uppercase; letter-spacing: 0.05em;
}
.udl-item {
padding: 8px 16px; font-size: 11px; cursor: pointer;
border-bottom: 1px solid #f1f5f9; transition: background 0.2s;
display: flex; align-items: flex-start; gap: 8px;
}
.udl-item:hover { background: #f1f5f9; }
.bg-udl-engagement { background-color: #3C854A; }
.bg-udl-representation { background-color: #367BB3; }
.bg-udl-action { background-color: #6A5190; }
.udl-pill {
font-size: 8px; padding: 2px 8px; border-radius: 999px;
color: white; font-weight: bold; text-transform: uppercase;
}
.solution-editor {
min-height: 150px; padding: 12px; font-size: 14px; line-height: 1.5;
outline: none; overflow-y: auto;
}
.udl-solution-chip {
display: inline-block; padding: 4px 8px; border-radius: 4px;
color: white; font-size: 11px; font-weight: 600; margin: 2px 0;
line-height: 1.2; width: 100%;
}
.udl-solution-chip button {
margin-left: 6px; opacity: 0.7; font-weight: bold;
}
.udl-solution-chip button:hover { opacity: 1; }
.udl-solution-chip .sub-text {
display: block; font-size: 9px; opacity: 0.9; font-weight: 400;
}
/* Shimmer Effect for AI Loading */
@keyframes shimmer {
0% { background-position: -200% 0; }
100% { background-position: 200% 0; }
}
.loading-shimmer {
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
background-size: 200% 100%;
animation: shimmer 1.5s infinite;
color: transparent !important;
opacity: 0.7;
}
.ai-loading-overlay {
position: absolute; inset: 0; background: rgba(255,255,255,0.7);
display: none; align-items: center; justify-content: center; z-index: 50;
}
.ai-loading-overlay.active { display: flex; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spinner { animation: spin 1s linear infinite; border: 2px solid #e2e8f0; border-top-color: #6366f1; border-radius: 50%; width: 20px; height: 20px; }
</style>
</head>
<body class="bg-slate-100 p-4 md:p-8 font-sans text-slate-900">
<div id="token-modal" class="fixed inset-0 bg-slate-900/50 backdrop-blur-sm z-[200] hidden items-center justify-center p-4">
<div class="bg-white rounded-xl shadow-2xl p-6 max-w-md w-full border border-slate-200">
<div class="flex items-center gap-2 mb-2">
<span class="text-2xl">✨</span>
<h2 class="text-lg font-bold">Google Gemini Configuration</h2>
</div>
<p class="text-sm text-slate-500 mb-4">Please enter your Google Gemini API Key.</p>
<input type="password" id="gemini-key-input" placeholder="AIzaSy..." class="w-full p-3 border rounded-lg mb-2 text-sm focus:ring-2 focus:ring-indigo-500 outline-none font-mono">
<div class="mb-4 bg-indigo-50 p-3 rounded-lg border border-indigo-100">
<div class="flex items-center gap-2 mb-2">
<input type="checkbox" id="use-proxy-toggle" class="w-4 h-4 text-indigo-600 rounded">
<label for="use-proxy-toggle" class="text-xs text-slate-600 font-bold select-none cursor-pointer">
Use CORS Proxy (Try Disabled First)
</label>
</div>
<p class="text-[10px] text-slate-500">
Using <strong>gemini-2.0-flash</strong>. This model usually supports direct browser connections.
</p>
</div>
<div id="token-status" class="text-xs font-bold mb-4 hidden p-2 rounded bg-slate-100"></div>
<div class="flex justify-between gap-2">
<button onclick="testToken()" class="px-4 py-2 text-sm font-bold text-indigo-600 bg-white rounded-lg hover:bg-indigo-50 border border-indigo-200">Test Key</button>
<div class="flex gap-2">
<button onclick="closeTokenModal()" class="px-4 py-2 text-sm font-bold text-slate-500 hover:text-slate-700">Cancel</button>
<button onclick="saveToken()" class="px-4 py-2 text-sm font-bold bg-indigo-600 text-white rounded-lg hover:bg-indigo-700">Save Key</button>
</div>
</div>
</div>
</div>
<div class="max-w-7xl mx-auto bg-white shadow-2xl rounded-xl overflow-hidden border border-slate-200">
<header class="bg-slate-800 p-6 text-white border-b-4 border-indigo-500">
<div class="flex flex-col md:flex-row justify-between items-start md:items-center gap-4">
<div>
<h1 class="text-2xl font-bold tracking-tight uppercase">Instructional Journey Map</h1>
<p class="text-slate-400 text-xs font-bold tracking-widest mt-1">
<a href="https://www.cast.org" target="_blank" class="underline underline-offset-2 hover:text-slate-200">CAST (Center for Applied Special Technology)</a> UDL GUIDELINES v3.0 INTEGRATION
</p>
</div>
<div class="no-print flex gap-2">
<button id="config-ai-btn" onclick="openTokenModal()" class="bg-slate-700 hover:bg-slate-600 px-3 py-2 rounded-lg text-[10px] font-bold transition flex items-center gap-2 border border-slate-600">
⚙️ AI CONFIG
</button>
<button onclick="window.print()" class="bg-slate-700 hover:bg-slate-600 px-4 py-2 rounded-lg text-xs font-bold transition flex items-center gap-2 border border-slate-600">
PRINT REPORT
</button>
<button onclick="addStep()" class="bg-indigo-600 hover:bg-indigo-500 px-4 py-2 rounded-lg text-xs font-bold transition flex items-center gap-2">
+ ADD SEGMENT
</button>
</div>
</div>
</header>
<div class="relative">
<div id="scroll-wrapper" class="scroll-container">
<canvas id="graphCanvas" class="graph-canvas"></canvas>
<div id="journey-container" class="flex min-w-max divide-x divide-slate-200">
<div class="step-column w-80 flex-shrink-0 flex flex-col relative" draggable="true">
<div class="ai-loading-overlay">
<div class="flex flex-col items-center gap-2">
<div class="spinner"></div>
<span class="text-[10px] font-bold text-slate-600 uppercase">Gemini Analyzing...</span>
</div>
</div>
<div class="bg-slate-900 text-white p-2 text-[10px] font-bold flex justify-between items-center">
<div class="flex items-center">
<div class="drag-handle no-print">⠿</div>
<span class="segment-label uppercase tracking-widest">SEGMENT 1</span>
</div>
<button onclick="removeStep(this)" class="no-print opacity-50 hover:opacity-100 transition-opacity">✕</button>
</div>
<div class="border-b border-slate-100">
<div class="section-header">Activities & Methods</div>
<textarea class="activity-input w-full p-3 text-sm focus:bg-slate-50 outline-none resize-none h-24 transition-colors" placeholder="What are the students doing?"></textarea>
</div>
<div class="border-b border-slate-100">
<div class="section-header">Materials & Tools</div>
<textarea class="materials-input w-full p-3 text-sm focus:bg-slate-50 outline-none resize-none h-20 transition-colors" placeholder="Apps, tools, papers..."></textarea>
</div>
<div class="graph-section border-b border-slate-100">
<div class="section-header graph-header !bg-indigo-50/30 !text-indigo-900 border-indigo-100" onclick="toggleGraph()">
<div class="flex items-center gap-2">
<span class="chevron">▼</span>
Level of Emotion or Productivity
</div>
<div class="tooltip-container relative">
<span class="info-icon text-[10px] bg-slate-200 w-4 h-4 rounded-full flex items-center justify-center font-bold">?</span>
<div class="tooltip-text">
<p class="mb-2"><strong>High Point:</strong> Emotion drives engagement. Effort feels productive.</p>
<p><strong>Low Point:</strong> Emotion interferes. Effort feels unproductive.</p>
</div>
</div>
</div>
<div class="graph-area">
<div class="absolute inset-0 pointer-events-none mt-2">
<div class="graph-grid-line" style="top: 20%"></div>
<div class="graph-grid-line" style="top: 50%"></div>
<div class="graph-grid-line" style="top: 80%"></div>
</div>
</div>
</div>
<div class="bg-slate-50/50 p-4 border-b border-slate-100 min-h-[160px]">
<div class="flex justify-between items-center mb-4">
<span class="text-[10px] font-bold text-slate-500 uppercase tracking-widest">Learner Engagement</span>
<span class="text-[8px] text-slate-300 font-bold uppercase tracking-widest">Low ← → High</span>
</div>
<div class="learner-list space-y-6"></div>
<button onclick="addLearner()" class="add-learner-btn no-print">+ Add Learner</button>
</div>
<div class="border-b border-slate-100 bg-rose-50/20">
<div class="section-header !bg-rose-100/50 !text-rose-900">
<span>Possible Barriers</span>
<button onclick="runAIAnalysis(this)" class="no-print bg-rose-600 text-white px-2 py-0.5 rounded-full text-[8px] hover:bg-rose-700 flex items-center gap-1">
✨ AI ANALYZE
</button>
</div>
<textarea class="barriers-input w-full p-3 text-sm bg-transparent outline-none resize-none h-24" placeholder="What might block learning?"></textarea>
</div>
<div class="relative flex-grow flex flex-col bg-emerald-50/10">
<div class="section-header !bg-slate-100 !text-slate-800">
<div class="flex items-center gap-2">
<span>UDL Solutions</span>
</div>
<button onclick="toggleUDLMenu(this)" class="no-print text-[9px] bg-slate-700 text-white px-2 py-0.5 rounded-full hover:bg-slate-800">Add Solution</button>
</div>
<div class="udl-menu no-print">
<div class="principle-header bg-udl-engagement">Engagement (The Why)</div>
<div class="guideline-subheader">7 Welcoming Interests & Identities</div>
<div class="udl-item" onclick="insertUDL(this, '7 Welcoming Interests & Identities', '7.1 Optimize choice and autonomy', '#3C854A')">7.1 Optimize choice and autonomy</div>
<div class="udl-item" onclick="insertUDL(this, '7 Welcoming Interests & Identities', '7.2 Optimize relevance, value, and authenticity', '#3C854A')">7.2 Optimize relevance, value, and authenticity</div>
<div class="udl-item" onclick="insertUDL(this, '7 Welcoming Interests & Identities', '7.3 Nurture joy and play', '#3C854A')">7.3 Nurture joy and play</div>
<div class="udl-item" onclick="insertUDL(this, '7 Welcoming Interests & Identities', '7.4 Address biases, threats, and distractions', '#3C854A')">7.4 Address biases, threats, and distractions</div>
<div class="guideline-subheader">8 Sustaining Effort & Persistence</div>
<div class="udl-item" onclick="insertUDL(this, '8 Sustaining Effort & Persistence', '8.1 Clarify the meaning and purpose of goals', '#3C854A')">8.1 Clarify the meaning and purpose of goals</div>
<div class="udl-item" onclick="insertUDL(this, '8 Sustaining Effort & Persistence', '8.2 Optimize challenge and support', '#3C854A')">8.2 Optimize challenge and support</div>
<div class="udl-item" onclick="insertUDL(this, '8 Sustaining Effort & Persistence', '8.3 Foster collaboration, interdependence, and collective learning', '#3C854A')">8.3 Foster collaboration, interdependence, and collective learning</div>
<div class="udl-item" onclick="insertUDL(this, '8 Sustaining Effort & Persistence', '8.4 Foster belonging and community', '#3C854A')">8.4 Foster belonging and community</div>
<div class="udl-item" onclick="insertUDL(this, '8 Sustaining Effort & Persistence', '8.5 Offer action-oriented feedback', '#3C854A')">8.5 Offer action-oriented feedback</div>
<div class="guideline-subheader">9 Emotional Capacity</div>
<div class="udl-item" onclick="insertUDL(this, '9 Emotional Capacity', '9.1 Recognize expectations, beliefs, and motivations', '#3C854A')">9.1 Recognize expectations, beliefs, and motivations</div>
<div class="udl-item" onclick="insertUDL(this, '9 Emotional Capacity', '9.2 Develop awareness of self and others', '#3C854A')">9.2 Develop awareness of self and others</div>
<div class="udl-item" onclick="insertUDL(this, '9 Emotional Capacity', '9.3 Promote individual and collective reflection', '#3C854A')">9.3 Promote individual and collective reflection</div>
<div class="udl-item" onclick="insertUDL(this, '9 Emotional Capacity', '9.4 Cultivate empathy and restorative practices', '#3C854A')">9.4 Cultivate empathy and restorative practices</div>
<div class="principle-header bg-udl-representation">Representation (The What)</div>
<div class="guideline-subheader">1 Perception</div>
<div class="udl-item" onclick="insertUDL(this, '1 Perception', '1.1 Support opportunities to customize the display of information', '#367BB3')">1.1 Support opportunities to customize the display of information</div>
<div class="udl-item" onclick="insertUDL(this, '1 Perception', '1.2 Support multiple ways to perceive information', '#367BB3')">1.2 Support multiple ways to perceive information</div>
<div class="udl-item" onclick="insertUDL(this, '1 Perception', '1.3 Represent a diversity of perspectives and identities in authentic ways', '#367BB3')">1.3 Represent a diversity of perspectives and identities in authentic ways</div>
<div class="guideline-subheader">2 Language & Symbols</div>
<div class="udl-item" onclick="insertUDL(this, '2 Language & Symbols', '2.1 Clarify vocabulary, symbols, and language structures', '#367BB3')">2.1 Clarify vocabulary, symbols, and language structures</div>
<div class="udl-item" onclick="insertUDL(this, '2 Language & Symbols', '2.2 Support decoding of text, mathematical notation, and symbols', '#367BB3')">2.2 Support decoding of text, mathematical notation, and symbols</div>
<div class="udl-item" onclick="insertUDL(this, '2 Language & Symbols', '2.3 Cultivate understanding and respect across languages and dialects', '#367BB3')">2.3 Cultivate understanding and respect across languages and dialects</div>
<div class="udl-item" onclick="insertUDL(this, '2 Language & Symbols', '2.4 Address biases in the use of language and symbols', '#367BB3')">2.4 Address biases in the use of language and symbols</div>
<div class="udl-item" onclick="insertUDL(this, '2 Language & Symbols', '2.5 Illustrate through multiple media', '#367BB3')">2.5 Illustrate through multiple media</div>
<div class="guideline-subheader">3 Building Knowledge</div>
<div class="udl-item" onclick="insertUDL(this, '3 Building Knowledge', '3.1 Connect prior knowledge to new learning', '#367BB3')">3.1 Connect prior knowledge to new learning</div>
<div class="udl-item" onclick="insertUDL(this, '3 Building Knowledge', '3.2 Highlight and explore patterns, critical features, big ideas, and relationships', '#367BB3')">3.2 Highlight and explore patterns, critical features, big ideas, and relationships</div>
<div class="udl-item" onclick="insertUDL(this, '3 Building Knowledge', '3.3 Cultivate multiple ways of knowing and making meaning', '#367BB3')">3.3 Cultivate multiple ways of knowing and making meaning</div>
<div class="udl-item" onclick="insertUDL(this, '3 Building Knowledge', '3.4 Maximize transfer and generalization', '#367BB3')">3.4 Maximize transfer and generalization</div>
<div class="principle-header bg-udl-action">Action & Expression (The How)</div>
<div class="guideline-subheader">4 Interaction</div>
<div class="udl-item" onclick="insertUDL(this, '4 Interaction', '4.1 Vary and honor the methods for response, navigation, and movement', '#6A5190')">4.1 Vary and honor the methods for response, navigation, and movement</div>
<div class="udl-item" onclick="insertUDL(this, '4 Interaction', '4.2 Optimize access to accessible materials and assistive and accessible technologies and tools', '#6A5190')">4.2 Optimize access to accessible materials and assistive and accessible technologies and tools</div>
<div class="guideline-subheader">5 Expression & Communication</div>
<div class="udl-item" onclick="insertUDL(this, '5 Expression & Communication', '5.1 Use multiple media for communication', '#6A5190')">5.1 Use multiple media for communication</div>
<div class="udl-item" onclick="insertUDL(this, '5 Expression & Communication', '5.2 Use multiple tools for construction, composition, and creativity', '#6A5190')">5.2 Use multiple tools for construction, composition, and creativity</div>
<div class="udl-item" onclick="insertUDL(this, '5 Expression & Communication', '5.3 Build fluencies with graduated levels of support for practice and performance', '#6A5190')">5.3 Build fluencies with graduated support</div>
<div class="udl-item" onclick="insertUDL(this, '5 Expression & Communication', '5.4 Address biases related to modes of expression and communication', '#6A5190')">5.4 Address biases related to modes of expression and communication</div>
<div class="guideline-subheader">6 Strategy Development</div>
<div class="udl-item" onclick="insertUDL(this, '6 Strategy Development', '6.1 Set meaningful goals', '#6A5190')">6.1 Set meaningful goals</div>
<div class="udl-item" onclick="insertUDL(this, '6 Strategy Development', '6.2 Anticipate and plan for challenges', '#6A5190')">6.2 Anticipate and plan for challenges</div>
<div class="udl-item" onclick="insertUDL(this, '6 Strategy Development', '6.3 Organize information and resources', '#6A5190')">6.3 Organize information and resources</div>
<div class="udl-item" onclick="insertUDL(this, '6 Strategy Development', '6.4 Enhance capacity for monitoring progress', '#6A5190')">6.4 Enhance capacity for monitoring progress</div>
<div class="udl-item" onclick="insertUDL(this, '6 Strategy Development', '6.5 Challenge exclusionary practices', '#6A5190')">6.5 Challenge exclusionary practices</div>
</div>
<div class="p-2 flex gap-1 flex-wrap no-print bg-slate-50 border-b border-slate-200">
<span class="udl-pill bg-udl-engagement">Engagement</span>
<span class="udl-pill bg-udl-representation">Representation</span>
<span class="udl-pill bg-udl-action">Action & Expression</span>
</div>
<div class="solution-editor w-full bg-transparent" contenteditable="true"></div>
</div>
</div>
</div>
</div>
</div>
<footer class="p-4 bg-slate-50 border-t flex flex-wrap justify-between items-center gap-4">
<div id="learner-legend" class="flex gap-4">
<a href="https://udlguidelines.cast.org/" target="_blank" class="no-print bg-indigo-50 hover:bg-indigo-100 text-indigo-700 text-[10px] font-bold px-3 py-1.5 rounded border border-indigo-200 transition uppercase tracking-wider">
Official CAST UDL Guidelines →
</a>
</div>
<div class="text-[10px] text-slate-400 font-bold uppercase tracking-widest">
UDL Framework © <a href="https://www.cast.org" target="_blank" class="underline underline-offset-2 hover:text-slate-500">CAST (Center for Applied Special Technology)</a> 2018 | Journey Map Tool
</div>
</footer>
</div>
<script>
const container = document.getElementById('journey-container');
const canvas = document.getElementById('graphCanvas');
const ctx = canvas.getContext('2d');
const tokenModal = document.getElementById('token-modal');
const tokenInput = document.getElementById('gemini-key-input');
const tokenStatus = document.getElementById('token-status');
const proxyToggle = document.getElementById('use-proxy-toggle');
let draggedItem = null;
let isGraphExpanded = false;
let aiKey = localStorage.getItem('gemini_key') || '';
let useProxy = localStorage.getItem('use_proxy') !== 'false'; // Default true
let learners = [
{ id: 1, color: '#4f46e5', name: 'Learner 1' },
{ id: 2, color: '#e11d48', name: 'Learner 2' },
{ id: 3, color: '#059669', name: 'Learner 3' }
];
// Updated to the working model version
const GEMINI_MODEL = "gemini-2.0-flash";
const colors = {
'Engagement': '#3C854A',
'Representation': '#367BB3',
'ActionExpression': '#6A5190',
'Action & Expression': '#6A5190'
};
function openTokenModal() {
tokenInput.value = aiKey;
proxyToggle.checked = useProxy;
tokenModal.classList.remove('hidden');
tokenModal.classList.add('flex');
tokenStatus.classList.add('hidden');
}
function closeTokenModal() {
tokenModal.classList.add('hidden');
tokenModal.classList.remove('flex');
}
function saveToken() {
aiKey = tokenInput.value.trim();
useProxy = proxyToggle.checked;
localStorage.setItem('gemini_key', aiKey);
localStorage.setItem('use_proxy', useProxy);
closeTokenModal();
if(aiKey) {
document.getElementById('config-ai-btn').classList.add('!bg-emerald-600', '!border-emerald-700');
}
}
// Helper to construct URL based on proxy setting
function getApiUrl() {
const baseUrl = `https://generativelanguage.googleapis.com/v1beta/models/${GEMINI_MODEL}:generateContent?key=${aiKey}`;
if (useProxy) {
return `https://corsproxy.io/?${encodeURIComponent(baseUrl)}`;
}
return baseUrl;
}
async function testToken() {
const token = tokenInput.value.trim();
const isProxyOn = proxyToggle.checked;
if(!token) {
showStatus("Please enter a key first", "text-red-500");
return;
}
showStatus("Testing Gemini connection...", "text-slate-500");
try {
// Construct URL manually for the test to use the input token, not the saved one
const baseUrl = `https://generativelanguage.googleapis.com/v1beta/models/${GEMINI_MODEL}:generateContent?key=${token}`;
const url = isProxyOn
? `https://corsproxy.io/?${encodeURIComponent(baseUrl)}`
: baseUrl;
const response = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
contents: [{ parts: [{ text: "Hello" }] }]
})
});
if (response.ok) {
showStatus("Success! Gemini Key is valid.", "text-emerald-600");
} else {
let errorMsg = `HTTP ${response.status}`;
try {
const errBody = await response.json();
if (errBody.error && errBody.error.message) {
errorMsg += `: ${errBody.error.message}`;
}
} catch(e) {} // Ignore parsing error
showStatus(errorMsg, "text-red-500");
}
} catch (e) {
console.error("Token Test Error:", e);
if (e.message.includes('Load failed') || e.name === 'TypeError') {
if (isProxyOn) {
showStatus("Proxy Failed. This environment might be blocking it. Uncheck Proxy.", "text-amber-600");
} else {
showStatus("Network Blocked. Enable 'Use CORS Proxy' for local file/Canvas use.", "text-amber-600");
}
} else {
showStatus(`Error: ${e.message}`, "text-red-500");
}
}
}
function showStatus(msg, colorClass) {
tokenStatus.textContent = msg;
tokenStatus.className = `text-xs font-bold mb-4 ${colorClass} p-2 bg-slate-50 rounded`;
tokenStatus.classList.remove('hidden');
}
async function runAIAnalysis(btn) {
if (!aiKey) {
openTokenModal();
return;
}
const col = btn.closest('.step-column');
const activities = col.querySelector('.activity-input').value;
const materials = col.querySelector('.materials-input').value;
const barriersField = col.querySelector('.barriers-input');
const solutionField = col.querySelector('.solution-editor');
const sliders = col.querySelectorAll('.emotion-slider');
if (!activities) {
alert("Please add some Activities & Methods first. The AI needs this context to perform the analysis.");
return;
}
let stats = "";
const learnerList = learners;
sliders.forEach((s) => {
const lName = learnerList.find(l => l.id == s.dataset.learnerId)?.name || 'Learner';
stats += `${lName} at level ${s.value}/5. `;
});
btn.disabled = true;
btn.innerHTML = "<span>⏳...</span>";
barriersField.classList.add('loading-shimmer');
solutionField.classList.add('loading-shimmer');
const systemPrompt = `You are a Universal Design for Learning (UDL) specialist.
Identify 2 likely barriers and 3 specific UDL v2.2 solutions based on the provided instructional context.
Output strictly valid JSON with the structure:
{ "barriers": "string", "solutions": [ { "cat": "Engagement" | "Representation" | "Action & Expression", "id": "guideline_id", "title": "short title" } ] }`;
const userPrompt = `Context:
Activities: ${activities}
Materials: ${materials}
Engagement Data: ${stats}
${systemPrompt}`;
try {
const url = getApiUrl();
const response = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
contents: [{ parts: [{ text: userPrompt }] }],
generationConfig: {
responseMimeType: "application/json"
}
})
});
if (!response.ok) {
let errorMessage = `HTTP ${response.status}`;
try {
const errJson = await response.json();
if (errJson.error && errJson.error.message) {
errorMessage += `: ${errJson.error.message}`;
}
} catch (e) {
// could not parse error body
}
throw new Error(errorMessage);
}
const data = await response.json();
const content = data.candidates[0].content.parts[0].text;
const result = JSON.parse(content);
barriersField.value = result.barriers;
if(result.solutions && result.solutions.length > 0) {
solutionField.innerHTML = '';
result.solutions.forEach(sol => {
const chip = document.createElement('div');
chip.className = 'udl-solution-chip';
let bg = colors[sol.cat];
if(!bg && sol.cat.includes("Action")) bg = colors['Action & Expression'];
if(!bg) bg = '#64748b';
chip.style.backgroundColor = bg;
chip.setAttribute('contenteditable', 'false');
chip.innerHTML = `<span>${sol.id || 'UDL'}: ${sol.title}</span><button onclick="this.parentElement.remove()">×</button>`;
solutionField.appendChild(chip);
});
}
} catch (err) {
console.error("AI Error:", err);
if (err.name === 'TypeError' && err.message === 'Load failed') {
if (useProxy) {
barriersField.value = "Connection Failed (404 from Proxy). Try disabling 'Use CORS Proxy' in settings.";
} else {
barriersField.value = "Network Blocked. Please Enable 'Use CORS Proxy' in AI Config.";
}
} else {
barriersField.value = `Analysis Error: ${err.message}`;
}
} finally {
btn.disabled = false;
btn.innerHTML = "✨ AI ANALYZE";
barriersField.classList.remove('loading-shimmer');
solutionField.classList.remove('loading-shimmer');
}
}
function init() {
if(aiKey) document.getElementById('config-ai-btn').classList.add('!bg-emerald-600', '!border-emerald-700');
// Restore proxy setting
if (localStorage.getItem('use_proxy') === 'false') {
useProxy = false;
}
proxyToggle.checked = useProxy;
window.addEventListener('resize', () => { if(isGraphExpanded) drawGraph(); });
document.addEventListener('input', (e) => {
if(e.target.classList.contains('emotion-slider') || e.target.classList.contains('annotation-input')) {
if(!isGraphExpanded) toggleGraph(true);
drawGraph();
}
});
document.addEventListener('click', (e) => {
if (!e.target.closest('.udl-menu') && !e.target.innerText.includes('Add Solution')) {
document.querySelectorAll('.udl-menu').forEach(m => m.classList.remove('active'));
}
});
const template = container.querySelector('.step-column');
renderSliders(template);
setupDragEvents(template);
for(let i=0; i<2; i++) addStep();
updateSegmentLabels();
}
function toggleUDLMenu(btn) {
const menu = btn.closest('.step-column').querySelector('.udl-menu');
const isActive = menu.classList.contains('active');
document.querySelectorAll('.udl-menu').forEach(m => m.classList.remove('active'));
if (!isActive) menu.classList.add('active');
}
function insertUDL(item, guideline, consideration, color) {
const editor = item.closest('.step-column').querySelector('.solution-editor');
const chip = document.createElement('div');
chip.className = 'udl-solution-chip';
chip.style.backgroundColor = color;
chip.contentEditable = "false";
chip.innerHTML = `<span class="sub-text">${guideline.toUpperCase()}</span>${consideration}`;
editor.appendChild(chip);
editor.appendChild(document.createElement('br'));
editor.focus();
item.closest('.udl-menu').classList.remove('active');
}
function toggleGraph(forceState) {
isGraphExpanded = forceState !== undefined ? forceState : !isGraphExpanded;
document.querySelectorAll('.graph-section').forEach(s => s.classList.toggle('expanded', isGraphExpanded));
document.querySelectorAll('.graph-area').forEach(a => a.classList.toggle('expanded', isGraphExpanded));
if (isGraphExpanded) {
setTimeout(drawGraph, 50);
setTimeout(drawGraph, 310);
} else {
ctx.clearRect(0, 0, canvas.width, canvas.height);
canvas.style.display = 'none';
}
}
function createLearnerItemHTML(learner) {
return `
<div class="learner-item space-y-2" data-learner-id="${learner.id}">
<div class="flex justify-between items-center">
<div class="flex items-center">
<span class="learner-dot" style="background: ${learner.color}"></span>
<span class="text-[9px] font-bold text-slate-500 uppercase tracking-tight">${learner.name}</span>
</div>
<button onclick="removeLearner(${learner.id})" class="no-print text-slate-300 hover:text-red-500 text-[10px]">✕</button>
</div>
<div class="flex items-center gap-2">
<span class="text-[8px] font-bold text-slate-400 shrink-0">L</span>
<div class="flex-grow">
<input type="range" min="1" max="5" step="1" value="3" class="emotion-slider" style="color: ${learner.color}" data-learner-id="${learner.id}">
<div class="slider-ticks"><span></span><span></span><span></span><span></span><span></span></div>
</div>
<span class="text-[8px] font-bold text-slate-400 shrink-0">H</span>
</div>
<input type="text" placeholder="Annotate..." class="annotation-input w-full bg-transparent border-b border-indigo-100/50 text-[10px] py-1 outline-none italic text-slate-600" data-learner-id="${learner.id}">
</div>`;
}
function renderSliders(column) {
column.querySelector('.learner-list').innerHTML = learners.map(l => createLearnerItemHTML(l)).join('');
}
function addLearner() {
if (learners.length >= 8) return;
const extraColors = ['#4f46e5', '#e11d48', '#059669', '#d97706', '#7c3aed', '#2563eb', '#db2777', '#4b5563'];
const id = Date.now();
const newLearner = { id, color: extraColors[learners.length] || '#000', name: `Learner ${learners.length + 1}` };
learners.push(newLearner);
container.querySelectorAll('.learner-list').forEach(list => {
const div = document.createElement('div');
div.innerHTML = createLearnerItemHTML(newLearner);
list.appendChild(div.firstElementChild);
});
if(isGraphExpanded) drawGraph();
}
function removeLearner(id) {
if (learners.length <= 1) return;
learners = learners.filter(l => l.id !== id);
container.querySelectorAll(`.learner-item[data-learner-id="${id}"]`).forEach(el => el.remove());
if(isGraphExpanded) drawGraph();
}
function addStep() {
const template = container.querySelector('.step-column');
const newCol = template.cloneNode(true);
newCol.querySelectorAll('textarea, input[type="text"]').forEach(t => t.value = '');
newCol.querySelector('.solution-editor').innerHTML = '';
newCol.querySelectorAll('input[type="range"]').forEach(r => r.value = 3);
newCol.querySelector('.udl-menu').classList.remove('active');
newCol.querySelector('.ai-loading-overlay').classList.remove('active');
setupDragEvents(newCol);
container.appendChild(newCol);
updateSegmentLabels();
if(isGraphExpanded) drawGraph();
}
function removeStep(btn) {
if (container.children.length > 1) {
btn.closest('.step-column').remove();
updateSegmentLabels();
if(isGraphExpanded) drawGraph();
}
}
function updateSegmentLabels() {
container.querySelectorAll('.step-column').forEach((col, i) => {
col.querySelector('.segment-label').innerText = `SEGMENT ${i+1}`;
});
}
function setupDragEvents(item) {
item.addEventListener('dragstart', () => { draggedItem = item; item.classList.add('dragging'); if(isGraphExpanded) toggleGraph(false); });
item.addEventListener('dragend', () => { item.classList.remove('dragging'); draggedItem = null; updateSegmentLabels(); if(isGraphExpanded) toggleGraph(true); });
item.addEventListener('dragover', e => {
e.preventDefault();
const draggables = [...container.querySelectorAll('.step-column:not(.dragging)')];
const afterElement = draggables.reduce((closest, child) => {
const box = child.getBoundingClientRect();
const offset = e.clientX - box.left - box.width / 2;
return (offset < 0 && offset > closest.offset) ? { offset, element: child } : closest;
}, { offset: Number.NEGATIVE_INFINITY }).element;
if (!afterElement) container.appendChild(draggedItem);
else container.insertBefore(draggedItem, afterElement);
});
}
function drawGraph() {
if (!isGraphExpanded) return;
canvas.style.display = 'block';
canvas.width = container.scrollWidth;
canvas.height = container.scrollHeight;
ctx.clearRect(0, 0, canvas.width, canvas.height);
const columns = [...container.querySelectorAll('.step-column')];
const containerRect = container.getBoundingClientRect();
const segmentStacks = columns.map(() => ({}));
learners.forEach(learner => {
const points = [];
columns.forEach((col, colIdx) => {
const slider = col.querySelector(`.emotion-slider[data-learner-id="${learner.id}"]`);
const annotation = col.querySelector(`.annotation-input[data-learner-id="${learner.id}"]`);
const graphArea = col.querySelector('.graph-area');
if (!slider || !graphArea) return;
const colRect = col.getBoundingClientRect();
const graphRect = graphArea.getBoundingClientRect();
const x = (colRect.left - containerRect.left) + (colRect.width / 2);
const val = parseInt(slider.value);
const percent = 1 - ((val - 1) / 4);
const y = (graphRect.top - containerRect.top) + 30 + (percent * (graphRect.height - 60));
if (!segmentStacks[colIdx][val]) segmentStacks[colIdx][val] = 0;
points.push({ x, y, val, color: learner.color, stackLevel: segmentStacks[colIdx][val]++, text: annotation ? annotation.value : '' });
});
if (points.length < 2) return;
ctx.beginPath(); ctx.strokeStyle = learner.color; ctx.globalAlpha = 0.8; ctx.lineWidth = 3;
ctx.moveTo(points[0].x, points[0].y);
for (let i = 0; i < points.length - 1; i++) {
const cpX = (points[i].x + points[i+1].x) / 2;
ctx.bezierCurveTo(cpX, points[i].y, cpX, points[i+1].y, points[i+1].x, points[i+1].y);
}
ctx.stroke(); ctx.globalAlpha = 1.0;
points.forEach(p => {
ctx.fillStyle = p.color; ctx.beginPath(); ctx.arc(p.x, p.y, 4.5, 0, Math.PI * 2); ctx.fill();
ctx.strokeStyle = 'white'; ctx.lineWidth = 1.5; ctx.stroke();
if (p.text.trim()) {
ctx.save(); ctx.font = 'italic 10px sans-serif';
const tw = ctx.measureText(p.text).width + 12;
const bx = p.x - (tw / 2);
const by = p.y - (18 + (p.stackLevel * 22));
ctx.fillStyle = 'white'; ctx.shadowBlur = 4; ctx.shadowColor = 'rgba(0,0,0,0.1)';
ctx.beginPath();
if (ctx.roundRect) ctx.roundRect(bx, by, tw, 18, 4);
else ctx.rect(bx, by, tw, 18);
ctx.fill();
ctx.shadowBlur = 0; ctx.fillStyle = p.color; ctx.fillText(p.text, bx + 6, by + 12.5); ctx.restore();
}
});
});
}
window.onload = init;
</script>
</body>
</html>