Advanced Study Chart, Exam Revision & Note Generator
Ultimate CMA Study Hub & Note Generator | CMA Knowledge CMA Knowledge
The Ultimate Exam Revision & Note Generation Engine
Focus Mode Active
Use the Pomodoro technique (25 min study / 5 min break) to maximize retention.
`;
let sourceHTML = header + `
Executive Summary:
${analyzedData.summary}
| Key Concept | Definition & Context |
`;
analyzedData.items.forEach(item => {
// Convert Web highlight tags to Word bold tags
let wordContext = item.context.replace(//g, '').replace(/<\/mark>/g, '');
sourceHTML += `| ${item.keyword} | ${wordContext} |
`;
});
sourceHTML += `
` + footer;// Create Blob and trigger download
const blob = new Blob(['\ufeff', sourceHTML], { type: 'application/msword' });
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
// Clean filename formatting
let safeName = analyzedData.topic.replace(/[^a-z0-9]/gi, '_').toLowerCase();
link.download = `CMA_Notes_${safeName}.doc`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}// Feature: Native PowerPoint Generation via PptxGenJS
function downloadPPT() {
if(typeof PptxGenJS === 'undefined') {
alert("Error: PowerPoint engine is still loading. Please wait a few seconds and try again.");
return;
}
let pptx = new PptxGenJS();
pptx.layout = 'LAYOUT_16x9';// Custom Master Slide settings (Footer applied to all slides)
pptx.defineSlideMaster({
title: "MASTER_SLIDE",
background: { color: "FFFFFF" },
objects: [
{ text: { text: `© CMA Knowledge | ${analyzedData.topic} | ${analyzedData.date}`, options: { x: 0.5, y: '95%', w: 10, h: 0.5, fontSize: 10, color: "888888", align: "center" } } }
]
});// 1. Title Slide Generation
let slideTitle = pptx.addSlide();
slideTitle.background = { color: "0059b3" }; // Primary Blue Background
slideTitle.addText(analyzedData.topic.toUpperCase(), {
x: 1, y: 2, w: '80%', h: 1.5, fontSize: 48, bold: true, color: "ffffff", align: "center"
});
slideTitle.addText(`Prepared by: ${analyzedData.author}\nDate: ${analyzedData.date}`, {
x: 1, y: 3.5, w: '80%', h: 1.5, fontSize: 20, color: "e6f2ff", align: "center"
});// 2. Executive Summary Slide Generation
let slideSummary = pptx.addSlide({ masterName: "MASTER_SLIDE" });
slideSummary.addText("Executive Summary", {
x: 0.5, y: 0.5, w: '90%', h: 1, fontSize: 36, bold: true, color: "0059b3", border: {type: 'bottom', color: '0059b3', pt: 2}
});
slideSummary.addText(analyzedData.summary, {
x: 0.5, y: 2, w: '90%', h: 3, fontSize: 24, color: "333333", fill: {color: "f4f8ff"}, padding: 20
});// 3. Content Slides Generation (Iterating through extracted items)
// Groups 2 concepts per slide for better PPT readability
for (let i = 0; i < analyzedData.items.length; i += 2) {
let s = pptx.addSlide({ masterName: "MASTER_SLIDE" });
s.addText("Core Concepts", {
x: 0.5, y: 0.5, w: '90%', h: 0.8, fontSize: 32, bold: true, color: "0059b3", border: {type: 'bottom', color: 'cce0ff', pt: 2}
});// Concept 1
let item1 = analyzedData.items[i];
s.addText(item1.keyword.toUpperCase(), { x: 0.5, y: 1.8, w: '30%', h: 1, fontSize: 22, bold: true, color: "0059b3" });
let cleanContext1 = item1.context.replace(/
/g, '').replace(/<\/mark>/g, '');
s.addText(cleanContext1, { x: 3.5, y: 1.8, w: '60%', h: 1.5, fontSize: 18, color: "333333", valign: "top" });// Concept 2 (if exists)
if (i + 1 < analyzedData.items.length) {
let item2 = analyzedData.items[i+1];
s.addShape(pptx.ShapeType.line, { x: 0.5, y: 3.5, w: '90%', h: 0, line: {color: 'e6f2ff', width: 2} }); // Divider
s.addText(item2.keyword.toUpperCase(), { x: 0.5, y: 4.0, w: '30%', h: 1, fontSize: 22, bold: true, color: "0059b3" });
let cleanContext2 = item2.context.replace(//g, '').replace(/<\/mark>/g, '');
s.addText(cleanContext2, { x: 3.5, y: 4.0, w: '60%', h: 1.5, fontSize: 18, color: "333333", valign: "top" });
}
}// Trigger file build and download
let safeName = analyzedData.topic.replace(/[^a-z0-9]/gi, '_').toLowerCase();
pptx.writeFile({ fileName: `CMA_Presentation_${safeName}.pptx` });
}