Upgrade third party js logic improve load speed.

This commit is contained in:
凡梦星尘
2022-10-26 22:37:03 +08:00
parent 90df1e1247
commit 525c8a7cf5
10 changed files with 58 additions and 27 deletions

View File

@@ -1,16 +1,16 @@
document.addEventListener('DOMContentLoaded', () => {
/* AddThis share plugin */
NexT.plugins.share.addthis = function() {
const element = '.addthis_inline_share_toolbox';
if (!NexT.CONFIG.addthis || !NexT.utils.checkDOMExist(element)) return;
const addthis_js = NexT.CONFIG.addthis.js + '?pubid=' + NexT.CONFIG.addthis.cfg.pubid;
NexT.utils.loadComments(element).then(() => {
NexT.utils.lazyLoadComponent(element, function() {
NexT.utils.getScript(addthis_js, {
attributes: {
async: true
async: false
},
parentNode: document.querySelector(element)
});
});
});
}