mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-11 09:26:37 +08:00
Added check if no comments are present for file result, which caused JS error.
This commit is contained in:
parent
303cb4308a
commit
0317872bc0
1 changed files with 18 additions and 17 deletions
|
@ -12,23 +12,24 @@
|
|||
} else if ( $(".result-comment") && $(".result-comment").length > 0 ) {
|
||||
comments = $(".result-comment");
|
||||
}
|
||||
$.each(comments, function(){
|
||||
var that = $(this);
|
||||
var link = that.attr("data-href");
|
||||
$.ajax({ method: 'GET',
|
||||
url: link,
|
||||
beforeSend: animateSpinner(that, true) })
|
||||
.done(function(data) {
|
||||
that.html(data.html);
|
||||
initCommentForm(that);
|
||||
initCommentsLink(that);
|
||||
scrollBottom(that.find(".content-comments"));
|
||||
animateSpinner(that, false);
|
||||
})
|
||||
.always(function() {
|
||||
animateSpinner(that, false);
|
||||
});
|
||||
});
|
||||
if(!_.isUndefined(comments)) {
|
||||
$.each(comments, function(){
|
||||
var that = $(this);
|
||||
var link = that.attr('data-href');
|
||||
$.ajax({ method: 'GET',
|
||||
url: link,
|
||||
beforeSend: animateSpinner(that, true) })
|
||||
.done(function(data) {
|
||||
that.html(data.html);
|
||||
initCommentForm(that);
|
||||
initCommentsLink(that);
|
||||
scrollBottom(that.find('.content-comments'));
|
||||
})
|
||||
.always(function() {
|
||||
animateSpinner(that, false);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// scroll to the botttom
|
||||
|
|
Loading…
Reference in a new issue