⚡ Upgrade third party js logic improve load speed.
This commit is contained in:
10
assets/js/third-party/share/addthis.js
vendored
10
assets/js/third-party/share/addthis.js
vendored
@@ -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)
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user