imsun / gitment

A comment system based on GitHub Issues.
https://imsun.github.io/gitment/
MIT License
4.06k stars 346 forks source link

文章自动初始化评论 javascript 代码片段解决方案 : ) #196

Open loveminimal opened 4 years ago

loveminimal commented 4 years ago

自己写了个片段,加到 new Gitment 所在的那个 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)
xmwilldo commented 4 years ago

@loveminimal 👍

EAPIAC commented 2 years ago

我为什么一直报错object ..