|
|
|
@ -178,18 +178,34 @@ define(["app/dom", "app/utils", "app/config", "app/api", "app/jade", "app/i18n",
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (config.vote) {
|
|
|
|
|
// update vote counter, but hide if votes sum to 0
|
|
|
|
|
var voteLevels = config['vote-levels'];
|
|
|
|
|
if (typeof voteLevels === 'string') {
|
|
|
|
|
// Eg. -5,5,15
|
|
|
|
|
voteLevels = voteLevels.split(',');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// update vote counter
|
|
|
|
|
var votes = function (value) {
|
|
|
|
|
var span = $("span.votes", footer);
|
|
|
|
|
if (span === null) {
|
|
|
|
|
if (value !== 0) {
|
|
|
|
|
footer.prepend($.new("span.votes", value));
|
|
|
|
|
}
|
|
|
|
|
footer.prepend($.new("span.votes", value));
|
|
|
|
|
} else {
|
|
|
|
|
if (value === 0) {
|
|
|
|
|
span.remove();
|
|
|
|
|
} else {
|
|
|
|
|
span.textContent = value;
|
|
|
|
|
span.textContent = value;
|
|
|
|
|
}
|
|
|
|
|
if (value) {
|
|
|
|
|
el.classList.remove('isso-no-votes');
|
|
|
|
|
} else {
|
|
|
|
|
el.classList.add('isso-no-votes');
|
|
|
|
|
}
|
|
|
|
|
if (voteLevels) {
|
|
|
|
|
var before = true;
|
|
|
|
|
for (var index = 0; index <= voteLevels.length; index++) {
|
|
|
|
|
if (before && (index >= voteLevels.length || value < voteLevels[index])) {
|
|
|
|
|
el.classList.add('isso-vote-level-' + index);
|
|
|
|
|
before = false;
|
|
|
|
|
} else {
|
|
|
|
|
el.classList.remove('isso-vote-level-' + index);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
@ -205,6 +221,8 @@ define(["app/dom", "app/utils", "app/config", "app/api", "app/jade", "app/i18n",
|
|
|
|
|
votes(rv.likes - rv.dislikes);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
votes(comment.likes - comment.dislikes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$("a.edit", footer).toggle("click",
|
|
|
|
|