Skip to content

Instantly share code, notes, and snippets.

@uahim
Last active August 27, 2017 21:04
Show Gist options
  • Save uahim/9fa6264ccf7425f17a89e3c8d1121d8b to your computer and use it in GitHub Desktop.
Save uahim/9fa6264ccf7425f17a89e3c8d1121d8b to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name stop (actually: pause) youtube html5 player on loading
// @author mihau
// @version 0.1
// @include http*://*.youtube.com/*
// @include http*://youtube.com/*
// ==/UserScript==
function ytstop() {
setTimeout("buttoncheck()", 200);
}
function buttoncheck() {
if (document.getElementsByClassName('ytp-play-button')[0].getAttribute('aria-label') == 'Pause') {
setTimeout("document.getElementsByClassName('ytp-play-button')[0].click()", 200);
} else {
buttoncheck();
}
}
window.addEventListener('DOMContentLoaded', ytstop, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment