// ==UserScript== // @name Prevent HBO Max Autoplay // @namespace prevent-hbo-max-autoplay // @description Automatically clicks the cancel button to prevent HBO Max from automatically playing the next episode. // @version 0.2 // @match https://play.hbomax.com/* // @icon https://www.google.com/s2/favicons?domain=hbomax.com // @license MIT // @downloadURL none // ==/UserScript== addEventListener('beforeunload', event => { alert(1)}); setInterval(function(){ const videos = document.querySelectorAll('video') if(videos.length !== 1){ return } const video = videos[0] const secondsLeft = video.duration - video.currentTime if(secondsLeft <= 2){ console.log('Cancelling autoplay!') video.pause() } }, 1000)