Skip to content

Instantly share code, notes, and snippets.

@THEtheChad
Last active December 31, 2015 23:49
Show Gist options
  • Save THEtheChad/8062911 to your computer and use it in GitHub Desktop.
Save THEtheChad/8062911 to your computer and use it in GitHub Desktop.
Facebook auto load
var results = document.getElementById('browse_result_area');
results.style.display = 'none';
function debounce(func, delay){
var timer;
return function(){
clearTimeout(timer);
timer = setTimeout(func, delay);
}
}
var loader;
var finished;
var loadMore = debounce(function(){
loader = setTimeout(function(){
console.log('loading list...');
document.body.scrollTop = document.body.clientHeight;
clearTimeout(finished);
});
finished = setTimeout(function(){
console.log('completed!');
results.style.display = 'block';
clearTimeout(loader);
}, 5000)
}, 100);
results.addEventListener('DOMNodeInserted', loadMore);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment