zoeboy commited on
Commit
30cffe5
·
verified ·
1 Parent(s): b17473f

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +527 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Criador De Cursos
3
- emoji: 📉
4
- colorFrom: purple
5
- colorTo: indigo
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: criador-de-cursos
3
+ emoji: 🐳
4
+ colorFrom: yellow
5
+ colorTo: yellow
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,527 @@
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>Advanced Course Creator Tool</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
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.11.338/pdf.min.js"></script>
10
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/mammoth/1.4.0/mammoth.browser.min.js"></script>
11
+ <style>
12
+ .file-drop-area {
13
+ border: 2px dashed #3b82f6;
14
+ transition: all 0.3s ease;
15
+ }
16
+ .file-drop-area.active {
17
+ border-color: #10b981;
18
+ background-color: rgba(16, 185, 129, 0.05);
19
+ }
20
+ .course-item {
21
+ transition: all 0.2s ease;
22
+ }
23
+ .course-item:hover {
24
+ transform: translateY(-2px);
25
+ }
26
+ /* Custom scrollbar */
27
+ ::-webkit-scrollbar {
28
+ width: 8px;
29
+ }
30
+ ::-webkit-scrollbar-track {
31
+ background: #f1f1f1;
32
+ }
33
+ ::-webkit-scrollbar-thumb {
34
+ background: #3b82f6;
35
+ border-radius: 4px;
36
+ }
37
+ /* Modal animation */
38
+ .modal-enter {
39
+ opacity: 0;
40
+ transform: translateY(-10px);
41
+ }
42
+ .modal-enter-active {
43
+ opacity: 1;
44
+ transform: translateY(0);
45
+ transition: all 0.3s ease;
46
+ }
47
+ .loader {
48
+ border-top-color: #3b82f6;
49
+ animation: spin 1s linear infinite;
50
+ }
51
+ @keyframes spin {
52
+ 0% { transform: rotate(0deg); }
53
+ 100% { transform: rotate(360deg); }
54
+ }
55
+ </style>
56
+ </head>
57
+ <body class="bg-gray-50 min-h-screen">
58
+ <div class="container mx-auto px-4 py-8">
59
+ <header class="text-center mb-12">
60
+ <h1 class="text-4xl font-bold text-gray-800 mb-2">Advanced Course Creator</h1>
61
+ <p class="text-lg text-gray-600">Transform your documents into structured online courses</p>
62
+ <div class="w-24 h-1 bg-blue-500 mx-auto mt-4 rounded-full"></div>
63
+ </header>
64
+
65
+ <div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
66
+ <!-- Upload Section -->
67
+ <div class="lg:col-span-1 bg-white rounded-xl shadow-md overflow-hidden">
68
+ <div class="p-6">
69
+ <div class="flex items-center mb-4">
70
+ <div class="bg-blue-100 p-2 rounded-full mr-3">
71
+ <i class="fas fa-file-upload text-blue-500 text-xl"></i>
72
+ </div>
73
+ <h2 class="text-xl font-semibold text-gray-800">Upload Documents</h2>
74
+ </div>
75
+
76
+ <div id="fileDropArea" class="file-drop-area rounded-lg p-8 text-center cursor-pointer mb-4">
77
+ <i class="fas fa-cloud-upload-alt text-4xl text-blue-400 mb-3"></i>
78
+ <p class="font-medium text-gray-600 mb-2">Drag & drop your files here</p>
79
+ <p class="text-sm text-gray-500 mb-4">or</p>
80
+ <label for="fileInput" class="inline-block px-6 py-2 bg-blue-500 hover:bg-blue-600 text-white font-medium rounded-lg transition cursor-pointer">
81
+ <input id="fileInput" type="file" accept=".txt,.pdf,.docx" multiple class="hidden">
82
+ <span>Browse Files</span>
83
+ </label>
84
+ <p class="text-xs text-gray-500 mt-3">Supported formats: TXT, PDF, DOCX</p>
85
+ </div>
86
+
87
+ <div class="mt-6">
88
+ <h3 class="font-medium text-gray-700 mb-3">File Processing Options</h3>
89
+ <div class="space-y-3">
90
+ <label class="flex items-center">
91
+ <input type="checkbox" id="autoSplitChapters" class="form-checkbox h-4 w-4 text-blue-500" checked>
92
+ <span class="ml-2 text-gray-700">Auto-split into chapters</span>
93
+ </label>
94
+ <label class="flex items-center">
95
+ <input type="checkbox" id="detectHeadings" class="form-checkbox h-4 w-4 text-blue-500" checked>
96
+ <span class="ml-2 text-gray-700">Detect headings as sections</span>
97
+ </label>
98
+ </div>
99
+ </div>
100
+ </div>
101
+ </div>
102
+
103
+ <!-- Course Structure Section -->
104
+ <div class="lg:col-span-2 bg-white rounded-xl shadow-md overflow-hidden">
105
+ <div class="p-6">
106
+ <div class="flex items-center mb-4">
107
+ <div class="bg-purple-100 p-2 rounded-full mr-3">
108
+ <i class="fas fa-graduation-cap text-purple-500 text-xl"></i>
109
+ </div>
110
+ <h2 class="text-xl font-semibold text-gray-800">Course Structure</h2>
111
+ </div>
112
+
113
+ <div class="mb-6">
114
+ <input type="text" id="courseTitle" placeholder="Enter course title" class="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
115
+ </div>
116
+
117
+ <div id="courseOutline" class="space-y-3">
118
+ <!-- Example content that will be replaced -->
119
+ <div class="p-4 bg-gray-100 rounded-lg text-center text-gray-500">
120
+ <p>Upload documents to see the generated course outline here</p>
121
+ </div>
122
+ </div>
123
+
124
+ <div class="mt-6 flex justify-between items-center">
125
+ <div class="flex items-center">
126
+ <div id="processingLoader" class="loader ease-linear rounded-full border-4 border-t-4 border-gray-200 h-6 w-6 mr-2 hidden"></div>
127
+ <span id="processingStatus" class="text-sm text-gray-500">Ready to process</span>
128
+ </div>
129
+ <button id="generateCourseBtn" class="px-6 py-2 bg-blue-500 hover:bg-blue-600 text-white font-medium rounded-lg transition flex items-center disabled:opacity-50">
130
+ <i class="fas fa-magic mr-2"></i>
131
+ Generate Course
132
+ </button>
133
+ </div>
134
+ </div>
135
+ </div>
136
+ </div>
137
+
138
+ <!-- Preview Section -->
139
+ <div id="previewSection" class="mt-12 bg-white rounded-xl shadow-md overflow-hidden hidden">
140
+ <div class="p-6">
141
+ <div class="flex items-center mb-4">
142
+ <div class="bg-green-100 p-2 rounded-full mr-3">
143
+ <i class="fas fa-eye text-green-500 text-xl"></i>
144
+ </div>
145
+ <h2 class="text-xl font-semibold text-gray-800">Course Preview</h2>
146
+ </div>
147
+
148
+ <div class="border border-gray-200 rounded-lg p-6">
149
+ <div id="coursePreview" class="prose max-w-none">
150
+ <!-- Preview content will be inserted here -->
151
+ </div>
152
+ </div>
153
+
154
+ <div class="mt-6 flex justify-end space-x-3">
155
+ <button id="exportPdfBtn" class="px-4 py-2 border border-gray-300 hover:bg-gray-50 text-gray-700 font-medium rounded-lg transition flex items-center">
156
+ <i class="fas fa-file-pdf mr-2 text-red-500"></i>
157
+ Export PDF
158
+ </button>
159
+ <button id="exportHtmlBtn" class="px-4 py-2 border border-gray-300 hover:bg-gray-50 text-gray-700 font-medium rounded-lg transition flex items-center">
160
+ <i class="fas fa-file-code mr-2 text-blue-500"></i>
161
+ Export HTML
162
+ </button>
163
+ <button id="publishBtn" class="px-6 py-2 bg-green-500 hover:bg-green-600 text-white font-medium rounded-lg transition flex items-center">
164
+ <i class="fas fa-rocket mr-2"></i>
165
+ Publish
166
+ </button>
167
+ </div>
168
+ </div>
169
+ </div>
170
+ </div>
171
+
172
+ <!-- Modal -->
173
+ <div id="successModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
174
+ <div class="bg-white rounded-xl p-6 max-w-md w-full transform transition-all modal-enter">
175
+ <div class="text-center">
176
+ <div class="mx-auto flex items-center justify-center h-12 w-12 rounded-full bg-green-100 mb-4">
177
+ <i class="fas fa-check text-green-500 text-xl"></i>
178
+ </div>
179
+ <h3 class="text-lg font-medium text-gray-900 mb-2" id="modalTitle">Success!</h3>
180
+ <p class="text-sm text-gray-500" id="modalMessage">Your course has been successfully generated.</p>
181
+ <div class="mt-5">
182
+ <button id="modalCloseBtn" type="button" class="px-4 py-2 bg-blue-500 hover:bg-blue-600 text-white font-medium rounded-lg transition">
183
+ Continue
184
+ </button>
185
+ </div>
186
+ </div>
187
+ </div>
188
+ </div>
189
+
190
+ <script>
191
+ // Set PDF.js worker path
192
+ pdfjsLib.GlobalWorkerOptions.workerSrc = 'https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.11.338/pdf.worker.min.js';
193
+
194
+ document.addEventListener('DOMContentLoaded', function() {
195
+ // Elements
196
+ const fileDropArea = document.getElementById('fileDropArea');
197
+ const fileInput = document.getElementById('fileInput');
198
+ const courseOutline = document.getElementById('courseOutline');
199
+ const generateCourseBtn = document.getElementById('generateCourseBtn');
200
+ const previewSection = document.getElementById('previewSection');
201
+ const processingLoader = document.getElementById('processingLoader');
202
+ const processingStatus = document.getElementById('processingStatus');
203
+ const coursePreview = document.getElementById('coursePreview');
204
+ const successModal = document.getElementById('successModal');
205
+ const modalCloseBtn = document.getElementById('modalCloseBtn');
206
+ const autoSplitChapters = document.getElementById('autoSplitChapters');
207
+ const detectHeadings = document.getElementById('detectHeadings');
208
+ const courseTitle = document.getElementById('courseTitle');
209
+
210
+ // File handling
211
+ fileDropArea.addEventListener('dragover', (e) => {
212
+ e.preventDefault();
213
+ fileDropArea.classList.add('active');
214
+ });
215
+
216
+ fileDropArea.addEventListener('dragleave', () => {
217
+ fileDropArea.classList.remove('active');
218
+ });
219
+
220
+ fileDropArea.addEventListener('drop', (e) => {
221
+ e.preventDefault();
222
+ fileDropArea.classList.remove('active');
223
+ handleFiles(e.dataTransfer.files);
224
+ });
225
+
226
+ fileInput.addEventListener('change', () => {
227
+ if (fileInput.files.length > 0) {
228
+ handleFiles(fileInput.files);
229
+ }
230
+ });
231
+
232
+ // Initialize empty course data
233
+ let courseData = {
234
+ title: '',
235
+ chapters: []
236
+ };
237
+
238
+ // Process uploaded files
239
+ async function handleFiles(files) {
240
+ processingLoader.classList.remove('hidden');
241
+ processingStatus.textContent = 'Processing files...';
242
+ generateCourseBtn.disabled = true;
243
+
244
+ courseData = {
245
+ title: courseTitle.value || 'New Course',
246
+ chapters: []
247
+ };
248
+
249
+ for (let file of files) {
250
+ try {
251
+ const content = await extractTextFromFile(file);
252
+ const chapterTitle = file.name.replace(/\.[^/.]+$/, ''); // Remove extension
253
+
254
+ courseData.chapters.push({
255
+ title: chapterTitle,
256
+ content: content,
257
+ sections: autoSplitChapters.checked && detectHeadings.checked ?
258
+ splitIntoSections(content) :
259
+ [{ title: 'Content', content: content }]
260
+ });
261
+ } catch (error) {
262
+ console.error('Error processing file:', error);
263
+ }
264
+ }
265
+
266
+ renderCourseOutline();
267
+ processingLoader.classList.add('hidden');
268
+ processingStatus.textContent = `${files.length} file(s) processed`;
269
+ generateCourseBtn.disabled = false;
270
+ }
271
+
272
+ // Extract text from different file types
273
+ async function extractTextFromFile(file) {
274
+ return new Promise((resolve, reject) => {
275
+ const reader = new FileReader();
276
+
277
+ reader.onload = async (e) => {
278
+ try {
279
+ if (file.type === 'application/pdf') {
280
+ const pdf = await pdfjsLib.getDocument(e.target.result).promise;
281
+ let text = '';
282
+ for (let i = 1; i <= pdf.numPages; i++) {
283
+ const page = await pdf.getPage(i);
284
+ const content = await page.getTextContent();
285
+ const strings = content.items.map(item => item.str);
286
+ text += strings.join(' ') + '\n';
287
+ }
288
+ resolve(text);
289
+ } else if (file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') {
290
+ const arrayBuffer = e.target.result;
291
+ const result = await mammoth.extractRawText({ arrayBuffer });
292
+ resolve(result.value);
293
+ } else { // Plain text
294
+ resolve(e.target.result);
295
+ }
296
+ } catch (error) {
297
+ reject(error);
298
+ }
299
+ };
300
+
301
+ if (file.type === 'application/pdf' || file.type === 'application/vnd.openxmlformats-officedocument.wordprocessingml.document') {
302
+ reader.readAsArrayBuffer(file);
303
+ } else {
304
+ reader.readAsText(file);
305
+ }
306
+ });
307
+ }
308
+
309
+ // Split content into sections based on headings
310
+ function splitIntoSections(content) {
311
+ // Simple implementation - can be enhanced with NLP
312
+ const lines = content.split('\n');
313
+ const sections = [];
314
+ let currentSection = { title: 'Introduction', content: '' };
315
+
316
+ for (const line of lines) {
317
+ if (line.match(/^(#+ )|([A-Z][^\.!?]+:\s*$)|(Chapter \d+:|Section \d+:)/)) {
318
+ if (currentSection.content.trim()) {
319
+ sections.push(currentSection);
320
+ }
321
+ currentSection = { title: line.trim(), content: '' };
322
+ } else {
323
+ currentSection.content += line + '\n';
324
+ }
325
+ }
326
+
327
+ if (currentSection.content.trim()) {
328
+ sections.push(currentSection);
329
+ }
330
+
331
+ return sections.length > 0 ? sections : [{ title: 'Content', content }];
332
+ }
333
+
334
+ // Render the course outline
335
+ function renderCourseOutline() {
336
+ if (courseData.chapters.length === 0) {
337
+ courseOutline.innerHTML = `
338
+ <div class="p-4 bg-gray-100 rounded-lg text-center text-gray-500">
339
+ <p>Upload documents to see the generated course outline here</p>
340
+ </div>
341
+ `;
342
+ return;
343
+ }
344
+
345
+ let html = '<div class="space-y-4">';
346
+
347
+ courseData.chapters.forEach((chapter, chapterIndex) => {
348
+ html += `
349
+ <div class="course-item bg-white border border-gray-200 rounded-lg overflow-hidden">
350
+ <div class="px-4 py-3 bg-gray-50 border-b border-gray-200 flex justify-between items-center">
351
+ <h3 class="font-medium text-gray-800 flex items-center">
352
+ <i class="far fa-folder-open text-blue-400 mr-2"></i>
353
+ ${chapter.title}
354
+ </h3>
355
+ <button class="text-gray-400 hover:text-gray-600" onclick="toggleChapterSections(${chapterIndex})">
356
+ <i class="fas fa-chevron-down"></i>
357
+ </button>
358
+ </div>
359
+ <div id="chapter-${chapterIndex}-sections" class="divide-y divide-gray-200">
360
+ `;
361
+
362
+ chapter.sections.forEach((section, sectionIndex) => {
363
+ html += `
364
+ <div class="px-4 py-3 flex items-start">
365
+ <div class="mr-3 mt-1">
366
+ <i class="far fa-file-alt text-gray-400"></i>
367
+ </div>
368
+ <div class="flex-1">
369
+ <h4 class="font-medium text-gray-700">${section.title}</h4>
370
+ <p class="text-sm text-gray-500 line-clamp-2">${section.content.substring(0, 100)}...</p>
371
+ </div>
372
+ <div class="flex space-x-2 ml-2">
373
+ <button class="text-gray-400 hover:text-blue-500" title="Edit" onclick="editSection(${chapterIndex}, ${sectionIndex})">
374
+ <i class="fas fa-pencil-alt text-sm"></i>
375
+ </button>
376
+ <button class="text-gray-400 hover:text-red-500" title="Delete" onclick="deleteSection(${chapterIndex}, ${sectionIndex})">
377
+ <i class="fas fa-trash-alt text-sm"></i>
378
+ </button>
379
+ </div>
380
+ </div>
381
+ `;
382
+ });
383
+
384
+ html += `
385
+ </div>
386
+ </div>
387
+ `;
388
+ });
389
+
390
+ html += `
391
+ <button onclick="addNewChapter()" class="w-full p-3 border-2 border-dashed border-gray-300 hover:border-blue-400 rounded-lg text-gray-500 hover:text-blue-500 transition flex items-center justify-center">
392
+ <i class="fas fa-plus mr-2"></i>
393
+ Add New Chapter
394
+ </button>
395
+ </div>
396
+ `;
397
+
398
+ courseOutline.innerHTML = html;
399
+ }
400
+
401
+ // Generate the final course
402
+ generateCourseBtn.addEventListener('click', function() {
403
+ processingLoader.classList.remove('hidden');
404
+ processingStatus.textContent = 'Generating course...';
405
+
406
+ // Update course title if changed
407
+ courseData.title = courseTitle.value || 'New Course';
408
+
409
+ // Generate preview
410
+ setTimeout(() => {
411
+ renderCoursePreview();
412
+ previewSection.classList.remove('hidden');
413
+ processingLoader.classList.add('hidden');
414
+ processingStatus.textContent = 'Course generated';
415
+
416
+ // Scroll to preview
417
+ previewSection.scrollIntoView({ behavior: 'smooth' });
418
+
419
+ // Show success modal
420
+ showModal('Course Generated', 'Your course has been successfully created from your documents.');
421
+ }, 1000);
422
+ });
423
+
424
+ // Render the course preview
425
+ function renderCoursePreview() {
426
+ let html = `
427
+ <h1 class="text-3xl font-bold mb-6 text-center">${courseData.title}</h1>
428
+ <div class="space-y-8">
429
+ `;
430
+
431
+ courseData.chapters.forEach(chapter => {
432
+ html += `
433
+ <div class="chapter">
434
+ <h2 class="text-2xl font-semibold mb-4 flex items-center">
435
+ <i class="far fa-folder-open text-blue-500 mr-3"></i>
436
+ ${chapter.title}
437
+ </h2>
438
+ <div class="ml-8 space-y-6">
439
+ `;
440
+
441
+ chapter.sections.forEach(section => {
442
+ html += `
443
+ <div class="section">
444
+ <h3 class="text-xl font-medium mb-3">${section.title}</h3>
445
+ <div class="prose prose-sm max-w-none">
446
+ <p>${section.content.split('\n').join('</p><p>')}</p>
447
+ </div>
448
+ </div>
449
+ `;
450
+ });
451
+
452
+ html += `
453
+ </div>
454
+ </div>
455
+ `;
456
+ });
457
+
458
+ html += `</div>`;
459
+ coursePreview.innerHTML = html;
460
+ }
461
+
462
+ // Show modal
463
+ function showModal(title, message) {
464
+ document.getElementById('modalTitle').textContent = title;
465
+ document.getElementById('modalMessage').textContent = message;
466
+ successModal.classList.remove('hidden');
467
+ }
468
+
469
+ // Close modal
470
+ modalCloseBtn.addEventListener('click', function() {
471
+ successModal.classList.add('hidden');
472
+ });
473
+
474
+ // Export functions
475
+ document.getElementById('exportPdfBtn').addEventListener('click', function() {
476
+ showModal('Export Feature', 'PDF export would be implemented here with a library like jsPDF.');
477
+ });
478
+
479
+ document.getElementById('exportHtmlBtn').addEventListener('click', function() {
480
+ showModal('Export Feature', 'HTML export would be implemented here, generating a downloadable HTML file.');
481
+ });
482
+
483
+ document.getElementById('publishBtn').addEventListener('click', function() {
484
+ showModal('Publish Feature', 'In a real application, this would publish your course to a learning management system.');
485
+ });
486
+
487
+ // Global functions accessible from inline handlers
488
+ window.toggleChapterSections = function(chapterIndex) {
489
+ const sectionsDiv = document.getElementById(`chapter-${chapterIndex}-sections`);
490
+ const toggleBtn = sectionsDiv.previousElementSibling.querySelector('button');
491
+
492
+ if (sectionsDiv.classList.contains('hidden')) {
493
+ sectionsDiv.classList.remove('hidden');
494
+ toggleBtn.innerHTML = '<i class="fas fa-chevron-down"></i>';
495
+ } else {
496
+ sectionsDiv.classList.add('hidden');
497
+ toggleBtn.innerHTML = '<i class="fas fa-chevron-right"></i>';
498
+ }
499
+ };
500
+
501
+ window.editSection = function(chapterIndex, sectionIndex) {
502
+ const section = courseData.chapters[chapterIndex].sections[sectionIndex];
503
+ showModal('Edit Section', `Editing feature would be implemented here for: "${section.title}"`);
504
+ };
505
+
506
+ window.deleteSection = function(chapterIndex, sectionIndex) {
507
+ if (confirm('Are you sure you want to delete this section?')) {
508
+ courseData.chapters[chapterIndex].sections.splice(sectionIndex, 1);
509
+ renderCourseOutline();
510
+ }
511
+ };
512
+
513
+ window.addNewChapter = function() {
514
+ const chapterTitle = prompt('Enter chapter title:', 'New Chapter');
515
+ if (chapterTitle) {
516
+ courseData.chapters.push({
517
+ title: chapterTitle,
518
+ content: '',
519
+ sections: [{ title: 'New Section', content: '' }]
520
+ });
521
+ renderCourseOutline();
522
+ }
523
+ };
524
+ });
525
+ </script>
526
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - <a href="https://enzostvs-deepsite.hf.space?remix=zoeboy/criador-de-cursos" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
527
+ </html>