Created
January 14, 2019 17:30
-
-
Save goran-rumin/7dfbdd19ffee839ae85467889dbd2a82 to your computer and use it in GitHub Desktop.
Youtube "Video paused. Continue watching?" confirmer for Tampermonkey
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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