Skip to content

Instantly share code, notes, and snippets.

@sgraber
Forked from benvinegar/gist:414837
Created March 10, 2011 21:29
Show Gist options
  • Save sgraber/864968 to your computer and use it in GitHub Desktop.
Save sgraber/864968 to your computer and use it in GitHub Desktop.
Disqus Comments Reload
<!-- You'll need to call get_disqus_num_replies() every time you alter the content (ex - ajax) -->
<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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment