Last active
December 31, 2015 23:49
-
-
Save THEtheChad/8062911 to your computer and use it in GitHub Desktop.
Facebook auto load
This file contains hidden or 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
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