Download script.js from codebyjerry/deepsite-project-u83dz: direct link, hf CLI and curl.
- Browser
- Download file 5.58 kB
-
https://huggingface.co/spaces/codebyjerry/deepsite-project-u83dz/resolve/main/script.js
- Command line
-
hf download hf://spaces/codebyjerry/deepsite-project-u83dz/script.js
-
curl -L -o script.js https://huggingface.co/spaces/codebyjerry/deepsite-project-u83dz/resolve/main/script.js
5.58 kB
| // Product Data | |
| const products = [ | |
| { id: 1, name: "Oversized Creative Tee", category: "clothing", price: 1299, oldPrice: 1599, image: "http://static.photos/fashion/640x360/1", badge: "Bestseller", description: "Premium cotton oversized t-shirt with unique graphic print. Relaxed fit for ultimate comfort." }, | |
| { id: 2, name: "Minimalist Hoodie", category: "clothing", price: 2499, image: "http://static.photos/fashion/640x360/2", badge: "New", description: "Essential hoodie in premium fleece. Clean design with subtle branding." }, | |
| { id: 3, name: "Street Cargo Pants", category: "clothing", price: 1899, oldPrice: 2299, image: "http://static.photos/fashion/640x360/3", badge: "Sale", description: "Functional cargo pants with multiple pockets. Durable cotton twill fabric." }, | |
| { id: 4, name: "Creator Laptop Backpack", category: "accessories", price: 3299, image: "http://static.photos/technology/640x360/4", description: "Water-resistant backpack with padded laptop compartment. Fits up to 16-inch laptops." }, | |
| { id: 5, name: "LUMINA Logo Cap", category: "merch", price: 899, image: "http://static.photos/people/640x360/5", description: "Embroidered dad cap with adjustable strap. One size fits all." }, | |
| { id: 6, name: "Wireless Earbuds Case", category: "accessories", price: 599, image: "http://static.photos/technology/640x360/6", badge: "New", description: "Silicone protective case for AirPods Pro. Anti-drop design with carabiner." }, | |
| { id: 7, name: "Creative Sketchbook", category: "lifestyle", price: 499, image: "http://static.photos/workspace/640x360/7", description: "A5 hardbound sketchbook with 120gsm paper. 120 pages for your creative ideas." }, | |
| { id: 8, name: "Premium Desk Mat", category: "lifestyle", price: 1199, image: "http://static.photos/workspace/640x360/8", badge: "Bestseller", description: "Extended mouse pad with stitched edges. Smooth surface for precise control." }, | |
| { id: 9, name: "Urban Sneakers", category: "clothing", price: 3999, image: "http://static.photos/fashion/640x360/9", description: "Lightweight running shoes with breathable mesh upper. Cushioned sole for all-day comfort." }, | |
| { id: 10, name: "Canvas Tote Bag", category: "accessories", price: 799, image: "http://static.photos/fashion/640x360/10", badge: "Eco", description: "Heavy-duty canvas tote with inner pocket. Perfect for shopping or daily carry." }, | |
| { id: 11, name: "Vintage Denim Jacket", category: "clothing", price: 3499, image: "http://static.photos/fashion/640x360/11", description: "Classic denim jacket with distressed details. Relaxed fit with button closure." }, | |
| { id: 12, name: "Smart Watch Band", category: "accessories", price: 1299, image: "http://static.photos/technology/640x360/12", badge: "New", description: "Premium silicone band compatible with Apple Watch. Multiple color options." }, | |
| { id: 13, name: "Creator Sticker Pack", category: "merch", price: 299, image: "http://static.photos/technology/640x360/13", description: "Set of 10 waterproof vinyl stickers. Perfect for laptops, phones, and notebooks." }, | |
| { id: 14, name: "Ceramic Coffee Mug", category: "lifestyle", price: 599, image: "http://static.photos/food/640x360/14", badge: "Popular", description: "Minimalist ceramic mug with LUMINA logo. Microwave and dishwasher safe." }, | |
| { id: 15, name: "Athletic Joggers", category: "clothing", price: 1699, image: "http://static.photos/fashion/640x360/15", description: "Tapered fit joggers with zip pockets. Moisture-wicking fabric for workouts." }, | |
| { id: 16, name: "Phone Grip Stand", category: "accessories", price: 399, image: "http://static.photos/technology/640x360/16", description: "Collapsible phone grip and stand. Secure hold for one-handed use." } | |
| ]; | |
| // Cart Functions | |
| function getCart() { | |
| try { | |
| return JSON.parse(localStorage.getItem('lumina_cart')) || []; | |
| } catch { | |
| return []; | |
| } | |
| } | |
| function saveCart(cart) { | |
| localStorage.setItem('lumina_cart', JSON.stringify(cart)); | |
| updateCartBadge(); | |
| } | |
| function addToCart(productId, quantity = 1, size = null, color = null) { | |
| const cart = getCart(); | |
| const existingIndex = cart.findIndex(item => | |
| item.id === productId && item.size === size && item.color === color | |
| ); | |
| if (existingIndex > -1) { | |
| cart[existingIndex].quantity += quantity; | |
| } else { | |
| cart.push({ id: productId, quantity, size, color }); | |
| } | |
| saveCart(cart); | |
| showToast('Added to cart successfully!'); | |
| } | |
| function removeFromCart(index) { | |
| const cart = getCart(); | |
| cart.splice(index, 1); | |
| saveCart(cart); | |
| } | |
| function clearCart() { | |
| localStorage.removeItem('lumina_cart'); | |
| updateCartBadge(); | |
| } | |
| function updateCartBadge() { | |
| const cart = getCart(); | |
| const badge = document.getElementById('cartBadge'); | |
| if (badge) { | |
| const totalItems = cart.reduce((sum, item) => sum + item.quantity, 0); | |
| badge.textContent = totalItems; | |
| badge.style.opacity = totalItems > 0 ? '1' : '0'; | |
| } | |
| } | |
| function updateQuantity(index, newQty) { | |
| const cart = getCart(); | |
| if (newQty < 1) return; | |
| cart[index].quantity = Math.min(10, newQty); | |
| saveCart(cart); | |
| } | |
| // Toast Notification | |
| function showToast(message) { | |
| const toast = document.getElementById('toast'); | |
| const toastMessage = document.getElementById('toastMessage'); | |
| if (toast && toastMessage) { | |
| toastMessage.textContent = message; | |
| toast.classList.remove('translate-y-20', 'opacity-0'); | |
| setTimeout(() => { | |
| toast.classList.add('translate-y-20', 'opacity-0'); | |
| }, 3000); | |
| } | |
| } | |
| // Initialize on all pages | |
| document.addEventListener('DOMContentLoaded', () => { | |
| updateCartBadge(); | |
| }); |