Spaces:
Running
Running
Download script.js from Pro-Support/tradematrix-triumph: direct link, hf CLI and curl.
- Browser
- Download file 3.07 kB
-
https://huggingface.co/spaces/Pro-Support/tradematrix-triumph/resolve/main/script.js
- Command line
-
hf download hf://spaces/Pro-Support/tradematrix-triumph/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Pro-Support/tradematrix-triumph/resolve/main/script.js
3.07 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // Navbar scroll effect | |
| const navbar = document.querySelector('custom-navbar').shadowRoot.querySelector('.navbar'); | |
| window.addEventListener('scroll', () => { | |
| if (window.scrollY > 50) { | |
| navbar.classList.add('scrolled'); | |
| } else { | |
| navbar.classList.remove('scrolled'); | |
| } | |
| }); | |
| // Smooth scroll for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| const target = document.querySelector(this.getAttribute('href')); | |
| if (target) { | |
| target.scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| } | |
| }); | |
| }); | |
| // Countdown timer | |
| const countdown = () => { | |
| const countdownDate = new Date(); | |
| countdownDate.setDate(countdownDate.getDate() + 3); | |
| const timer = setInterval(() => { | |
| const now = new Date().getTime(); | |
| const distance = countdownDate - now; | |
| const days = Math.floor(distance / (1000 * 60 * 60 * 24)); | |
| const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); | |
| const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); | |
| const seconds = Math.floor((distance % (1000 * 60)) / 1000); | |
| document.getElementById('countdown').innerHTML = `${days}d ${hours}h ${minutes}m ${seconds}s`; | |
| if (distance < 0) { | |
| clearInterval(timer); | |
| document.getElementById('countdown').innerHTML = "OFFER EXPIRED!"; | |
| } | |
| }, 1000); | |
| }; | |
| countdown(); | |
| // Animate elements when they come into view | |
| const animateOnScroll = () => { | |
| const elements = document.querySelectorAll('.animate-fade, .animate-slide-up, .animate-slide-left, .animate-slide-right'); | |
| elements.forEach(element => { | |
| const elementPosition = element.getBoundingClientRect().top; | |
| const screenPosition = window.innerHeight / 1.2; | |
| if (elementPosition < screenPosition) { | |
| element.classList.add('animate-active'); | |
| } | |
| }); | |
| }; | |
| window.addEventListener('scroll', animateOnScroll); | |
| animateOnScroll(); | |
| // Copy trading matrix | |
| document.querySelectorAll('.copy-matrix').forEach(button => { | |
| button.addEventListener('click', () => { | |
| const matrix = document.getElementById('trading-matrix').textContent; | |
| navigator.clipboard.writeText(matrix); | |
| const originalText = button.textContent; | |
| button.textContent = "Copied!"; | |
| button.classList.add('bg-green-500'); | |
| setTimeout(() => { | |
| button.textContent = originalText; | |
| button.classList.remove('bg-green-500'); | |
| }, 2000); | |
| }); | |
| }); | |
| }); |