kelyvin / ghost-caffeine-theme

A minimalist, Material Design inspired Ghost Theme for optimal desktop and mobile experiences
https://caffeinecoding.com
MIT License
333 stars 97 forks source link

Disqus comment count bug fixes #34

Closed pupboss closed 7 years ago

kelyvin commented 7 years ago

Thanks for the fix and great catch!

pupboss commented 7 years ago

Hmm, pls don't merge it immediately.

I found that it may cause problems, in some country, such as China, Disqus was banned, so even though the count.js was loaded via async, it still block the rendering, until count.js was timed out, I'm not a front-end programer...So I didn't get any way out, I hope you can deal with it at your convenience : )

kelyvin commented 7 years ago

That's okay I have merged the change in anyway, since the app supports disqus by default it's an easy add. Even If disqus does not exist, the url route change is only a "hash fragment". So if the disqus comments don't exist, it won't affect scrolling on the page anyway. :)

pupboss commented 7 years ago

It seems we had a little miscommunication, I'll put on an image to clarify

The script looks like this:

<script id="dsq-count-scr" src="//pupboss.disqus.com/count.js" async></script>

But if I don't turn on the proxy, count.js can not be loaded because the Chinese GOV banned the Disqus.

While the loading of count.js, the rendering of the page also blocked.

I didn't know why the async loading of a .js would block the page rendering...

When the count.js was timed out, the text would appear...

And, I have put the script at the end of the HTML

The bug only appear at the extreme situation, please ignore it, thank you for your patient :)

pupboss commented 7 years ago

Oh! I see!!

Maybe the masonry's layout action needed all resources was loaded, so the count.js blocked the layout action. I'll try to fix it.