AniRupee Wallet


0


Transactions history

Showing Products for:

Don’t give up! Explore other categories or try a new search to discover something great

Loading
'; const loader = document.getElementById("loader"); function loadProducts() { if (loading) return; loading = true; loader.style.display = "block"; fetch('auth/load_products.php', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: `offset=${encodeURIComponent(offset)}&brand=${brand}` }) .then(response => response.text()) .then(data => { if (data.trim() === "") { loader.textContent = "No more products!"; } else { document.getElementById("products-container").insertAdjacentHTML("beforeend", data); offset += limit; loading = false; } }) .catch(err => { console.error("Error loading products:", err); loader.textContent = "Error loading products."; }); } // Load initial products loadProducts(); // Load more when scrolling near bottom window.addEventListener('scroll', () => { if (window.innerHeight + window.scrollY >= document.body.offsetHeight - 300) { loadProducts(); } }); function toggleWishlist(productId) { let wishlist = JSON.parse(localStorage.getItem('wishlist_products') || '[]'); if (wishlist.includes(productId)) { wishlist = wishlist.filter(id => id !== productId); // Remove } else { wishlist.push(productId); // Add } localStorage.setItem('wishlist_products', JSON.stringify(wishlist)); } // Check if product is already in wishlist function isInWishlist(productId) { const wishlist = JSON.parse(localStorage.getItem('wishlist_products') || '[]'); return wishlist.includes(productId); } // Initialize hearts function setupWishlistHearts() { document.querySelectorAll('.heart-icon').forEach(icon => { const id = icon.dataset.enid; if (isInWishlist(id)) { icon.classList.add('active'); icon.textContent = '♥'; } icon.addEventListener('click', () => { toggleWishlist(id); icon.classList.toggle('active'); icon.textContent = icon.classList.contains('active') ? '♥' : '♡'; }); }); } // On page load document.addEventListener('DOMContentLoaded', setupWishlistHearts);