mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-13 08:34:49 +08:00
Fix comments counter for zero comments
This commit is contained in:
parent
db7c6435b3
commit
57ef9573f2
1 changed files with 8 additions and 2 deletions
|
@ -2,8 +2,14 @@
|
||||||
/* eslint-disable no-restricted-globals, no-alert */
|
/* eslint-disable no-restricted-globals, no-alert */
|
||||||
var Comments = (function() {
|
var Comments = (function() {
|
||||||
function changeCounter(comment, value) {
|
function changeCounter(comment, value) {
|
||||||
var currnetCount = $('#comment-counter-' + comment.closest('.comments-container').attr('data-object-id'));
|
var currentCount = $('#comment-counter-' + comment.closest('.comments-container').attr('data-object-id'));
|
||||||
currnetCount.html(parseInt(currnetCount.html(), 10) + value);
|
var newValue = parseInt(currentCount.html(), 10) + value;
|
||||||
|
currentCount.html(newValue);
|
||||||
|
if (newValue === 0) {
|
||||||
|
currentCount.addClass('hidden');
|
||||||
|
} else {
|
||||||
|
currentCount.removeClass('hidden');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function scrollBottom(container) {
|
function scrollBottom(container) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue