Legal Contract Prompt Generator
Create professional AI prompts for drafting precise legal clauses and agreements. Customize your prompt with specific requirements.
Your AI Prompt
`;
promptList.appendChild(promptItem);
});
}
// Expose functions to global scope for inline event handlers
window.copyPrompt = function(index) {
navigator.clipboard.writeText(savedPrompts[index])
.then(() => {
alert('Prompt copied to clipboard');
})
.catch(err => {
console.error('Failed to copy: ', err);
alert('Failed to copy prompt');
});
};
window.removePrompt = function(index) {
savedPrompts.splice(index, 1);
renderPromptList();
if (savedPrompts.length === 0) {
promptListSection.classList.add('hidden');
}
};
// Load jsPDF library dynamically
function loadJsPDF() {
const script = document.createElement('script');
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js';
script.onload = function() {
console.log('jsPDF loaded successfully');
};
document.head.appendChild(script);
}
// Initialize jsPDF when download button is first clicked
downloadBtn.addEventListener('click', function initJsPDF() {
if (typeof window.jspdf === 'undefined') {
loadJsPDF();
}
downloadBtn.removeEventListener('click', initJsPDF);
}, { once: true });
});