Open the more advanced embedded. js, and you can find the following code

 O = S.selectors = { ".ds-thread": { type: "EmbedThread" }, ".ds-recent-comments": { type: "RecentComments" }, ".ds-recent-visitors": { type: "RecentVisitors" }, ".ds-top-users": { type: "TopUsers" }, ".ds-top-threads": { type: "TopThreads" }, ".ds-login": { type: "LoginWidget" }, ".ds-thread-count": { type: "ThreadCount" }, ".ds-share": { type: "ShareWidget" } },

It's good enough to say more. So many functions can be called back, which is convenient for us to use~

For example, the callback comment box:

 if ($('.ds-thread').length > 0) { if (typeof DUOSHUO !== ' undefined') DUOSHUO.EmbedThread('.ds-thread'); else $.getScript("//static.duoshuo.com/embed.js");

For example, the number of callback comments

 if ($('.ds-thread-count').length > 0) { if (typeof DUOSHUO !== ' undefined') DUOSHUO.EmbedThread('.ds-thread-count'); else $.getScript("//static.duoshuo.com/embed.js");

Other callback methods are similar. Fill the callback function into the event of pjax: complete. Quite simple, no more details.

Note: I found this method before, but I was lazy all the time. Later, I found that there was an article about it here~ http://www.4zen.top/ajaxed-load-duoshuo-count/ If you want to know more, you can go here and have a look.

Last modification: March 23, 2019
Do you like my article?
Don't forget to praise or appreciate, let me know that you accompany me on the way of creation.