Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
loveminimal opened this issue Dec 1, 2019 · 2 comments

Comments

@loveminimal
Copy link

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

@loveminimal 👍

@EAPIAC
Copy link

EAPIAC commented Aug 27, 2021

我为什么一直报错object ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@xmwilldo @loveminimal @EAPIAC and others