36 lines
890 B
JavaScript
36 lines
890 B
JavaScript
let selectedProducts = [];
|
|
|
|
function toggleSelect(card) {
|
|
const productId = card.dataset.id;
|
|
|
|
if (card.classList.contains('selected')) {
|
|
card.classList.remove('selected');
|
|
selectedProducts = selectedProducts.filter(id => id !== productId);
|
|
} else {
|
|
card.classList.add('selected');
|
|
selectedProducts.push(productId);
|
|
}
|
|
}
|
|
|
|
function goGenerate() {
|
|
if (selectedProducts.length === 0) {
|
|
showToast();
|
|
return;
|
|
}
|
|
localStorage.setItem('selectedProducts', JSON.stringify(selectedProducts));
|
|
window.location.href = 'generate-content.html';
|
|
}
|
|
|
|
function goToProfile() {
|
|
window.location.href = 'profile.html';
|
|
}
|
|
|
|
function showToast() {
|
|
const overlay = document.getElementById('toastOverlay');
|
|
overlay.style.display = 'flex';
|
|
|
|
setTimeout(() => {
|
|
overlay.style.display = 'none';
|
|
}, 2000);
|
|
}
|