Created
January 1, 2011 12:28
-
-
Save edvakf/761717 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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