Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
// ==UserScript==
// @include http://www.youtube.com/*
// ==/UserScript==
(function() {
var clip = document.getElementsByClassName('clip');
var timer;
function handleScroll() {
clearTimeout(timer);
timer = setTimeout(function() {
Array.prototype.forEach.call(clip, function(span) {
var img = span.getElementsByTagName('img')[0];
var thumb = img.getAttribute('data-thumb');
if (thumb) {
img.removeAttribute('data-thumb');
img.src = thumb;
}
});
}, 100);
}
//window.addEventListener('scroll', handleScroll, false);
window.addEventListener('AutoPagerize_DOMNodeInserted', handleScroll, false);
window.addEventListener('AutoPatchWork.DOMNodeInserted', handleScroll, false);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment