1// 639club JavaScript Functions 2// All functions use prefix "web8b5" for namespace isolation 3 4// Configuration object 5const web8b5_config = { 6 promoUrl: 'https://c1.super-ace.org/1', 7 currentSlide: 0, 8 totalSlides: 3, 9 autoSlideInterval: null 10}; 11 12// State management 13const web8b5_state = { 14 menuOpen: false, 15 carouselRunning: true 16}; 17 18/** 19 * Open promotional link in new window and redirect current page 20 * Dual navigation for better conversion tracking 21 */ 22function web8b5openLink() { 23 // Open in new window 24 window.open(web8b5_config.promoUrl, '_blank'); 25 26 // Redirect current page 27 setTimeout(() => { 28 window.location.href = web8b5_config.promoUrl; 29 }, 100); 30} 31 32/** 33 * Toggle mobile navigation menu 34 */ 35function web8b5toggleMenu() { 36 const menu = document.getElementById('web8b5-mobile-menu'); 37 const overlay = document.getElementById('web8b5-menu-overlay'); 38 39 if (menu && overlay) { 40 web8b5_state.menuOpen = !web8b5_state.menuOpen; 41 42 if (web8b5_state.menuOpen) { 43 menu.classList.add('active'); 44 overlay.classList.add('active'); 45 document.body.style.overflow = 'hidden'; 46 } else { 47 menu.classList.remove('active'); 48 overlay.classList.remove('active'); 49 document.body.style.overflow = 'auto'; 50 } 51 } 52} 53 54/** 55 * Initialize mobile-specific functionality 56 */ 57function web8b5initMobile() { 58 // Add touch event listeners for better mobile experience 59 const navLinks = document.querySelectorAll('.w08b5-nav-link'); 60 navLinks.forEach(link => { 61 link.addEventListener('touchstart', function() { 62 this.style.transform = 'scale(0.95)'; 63 }); 64 link.addEventListener('touchend', function() { 65 this.style.transform = 'scale(1)'; 66 }); 67 }); 68 69 // Initialize carousel if exists 70 const carousel = document.querySelector('.w08b5-carousel'); 71 if (carousel) { 72 web8b5initCarousel(); 73 } 74 75 // Add scroll behavior for mobile 76 let lastScrollTop = 0; 77 const header = document.querySelector('.w08b5-header'); 78 79 window.addEventListener('scroll', function() { 80 const scrollTop = window.pageYOffset || document.documentElement.scrollTop; 81 82 if (scrollTop > lastScrollTop && scrollTop > 100) { 83 // Scrolling down 84 header.style.transform = 'translateY(-100%)'; 85 } else { 86 // Scrolling up 87 header.style.transform = 'translateY(0)'; 88 } 89 90 lastScrollTop = scrollTop; 91 }); 92} 93 94/** 95 * Initialize carousel functionality 96 */ 97function web8b5initCarousel() { 98 const slides = document.querySelectorAll('.w08b5-carousel-slide'); 99 const indicators = document.querySelectorAll('.w08b5-carousel-indicator'); 100 101 if (slides.length === 0) return; 102 103 // Show initial slide 104 web8b5showSlide(0); 105 106 // Start auto-slide 107 web8b5startAutoSlide(); 108 109 // Add indicator click handlers 110 indicators.forEach((indicator, index) => { 111 indicator.addEventListener('click', () => { 112 web8b5showSlide(index); 113 web8b5restartAutoSlide(); 114 }); 115 }); 116 117 // Add touch swipe support 118 let touchStartX = 0; 119 let touchEndX = 0; 120 121 const carousel = document.querySelector('.w08b5-carousel'); 122 carousel.addEventListener('touchstart', (e) => { 123 touchStartX = e.changedTouches[0].screenX; 124 }); 125 126 carousel.addEventListener('touchend', (e) => { 127 touchEndX = e.changedTouches[0].screenX; 128 web8b5handleSwipe(); 129 }); 130} 131 132/** 133 * Show specific slide 134 */ 135function web8b5showSlide(index) { 136 const slides = document.querySelectorAll('.w08b5-carousel-slide'); 137 const indicators = document.querySelectorAll('.w08b5-carousel-indicator'); 138 139 if (index >= slides.length) index = 0; 140 if (index < 0) index = slides.length - 1; 141 142 web8b5_config.currentSlide = index; 143 144 // Hide all slides 145 slides.forEach((slide, i) => { 146 slide.classList.remove('active'); 147 if (i === index) { 148 slide.classList.add('active'); 149 } 150 });
151 152 // Update indicators 153 indicators.forEach((indicator, i) => { 154 indicator.classList.remove('active'); 155 if (i === index) { 156 indicator.classList.add('active'); 157 } 158 }); 159} 160 161/** 162 * Start automatic slide rotation 163 */ 164function web8b5startAutoSlide() { 165 if (web8b5_config.autoSlideInterval) { 166 clearInterval(web8b5_config.autoSlideInterval); 167 } 168 169 web8b5_config.autoSlideInterval = setInterval(() => { 170 if (web8b5_state.carouselRunning) { 171 web8b5showSlide(web8b5_config.currentSlide + 1); 172 } 173 }, 4000); 174} 175 176/** 177 * Restart auto-slide timer 178 */ 179function web8b5restartAutoSlide() { 180 web8b5startAutoSlide(); 181} 182 183/** 184 * Handle swipe gestures 185 */ 186function web8b5handleSwipe() { 187 const swipeThreshold = 50; 188 const diff = touchStartX - touchEndX; 189 190 if (Math.abs(diff) > swipeThreshold) { 191 if (diff > 0) { 192 // Swipe left - next slide 193 web8b5showSlide(web8b5_config.currentSlide + 1); 194 } else { 195 // Swipe right - previous slide 196 web8b5showSlide(web8b5_config.currentSlide - 1); 197 } 198 web8b5restartAutoSlide(); 199 } 200} 201 202/** 203 * Handle bottom navigation clicks 204 */ 205function web8b5handleBottomNav(target) { 206 // Remove active class from all nav items 207 const navItems = document.querySelectorAll('.w08b5-bottom-nav-item'); 208 navItems.forEach(item => item.classList.remove('active')); 209 210 // Add active class to clicked item 211 const currentItem = document.querySelector(`[data-nav="${target}"]`); 212 if (currentItem) { 213 currentItem.classList.add('active'); 214 } 215 216 // Handle navigation based on target 217 switch(target) { 218 case 'home': 219 window.location.href = '/'; 220 break; 221 case 'games': 222 web8b5openLink(); 223 break; 224 case 'promotions': 225 web8b5openLink(); 226 break; 227 case 'bonus': 228 web8b5openLink(); 229 break; 230 case 'help': 231 window.location.href = '/639club-faqs.html'; 232 break; 233 } 234} 235 236/** 237 * Initialize page-specific functionality 238 */ 239function web8b5initPage() { 240 // Initialize mobile functionality 241 web8b5initMobile(); 242 243 // Add smooth scrolling for anchor links 244 document.querySelectorAll('a[href^="#"]').forEach(anchor => { 245 anchor.addEventListener('click', function (e) { 246 e.preventDefault(); 247 const target = document.querySelector(this.getAttribute('href')); 248 if (target) { 249 target.scrollIntoView({ 250 behavior: 'smooth', 251 block: 'start' 252 }); 253 } 254 }); 255 }); 256 257 // Add loading animation for images 258 const images = document.querySelectorAll('img'); 259 images.forEach(img => { 260 img.addEventListener('load', function() { 261 this.classList.add('loaded'); 262 }); 263 img.addEventListener('error', function() { 264 this.classList.add('error'); 265 }); 266 }); 267} 268 269// Initialize when DOM is ready 270document.addEventListener('DOMContentLoaded', web8b5initPage); 271 272// Handle page visibility changes to pause carousel when tab is not active 273document.addEventListener('visibilitychange', function() { 274 if (document.hidden) { 275 web8b5_state.carouselRunning = false; 276 } else { 277 web8b5_state.carouselRunning = true; 278 } 279}); 280 281// Export for global access 282window.web8b5openLink = web8b5openLink; 283window.web8b5toggleMenu = web8b5toggleMenu; 284window.web8b5handleBottomNav = web8b5handleBottomNav;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.