cusdis.html 679 B

123456789101112131415161718192021
  1. {{- $host := default "https://cusdis.com" .Site.Params.comments.cusdis.host -}}
  2. <div id="cusdis_thread"
  3. data-host="{{ $host }}"
  4. data-app-id="{{ .Site.Params.comments.cusdis.id }}"
  5. data-page-id="{{ .File.UniqueID }}"
  6. data-page-url="{{ .Permalink }}"
  7. data-page-title="{{ .Title }}"></div>
  8. <script async defer src="{{ $host }}/js/cusdis.es.js"></script>
  9. <script>
  10. function setCusdisTheme(theme) {
  11. let cusdis = document.querySelector('#cusdis_thread iframe');
  12. if (cusdis) {
  13. window.CUSDIS.setTheme(theme)
  14. }
  15. }
  16. window.addEventListener('onColorSchemeChange', (e) => {
  17. setCusdisTheme(e.detail)
  18. })
  19. </script>