Sha256: eda6b334ee94c4a50d1ff0196921542c6e8e20d6cd6843c87fcc09d55fdb8c98

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

<div id="disqus_thread" class="mt4"></div>
<script>
  (function () {

  'use strict';

  // Global object
  var App = {};  

  // Create button
  App.commentsButton = document.createElement('button');
  App.commentsButton.setAttribute('class', 'measure w-100 tc f5 fw4 gray pa3 ba br2 b--gray bg-white pointer');
  App.commentsButton.setAttribute('data-js', 'comments-button');
  App.commentsButton.innerHTML = '{{ site.data.theme.text.comment_button }}';

  // Append button to body
  document.body.appendChild( App.commentsButton );

  // Click event handler
  App.commentsButton.onclick = function () {

    // Remove button on click
    this.parentNode.removeChild(this);
    
    // Your Disqus shortname
    App.disqus_shortname = '{{ site.disqus.shortname }}';

    // Embed Disqus
    var dsq = document.createElement('script');

    dsq.type = 'text/javascript';
    dsq.async = true;
    dsq.src = '//' + App.disqus_shortname + '.disqus.com/embed.js';

    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);

  };

  })();
</script>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ark-jekyll-theme-0.0.2 _includes/disqus_comments.html