• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Please note that this section is for questions regarding the forum itself - it is not for fan game-related questions. If you have a question about a fan game, ask in the appropriate thread.

  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Issue: Videos continue to play in a spoiler when hidden

  • 7
    Posts
    11
    Years
    • Seen May 18, 2024
    In my mind, when you hide a spoiler, it should stop the video playing

    this can be achieved with the following simple code

    JavaScript:
    window.addEventListener("click",e=>{
        var t=e.target;
        if (t.matches(".spoiler-block input.button")){
            if (t.value.split(" ")[0]==="Show"){
                [...t.closest(".spoiler-block").querySelectorAll("iframe")].forEach(f=>{
                    var oS = f.src;
                    f.src="";
                    f.src=oS;
                })
            }
        }
    });
     
    Back
    Top