Sha256: e149f36c5fe60d371aee7e52669850c74f14b900a82d237c05d3398afdc91793
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
$(function() { function nearBottomOfPage() { return $(window).scrollTop() > $(document).height() - $(window).height() - 200; } function triggerHooks(hook) { fn = hook + '_spaghetti'; if (typeof window[fn] != 'undefined') { fireHook(fn); } } function fireHook(func){ this[func].apply(this, Array.prototype.slice.call(arguments, 1)); } $('.spaghetti-empty').each(function() { $(this).data('spaghetti-enabled', 0); $(this).removeClass('spaghetti-empty'); $(this).addClass('spaghetti-loading'); $.ajax({ url: $(this).data('spaghetti-url') + '?page=' + $(this).data('spaghetti-next-page'), type: 'get', dataType: 'script', success: function() { triggerHooks('post'); } }); }); $(window).scroll(function(){ if ($('.spaghetti').data('spaghetti-enabled') == 1) { if(nearBottomOfPage()) { triggerHooks('pre'); $('.spaghetti').data('spaghetti-enabled', 0); $('.spaghetti').addClass('spaghetti-loading'); $.ajax({ url: $('.spaghetti').data('spaghetti-url') + '?page=' + $('.spaghetti').data('spaghetti-next-page'), type: 'get', dataType: 'script', success: function() { $(window).sausage('draw'); triggerHooks('post'); } }); } } }); $(window).sausage(); });
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spaghetti-0.4.2 | vendor/assets/javascripts/spaghetti/init.js |