[Git][noosfero/noosfero][master] comments: load comments on scroll only if there are comments on the page
Rodrigo Souto
gitlab at mg.gitlab.com
Mon Sep 24 17:30:50 BRT 2018
Rodrigo Souto pushed to branch master at Noosfero / noosfero
Commits:
70794a36 by Rodrigo Souto at 2018-09-24T20:30:40Z
comments: load comments on scroll only if there are comments on the page
- - - - -
1 changed file:
- public/javascripts/upload-file.js
Changes:
=====================================
public/javascripts/upload-file.js
=====================================
@@ -1,18 +1,20 @@
function loadMoreComments() {
var commentList = $('#article-comments-list');
- var pageId = commentList.data('page');
- var profile = commentList.data('profile');
- var nextCommentPage = commentList.data('comment-page') + 1;
+ if (commentList.length > 0) {
+ var pageId = commentList.data('page');
+ var profile = commentList.data('profile');
+ var nextCommentPage = commentList.data('comment-page') + 1;
- $.get('/' + profile + '/' + pageId + '/view_more_comments', {
- comment_page: nextCommentPage,
- id: pageId,
- dataType: 'json'
- })
- .done(function() {
- commentList.data('comment-page', nextCommentPage);
- $(window).bind('scroll', bindScroll);
- });
+ $.get('/' + profile + '/' + pageId + '/view_more_comments', {
+ comment_page: nextCommentPage,
+ id: pageId,
+ dataType: 'json'
+ })
+ .done(function() {
+ commentList.data('comment-page', nextCommentPage);
+ $(window).bind('scroll', bindScroll);
+ });
+ }
}
function bindScroll() {
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/70794a362c25aabc2b9d0f2857cd499f423817f8
--
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/70794a362c25aabc2b9d0f2857cd499f423817f8
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180924/c2e3be3f/attachment-0001.html>
More information about the Noosfero-dev
mailing list