Skip to content

Instantly share code, notes, and snippets.

@FrnandMG
Last active November 25, 2015 00:44
Show Gist options
  • Save FrnandMG/6fb1a65e404cf9f55bf3 to your computer and use it in GitHub Desktop.
Save FrnandMG/6fb1a65e404cf9f55bf3 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Youtube HTML5 stop autoplay
// @namespace http://smiler.se/
// @description Prevent HTML5 videos on youtube from autoplaying
// @include http://www.youtube.com/*
// @include https://www.youtube.com/*
// @exclude http://www.youtube.com/embed/*
// @exclude https://www.youtube.com/embed/*
// @match http://www.youtube.com/*
// @match https://www.youtube.com/*
// @match http://s.ytimg.com/yts/jsbin/html5player*
// @match https://s.ytimg.com/yts/jsbin/html5player*
// @match http://*.googlevideo.com/videoplayback*
// @match https://*.googlevideo.com/videoplayback*
// @match http://*.youtube.com/videoplayback*
// @match https://*.youtube.com/videoplayback*
// @version 1.0
// ==/UserScript==
function onLoad() {
setTimeout(function(){
video = document.getElementsByTagName('video')[0];
if (video) {
video.pause();
video.currentTime = 0;
}
}, 300);
}
window.addEventListener('load', onLoad, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment