theaimoron commited on
Commit
4e38357
·
verified ·
1 Parent(s): 0094e60

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +6 -4
  2. index.html +657 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Social Stories For Special Needs Pwids
3
- emoji: 🔥
4
- colorFrom: red
5
  colorTo: blue
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: social-stories-for-special-needs-pwids
3
+ emoji: 🐳
4
+ colorFrom: blue
5
  colorTo: blue
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,657 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>My Story - Social Story Creator</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ @keyframes fadeIn {
11
+ from { opacity: 0; }
12
+ to { opacity: 1; }
13
+ }
14
+ .fade-in {
15
+ animation: fadeIn 0.5s ease-in-out;
16
+ }
17
+ .symbol-btn:hover {
18
+ transform: scale(1.1);
19
+ transition: transform 0.2s;
20
+ }
21
+ .page-preview {
22
+ min-height: 200px;
23
+ border-radius: 10px;
24
+ }
25
+ .draggable-item {
26
+ cursor: grab;
27
+ }
28
+ .draggable-item:active {
29
+ cursor: grabbing;
30
+ }
31
+ .instruction-step {
32
+ background: rgba(124, 58, 237, 0.1);
33
+ border-left: 4px solid #7c3aed;
34
+ padding: 10px;
35
+ margin-bottom: 10px;
36
+ border-radius: 0 4px 4px 0;
37
+ }
38
+ .example-box {
39
+ background: rgba(16, 185, 129, 0.1);
40
+ border: 2px dashed #10b981;
41
+ border-radius: 8px;
42
+ padding: 15px;
43
+ margin: 10px 0;
44
+ }
45
+ @keyframes spin {
46
+ 0% { transform: rotate(0deg); }
47
+ 100% { transform: rotate(360deg); }
48
+ }
49
+ .loading-spinner {
50
+ border: 5px solid rgba(255, 255, 255, 0.3);
51
+ border-radius: 50%;
52
+ border-top: 5px solid #7c3aed;
53
+ width: 50px;
54
+ height: 50px;
55
+ animation: spin 1s linear infinite;
56
+ }
57
+ .loading-text {
58
+ position: relative;
59
+ }
60
+ .loading-text::after {
61
+ content: "...";
62
+ position: absolute;
63
+ animation: dots 1.5s steps(5, end) infinite;
64
+ }
65
+ @keyframes dots {
66
+ 0%, 20% { content: "."; }
67
+ 40% { content: ".."; }
68
+ 60%, 100% { content: "..."; }
69
+ }
70
+ </style>
71
+ </head>
72
+ <body class="bg-black text-white min-h-screen">
73
+ <!-- Welcome Modal -->
74
+ <div id="welcomeModal" class="fixed inset-0 bg-black bg-opacity-90 flex items-center justify-center z-50 p-4">
75
+ <div class="bg-gray-900 rounded-lg p-6 max-w-2xl w-full mx-4 border-2 border-purple-500">
76
+ <div class="text-center mb-6">
77
+ <h1 class="text-4xl font-bold text-purple-400 mb-2">
78
+ <i class="fas fa-book-open mr-2"></i>Welcome to My Story!
79
+ </h1>
80
+ <p class="text-xl text-blue-300">Let's create stories and schedules together!</p>
81
+ </div>
82
+
83
+ <div class="mb-6">
84
+ <h2 class="text-2xl text-yellow-300 mb-3 font-bold">How to Use This App</h2>
85
+
86
+ <div class="instruction-step">
87
+ <h3 class="text-lg text-pink-400 font-medium"><i class="fas fa-book mr-2"></i>Story Creator</h3>
88
+ <p class="text-white">1. Tap on symbols to add them to your story</p>
89
+ <p class="text-white">2. Type words to tell your story</p>
90
+ <p class="text-white">3. Add sounds and animations to make it fun!</p>
91
+ </div>
92
+
93
+ <div class="instruction-step">
94
+ <h3 class="text-lg text-green-400 font-medium"><i class="fas fa-calendar-alt mr-2"></i>Visual Schedule</h3>
95
+ <p class="text-white">1. Drag symbols to your schedule</p>
96
+ <p class="text-white">2. Type what happens at each step</p>
97
+ <p class="text-white">3. See your day in pictures!</p>
98
+ </div>
99
+ </div>
100
+
101
+ <div class="example-box">
102
+ <h3 class="text-xl text-green-400 font-bold mb-2"><i class="fas fa-lightbulb mr-2"></i>Example Story</h3>
103
+ <div class="flex items-center mb-3">
104
+ <div class="bg-blue-600 text-white p-3 rounded-full mr-3">
105
+ <i class="fas fa-home text-2xl"></i>
106
+ </div>
107
+ <p class="text-white">"First, I wake up at home."</p>
108
+ </div>
109
+ <div class="flex items-center mb-3">
110
+ <div class="bg-yellow-500 text-white p-3 rounded-full mr-3">
111
+ <i class="fas fa-utensils text-2xl"></i>
112
+ </div>
113
+ <p class="text-white">"Then, I eat breakfast."</p>
114
+ </div>
115
+ <div class="flex items-center">
116
+ <div class="bg-red-500 text-white p-3 rounded-full mr-3">
117
+ <i class="fas fa-bus text-2xl"></i>
118
+ </div>
119
+ <p class="text-white">"Finally, I take the bus to school."</p>
120
+ </div>
121
+ </div>
122
+
123
+ <div class="mt-6 text-center">
124
+ <button id="startButton" class="bg-purple-600 hover:bg-purple-700 text-white px-8 py-3 rounded-lg text-xl font-bold">
125
+ <i class="fas fa-play mr-2"></i>Let's Begin!
126
+ </button>
127
+ </div>
128
+ </div>
129
+ </div>
130
+
131
+ <!-- Loading Screen -->
132
+ <div id="loadingScreen" class="fixed inset-0 bg-black bg-opacity-90 flex flex-col items-center justify-center z-50 hidden">
133
+ <div class="loading-spinner mb-4"></div>
134
+ <h2 class="text-2xl text-purple-400 mb-2">Your story begins now</h2>
135
+ <p class="text-blue-300 loading-text">Loading</p>
136
+ </div>
137
+
138
+ <div class="container mx-auto px-4 py-6">
139
+ <!-- Header -->
140
+ <header class="flex justify-between items-center mb-8">
141
+ <h1 class="text-3xl font-bold text-purple-400">
142
+ <i class="fas fa-book-open mr-2"></i>My Story
143
+ </h1>
144
+ <button id="helpBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg">
145
+ <i class="fas fa-question-circle mr-1"></i>Help
146
+ </button>
147
+ </header>
148
+
149
+ <!-- Main App Tabs -->
150
+ <div class="flex border-b border-gray-700 mb-6">
151
+ <button id="storyTab" class="tab-btn active px-4 py-2 font-medium text-pink-400 border-b-2 border-pink-400">
152
+ Story Creator
153
+ </button>
154
+ <button id="scheduleTab" class="tab-btn px-4 py-2 font-medium text-green-400">
155
+ Visual Schedule
156
+ </button>
157
+ </div>
158
+
159
+ <!-- Story Creator Section -->
160
+ <div id="storyCreator" class="fade-in">
161
+ <div class="mb-6">
162
+ <label class="block text-yellow-300 mb-2">Story Title</label>
163
+ <input type="text" id="storyTitle" class="w-full bg-gray-800 text-white p-3 rounded-lg border border-gray-700 focus:border-purple-500 focus:outline-none" placeholder="Enter your story title">
164
+ </div>
165
+
166
+ <!-- Page Editor -->
167
+ <div class="bg-gray-900 p-4 rounded-lg mb-6">
168
+ <div class="flex justify-between items-center mb-4">
169
+ <h3 class="text-xl text-blue-300">Page Editor</h3>
170
+ <div>
171
+ <button id="addPageBtn" class="bg-green-600 hover:bg-green-700 text-white px-3 py-1 rounded mr-2">
172
+ <i class="fas fa-plus mr-1"></i>Add Page
173
+ </button>
174
+ <button id="deletePageBtn" class="bg-red-600 hover:bg-red-700 text-white px-3 py-1 rounded">
175
+ <i class="fas fa-trash mr-1"></i>Delete
176
+ </button>
177
+ </div>
178
+ </div>
179
+
180
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
181
+ <!-- Page Preview -->
182
+ <div class="bg-gray-800 p-4 page-preview flex flex-col items-center justify-center border-2 border-purple-500">
183
+ <p id="currentPageNumber" class="text-purple-300 mb-2">Page 1</p>
184
+ <div id="pagePreview" class="w-full h-40 bg-gray-700 rounded flex items-center justify-center text-gray-400">
185
+ Your page content will appear here
186
+ </div>
187
+ <div class="mt-4 flex space-x-2">
188
+ <button id="prevPageBtn" class="bg-gray-700 hover:bg-gray-600 text-white px-3 py-1 rounded">
189
+ <i class="fas fa-arrow-left"></i>
190
+ </button>
191
+ <button id="nextPageBtn" class="bg-gray-700 hover:bg-gray-600 text-white px-3 py-1 rounded">
192
+ <i class="fas fa-arrow-right"></i>
193
+ </button>
194
+ </div>
195
+ </div>
196
+
197
+ <!-- Content Editor -->
198
+ <div class="col-span-2">
199
+ <div class="mb-4">
200
+ <label class="block text-yellow-300 mb-2">Page Text</label>
201
+ <textarea id="pageText" class="w-full bg-gray-800 text-white p-3 rounded-lg border border-gray-700 focus:border-purple-500 focus:outline-none h-24" placeholder="Enter text for this page"></textarea>
202
+ </div>
203
+
204
+ <div class="mb-4">
205
+ <label class="block text-yellow-300 mb-2">Add Symbol</label>
206
+ <div class="grid grid-cols-4 gap-2">
207
+ <button class="symbol-btn bg-blue-600 hover:bg-blue-700 text-white p-2 rounded">
208
+ <i class="fas fa-smile text-2xl"></i>
209
+ </button>
210
+ <button class="symbol-btn bg-red-500 hover:bg-red-600 text-white p-2 rounded">
211
+ <i class="fas fa-heart text-2xl"></i>
212
+ </button>
213
+ <button class="symbol-btn bg-green-500 hover:bg-green-600 text-white p-2 rounded">
214
+ <i class="fas fa-home text-2xl"></i>
215
+ </button>
216
+ <button class="symbol-btn bg-yellow-500 hover:bg-yellow-600 text-white p-2 rounded">
217
+ <i class="fas fa-car text-2xl"></i>
218
+ </button>
219
+ <button class="symbol-btn bg-purple-500 hover:bg-purple-600 text-white p-2 rounded">
220
+ <i class="fas fa-utensils text-2xl"></i>
221
+ </button>
222
+ <button class="symbol-btn bg-pink-500 hover:bg-pink-600 text-white p-2 rounded">
223
+ <i class="fas fa-school text-2xl"></i>
224
+ </button>
225
+ <button class="symbol-btn bg-indigo-500 hover:bg-indigo-600 text-white p-2 rounded">
226
+ <i class="fas fa-bed text-2xl"></i>
227
+ </button>
228
+ <button class="symbol-btn bg-teal-500 hover:bg-teal-600 text-white p-2 rounded">
229
+ <i class="fas fa-bath text-2xl"></i>
230
+ </button>
231
+ </div>
232
+ </div>
233
+
234
+ <div class="mb-4">
235
+ <label class="block text-yellow-300 mb-2">Add Sound</label>
236
+ <select id="soundSelect" class="w-full bg-gray-800 text-white p-2 rounded-lg border border-gray-700 focus:border-purple-500 focus:outline-none">
237
+ <option value="">No sound</option>
238
+ <option value="bell">Bell</option>
239
+ <option value="chime">Chime</option>
240
+ <option value="ding">Ding</option>
241
+ <option value="success">Success</option>
242
+ </select>
243
+ </div>
244
+
245
+ <div>
246
+ <label class="block text-yellow-300 mb-2">Animation</label>
247
+ <div class="flex space-x-2">
248
+ <button class="animation-btn bg-gray-700 hover:bg-gray-600 text-white px-3 py-1 rounded" data-animation="fade">
249
+ Fade In
250
+ </button>
251
+ <button class="animation-btn bg-gray-7 hover:bg-gray-600 text-white px-3 py-1 rounded" data-animation="bounce">
252
+ Bounce
253
+ </button>
254
+ <button class="animation-btn bg-gray-700 hover:bg-gray-600 text-white px-3 py-1 rounded" data-animation="shake">
255
+ Shake
256
+ </button>
257
+ </div>
258
+ </div>
259
+ </div>
260
+ </div>
261
+ </div>
262
+
263
+ <!-- Save/Export -->
264
+ <div class="flex justify-end space-x-3">
265
+ <button id="saveStoryBtn" class="bg-purple-600 hover:bg-purple-700 text-white px-6 py-2 rounded-lg">
266
+ <i class="fas fa-save mr-2"></i>Save Story
267
+ </button>
268
+ <button id="exportStoryBtn" class="bg-green-600 hover:bg-green-700 text-white px-6 py-2 rounded-lg">
269
+ <i class="fas fa-file-export mr-2"></i>Export
270
+ </button>
271
+ </div>
272
+ </div>
273
+
274
+ <!-- Visual Schedule Section (Hidden by default) -->
275
+ <div id="visualSchedule" class="hidden fade-in">
276
+ <div class="mb-6">
277
+ <label class="block text-yellow-300 mb-2">Schedule Title</label>
278
+ <input type="text" id="scheduleTitle" class="w-full bg-gray-800 text-white p-3 rounded-lg border border-gray-700 focus:border-purple-500 focus:outline-none" placeholder="Enter your schedule title">
279
+ </div>
280
+
281
+ <div class="bg-gray-900 p-4 rounded-lg mb-6">
282
+ <div class="flex justify-between items-center mb-4">
283
+ <h3 class="text-xl text-blue-300">Schedule Items</h3>
284
+ <button id="addScheduleItemBtn" class="bg-green-600 hover:bg-green-700 text-white px-3 py-1 rounded">
285
+ <i class="fas fa-plus mr-1"></i>Add Item
286
+ </button>
287
+ </div>
288
+
289
+ <!-- Schedule Items Container -->
290
+ <div id="scheduleItemsContainer" class="space-y-3">
291
+ <!-- Sample items will be added here -->
292
+ </div>
293
+ </div>
294
+
295
+ <!-- Symbol Library for Schedule -->
296
+ <div class="mb-6">
297
+ <h3 class="text-xl text-blue-300 mb-3">Symbol Library</h3>
298
+ <div class="grid grid-cols-6 gap-3">
299
+ <div class="symbol-item draggable-item bg-gray-800 p-3 rounded-lg text-center cursor-move" draggable="true" data-symbol="home">
300
+ <i class="fas fa-home text-3xl text-yellow-400 mb-1"></i>
301
+ <p class="text-sm">Home</p>
302
+ </div>
303
+ <div class="symbol-item draggable-item bg-gray-800 p-3 rounded-lg text-center cursor-move" draggable="true" data-symbol="school">
304
+ <i class="fas fa-school text-3xl text-blue-400 mb-1"></i>
305
+ <p class="text-sm">School</p>
306
+ </div>
307
+ <div class="symbol-item draggable-item bg-gray-800 p-3 rounded-lg text-center cursor-move" draggable="true" data-symbol="eat">
308
+ <i class="fas fa-utensils text-3xl text-red-400 mb-1"></i>
309
+ <p class="text-sm">Eat</p>
310
+ </div>
311
+ <div class="symbol-item draggable-item bg-gray-800 p-3 rounded-lg text-center cursor-move" draggable="true" data-symbol="play">
312
+ <i class="fas fa-gamepad text-3xl text-green-400 mb-1"></i>
313
+ <p class="text-sm">Play</p>
314
+ </div>
315
+ <div class="symbol-item draggable-item bg-gray-800 p-3 rounded-lg text-center cursor-move" draggable="true" data-symbol="sleep">
316
+ <i class="fas fa-bed text-3xl text-purple-400 mb-1"></i>
317
+ <p class="text-sm">Sleep</p>
318
+ </div>
319
+ <div class="symbol-item draggable-item bg-gray-800 p-3 rounded-lg text-center cursor-move" draggable="true" data-symbol="bath">
320
+ <i class="fas fa-bath text-3xl text-teal-400 mb-1"></i>
321
+ <p class="text-sm">Bath</p>
322
+ </div>
323
+ </div>
324
+ </div>
325
+
326
+ <!-- Save/Export Schedule -->
327
+ <div class="flex justify-end space-x-3">
328
+ <button id="saveScheduleBtn" class="bg-purple-600 hover:bg-purple-700 text-white px-6 py-2 rounded-lg">
329
+ <i class="fas fa-save mr-2"></i>Save Schedule
330
+ </button>
331
+ <button id="exportScheduleBtn" class="bg-green-600 hover:bg-green-700 text-white px-6 py-2 rounded-lg">
332
+ <i class="fas fa-file-export mr-2"></i>Export
333
+ </button>
334
+ </div>
335
+ </div>
336
+ </div>
337
+
338
+ <!-- Help Modal -->
339
+ <div id="helpModal" class="fixed inset-0 bg-black bg-opacity-75 flex items-center justify-center hidden z-50">
340
+ <div class="bg-gray-900 rounded-lg p-6 max-w-md w-full mx-4 border border-purple-500">
341
+ <div class="flex justify-between items-center mb-4">
342
+ <h3 class="text-xl text-purple-400">Help Guide</h3>
343
+ <button id="closeHelpModal" class="text-gray-400 hover:text-white">
344
+ <i class="fas fa-times"></i>
345
+ </button>
346
+ </div>
347
+ <div class="space-y-3">
348
+ <p class="text-blue-300"><i class="fas fa-book mr-2"></i><strong>Story Creator:</strong> Create multi-page stories with text, symbols, sounds and animations.</p>
349
+ <p class="text-green-300"><i class="fas fa-calendar-alt mr-2"></i><strong>Visual Schedule:</strong> Create step-by-step schedules with draggable symbols.</p>
350
+ <p class="text-yellow-300"><i class="fas fa-icons mr-2"></i>Click on symbols to add them to your story pages.</p>
351
+ <p class="text-pink-300"><i class="fas fa-arrows-alt mr-2"></i>Drag and drop symbols in the visual schedule.</p>
352
+ <p class="text-gray-400 text-sm mt-4">My Story v1.0 - Basic Tier</p>
353
+ </div>
354
+ </div>
355
+ </div>
356
+
357
+ <script>
358
+ // App State
359
+ const appState = {
360
+ currentTab: 'story',
361
+ currentPage: 1,
362
+ pages: [
363
+ {
364
+ text: '',
365
+ symbol: null,
366
+ sound: null,
367
+ animation: null
368
+ }
369
+ ],
370
+ scheduleItems: []
371
+ };
372
+
373
+ // DOM Elements
374
+ const welcomeModal = document.getElementById('welcomeModal');
375
+ const loadingScreen = document.getElementById('loadingScreen');
376
+ const startButton = document.getElementById('startButton');
377
+ const storyTab = document.getElementById('storyTab');
378
+ const scheduleTab = document.getElementById('scheduleTab');
379
+ const storyCreator = document.getElementById('storyCreator');
380
+ const visualSchedule = document.getElementById('visualSchedule');
381
+ const helpBtn = document.getElementById('helpBtn');
382
+ const helpModal = document.getElementById('helpModal');
383
+ const closeHelpModal = document.getElementById('closeHelpModal');
384
+ const storyTitle = document.getElementById('storyTitle');
385
+ const pageText = document.getElementById('pageText');
386
+ const currentPageNumber = document.getElementById('currentPageNumber');
387
+ const pagePreview = document.getElementById('pagePreview');
388
+ const addPageBtn = document.getElementById('addPageBtn');
389
+ const deletePageBtn = document.getElementById('deletePageBtn');
390
+ const prevPageBtn = document.getElementById('prevPageBtn');
391
+ const nextPageBtn = document.getElementById('nextPageBtn');
392
+ const soundSelect = document.getElementById('soundSelect');
393
+ const saveStoryBtn = document.getElementById('saveStoryBtn');
394
+ const exportStoryBtn = document.getElementById('exportStoryBtn');
395
+ const scheduleTitle = document.getElementById('scheduleTitle');
396
+ const addScheduleItemBtn = document.getElementById('addScheduleItemBtn');
397
+ const scheduleItemsContainer = document.getElementById('scheduleItemsContainer');
398
+ const saveScheduleBtn = document.getElementById('saveScheduleBtn');
399
+ const exportScheduleBtn = document.getElementById('exportScheduleBtn');
400
+ const symbolBtns = document.querySelectorAll('.symbol-btn');
401
+ const animationBtns = document.querySelectorAll('.animation-btn');
402
+ const symbolItems = document.querySelectorAll('.symbol-item');
403
+
404
+ // Start the app
405
+ startButton.addEventListener('click', function() {
406
+ welcomeModal.classList.add('hidden');
407
+ loadingScreen.classList.remove('hidden');
408
+
409
+ // Simulate loading for 2 seconds
410
+ setTimeout(function() {
411
+ loadingScreen.classList.add('hidden');
412
+ // Play a welcoming sound
413
+ playSound('chime');
414
+ }, 2000);
415
+ });
416
+
417
+ // Tab Switching
418
+ storyTab.addEventListener('click', () => switchTab('story'));
419
+ scheduleTab.addEventListener('click', () => switchTab('schedule'));
420
+
421
+ function switchTab(tab) {
422
+ appState.currentTab = tab;
423
+
424
+ if (tab === 'story') {
425
+ storyTab.classList.add('border-b-2', 'border-pink-400');
426
+ scheduleTab.classList.remove('border-b-2', 'border-green-400');
427
+ storyCreator.classList.remove('hidden');
428
+ visualSchedule.classList.add('hidden');
429
+ playSound('ding');
430
+ } else {
431
+ storyTab.classList.remove('border-b-2', 'border-pink-400');
432
+ scheduleTab.classList.add('border-b-2', 'border-green-400');
433
+ storyCreator.classList.add('hidden');
434
+ visualSchedule.classList.remove('hidden');
435
+ playSound('bell');
436
+ }
437
+ }
438
+
439
+ // Help Modal
440
+ helpBtn.addEventListener('click', () => {
441
+ helpModal.classList.remove('hidden');
442
+ playSound('ding');
443
+ });
444
+
445
+ closeHelpModal.addEventListener('click', () => {
446
+ helpModal.classList.add('hidden');
447
+ });
448
+
449
+ // Story Page Management
450
+ addPageBtn.addEventListener('click', addPage);
451
+ deletePageBtn.addEventListener('click', deletePage);
452
+ prevPageBtn.addEventListener('click', goToPrevPage);
453
+ nextPageBtn.addEventListener('click', goToNextPage);
454
+
455
+ function addPage() {
456
+ appState.pages.push({
457
+ text: '',
458
+ symbol: null,
459
+ sound: null,
460
+ animation: null
461
+ });
462
+ appState.currentPage = appState.pages.length;
463
+ updatePageDisplay();
464
+ playSound('success');
465
+ }
466
+
467
+ function deletePage() {
468
+ if (appState.pages.length > 1) {
469
+ appState.pages.splice(appState.currentPage - 1, 1);
470
+ if (appState.currentPage > appState.pages.length) {
471
+ appState.currentPage = appState.pages.length;
472
+ }
473
+ updatePageDisplay();
474
+ playSound('bell');
475
+ } else {
476
+ alert("You must have at least one page in your story.");
477
+ }
478
+ }
479
+
480
+ function goToPrevPage() {
481
+ if (appState.currentPage > 1) {
482
+ appState.currentPage--;
483
+ updatePageDisplay();
484
+ playSound('ding');
485
+ }
486
+ }
487
+
488
+ function goToNextPage() {
489
+ if (appState.currentPage < appState.pages.length) {
490
+ appState.currentPage++;
491
+ updatePageDisplay();
492
+ playSound('ding');
493
+ }
494
+ }
495
+
496
+ function updatePageDisplay() {
497
+ const currentPageData = appState.pages[appState.currentPage - 1];
498
+
499
+ // Update page number display
500
+ currentPageNumber.textContent = `Page ${appState.currentPage} of ${appState.pages.length}`;
501
+
502
+ // Update form fields with current page data
503
+ pageText.value = currentPageData.text || '';
504
+ soundSelect.value = currentPageData.sound || '';
505
+
506
+ // Update preview
507
+ updatePagePreview();
508
+ }
509
+
510
+ function updatePagePreview() {
511
+ const currentPageData = appState.pages[appState.currentPage - 1];
512
+ let previewHTML = '';
513
+
514
+ if (currentPageData.text) {
515
+ previewHTML += `<p class="text-white mb-2 text-lg">${currentPageData.text}</p>`;
516
+ }
517
+
518
+ if (currentPageData.symbol) {
519
+ // This is a simplified version - in a real app, you'd map to actual symbols
520
+ previewHTML += `<div class="text-5xl my-3">${getSymbolIcon(currentPageData.symbol)}</div>`;
521
+ }
522
+
523
+ pagePreview.innerHTML = previewHTML || 'Your page content will appear here';
524
+
525
+ // Apply animation class if exists
526
+ if (currentPageData.animation) {
527
+ pagePreview.className = 'w-full h-40 bg-gray-700 rounded flex items-center justify-center ' + currentPageData.animation;
528
+ } else {
529
+ pagePreview.className = 'w-full h-40 bg-gray-700 rounded flex items-center justify-center';
530
+ }
531
+ }
532
+
533
+ function getSymbolIcon(symbol) {
534
+ // Simplified mapping - in a real app you'd have proper symbol mapping
535
+ const icons = {
536
+ 'smile': 'fa-smile',
537
+ 'heart': 'fa-heart',
538
+ 'home': 'fa-home',
539
+ 'car': 'fa-car',
540
+ 'utensils': 'fa-utensils',
541
+ 'school': 'fa-school',
542
+ 'bed': 'fa-bed',
543
+ 'bath': 'fa-bath'
544
+ };
545
+ return `<i class="fas ${icons[symbol] || 'fa-question'}"></i>`;
546
+ }
547
+
548
+ // Form Field Event Listeners
549
+ pageText.addEventListener('input', function() {
550
+ appState.pages[appState.currentPage - 1].text = this.value;
551
+ updatePagePreview();
552
+ });
553
+
554
+ soundSelect.addEventListener('change', function() {
555
+ appState.pages[appState.currentPage - 1].sound = this.value;
556
+ if (this.value) {
557
+ playSound(this.value);
558
+ }
559
+ });
560
+
561
+ // Symbol Buttons
562
+ symbolBtns.forEach(btn => {
563
+ btn.addEventListener('click', function() {
564
+ const iconClass = this.querySelector('i').className.split(' ')[1];
565
+ const symbol = iconClass.replace('fa-', '');
566
+ appState.pages[appState.currentPage - 1].symbol = symbol;
567
+ updatePagePreview();
568
+ playSound('ding');
569
+ });
570
+ });
571
+
572
+ // Animation Buttons
573
+ animationBtns.forEach(btn => {
574
+ btn.addEventListener('click', function() {
575
+ const animation = this.dataset.animation;
576
+ appState.pages[appState.currentPage - 1].animation = animation;
577
+ updatePagePreview();
578
+ playSound('chime');
579
+ });
580
+ });
581
+
582
+ // Save/Export Buttons
583
+ saveStoryBtn.addEventListener('click', function() {
584
+ alert('Story saved successfully!');
585
+ playSound('success');
586
+ // In a real app, this would save to localStorage or a database
587
+ });
588
+
589
+ exportStoryBtn.addEventListener('click', function() {
590
+ alert('Story exported!');
591
+ playSound('success');
592
+ // In a real app, this would generate a PDF or shareable file
593
+ });
594
+
595
+ // Visual Schedule Functions
596
+ addScheduleItemBtn.addEventListener('click', addScheduleItem);
597
+
598
+ function addScheduleItem() {
599
+ const itemId = Date.now();
600
+ const itemHTML = `
601
+ <div class="schedule-item bg-gray-800 p-3 rounded-lg flex items-center" data-id="${itemId}">
602
+ <div class="symbol-placeholder bg-gray-700 w-10 h-10 rounded-full flex items-center justify-center mr-3">
603
+ <i class="fas fa-plus text-gray-400"></i>
604
+ </div>
605
+ <input type="text" class="flex-grow bg-gray-700 text-white p-2 rounded border border-gray-600 focus:border-green-500 focus:outline-none" placeholder="Enter step description">
606
+ <button class="delete-schedule-item ml-2 text-red-400 hover:text-red-300">
607
+ <i class="fas fa-trash"></i>
608
+ </button>
609
+ </div>
610
+ `;
611
+
612
+ scheduleItemsContainer.insertAdjacentHTML('beforeend', itemHTML);
613
+ appState.scheduleItems.push({
614
+ id: itemId,
615
+ symbol: null,
616
+ text: ''
617
+ });
618
+
619
+ // Add event listener to the delete button
620
+ const newItem = scheduleItemsContainer.lastElementChild;
621
+ const deleteBtn = newItem.querySelector('.delete-schedule-item');
622
+ deleteBtn.addEventListener('click', function() {
623
+ deleteScheduleItem(itemId);
624
+ });
625
+
626
+ // Add drop target for symbols
627
+ const symbolPlaceholder = newItem.querySelector('.symbol-placeholder');
628
+ symbolPlaceholder.addEventListener('dragover', handleDragOver);
629
+ symbolPlaceholder.addEventListener('drop', function(e) {
630
+ handleDrop(e, itemId);
631
+ });
632
+
633
+ // Add input event listener
634
+ const textInput = newItem.querySelector('input');
635
+ textInput.addEventListener('input', function() {
636
+ updateScheduleItemText(itemId, this.value);
637
+ });
638
+
639
+ playSound('ding');
640
+ }
641
+
642
+ function deleteScheduleItem(itemId) {
643
+ const itemIndex = appState.scheduleItems.findIndex(item => item.id === itemId);
644
+ if (itemIndex !== -1) {
645
+ appState.scheduleItems.splice(itemIndex, 1);
646
+ }
647
+
648
+ const itemElement = document.querySelector(`.schedule-item[data-id="${itemId}"]`);
649
+ if (itemElement) {
650
+ itemElement.remove();
651
+ }
652
+ playSound('bell');
653
+ }
654
+
655
+ function updateScheduleItemText(itemId, text) {
656
+ const item = appState.scheduleItems.find(item => item.id === item
657
+ </html>