Add support for reversing the sort-order of comments

pull/322/head
Danilo Bargen 7 years ago
parent d37b5bb030
commit 9b36118da6

@ -19,6 +19,7 @@ preferably in the script tag which embeds the JS:
data-isso-avatar-bg="#f0f0f0"
data-isso-avatar-fg="#9abf88 #5698c4 #e279a3 #9163b6 ..."
data-isso-vote="true"
data-isso-sorting="oldest"
data-vote-levels=""
src="/prefix/js/embed.js"></script>
@ -125,6 +126,11 @@ For example, the value `"-5,5"` will cause each `isso-comment` to be given one o
These classes can then be used to customize the appearance of comments (eg. put a star on popular comments)
data-isso-sorting
-----------------
This can be set either to `oldest` (the default) or `newest`.
data-isso-id
------------

@ -10,6 +10,7 @@ define(function() {
"max-comments-top": "inf",
"max-comments-nested": 5,
"reveal-on-click": 5,
"sorting": "oldest",
"avatar": true,
"avatar-bg": "#f0f0f0",
"avatar-fg": ["#9abf88", "#5698c4", "#e279a3", "#9163b6",

@ -42,6 +42,12 @@ require(["app/lib/ready", "app/config", "app/i18n", "app/api", "app/isso", "app/
var lastcreated = 0;
var count = rv.total_replies;
// Correct sorting of comments
if (config["sorting"] === "newest") {
rv.replies.reverse();
}
rv.replies.forEach(function(comment) {
isso.insert(comment, false);
if(comment.created > lastcreated) {

Loading…
Cancel
Save