Created
May 17, 2010 20:59
-
-
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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'; | |
} | |
}; |
Only if you are an early adopter (you can opt-in in settings).
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?
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
Is this still supposed to work?