blob: 66cdbbf9b76bd3303c4629cd7f22349b19b5d85d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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');
}
}
|