Download script.js from Skywalker71/bytebazaar-tech-haven: direct link, hf CLI and curl.
- Browser
- Download file 1.54 kB
-
https://huggingface.co/spaces/Skywalker71/bytebazaar-tech-haven/resolve/main/script.js
- Command line
-
hf download hf://spaces/Skywalker71/bytebazaar-tech-haven/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Skywalker71/bytebazaar-tech-haven/resolve/main/script.js
1.54 kB
| // Main JavaScript functionality | |
| document.addEventListener('DOMContentLoaded', () => { | |
| // Initialize any global functionality here | |
| console.log('ByteBazaar loaded!'); | |
| // Initialize price range slider | |
| const initRangeSliders = () => { | |
| document.querySelectorAll('input[type="range"]').forEach(slider => { | |
| slider.addEventListener('input', function() { | |
| const valueDisplay = this.nextElementSibling?.querySelector('span:nth-child(2)'); | |
| if (valueDisplay) { | |
| valueDisplay.textContent = `${this.value}`; | |
| } | |
| }); | |
| }); | |
| }; | |
| // Initialize filter sections | |
| const initFilterSections = () => { | |
| document.querySelectorAll('.filter-section').forEach(section => { | |
| const header = section.querySelector('.filter-header'); | |
| if (header) { | |
| header.addEventListener('click', () => { | |
| const content = section.querySelector('.filter-content'); | |
| content.classList.toggle('hidden'); | |
| }); | |
| } | |
| }); | |
| }; | |
| initRangeSliders(); | |
| initFilterSections(); | |
| // Example: Add to cart functionality | |
| document.addEventListener('click', (e) => { | |
| if (e.target.classList.contains('add-to-cart')) { | |
| const product = e.target.closest('.product-card').dataset.product; | |
| alert(`Added ${product} to your cart!`); | |
| } | |
| }); | |
| // Mobile menu toggle would be handled by the navbar component | |
| }); |