gitment icon indicating copy to clipboard operation
gitment copied to clipboard

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

Open loveminimal opened this issue 6 years ago • 2 comments

自己写了个片段,加到 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)

loveminimal avatar Dec 01 '19 09:12 loveminimal

@loveminimal 👍

xmwilldo avatar Mar 24 '20 11:03 xmwilldo

我为什么一直报错object ..

EAPIAC avatar Aug 27 '21 01:08 EAPIAC