|
1 | 1 | <section class="comments">
|
2 |
| - <h3>Comments</h3> |
3 |
| - <div id="disqus_thread"></div> |
| 2 | + <div id="container"></div> |
| 3 | + <link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css"> |
| 4 | + <script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script> |
4 | 5 | </section>
|
5 |
| -<script type="text/javascript"> |
6 |
| - var disqus_loaded = false; |
7 | 6 |
|
8 |
| - function load_disqus() |
9 |
| - { |
10 |
| - disqus_loaded = true; |
11 |
| - var disqus_shortname = '{{site.disqus_username}}'; |
12 |
| - var disqus_title = '{{page.title.replace("'", "\\'")}}'; |
13 |
| - var disqus_url = '{{page.url}}'; |
14 |
| - var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; |
15 |
| - dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; |
16 |
| - (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); |
17 |
| - var ldr = document.getElementById('disqus_loader'); |
18 |
| - }; |
| 7 | +<script type="text/javascript"> |
| 8 | + var gitment_loaded = false; |
| 9 | + var gitment = new Gitment({ |
| 10 | + id: '页面 ID', // 可选。默认为 location.href |
| 11 | + owner: '你的 GitHub ID', |
| 12 | + repo: '存储评论的 repo', |
| 13 | + oauth: { |
| 14 | + client_id: '你的 client ID', |
| 15 | + client_secret: '你的 client secret', |
| 16 | + }, |
| 17 | + }) |
| 18 | + function load_gitment(){ |
| 19 | + gitment_loaded = true |
| 20 | + gitment.render('container') |
| 21 | + } |
19 | 22 | window.onscroll = function(e) {
|
20 | 23 | if ((window.innerHeight + window.scrollY) >= (document.body.offsetHeight - 800)) {
|
21 | 24 | //hit bottom of page
|
22 |
| - if (disqus_loaded==false) |
23 |
| - load_disqus() |
| 25 | + if (gitment_loaded==false) |
| 26 | + load_gitment() |
24 | 27 | }
|
25 | 28 | };
|
26 | 29 | </script>
|
0 commit comments