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

[功能修复] 每个网页有独立的gitalk #17

Open
Charmve opened this issue Jul 23, 2021 · 0 comments
Open

[功能修复] 每个网页有独立的gitalk #17

Charmve opened this issue Jul 23, 2021 · 0 comments
Labels
Gitalk collection for online-book comment 👐 open-question open-question for all readers discussing 👏 task completed

Comments

@Charmve
Copy link
Owner

Charmve commented Jul 23, 2021

在线电子书,大家的评论都存到了主页README的分支中,之后得修改。

现在的源码:

<script>
    const gitalk = new Gitalk({
      id: decodeURI('{{ page.url }}'),
      clientID: 'c41595e0999dd2834af4',
      clientSecret: '4ad47f16f60a04c2870a1939406a6ad87bf219ec',
      repo: 'computer-vision-in-action',
      owner: 'Charmve',
      admin: ['Charmve'],
      // 每个网页独立的gitalk
      //title: location.hash.match(/#(.*?)([?]|$)/)[1],
      //id: location.hash.match(/#(.*?)([?]|$)/)[1],
      // facebook-like distraction free mode
      labels: ['Gitalk'],
      perPage: 50,
      distractionFreeMode: false
    })
    // 监听URL中hash的变化,如果发现换了一个MD文件,那么刷新页面,解决整个网站使用一个gitalk评论issues的问题。
    window.onhashchange = function(event){
      if(event.newURL.split('#')[0] !== event.oldURL.split('#')[0]) {
        location.reload()
      }
    }
    // 由于docsify/lib/plugins/gitalk.min.js文件中已经有下面代码了,所以不需要在写一次了
    // gitalk.render('gitalk-container')
  </script>
@Charmve Charmve added 🏇wontfix This will not be worked on 👐 open-question open-question for all readers discussing Gitalk collection for online-book comment labels Jul 23, 2021
@Charmve Charmve added 👏 task completed and removed 🏇wontfix This will not be worked on labels Aug 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Gitalk collection for online-book comment 👐 open-question open-question for all readers discussing 👏 task completed
Projects
None yet
Development

No branches or pull requests

1 participant