Spaces:
Running
Running
| // Age verification | |
| function showAgeVerification() { | |
| const verification = document.createElement('div'); | |
| verification.className = 'age-verification'; | |
| verification.innerHTML = ` | |
| <div class="age-verification-content"> | |
| <h2>Age Verification</h2> | |
| <p>This website contains adult content and is only suitable for those who are 18 years or older. By entering, you confirm that you are at least 18 years of age or the legal age in your jurisdiction to view such material.</p> | |
| <div class="age-verification-buttons"> | |
| <button class="age-verification-btn enter">I am 18 or older - Enter</button> | |
| <button class="age-verification-btn exit">I am under 18 - Exit</button> | |
| </div> | |
| </div> | |
| `; | |
| document.body.appendChild(verification); | |
| verification.querySelector('.enter').addEventListener('click', () => { | |
| document.body.removeChild(verification); | |
| document.cookie = "age_verified=true; max-age=2592000; path=/"; // 30 days | |
| }); | |
| verification.querySelector('.exit').addEventListener('click', () => { | |
| window.location.href = "https://www.google.com"; | |
| }); | |
| } | |
| // Check if age is already verified | |
| if (document.cookie.indexOf('age_verified=true') === -1) { | |
| showAgeVerification(); | |
| } | |
| document.addEventListener('DOMContentLoaded', () => { | |
| // Smooth scrolling for anchor links | |
| document.querySelectorAll('a[href^="#"]').forEach(anchor => { | |
| anchor.addEventListener('click', function (e) { | |
| e.preventDefault(); | |
| document.querySelector(this.getAttribute('href')).scrollIntoView({ | |
| behavior: 'smooth' | |
| }); | |
| }); | |
| }); | |
| // Animation on scroll | |
| const animateOnScroll = () => { | |
| const elements = document.querySelectorAll('.animate-on-scroll'); | |
| elements.forEach(element => { | |
| const elementPosition = element.getBoundingClientRect().top; | |
| const screenPosition = window.innerHeight / 1.3; | |
| if (elementPosition < screenPosition) { | |
| element.classList.add('animate-fadeIn'); | |
| } | |
| }); | |
| }; | |
| window.addEventListener('scroll', animateOnScroll); | |
| animateOnScroll(); // Run once on load | |
| }); |