aboutsummaryrefslogtreecommitdiff
path: root/views/default/js/infinite_scroll/automatic_pagination.php
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-15 15:07:03 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-15 15:07:03 -0300
commitfe7bc5b2fa63f4b8562a961cf3910db1f3b8f7a1 (patch)
treef3cd74d36b8cee66c63db2829380ae2ae665b64e /views/default/js/infinite_scroll/automatic_pagination.php
downloadelgg-fe7bc5b2fa63f4b8562a961cf3910db1f3b8f7a1.tar.gz
elgg-fe7bc5b2fa63f4b8562a961cf3910db1f3b8f7a1.tar.bz2
Squashed 'mod/infinite_scroll/' content from commit 68db72a
git-subtree-dir: mod/infinite_scroll git-subtree-split: 68db72a726e9ccd3603acbf59914c2017276b0ed
Diffstat (limited to 'views/default/js/infinite_scroll/automatic_pagination.php')
-rw-r--r--views/default/js/infinite_scroll/automatic_pagination.php34
1 files changed, 34 insertions, 0 deletions
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 @@
+<?php
+/**
+ * Load next page of a listing through ajax automatically
+ *
+ * @package ElggInfiniteScroll
+ */
+?>
+
+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);