Skip to content

Instantly share code, notes, and snippets.

@valueof
Created May 17, 2010 20:59
Show Gist options
  • Save valueof/404220 to your computer and use it in GitHub Desktop.
Save valueof/404220 to your computer and use it in GitHub Desktop.
This function hides Disqus if thread is closed and no comments were posted.
/*
* This function hides Disqus if thread is closed and no comments were posted.
* It is better to place this function in HEAD.
*
* IMPORTANT: Please note, that this example uses internal APIs that might change in future.
* We will not provide any prior announcement before changing or removing any internal APIs.
*/
var disqus_callback = function () {
if (DISQUS.jsonData.thread.closed && DISQUS.jsonData.thread.total_posts === 0) {
DISQUS.nodes.container.style.display = 'none';
}
};
@geokat
Copy link

geokat commented May 26, 2010

Is this still supposed to work?

@valueof
Copy link
Author

valueof commented May 26, 2010

Only if you are an early adopter (you can opt-in in settings).

@geokat
Copy link

geokat commented May 26, 2010

Anton, thank you for your reply.

I enabled the early adopter option in settings, but

<script type="text/javascript"> var disqus_developer = function () { DISQUS.nodes.container.style.display = 'none'; }; </script>

has no effect on the comments display. Is there are anything else I need to do for this to work?

@valueof
Copy link
Author

valueof commented May 26, 2010

Oops sorry, there was a typo in this gist. It is supposed to be disqus_callback, not disqus_developer.

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