|
|
@ -229,7 +229,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
function getChildren(id) {
|
|
|
|
function getChildren(id) {
|
|
|
|
if (childComments.length === 0) {
|
|
|
|
if (childComments.length === 0) {
|
|
|
|
return null
|
|
|
|
return null;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var list = [];
|
|
|
|
var list = [];
|
|
|
@ -255,6 +255,31 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let renderComment = (data) => {
|
|
|
|
let renderComment = (data) => {
|
|
|
|
|
|
|
|
let processData = (s) => {
|
|
|
|
|
|
|
|
if (s.comment.author.profileUrl) {
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
<a href="${comment.author.profileUrl}" target="_blank" rel="nofollow noopener noreferrer">
|
|
|
|
|
|
|
|
<img src="${comment.author.avatar.cache}">
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
s.comment.avatarEl = `<a href="${s.comment.author.profileUrl}" target="_blank" rel="nofollow noopener noreferrer"><img src="${s.comment.author.avatar.cache}"></a>`;
|
|
|
|
|
|
|
|
s.comment.authorEl = `<a href="${s.comment.author.profileUrl}">${s.comment.author.name}</a>`;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
s.comment.avatarEl = `<img src="${s.comment.author.avatar.cache}">`;
|
|
|
|
|
|
|
|
s.comment.authorEl = `${s.comment.author.name}`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (s.isPrimary) {
|
|
|
|
|
|
|
|
s.comment.authorEl += `<span class="dsqjs-admin-badge">${disqusjs.config.adminLabel}</span>`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (s.children) {
|
|
|
|
|
|
|
|
s.nesting = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return s;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let renderCommentItem = (s) => {
|
|
|
|
let renderCommentItem = (s) => {
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
<div class="dsqjs-item-container">
|
|
|
|
<div class="dsqjs-item-container">
|
|
|
@ -279,47 +304,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
data.map((s) => {
|
|
|
|
data.map((s) => {
|
|
|
|
let childrenComments = (s) => {
|
|
|
|
let childrenComments = (s) => {
|
|
|
|
var nesting = s.nesting
|
|
|
|
var nesting = s.nesting,
|
|
|
|
|
|
|
|
children = (s.children || []);
|
|
|
|
var children = (s.children || []);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!children) {
|
|
|
|
if (!children) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (nesting < 4) {
|
|
|
|
let html = (() => {
|
|
|
|
var html = '<ul class="dsqjs-list dsqjs-children">';
|
|
|
|
if (nesting < 4) {
|
|
|
|
} else {
|
|
|
|
return '<ul class="dsqjs-list dsqjs-children">';
|
|
|
|
var html = '<ul class="dsqjs-list">';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
children.map((s) => {
|
|
|
|
|
|
|
|
let comment = s.comment;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (comment.author.profileUrl) {
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
<a href="${comment.author.profileUrl}" target="_blank" rel="nofollow noopener noreferrer">
|
|
|
|
|
|
|
|
<img src="${comment.author.avatar.cache}">
|
|
|
|
|
|
|
|
</a>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
comment.avatarEl = `<a href="${comment.author.profileUrl}" target="_blank" rel="nofollow noopener noreferrer"><img src="${comment.author.avatar.cache}"></a>`;
|
|
|
|
|
|
|
|
comment.authorEl = `<a href="${comment.author.profileUrl}">${comment.author.name}</a>`;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
comment.avatarEl = `<img src="${comment.author.avatar.cache}">`;
|
|
|
|
return '<ul class="dsqjs-list">';
|
|
|
|
comment.authorEl = `${comment.author.name}`;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
|
if (s.isPrimary) {
|
|
|
|
html += children.map((s) => {
|
|
|
|
comment.authorEl += `<span class="dsqjs-admin-badge">${disqusjs.config.adminLabel}</span>`;
|
|
|
|
s = processData(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
s.nesting = nesting + 1;
|
|
|
|
s.nesting = nesting + 1;
|
|
|
|
|
|
|
|
|
|
|
|
html += `<li class="dsqjs-item" id="comment-${comment.id}">`;
|
|
|
|
return `<li class="dsqjs-item" id="comment-${s.comment.id}">${renderCommentItem(s.comment)}${childrenComments(s)}</li>`;
|
|
|
|
|
|
|
|
|
|
|
|
html += renderCommentItem(comment);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
html += `${childrenComments(s)}</li>`;
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
html += '</ul>';
|
|
|
|
html += '</ul>';
|
|
|
@ -331,29 +336,9 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let comment = s.comment;
|
|
|
|
s = processData(s);
|
|
|
|
|
|
|
|
|
|
|
|
if (comment.author.profileUrl) {
|
|
|
|
|
|
|
|
comment.avatarEl = `<a href="${comment.author.profileUrl}" target="_blank" rel="nofollow noopener noreferrer"><img src="${comment.author.avatar.cache}"></a>`;
|
|
|
|
|
|
|
|
comment.authorEl = `<a href="${comment.author.profileUrl}">${comment.author.name}</a>`;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
comment.avatarEl = `<img src="${comment.author.avatar.cache}">`;
|
|
|
|
|
|
|
|
comment.authorEl = `${comment.author.name}`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (s.isPrimary) {
|
|
|
|
|
|
|
|
comment.authorEl += `<span class="dsqjs-admin-badge">${disqusjs.config.adminLabel}</span>`;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (s.children) {
|
|
|
|
|
|
|
|
s.nesting = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let html = `<li class="dsqjs-item" id="comment-${comment.id}">`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
html += renderCommentItem(comment);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
html += `${childrenComments(s)}</li>`;
|
|
|
|
let html = `<li class="dsqjs-item" id="comment-${s.comment.id}">${renderCommentItem(s.comment)}${childrenComments(s)}</li>`;
|
|
|
|
|
|
|
|
|
|
|
|
document.getElementById('dsqjs-list').insertAdjacentHTML('beforeend', html);
|
|
|
|
document.getElementById('dsqjs-list').insertAdjacentHTML('beforeend', html);
|
|
|
|
})
|
|
|
|
})
|
|
|
|