JO
2024-06-28 359cb1603348374b9ef46b72ece66bcdca6cd0e0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* global NexT, CONFIG, DisqusJS */
 
document.addEventListener('page:loaded', () => {
  if (!CONFIG.page.comments) return;
 
  NexT.utils.loadComments('#disqus_thread')
    .then(() => NexT.utils.getScript(CONFIG.disqusjs.js, { condition: window.DisqusJS }))
    .then(() => {
      window.dsqjs = new DisqusJS({
        api       : CONFIG.disqusjs.api || 'https://disqus.com/api/',
        apikey    : CONFIG.disqusjs.apikey,
        shortname : CONFIG.disqusjs.shortname,
        url       : CONFIG.page.permalink,
        identifier: CONFIG.page.path,
        title     : CONFIG.page.title
      });
      window.dsqjs.render(document.querySelector('.disqusjs-container'));
    });
});
 
document.addEventListener('pjax:send', () => {
  if (window.dsqjs) window.dsqjs.destroy();
});