Spaces:
Running
Running
Download script.js from Soul4orm777/lemon-drop: direct link, hf CLI and curl.
- Browser
- Download file 1.48 kB
-
https://huggingface.co/spaces/Soul4orm777/lemon-drop/resolve/main/script.js
- Command line
-
hf download hf://spaces/Soul4orm777/lemon-drop/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Soul4orm777/lemon-drop/resolve/main/script.js
1.48 kB
| // Shared JavaScript across all pages | |
| document.addEventListener('DOMContentLoaded', function() { | |
| console.log('Lemon Drop App loaded'); | |
| // Add to cart functionality | |
| const addToCartButtons = document.querySelectorAll('.add-to-cart-btn'); | |
| addToCartButtons.forEach(button => { | |
| button.addEventListener('click', function() { | |
| const productId = this.dataset.productId; | |
| const productName = this.dataset.productName; | |
| // In a real app, this would add to cart | |
| console.log(`Added ${productName} (${productId}) to cart`); | |
| // Show confirmation | |
| const originalText = this.innerHTML; | |
| this.innerHTML = '<i data-feather="check"></i> Added!'; | |
| this.classList.remove('bg-emerald-500'); | |
| this.classList.add('bg-green-500'); | |
| setTimeout(() => { | |
| this.innerHTML = originalText; | |
| this.classList.remove('bg-green-500'); | |
| this.classList.add('bg-emerald-500'); | |
| feather.replace(); | |
| }, 2000); | |
| }); | |
| }); | |
| // Weight selector | |
| const weightButtons = document.querySelectorAll('[data-weight]'); | |
| weightButtons.forEach(button => { | |
| button.addEventListener('click', function() { | |
| weightButtons.forEach(btn => btn.classList.remove('bg-emerald-500')); | |
| this.classList.add('bg-emerald-500'); | |
| }); | |
| }); | |
| }); |