Make Disqus comment counting work on Infinite Scroll
Harianto van Insulinde -
Without the need of polling, there’s better way to check if there are some changes.
With MutationObserver is what you need.
Change DISQUSEXAMPLE to your Disqus name
In this script I attach onload event on the script element then, assign the parent element I need to Observe, create an Observer and a function what to do on Mutation and use Disqus Widget to reset the count, make sure if parent element exist and attach the Observer with some configurations to observe.
Bonus
Sometimes when I look at the code too long, I feel I want to refactor and make a reusable function.