1/** 2 * Stephenmoyeronline - California Online Casino 3 * JavaScript functionality 4 */ 5 6(function() { 7 'use strict'; 8 9 document.addEventListener('DOMContentLoaded', function() { 10 initBurgerMenu(); 11 initTOCToggle(); 12 initFAQ(); 13 initSmoothScroll(); 14 initImageErrorHandling(); 15 }); 16 17 /** 18 * Burger Menu Toggle 19 */ 20 function initBurgerMenu() { 21 const burgerBtn = document.querySelector('.burger-menu'); 22 const mobileNav = document.querySelector('.mobile-nav'); 23 const mobileNavLinks = document.querySelectorAll('.mobile-nav-list a'); 24 25 if (burgerBtn && mobileNav) { 26 burgerBtn.addEventListener('click', function() { 27 this.classList.toggle('active'); 28 mobileNav.classList.toggle('active'); 29 mobileNav.setAttribute('aria-hidden', !mobileNav.classList.contains('active')); 30 document.body.style.overflow = mobileNav.classList.contains('active') ? 'hidden' : ''; 31 }); 32 33 mobileNavLinks.forEach(function(link) { 34 link.addEventListener('click', function() { 35 burgerBtn.classList.remove('active'); 36 mobileNav.classList.remove('active'); 37 mobileNav.setAttribute('aria-hidden', 'true'); 38 document.body.style.overflow = ''; 39 }); 40 }); 41 } 42 } 43 44 /** 45 * Table of Contents Toggle 46 */ 47 function initTOCToggle() { 48 const tocToggle = document.querySelector('.toc-toggle'); 49 const tocContent = document.querySelector('.toc-content'); 50 51 if (tocToggle && tocContent) { 52 tocToggle.addEventListener('click', function() { 53 const isExpanded = this.getAttribute('aria-expanded') === 'true'; 54 this.setAttribute('aria-expanded', !isExpanded); 55 tocContent.classList.toggle('open'); 56 }); 57 } 58 } 59 60 /** 61 * FAQ Accordion functionality 62 */ 63 function initFAQ() { 64 const faqItems = document.querySelectorAll('.faq-item'); 65 66 faqItems.forEach(function(item) { 67 const question = item.querySelector('.faq-question'); 68 69 if (question) { 70 question.addEventListener('click', function() { 71 const isActive = item.classList.contains('active'); 72 73 faqItems.forEach(function(otherItem) { 74 if (otherItem !== item) { 75 otherItem.classList.remove('active'); 76 const otherQuestion = otherItem.querySelector('.faq-question'); 77 if (otherQuestion) { 78 otherQuestion.setAttribute('aria-expanded', 'false'); 79 } 80 } 81 }); 82 83 item.classList.toggle('active'); 84 question.setAttribute('aria-expanded', !isActive); 85 }); 86 } 87 }); 88 } 89 90 /** 91 * Smooth scroll for anchor links 92 */ 93 function initSmoothScroll() { 94 const anchorLinks = document.querySelectorAll('a[href^="#"]'); 95 96 anchorLinks.forEach(function(link) { 97 link.addEventListener('click', function(e) { 98 const targetId = this.getAttribute('href'); 99 100 if (targetId === '#') return; 101 102 const targetElement = document.querySelector(targetId); 103 104 if (targetElement) { 105 e.preventDefault(); 106 107 const headerOffset = 20; 108 const elementPosition = targetElement.getBoundingClientRect().top; 109 const offsetPosition = elementPosition + window.pageYOffset - headerOffset; 110 111 window.scrollTo({ 112 top: offsetPosition, 113 behavior: 'smooth' 114 }); 115 } 116 }); 117 }); 118 } 119 120 /** 121 * Image error handling - show skeleton on error 122 */ 123 function initImageErrorHandling() { 124 const images = document.querySelectorAll('img'); 125
126 images.forEach(function(img) { 127 if (img.complete && img.naturalHeight === 0) { 128 showSkeleton(img); 129 } 130 131 img.addEventListener('error', function() { 132 showSkeleton(this); 133 }); 134 135 img.addEventListener('load', function() { 136 hideSkeleton(this); 137 }); 138 }); 139 } 140 141 function showSkeleton(img) { 142 img.style.display = 'none'; 143 const skeleton = img.previousElementSibling; 144 if (skeleton && skeleton.classList.contains('skeleton')) { 145 skeleton.style.display = 'block'; 146 } 147 } 148 149 function hideSkeleton(img) { 150 img.style.display = 'block'; 151 const skeleton = img.previousElementSibling; 152 if (skeleton && skeleton.classList.contains('skeleton')) { 153 skeleton.style.display = 'none'; 154 } 155 } 156 157})();
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.