🔧 ديواراتي — نظام العلاج 3ilej

مولّد وحدات العلاج — الأعداد الحقيقية والتحليل

30 وحدة علاج • 9 عائلات • الأعداد الحقيقية، الجذور، التحليل، المعادلات

توليد شامل — احصل على كل الوحدات (30 وحدة) في ملف مضغوط واحد
'; } function buildJSON(op){ return { module_id: op.id, notion: op.notion, niveau_scolaire: "9ème / 2ème secondaire", chapitre: "الأعداد الحقيقية والتحليل", type: op.type, typeLabel: op.typeLabel, erreur_typique: op.erreur, rappel: op.rappel, exemple: op.exemple, exos: makeExos(op.type, 10), meta: { generateur: "Devoirati Remediation Generator — Réels/Factorisation v1", date: new Date().toISOString().slice(0,10) } }; } function buildREADME(op){ return "# وحدة علاج — "+op.notion+"\n" +"## Devoirati — نظام 3ilej\n\n" +"**module_id:** "+op.id+"\n" +"**type:** "+op.type+" ("+op.typeLabel+")\n\n" +"## الخطأ الشائع\n"+op.erreur+"\n\n" +"## المحتوى\n" +"| الملف | الوصف |\n|------|-------|\n" +"| index.html | الصفحة التفاعلية |\n" +"| data.json | بيانات الوحدة |\n\n" +"تم التوليد: "+new Date().toISOString().slice(0,10)+"\n"; } async function generateOne(op){ try{ var zip = new JSZip(); var folder = zip.folder(op.id); folder.file('index.html', buildHTML(op)); folder.file('data.json', JSON.stringify(buildJSON(op), null, 2)); folder.file('README.md', buildREADME(op)); var blob = await zip.generateAsync({type:'blob'}); downloadBlob(blob, op.id+'.zip'); toast('✅ تم تنزيل: '+op.id+'.zip'); }catch(e){ toast('❌ خطأ: '+e.message, true); console.error(e); } } async function generateAll(){ try{ var zip = new JSZip(); var catalog = []; FAMILIES.forEach(function(fam){ fam.operations.forEach(function(op){ var folder = zip.folder(op.id); folder.file('index.html', buildHTML(op)); folder.file('data.json', JSON.stringify(buildJSON(op), null, 2)); folder.file('README.md', buildREADME(op)); catalog.push({module_id:op.id, famille:fam.title, notion:op.notion, typeLabel:op.typeLabel, type:op.type}); }); }); zip.file('catalog.json', JSON.stringify({titre:"Réels + Factorisation", modules:catalog}, null, 2)); var blob = await zip.generateAsync({type:'blob'}); downloadBlob(blob, 'remediation_reels_factorisation.zip'); toast('📦 تم تنزيل 30 وحدة علاج كاملة!'); }catch(e){ toast('❌ خطأ: '+e.message, true); console.error(e); } } function downloadBlob(blob, name){ var a=document.createElement('a'); a.href=URL.createObjectURL(blob); a.download=name; document.body.appendChild(a); a.click(); setTimeout(function(){URL.revokeObjectURL(a.href);a.remove();},1000); } function toast(msg, err){ var t=document.getElementById('toast'); t.textContent=msg; t.className='show'+(err?' err':''); setTimeout(function(){t.className=err?'err':'';},3200); } initUI();