Writing
Art
Brainstorming
Storytelling
AI Prompts
📚 Generated Prompts History
`;
promptResults.appendChild(card);
resultsSection.style.display = "block";
historySection.style.display = "none";
});
historyItems.appendChild(historyItem);
});
}
function toggleHistory() {
if (historySection.style.display === "block") {
historySection.style.display = "none";
historyBtn.textContent = "History";
} else {
historySection.style.display = "block";
resultsSection.style.display = "none";
historyBtn.textContent = "Hide History";
}
}
function switchTab(tab) {
currentTab = tab;
tabs.forEach(t => t.classList.remove('active'));
document.querySelector(`.tab[data-tab="${tab}"]`).classList.add('active');
}
function clearForm() {
formInputs.forEach(input => {
if (input.type !== 'checkbox') {
input.value = '';
}
});
checkboxes.forEach(checkbox => {
checkbox.checked = ['character', 'setting', 'conflict'].includes(checkbox.id);
});
document.getElementById('genre').value = 'random';
document.getElementById('complexity').value = 'moderate';
document.getElementById('output-style').value = 'descriptive';
resultsSection.style.display = "none";
historySection.style.display = "none";
}
function escapeHtml(unsafe) {
return unsafe
.replace(/&/g, "&")
.replace(//g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
}
});
// Global functions
function copyToClipboard(text) {
navigator.clipboard.writeText(text)
.then(() => alert("Prompt copied to clipboard!"))
.catch(() => alert("Failed to copy."));
}