Skip to content

Instantly share code, notes, and snippets.

@edvakf
Created January 1, 2011 12:28
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save edvakf/761717 to your computer and use it in GitHub Desktop.
// ==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