aboutsummaryrefslogtreecommitdiff
path: root/themes/hugo-theme-stack/layouts/partials/comments/provider/cusdis.html
blob: a89746c6ad8dab65ee5cd4c5c3f0c21c137af620 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{{- $host := default "https://cusdis.com" .Site.Params.comments.cusdis.host -}}
<div id="cusdis_thread"
    data-host="{{ $host }}"
    data-app-id="{{ .Site.Params.comments.cusdis.id }}"
    data-page-id="{{ .File.UniqueID }}"
    data-page-url="{{ .Permalink }}"
    data-page-title="{{ .Title }}"></div>
<script async defer src="{{ $host }}/js/cusdis.es.js"></script>

<script>
    function setCusdisTheme(theme) {
        let cusdis = document.querySelector('#cusdis_thread iframe');
        if (cusdis) {
            window.CUSDIS.setTheme(theme)
        }
    }

    window.addEventListener('onColorSchemeChange', (e) => {
        setCusdisTheme(e.detail)
    })
</script>