Sha256: cf2aa2dc388a5c38227a552d68ac35f826a724be6caa8434c8c7383a3acf9750

Contents?: true

Size: 1.49 KB

Versions: 12

Compression:

Stored size: 1.49 KB

Contents

<!--
  The Disqus lazy loading.
-->
<div id="disqus_thread" class="pt-2 pb-2">
  <p class="text-center text-muted small">
    Comments powered by <a href="https://disqus.com/">Disqus</a>.
  </p>
</div>

<script type="text/javascript">

  var disqus_config = function () {
    this.page.url = '{{ page.url | absolute_url }}';
    this.page.identifier = '{{ page.url }}';
  };

  /* Lazy loading */

  var disqus_observer = new IntersectionObserver(function (entries) {
    if(entries[0].isIntersecting) {
        (function () {
            var d = document, s = d.createElement('script');
            s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js';
            s.setAttribute('data-timestamp', +new Date());
            (d.head || d.body).appendChild(s);
        })();

        disqus_observer.disconnect();
    }
  }, { threshold: [0] });

  disqus_observer.observe(document.querySelector('#disqus_thread'));

  /* Auto switch theme */

  function reloadDisqus() {
    /* Disqus hasn't been loaded */
    if (typeof DISQUS === "undefined") {
      return;
    }

    if (document.readyState == 'complete') {
      DISQUS.reset({ reload: true, config: disqus_config });
    }
  }

  const modeToggle = document.querySelector(".mode-toggle");

  if (typeof modeToggle !== "undefined") {
    /*  modeToggle.addEventListener('click', reloadDisqus); // not pretty for 'color-scheme'  */
    window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', reloadDisqus);
  }

</script>

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
jekyll-theme-chirpy-5.3.1 _includes/comments/disqus.html
jekyll-theme-chirpy-clarkezone-5.3.2 _includes/comments/disqus.html
jekyll-theme-chirpy-5.3.0 _includes/comments/disqus.html
jekyll-theme-abd3lraouf-5.2.9 _includes/comments/disqus.html
jekyll-theme-abd3lraouf-5.2.8 _includes/comments/disqus.html
jekyll-theme-abd3lraouf-5.2.7 _includes/comments/disqus.html
jekyll-theme-chirpy-5.2.1 _includes/comments/disqus.html
jekyll-theme-chirpy-5.2.0 _includes/comments/disqus.html
jekyll-theme-chirpy-5.1.0 _includes/comments/disqus.html
jekyll-theme-chirpy-5.0.2 _includes/comments/disqus.html
jekyll-theme-chirpy-5.0.1 _includes/comments/disqus.html
jekyll-theme-chirpy-5.0.0 _includes/comments/disqus.html