Skip to content

Instantly share code, notes, and snippets.

@benvinegar
Created May 26, 2010 18:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save benvinegar/414837 to your computer and use it in GitHub Desktop.
Save benvinegar/414837 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
//<![CDATA[
var get_disqus_num_replies = function() {
var links = document.getElementsByTagName('a');
var query = '?';
for(var i = 0; i < links.length; i++) {
if(links[i].href.indexOf('#disqus_thread') >= 0) {
query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&';
}
}
var s = document.createElement('script');
s.type='text/javascript';
s.src = 'http://marcador.disqus.com/get_num_replies.js' + query;
var body = document.getElementsByTagName('body')[0];
body.appendChild(s);
};
get_disqus_num_replies();
//]]>
</script>
@vin-ai
Copy link

vin-ai commented Apr 30, 2013

Why not just calls:

DISQUSWIDGETS.getCount();

or count on server side using:

https://github.com/disqus/DISQUS-API-Recipes/blob/master/php/get-thread-details.php

@barkgj
Copy link

barkgj commented Jun 4, 2013

@vinarkrsharma: thanks, works great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment