diff options
Diffstat (limited to 'mod/riverdashboard/views/default/riverdashboard/js.php')
-rw-r--r-- | mod/riverdashboard/views/default/riverdashboard/js.php | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/mod/riverdashboard/views/default/riverdashboard/js.php b/mod/riverdashboard/views/default/riverdashboard/js.php index 1e97a510a..37de3ad04 100644 --- a/mod/riverdashboard/views/default/riverdashboard/js.php +++ b/mod/riverdashboard/views/default/riverdashboard/js.php @@ -8,7 +8,7 @@ var myParent = $(this).closest('.river_item'); if (myParent.find('.likes_list').css('display') == 'none') { // hide comments - myParent.find('.river_comment').animate({"height": "toggle", "opacity": "toggle"}, { duration: 400 }); + myParent.find('.comments_container').animate({"height": "toggle", "opacity": "toggle"}, { duration: 400 }); // change selected tab myParent.find('.show_comments_button').addClass('off'); myParent.find('.likes_user_list_button').removeClass('off'); @@ -19,16 +19,33 @@ $('.show_comments_button').click(function() { var myParent = $(this).closest('.river_item'); - if (myParent.find('.river_comment').css('display') == 'none') { - // hide comments + if (myParent.find('.comments_container').css('display') == 'none') { + // hide likes myParent.find('.likes_list').animate({"height": "toggle", "opacity": "toggle"}, { duration: 400 }); // change selected tab myParent.find('.show_comments_button').removeClass('off'); myParent.find('.likes_user_list_button').addClass('off'); // show users that liked object - elgg_slide_toggle(this, '.river_item', '.river_comment'); + elgg_slide_toggle(this, '.river_item', '.comments_container'); } }); + // grab more comments + $('.river_show_more_comments').click(function() { + var riverItem = $(this).closest('.river_item'); + var guid = riverItem.attr('id').replace('river_entity_', ''); + var commentsList = riverItem.find('.comments_list'); + var numComments = riverItem.find('.river_comment').length; + + var params = { + 'entity_guid': guid, + 'offset': numComments + } + + $.post('<?php echo $vars['url'];?>mod/riverdashboard/endpoint/get_comments.php', params, function(data) { + commentsList.prepend(data); + commentsList.prev('.river_show_more_comments').hide(); + }); + }); }); </script>
\ No newline at end of file |