diff --git a/src/disqus.js b/src/disqus.js index df3b43d..e09f597 100644 --- a/src/disqus.js +++ b/src/disqus.js @@ -433,6 +433,39 @@ }) } + /* + * loadHasMore(id) - 获取隐藏回复列表 + * + * @param {Array} id - 父评论 ID + * @return {Array} - 解析后的评论列表数据 + */ + let loadHasMore = (id, cursor) => { + // 获取传入的 cursor + cursor = (!cursor) ? '' : `&cursor=${cursor}`; + /* + * 获取隐藏评论列表 + * + * API URI: /3.0/posts/getDescendants?limit=50&order=desc&post=[parrent id]&start_post=&cursor=[cursor]&api_key=[apikey] + * + * https://github.com/fooleap/disqus-php-api/issues/44 + * + * 每次加载隐藏评论的时候修改数组并进行重排序 + */ + let url = `${disqusjs.config.api}3.0/posts/getDescendants?limit=50&order=desc&post=${id}&start_post=${cursor}&api_key=${apikey()}`; + get(url, (res) => { + if (res.code === 0 && res.response.length > 0) { + console.log(res); + console.log(disqusjs.page.comment); + } else { + // DisqusJS 加载错误 + console.log('Error'); + } + }, (e) => { + // 评论列表加载错误 + console.log('Error'); + }) + } + /* * parseCommentData(data) - 解析评论列表 * @@ -620,10 +653,10 @@ // 处理可能存在的隐藏回复 let hasMoreEl = ``; if (comment.hasMore) { - hasMoreEl = `
`; + hasMoreEl = ``; } - html += `