Sha256: d409378a2701dcba0d1780ff46159f9523f4aac31ab271b4ff92e406a879ee07

Contents?: true

Size: 1.45 KB

Versions: 29

Compression:

Stored size: 1.45 KB

Contents

<!-- https://utteranc.es/ -->
<script src="https://utteranc.es/client.js"
        repo="{{ site.comments.utterances.repo }}"
        issue-term="{{ site.comments.utterances.issue_term }}"
        crossorigin="anonymous"
        async>
</script>

<script type="text/javascript">
  $(function() {
    const origin = "https://utteranc.es";
    const iframe = "iframe.utterances-frame";
    const lightTheme = "github-light";
    const darkTheme = "github-dark";
    let initTheme = lightTheme;

    if ($("html[data-mode=dark]").length > 0
        || ($("html[data-mode]").length == 0
            && window.matchMedia("(prefers-color-scheme: dark)").matches)) {
      initTheme = darkTheme;
    }

    addEventListener("message", (event) => {
      let theme;

      /* credit to <https://github.com/utterance/utterances/issues/170#issuecomment-594036347> */
      if (event.origin === origin) {
        /* page initial */
        theme = initTheme;

      } else if (event.source === window && event.data &&
            event.data.direction === ModeToggle.ID) {
        /* global theme mode changed */
        const mode = event.data.message;
        theme = (mode === ModeToggle.DARK_MODE ? darkTheme : lightTheme);

      } else {
        return;
      }

      const message = {
        type: "set-theme",
        theme: theme
      };

      const utterances = document.querySelector(iframe).contentWindow;
      utterances.postMessage(message, origin);
    });

  });
</script>

Version data entries

29 entries across 29 versions & 7 rubygems

Version Path
jekyll-theme-chirpy-6.2.2 _includes/comments/utterances.html
jekyll-theme-chirpy-6.2.1 _includes/comments/utterances.html
jekyll-theme-chirpy-6.2.0 _includes/comments/utterances.html
jekyll-theme-chirpy-birdly-6.1.2 _includes/comments/utterances.html
jekyll-theme-chirpy-birdly-6.1.0 _includes/comments/utterances.html
jekyll-theme-chirpy-birdly-6.1.1 _includes/comments/utterances.html
jekyll-theme-chirpy-6.1.0 _includes/comments/utterances.html
jekyll-theme-chirpy-birdly-6.0.2 _includes/comments/utterances.html
jekyll-theme-chirpy-6.0.1 _includes/comments/utterances.html
jekyll-theme-chirpy-6.0.0 _includes/comments/utterances.html
jekyll-theme-chirpy-5.6.1 _includes/comments/utterances.html
jekyll-theme-chirpy-5.6.0 _includes/comments/utterances.html
custom-chirpy-5.5.2 _includes/comments/utterances.html
jekyll-theme-chirpy-5.5.2 _includes/comments/utterances.html
jekyll-theme-chirpy-5.5.1 _includes/comments/utterances.html
jekyll-theme-chirpy-5.5.0 _includes/comments/utterances.html
jekyll-theme-chirpy-customized-by-alazaroc-5.4.0 _includes/comments/utterances.html
dev-jekyll-theme-1.0.0 _includes/comments/utterances.html
jekyll-theme-chirpy-5.4.0 _includes/comments/utterances.html
jekyll-theme-chirpy-5.3.2 _includes/comments/utterances.html