Sha256: c203bebb6ff97b939f83723f874df3591722d1fcea61ca749ff672fafddb55de
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 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() { $.ajax({ url: $(this).data('spaghetti-url') + '?page=' + $(this).data('spaghetti-next-page'), type: 'get', dataType: 'script', success: function() { $(this).removeClass('spaghetti-empty'); } }); }); $(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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spaghetti-0.3.3 | vendor/assets/javascripts/spaghetti/init.js |
spaghetti-0.3.2 | vendor/assets/javascripts/spaghetti/init.js |
spaghetti-0.3.0 | vendor/assets/javascripts/spaghetti/init.js |