Last active
January 23, 2018 12:09
-
-
Save thienha1/d58afd6f3f0f36a5f352103ea3606c7e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 YT Embed Auto-pause | |
// @namespace [NAMEHASH] | |
// @version 0.1 | |
// @description Pauses Youtube Videos after a delay | |
// @author /u/AyrA_ch | |
// @match https://youtube.com/embed/* | |
// @match https://*.youtube.com/embed/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var autoplayOnly=false; | |
//Only run timer if video is on autoplay | |
if(!autoplayOnly || location.href.match(/[\&\?]autoplay=1/)){ | |
window.setTimeout(function(){ | |
var v=document.querySelector("video"); | |
if(v && !v.paused){ | |
v.pause(); | |
} | |
},200000); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment