Unfortunately I can't comment on Niklas' answer, but his answer is correct. The one thing I would change is to issue a Dojo event in the case where you've scrolled to the bottom instead of calling a specific function.
var scrollingDetector = (function() {
var max = calculateScrollHeight();
return function(){
if (max < window.pageYOffset) {
max = calculateScrollHeight();
dojo.publish('/newsApp/onScrollBottom');
}
}
function calculateScrollHeight(){
return (document.documentElement.scrollHeight - document.documentElement.clientHeight) - 80;
}
})();
setInterval(scrollingDetector, 500);
(I also took the liberty of refactoring slightly in the interest of performance, as we only need to recalculate the height when we hit the bottom of the page).
This will allow you to hook into this event elsewhere in your code without having to edit this snippet or override the onMoreButtonClick() function.