Skip to content

Instantly share code, notes, and snippets.

@goran-rumin
Created January 14, 2019 17:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goran-rumin/7dfbdd19ffee839ae85467889dbd2a82 to your computer and use it in GitHub Desktop.
Save goran-rumin/7dfbdd19ffee839ae85467889dbd2a82 to your computer and use it in GitHub Desktop.
Youtube "Video paused. Continue watching?" confirmer for Tampermonkey
// ==UserScript==
// @name Youtube-click-OK
// @namespace http://tampermonkey.net/
// @version 0.0.1
// @description clicks YES on "Video paused. Continue watching?" dialog
// @author goran
// @match https://www.youtube.com/*
// @grant none
// ==/UserScript==
var checkInterval = 5000 //millis
function tryClick() {
if(!document.URL.includes('watch')) {
return;
}
var resumeDialogCollection = document.getElementsByTagName('ytd-popup-container').item(0).getElementsByTagName('paper-dialog');
if(resumeDialogCollection.length == 0 || resumeDialogCollection.item(0).style.display == 'none') {
return;
}
document.getElementById('confirm-button').click();
}
(function() {
'use strict';
setInterval(tryClick, checkInterval);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment