const redirect = 'https://go.enderman.ch/youtube'; let video = document.querySelector('#player'); async function sleep(ms) { await new Promise(resolve => setTimeout(resolve, ms)); } document.querySelector('.content').onclick = () => { document.title = 'Downloading...'; video.style.cursor = 'default'; video.play(); } video.addEventListener('ended', async () => { document.title = 'Download complete!'; await sleep(1500); window.location.replace(redirect); });