gitment icon indicating copy to clipboard operation
gitment copied to clipboard

每次网站发布都需要重新初始化评论的问题

Open vincent931018 opened this issue 7 years ago • 3 comments

请问如何解决每次发布 都要把全部文章都重新初始化评论的问题 不然好麻烦啊。

vincent931018 avatar Jun 09 '18 04:06 vincent931018

+1 #8 初始化评论框方案讨论

xu-song avatar Aug 05 '18 10:08 xu-song

请问如何解决每次发布 都要把全部文章都重新初始化评论的问题 不然好麻烦啊。

自己写了个脚本,加到那个 script 标签中就可以了 :)

  // Auto Initialize Comments

  let cmtBtns = document.getElementsByClassName('gitment-comments-init-btn');
  let isClicked = false;

  let timer = setInterval(() => {
    Array.prototype.forEach.call(cmtBtns, item => {
      item.click();
      isClicked = true;
      if(isClicked) {
        clearInterval(timer);
        console.log('Clear timer.')
      }        
    })
  }, 1000)

loveminimal avatar Dec 01 '19 09:12 loveminimal

Hello @loveminimal 问下,你这个是点开每个post ,然后就自己去点击initComments 按钮了是吗?我好像加上你的代码,是这个样子的行为。 还有一个问题,我很疑惑,不知道你晓不晓得,就是每次发布后,不是要init comments 么,那之前的comments 是不是就没有了? 只是在github 的issue 里面能看到?这不是bug么?

luffyao avatar Dec 14 '19 15:12 luffyao