summaryrefslogtreecommitdiffstats
path: root/layouts/partials/comment-disqus.html
blob: 909c0ed5293f03dd716e61989d11c3e91840da1d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<div class="post-comment" data-comment="disqus">
    <span class="post-comment-notloaded">
        <ion-icon name="chatbox-ellipses"></ion-icon>&nbsp;查看评论
    </span>
    <div id="disqus_thread" style="display: none;"></div>
    <script>
        function loadComment() {
            var commentArea = document.querySelector('.post-comment');
            var disqus_config = function () {
                this.page.url = '{{ .Permalink }}';
                this.page.identifier = '{{ .File.ContentBaseName }}';
            };
            var s = document.createElement('script');
            s.src = 'https://' + '{{ .Site.Params.disqusShortname }}' + '.disqus.com/embed.js';
            s.setAttribute('data-timestamp', +new Date());
            document.querySelector('#disqus_thread').removeAttribute('style');
            (document.body || document.head).appendChild(s);
            document.querySelector('span.post-comment-notloaded').setAttribute('style', 'display: none;');
        }
    </script>
</div>