2022-05-21 17:47:26 +08:00
|
|
|
/* global NexT, CONFIG, Pjax */
|
|
|
|
|
|
|
|
const pjax = new Pjax({
|
|
|
|
selectors: [
|
|
|
|
'head title',
|
|
|
|
'script[type="application/json"]',
|
|
|
|
'.main-inner',
|
|
|
|
'.post-toc-wrap',
|
|
|
|
'.languages',
|
|
|
|
'.pjax'
|
|
|
|
],
|
|
|
|
analytics: false,
|
|
|
|
cacheBust: false,
|
2022-07-13 21:25:15 +08:00
|
|
|
scrollTo : !NexT.CONFIG.bookmark.enable
|
2022-05-21 17:47:26 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
document.addEventListener('pjax:success', () => {
|
|
|
|
pjax.executeScripts(document.querySelectorAll('script[data-pjax]'));
|
|
|
|
NexT.boot.refresh();
|
|
|
|
// Define Motion Sequence & Bootstrap Motion.
|
2022-07-13 21:25:15 +08:00
|
|
|
if (NexT.CONFIG.motion.enable) {
|
2022-05-21 17:47:26 +08:00
|
|
|
NexT.motion.integrator
|
|
|
|
.init()
|
|
|
|
.add(NexT.motion.middleWares.subMenu)
|
|
|
|
.add(NexT.motion.middleWares.postList)
|
|
|
|
.bootstrap();
|
|
|
|
}
|
2022-07-13 21:25:15 +08:00
|
|
|
if (NexT.CONFIG.sidebar.display !== 'remove') {
|
2022-05-21 17:47:26 +08:00
|
|
|
const hasTOC = document.querySelector('.post-toc');
|
|
|
|
document.querySelector('.sidebar-inner').classList.toggle('sidebar-nav-active', hasTOC);
|
|
|
|
NexT.utils.activateSidebarPanel(hasTOC ? 0 : 1);
|
|
|
|
NexT.utils.updateSidebarPosition();
|
|
|
|
}
|
|
|
|
});
|