Sha256: 65419e12efc6b83805bf32460738b5d55c00a220db51878d299c1a39008bb9c1

Contents?: true

Size: 1.26 KB

Versions: 12

Compression:

Stored size: 1.26 KB

Contents

// Compress via uglify:
// uglifyjs load-disqus.js -c -m > load-disqus.min.js
(function(w, d) {
  var disqus_config = function () {
    this.page.title = '{{ page.title }}';
    this.page.identifier = '{{ page.id }}';
    this.page.url = '{{ page.url | absolute_url }}';
  };

  w._disqusFirst = typeof w._disqusFirst != 'undefined' ? w._disqusFirst : true;
  w._disqusLoading = typeof w._disqusLoading != 'undefined' ? w._disqusLoading : false;
  w._disqusThis = false;
  w._disqusThreadOffsetTop = d.getElementById('disqus_thread').offsetTop;

  function loadDQ(e) {
    var scrollTop = w.pageYOffset || d.body.scrollTop;
    if ( w.DISQUS &&
        !w._disqusThis &&
        !w._disqusFirst &&
        scrollTop + w.innerHeight >= w._disqusThreadOffsetTop) {

      w._disqusThis = true;
      w.DISQUS.reset({
        reload: true,
        config: disqus_config
      });
    }
  };

  if (!w._disqusLoading) {
    w._disqusLoading = true;

    loadJSDeferred('//{{ site.disqus_shortname }}.disqus.com/embed.js');

    // add event listener
    if (w.addEventListener) w.addEventListener('scroll', loadDQ, { passive: true });
    else if (w.attachEvent) w.attachEvent('onscroll', loadDQ);
    else w.onscroll = loadDQ;
  } else {
    w._disqusFirst = false;
  }
}(window, document));

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
jekyll-theme-hydejack-6.6.1 _includes/scripts/load-disqus.js
jekyll-theme-hydejack-6.6.0 _includes/scripts/load-disqus.js
jekyll-theme-hydejack-6.5.0 _includes/scripts/load-disqus.js
jekyll-theme-hydejack-6.4.1 _includes/scripts/load-disqus.js
jekyll-theme-hydejack-6.4.0 _includes/scripts/load-disqus.js
jekyll-theme-hydejack-6.3.0 _includes/scripts/load-disqus.js
jekyll-theme-hydejack-6.2.0 _includes/scripts/load-disqus.js
jekyll-theme-hydejack-6.1.0 _includes/scripts/load-disqus.js
jekyll-theme-hydejack-6.0.0 _includes/scripts/load-disqus.js
jekyll-theme-hydejack-6.0.0.pre.beta3 _includes/scripts/load-disqus.js
jekyll-theme-hydejack-6.0.0.pre.beta2 _includes/scripts/load-disqus.js
jekyll-theme-hydejack-6.0.0.pre.alpha _includes/scripts/load-disqus.js