Skip to content

Instantly share code, notes, and snippets.

@thienha1
Last active January 23, 2018 12:09
Show Gist options
  • Save thienha1/d58afd6f3f0f36a5f352103ea3606c7e to your computer and use it in GitHub Desktop.
Save thienha1/d58afd6f3f0f36a5f352103ea3606c7e to your computer and use it in GitHub Desktop.
// ==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