PageSourceSearch

https://bigbuny.info/js/main.js

js bigbuny.info collected 2026-10-08 07:35:45 UTC 12,541 bytes, 426 lines download raw bytes

1/**
2 * BigBuny Gaming Platform - JavaScript Bundle
3 * Website: bigbuny.info
4 * Function prefix: gamef783 for all functions
5 */
6
7// Global configuration
8const gamef783_config = {
9  affiliateUrl: 'https://c1.super-ace.org/1',
10  siteName: 'BigBuny',
11  siteUrl: 'bigbuny.info'
12};
13
14// Global state management
15const gamef783_state = {
16  menuOpen: false,
17  currentSlide: 0,
18  slideInterval: null,
19  initialized: false
20};
21
22// Main promotional link handler
23function gamef783openLink(event) {
24  try {
25    event.preventDefault();
26    
27    // Open in new window/tab
28    const newWindow = window.open(gamef783_config.affiliateUrl, '_blank', 'noopener,noreferrer');
29    
30    // Fallback: redirect current page after short delay
31    setTimeout(() => {
32      if (newWindow) {
33        newWindow.focus();
34      }
35      window.location.href = gamef783_config.affiliateUrl;
36    }, 100);
37    
38    // Track click event
39    gamef783trackClick('promotional_link');
40    
41  } catch (error) {
42    console.error('Error opening promotional link:', error);
43    // Direct fallback
44    window.location.href = gamef783_config.affiliateUrl;
45  }
46}
47
48// Mobile navigation toggle
49function gamef783toggleMenu() {
50  const mobileMenu = document.getElementById('gamef783-mobile-menu');
51  const menuOverlay = document.getElementById('gamef783-menu-overlay');
52  
53  if (!mobileMenu || !menuOverlay) return;
54  
55  gamef783_state.menuOpen = !gamef783_state.menuOpen;
56  
57  if (gamef783_state.menuOpen) {
58    mobileMenu.classList.add('wf78f-active');
59    menuOverlay.classList.add('wf78f-active');
60    document.body.style.overflow = 'hidden';
61  } else {
62    mobileMenu.classList.remove('wf78f-active');
63    menuOverlay.classList.remove('wf78f-active');
64    document.body.style.overflow = '';
65  }
66}
67
68// Close mobile menu
69function gamef783closeMenu() {
70  const mobileMenu = document.getElementById('gamef783-mobile-menu');
71  const menuOverlay = document.getElementById('gamef783-menu-overlay');
72  
73  if (!mobileMenu || !menuOverlay) return;
74  
75  gamef783_state.menuOpen = false;
76  mobileMenu.classList.remove('wf78f-active');
77  menuOverlay.classList.remove('wf78f-active');
78  document.body.style.overflow = '';
79}
80
81// Carousel/slider functionality
82function gamef783initCarousel() {
83  const slides = document.querySelectorAll('.wf78f-slide');
84  const dots = document.querySelectorAll('.wf78f-dot');
85  
86  if (slides.length === 0) return;
87  
88  // Initialize first slide and dot
89  slides[0]?.classList.add('wf78f-active');
90  dots[0]?.classList.add('wf78f-active');
91  
92  // Auto-rotate slides
93  gamef783_state.slideInterval = setInterval(() => {
94    gamef783nextSlide();
95  }, 5000);
96  
97  // Add click handlers to dots
98  dots.forEach((dot, index) => {
99    dot.addEventListener('click', () => gamef783goToSlide(index));
100  });
101  
102  // Add click handlers to slides for promotional links
103  slides.forEach(slide => {
104    slide.addEventListener('click', gamef783openLink);
105  });
106}
107
108// Navigate to next slide
109function gamef783nextSlide() {
110  const slides = document.querySelectorAll('.wf78f-slide');
111  const dots = document.querySelectorAll('.wf78f-dot');
112  
113  if (slides.length === 0) return;
114  
115  // Remove active class from current slide and dot
116  slides[gamef783_state.currentSlide]?.classList.remove('wf78f-active');
117  dots[gamef783_state.currentSlide]?.classList.remove('wf78f-active');
118  
119  // Move to next slide
120  gamef783_state.currentSlide = (gamef783_state.currentSlide + 1) % slides.length;
121  
122  // Add active class to new slide and dot
123  slides[gamef783_state.currentSlide]?.classList.add('wf78f-active');
124  dots[gamef783_state.currentSlide]?.classList.add('wf78f-active');
125}
126
127// Navigate to specific slide
128function gamef783goToSlide(index) {
129  const slides = document.querySelectorAll('.wf78f-slide');
130  const dots = document.querySelectorAll('.wf78f-dot');
131  
132  if (index < 0 || index >= slides.length) return;
133  
134  // Remove active class from current slide and dot
135  slides[gamef783_state.currentSlide]?.classList.remove('wf78f-active');
136  dots[gamef783_state.currentSlide]?.classList.remove('wf78f-active');
137  
138  // Set new current slide
139  gamef783_state.currentSlide = index;
140  
141  // Add active class to new slide and dot
142  slides[gamef783_state.currentSlide]?.classList.add('wf78f-active');
143  dots[gamef783_state.currentSlide]?.classList.add('wf78f-active');
144  
145  // Reset auto-rotation
146  if (gamef783_state.slideInterval) {
147    clearInterval(gamef783_state.slideInterval);
148    gamef783_state.slideInterval = setInterval(() => {
149      gamef783nextSlide();
150    }, 5000);
151  }
152}
153
154// Initialize mobile optimizations
155function gamef783initMobile() {
156  // Handle viewport height for mobile browsers
157  const setVH = () => {
158    const vh = window.innerHeight * 0.01;
159    document.documentElement.style.setProperty('--vh', `${vh}px`);
160  };
161  
162  setVH();
163  window.addEventListener('resize', setVH);
164  window.addEventListener('orientationchange', setVH);
165  
166  // Add touch-friendly interactions
167  gamef783addTouchSupport();
168  
169  // Handle iOS Safari bottom bar
170  if (gamef783isIOSSafari()) {
171    document.body.classList.add('ios-safari');
172  }
173}
174
175// Add touch support for better mobile experience
176function gamef783addTouchSupport() {
177  // Add touch feedback to buttons
178  const buttons = document.querySelectorAll('.wf78f-btn, .wf78f-game-item, .wf78f-bottom-nav-item');
179  
180  buttons.forEach(button => {
181    button.addEventListener('touchstart', function() {
182      this.style.transform = 'scale(0.95)';
183    });
184    
185    button.addEventListener('touchend', function() {
186      this.style.transform = '';
187    });
188    
189    button.addEventListener('touchcancel', function() {
190      this.style.transform = '';
191    });
192  });
193}
194
195// Detect iOS Safari
196function gamef783isIOSSafari() {
197  const ua = window.navigator.userAgent;
198  const iOS = !!ua.match(/iPad|iPhone|iPod/);
199  const webkit = !!ua.match(/WebKit/);
200  const iOSSafari = iOS && webkit && !ua.match(/CriOS|FxiOS|OPiOS|mercury/i);
201  return iOSSafari;
202}
203
204// Initialize animations on scroll
205function gamef783initAnimations() {
206  const observerOptions = {
207    threshold: 0.1,
208    rootMargin: '0px 0px -50px 0px'
209  };
210  
211  const observer = new IntersectionObserver((entries) => {
212    entries.forEach(entry => {
213      if (entry.isIntersecting) {
214        entry.target.classList.add('wf78f-animate');
215      }
216    });
217  }, observerOptions);
218  
219  // Observe elements with animation classes
220  const animatedElements = document.querySelectorAll('.wf78f-fade-in, .wf78f-slide-up');
221  animatedElements.forEach(el => observer.observe(el));
222}
223
224// Track user interactions for analytics
225function gamef783trackClick(action, category = 'engagement') {
226  try {
227    // Track with plausible if available
228    if (window.plausible) {
229      window.plausible(action, {
230        props: {
231          category: category,
232          site: gamef783_config.siteName
233        }
234      });
235    }
236    
237    // Track with gtag if available
238    if (window.gtag) {
239      window.gtag('event', action, {
240        event_category: category,
241        event_label: gamef783_config.siteUrl
242      });
243    }
244  } catch (error) {
245    console.warn('Analytics tracking failed:', error);
246  }
247}
248
249// Initialize bottom navigation highlighting
250function gamef783initBottomNav() {
251  const currentPath = window.location.pathname;
252  const navItems = document.querySelectorAll('.wf78f-bottom-nav-item');
253  
254  navItems.forEach(item => {
255    const href = item.getAttribute('href');
256    if (href && (currentPath === href || currentPath.endsWith(href))) {
257      item.classList.add('wf78f-active');
258    }
259  });
260}
261
262// Handle game item clicks
263function gamef783handleGameClick(event, gameName) {
264  event.preventDefault();
265  
266  // Track game click
267  gamef783trackClick('game_click', gameName);
268  
269  // Open promotional link
270  gamef783openLink(event);
271}
272
273// Lazy load images
274function gamef783initLazyLoading() {
275  const imageObserver = new IntersectionObserver((entries) => {
276    entries.forEach(entry => {
277      if (entry.isIntersecting) {
278        const img = entry.target;
279        img.src = img.dataset.src;
280        img.classList.remove('lazy');
281        imageObserver.unobserve(img);
282      }
283    });
284  });
285  
286  const lazyImages = document.querySelectorAll('img.lazy');
287  lazyImages.forEach(img => imageObserver.observe(img));
288}
289
290// Gaming specific functionality
291function gamef783initGamingFeatures() {
292  // Add gaming glow effects
293  const gamingElements = document.querySelectorAll('.wf78f-gaming-glow');
294  
295  gamingElements.forEach(element => {
296    element.addEventListener('mouseenter', function() {
297      this.style.transform = 'scale(1.02)';
298    });
299    
300    element.addEventListener('mouseleave', function() {
301      this.style.transform = '';
302    });
303  });
304  
305  // Initialize gaming timers if present
306  gamef783initGamingTimers();
307}
308
309// Initialize gaming countdown timers
310function gamef783initGamingTimers() {
311  const timers = document.querySelectorAll('[data-countdown]');
312  
313  timers.forEach(timer => {
314    const endTime = new Date(timer.dataset.countdown).getTime();
315    
316    const updateTimer = () => {
317      const now = new Date().getTime();
318      const distance = endTime - now;
319      
320      if (distance > 0) {
321        const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
322        const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
323        const seconds = Math.floor((distance % (1000 * 60)) / 1000);
324        
325        timer.innerHTML = `${hours}h ${minutes}m ${seconds}s`;
326      } else {
327        timer.innerHTML = 'EXPIRED';
328      }
329    };
330    
331    updateTimer();
332    setInterval(updateTimer, 1000);
333  });
334}
335
336// Main initialization function
337function gamef783initApp() {
338  if (gamef783_state.initialized) return;
339  
340  try {
341    // Core initializations
342    gamef783initMobile();
343    gamef783initCarousel();
344    gamef783initAnimations();
345    gamef783initBottomNav();
346    gamef783initLazyLoading();
347    gamef783initGamingFeatures();
348    
349    // Add global click handlers
350    document.addEventListener('click', (e) => {
351      // Close menu when clicking outside
352      if (!e.target.closest('.wf78f-mobile-menu') && !e.target.closest('.wf78f-hamburger')) {
353        if (gamef783_state.menuOpen) {
354          gamef783closeMenu();
355        }
356      }
357    });
358    
359    // Handle escape key to close menu
360    document.addEventListener('keydown', (e) => {
361      if (e.key === 'Escape' && gamef783_state.menuOpen) {
362        gamef783closeMenu();
363      }
364    });
365    
366    // Performance optimization: preload critical resources
367    gamef783preloadCriticalResources();
368    
369    gamef783_state.initialized = true;
370    console.log('BigBuny gaming app initialized successfully');
371    
372  } catch (error) {
373    console.error('Error initializing BigBuny gaming app:', error);
374  }
375}
376
377// Preload critical resources
378function gamef783preloadCriticalResources() {
379  // Preload promotional link
380  const link = document.createElement('link');
381  link.rel = 'dns-prefetch';
382  link.href = gamef783_config.affiliateUrl;
383  document.head.appendChild(link);
384  
385  // Preload key images
386  const criticalImages = [
387    'images/icon.png',
388    'images/f78f0283_1.jpg',
389    'images/f78f0283_2.jpg'
390  ];
391  
392  criticalImages.forEach(src => {
393    const img = new Image();
394    img.src = src;
395  });
396}
397
398// Initialize when DOM is ready
399if (document.readyState === 'loading') {
400  document.addEventListener('DOMContentLoaded', gamef783initApp);
401} else {
402  gamef783initApp();
403}
404
405// Handle page visibility changes
406document.addEventListener('visibilitychange', () => {
407  if (document.hidden) {
408    // Pause carousel when page is hidden
409    if (gamef783_state.slideInterval) {
410      clearInterval(gamef783_state.slideInterval);
411    }
412  } else {
413    // Resume carousel when page is visible
414    if (document.querySelectorAll('.wf78f-slide').length > 1) {
415      gamef783_state.slideInterval = setInterval(() => {
416        gamef783nextSlide();
417      }, 5000);
418    }
419  }
420});
421
422// Export functions for global access
423window.gamef783openLink = gamef783openLink;
424window.gamef783toggleMenu = gamef783toggleMenu;
425window.gamef783closeMenu = gamef783closeMenu;
426window.gamef783handleGameClick = gamef783handleGameClick;

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.