Spaces:
Running
Running
Download script.js from tjksecurity/exposureguard-pro: direct link, hf CLI and curl.
- Browser
- Download file 7.44 kB
-
https://huggingface.co/spaces/tjksecurity/exposureguard-pro/resolve/main/script.js
- Command line
-
hf download hf://spaces/tjksecurity/exposureguard-pro/script.js
-
curl -L -o script.js https://huggingface.co/spaces/tjksecurity/exposureguard-pro/resolve/main/script.js
7.44 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| // Initialize slide navigation | |
| initializeSlideNavigation(); | |
| // Initialize scroll animations | |
| initializeScrollAnimations(); | |
| // Initialize metrics counter (simulated) | |
| initializeMetrics(); | |
| // 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', | |
| block: 'start' | |
| }); | |
| } | |
| }); | |
| }); | |
| // Initialize tooltips for icons | |
| initializeTooltips(); | |
| }); | |
| function initializeSlideNavigation() { | |
| const slideNav = document.getElementById('slide-nav'); | |
| const slideContents = document.querySelectorAll('.slide-content'); | |
| if (!slideNav || slideContents.length === 0) return; | |
| // Create navigation items for each slide | |
| const slideTitles = [ | |
| "Cover β¨", | |
| "The Problem π΄", | |
| "Market Shift π", | |
| "The Solution π‘", | |
| "Product Walkthrough π", | |
| "Funnel Comparison π", | |
| "Traction π", | |
| "Business Model π°", | |
| "Acquisition Value π―", | |
| "Competitive Position βοΈ", | |
| "Integration Path π§", | |
| "Exit Intent πͺ" | |
| ]; | |
| slideNav.innerHTML = slideTitles.map((title, index) => ` | |
| <button class="slide-nav-item w-full text-left p-3 rounded-lg mb-2 hover:bg-indigo-50 transition-colors ${index === 0 ? 'active' : ''}" | |
| data-target="${index + 1}"> | |
| <div class="flex items-center gap-3"> | |
| <div class="w-8 h-8 rounded-full bg-indigo-100 flex items-center justify-center"> | |
| <span class="text-indigo-700 font-bold">${index + 1}</span> | |
| </div> | |
| <span class="font-medium">${title}</span> | |
| </div> | |
| </button> | |
| `).join(''); | |
| // Add click handlers | |
| document.querySelectorAll('.slide-nav-item').forEach(button => { | |
| button.addEventListener('click', function() { | |
| const targetSlide = this.getAttribute('data-target'); | |
| // Update active state | |
| document.querySelectorAll('.slide-nav-item').forEach(btn => { | |
| btn.classList.remove('active'); | |
| }); | |
| this.classList.add('active'); | |
| // Scroll to slide | |
| const slideElement = document.querySelector(`[data-slide="${targetSlide}"]`); | |
| if (slideElement) { | |
| slideElement.scrollIntoView({ | |
| behavior: 'smooth', | |
| block: 'start' | |
| }); | |
| } | |
| }); | |
| }); | |
| } | |
| function initializeScrollAnimations() { | |
| const observerOptions = { | |
| root: null, | |
| rootMargin: '0px', | |
| threshold: 0.1 | |
| }; | |
| const observer = new IntersectionObserver((entries) => { | |
| entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| entry.target.classList.add('animate-in'); | |
| } | |
| }); | |
| }, observerOptions); | |
| // Observe all slide contents | |
| document.querySelectorAll('.slide-content').forEach(slide => { | |
| observer.observe(slide); | |
| }); | |
| } | |
| function initializeMetrics() { | |
| // Simulate live metrics update | |
| const metrics = { | |
| activationRate: 42, | |
| scanToSignup: 28, | |
| signupToPaid: 65, | |
| retention: 92 | |
| }; | |
| // Animate metrics on scroll | |
| const metricsObserver = new IntersectionObserver((entries) => { | |
| entries.forEach(entry => { | |
| if (entry.isIntersecting) { | |
| animateValue('activation-rate', 0, metrics.activationRate, 1500); | |
| animateValue('scan-to-signup', 0, metrics.scanToSignup, 1500); | |
| animateValue('signup-to-paid', 0, metrics.signupToPaid, 1500); | |
| animateValue('retention', 0, metrics.retention, 1500); | |
| metricsObserver.unobserve(entry.target); | |
| } | |
| }); | |
| }, { threshold: 0.5 }); | |
| const metricsSection = document.getElementById('traction-metrics'); | |
| if (metricsSection) { | |
| metricsObserver.observe(metricsSection); | |
| } | |
| } | |
| function animateValue(id, start, end, duration) { | |
| const element = document.getElementById(id); | |
| if (!element) return; | |
| let startTimestamp = null; | |
| const step = (timestamp) => { | |
| if (!startTimestamp) startTimestamp = timestamp; | |
| const progress = Math.min((timestamp - startTimestamp) / duration, 1); | |
| const value = Math.floor(progress * (end - start) + start); | |
| element.textContent = value + '%'; | |
| if (progress < 1) { | |
| window.requestAnimationFrame(step); | |
| } | |
| }; | |
| window.requestAnimationFrame(step); | |
| } | |
| function initializeTooltips() { | |
| // Initialize tooltips for icons with data-tooltip attribute | |
| document.querySelectorAll('[data-tooltip]').forEach(element => { | |
| element.addEventListener('mouseenter', function(e) { | |
| const tooltip = document.createElement('div'); | |
| tooltip.className = 'fixed z-50 px-3 py-2 bg-gray-900 text-white text-sm rounded-lg shadow-lg'; | |
| tooltip.textContent = this.getAttribute('data-tooltip'); | |
| tooltip.style.left = e.pageX + 'px'; | |
| tooltip.style.top = (e.pageY - 40) + 'px'; | |
| tooltip.id = 'dynamic-tooltip'; | |
| document.body.appendChild(tooltip); | |
| }); | |
| element.addEventListener('mouseleave', function() { | |
| const tooltip = document.getElementById('dynamic-tooltip'); | |
| if (tooltip) { | |
| tooltip.remove(); | |
| } | |
| }); | |
| element.addEventListener('mousemove', function(e) { | |
| const tooltip = document.getElementById('dynamic-tooltip'); | |
| if (tooltip) { | |
| tooltip.style.left = e.pageX + 'px'; | |
| tooltip.style.top = (e.pageY - 40) + 'px'; | |
| } | |
| }); | |
| }); | |
| } | |
| // API Integration - Simulated data fetch for pitch deck content | |
| async function fetchTractionData() { | |
| try { | |
| // In production, this would fetch from your API | |
| const response = await fetch('https://api.mockapi.io/traction', { | |
| method: 'GET', | |
| headers: { | |
| 'Content-Type': 'application/json' | |
| } | |
| }); | |
| if (!response.ok) { | |
| throw new Error('Failed to fetch traction data'); | |
| } | |
| const data = await response.json(); | |
| updateTractionDisplay(data); | |
| } catch (error) { | |
| console.log('Using simulated traction data'); | |
| // Fallback to simulated data | |
| const simulatedData = { | |
| activationRate: 42, | |
| scanToSignup: 28, | |
| signupToPaid: 65, | |
| retention: 92, | |
| arpu: 14.5, | |
| mrr: 85000 | |
| }; | |
| updateTractionDisplay(simulatedData); | |
| } | |
| } | |
| function updateTractionDisplay(data) { | |
| // Update traction metrics in the UI | |
| console.log('Traction data updated:', data); | |
| } | |
| // Export functions for web components if needed | |
| window.AppUtils = { | |
| initializeSlideNavigation, | |
| animateValue, | |
| fetchTractionData | |
| }; |