From fe7bc5b2fa63f4b8562a961cf3910db1f3b8f7a1 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 15 Mar 2014 15:07:03 -0300 Subject: Squashed 'mod/infinite_scroll/' content from commit 68db72a git-subtree-dir: mod/infinite_scroll git-subtree-split: 68db72a726e9ccd3603acbf59914c2017276b0ed --- .../js/infinite_scroll/automatic_pagination.php | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 views/default/js/infinite_scroll/automatic_pagination.php (limited to 'views/default/js/infinite_scroll/automatic_pagination.php') diff --git a/views/default/js/infinite_scroll/automatic_pagination.php b/views/default/js/infinite_scroll/automatic_pagination.php new file mode 100644 index 000000000..6d296bb2d --- /dev/null +++ b/views/default/js/infinite_scroll/automatic_pagination.php @@ -0,0 +1,34 @@ + + +elgg.require('elgg.infinite_scroll'); +elgg.provide('elgg.infinite_scroll.automatic_pagination'); + +elgg.infinite_scroll.automatic_pagination.add_waypoint = function() { + $(this).unbind('append'); + $(this).waypoint(elgg.infinite_scroll.automatic_pagination.remove_waypoint, { + offset: '100%', + }); + +}; + +elgg.infinite_scroll.automatic_pagination.remove_waypoint = function() { + $(this).waypoint('destroy'); + $(this).click(); + $(this).bind('append', elgg.infinite_scroll.automatic_pagination.add_waypoint); +}; + +elgg.infinite_scroll.automatic_pagination.init = function() { + $('.elgg-infinite-scroll-bottom .elgg-button').waypoint( + elgg.infinite_scroll.automatic_pagination.remove_waypoint, { + offset: '100%', + } + ); +}; + +elgg.register_hook_handler('init', 'system', elgg.infinite_scroll.automatic_pagination.init); -- cgit v1.2.3