diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2014-03-15 15:07:03 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2014-03-15 15:07:03 -0300 |
commit | 6800aad47fb4208289171b1125eba69ccf93c08c (patch) | |
tree | b4edbb7d60a0ab81be446980294f65c183044326 /mod/infinite_scroll/start.php | |
parent | 82ca8e9f8839b98a5770a90027adcecbe603d06f (diff) | |
parent | fe7bc5b2fa63f4b8562a961cf3910db1f3b8f7a1 (diff) | |
download | elgg-6800aad47fb4208289171b1125eba69ccf93c08c.tar.gz elgg-6800aad47fb4208289171b1125eba69ccf93c08c.tar.bz2 |
Merge commit 'fe7bc5b2fa63f4b8562a961cf3910db1f3b8f7a1' as 'mod/infinite_scroll'
Diffstat (limited to 'mod/infinite_scroll/start.php')
-rw-r--r-- | mod/infinite_scroll/start.php | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/mod/infinite_scroll/start.php b/mod/infinite_scroll/start.php new file mode 100644 index 000000000..66cdbbf9b --- /dev/null +++ b/mod/infinite_scroll/start.php @@ -0,0 +1,44 @@ +<?php +/** + * Elgg Infinite Scroll + * + * @package ElggInfiniteScroll + */ + +elgg_register_event_handler('init', 'system', 'infinite_scroll_init'); + +/** + * Initialize the infinite scroll plugin. + * + */ +function infinite_scroll_init() { + + if (elgg_get_plugin_user_setting('pagination_type') != 'classic') { + + elgg_register_ajax_view('infinite_scroll/list'); + + // Extend the main css view + elgg_extend_view('css/elgg', 'infinite_scroll/css'); + + // register the infinite scroll's JavaScript + $infinite_scroll_js = elgg_get_simplecache_url('js', 'infinite_scroll/infinite_scroll'); + elgg_register_simplecache_view('js/infinite_scroll/infinite_scroll'); + elgg_register_js('elgg.infinite_scroll', $infinite_scroll_js); + + if (elgg_get_plugin_user_setting('pagination_type') == 'automatic') { + // Register javascript needed for automatic pagination + $js_url = 'mod/infinite_scroll/vendors/jquery-waypoints/waypoints.min.js'; + elgg_register_js('jquery-waypoints', $js_url); + + $automatic_pagination_js = elgg_get_simplecache_url('js', 'infinite_scroll/automatic_pagination'); + elgg_register_simplecache_view('js/infinite_scroll/automatic_pagination'); + elgg_register_js('elgg.infinite_scroll.automatic_pagination', $automatic_pagination_js); + } + + $new_items_js = elgg_get_simplecache_url('js', 'infinite_scroll/new_items'); + elgg_register_simplecache_view('js/infinite_scroll/new_items'); + elgg_register_js('elgg.infinite_scroll.new_items', $new_items_js); + + elgg_extend_view('navigation/pagination', 'infinite_scroll/initialize_js'); + } +} |