Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

267
Vistas
Tampermonkey waitForKeyElements on successive YouTube videos

I have a script that currently does away with those pesky "Continue watching?" prompts on YouTube, using Tampermonkey and waitForKeyElements.

However, it only seems to work if the prompt appears on the first YouTube video that I load (within the video, not between them). It doesn't seem to work for prompts on successive videos when I keep my autoplay going. When a prompt appears at the start of a new video, it doesn't seem to work at all. Here's what I'm talking about:

enter image description here

I've heard this could be because YouTube replaces "history state" and doesn't actually reload/change pages when going from one video to the next (please let me know if I'm wrong on this). How could I cater the following script to modern YouTube autoplay/"page changes"?

Basically, how do I get the waitForKeyElements and function to fire every single time the prompt appears when I autoplay videos for an extended period of time (whether on the first video or another)?

// ==UserScript==
// @name     YouTube Yes SJ3
// @include  https://www.youtube.com/*
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @require  https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant    GM_addStyle
// ==/UserScript==

waitForKeyElements ("#confirm-button.style-scope.yt-confirm-dialog-renderer.style-blue-text.size-default:contains('Yes')", clicks);

    function clicks (jNode) {
        var clickEvent = document.createEvent ('MouseEvents');
        clickEvent.initEvent ('click', true, true);
        jNode[0].dispatchEvent (clickEvent);
        console.log('SJ3');
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda