hexo-theme-icarus/source/js/pjax.js

42 lines
1.2 KiB
JavaScript
Raw Normal View History

(function() {
// eslint-disable-next-line no-unused-vars
let pjax;
function initPjax() {
try {
const Pjax = window.Pjax || function() {};
pjax = new Pjax({
selectors: [
'[data-pjax]',
'.pjax-reload',
'head title',
'.columns',
'.navbar-start',
'.navbar-end',
'.searchbox link',
'.searchbox script',
'#back-to-top',
'#comments link',
2024-07-14 03:35:08 +00:00
'#comments script'
]
});
} catch (e) {
console.warn('PJAX error: ' + e);
}
}
// // Listen for start of Pjax
// document.addEventListener('pjax:send', function() {
// return;
// // TODO pace start loading animation
// })
// // Listen for completion of Pjax
// document.addEventListener('pjax:complete', function() {
// return;
// // TODO pace stop loading animation
// })
document.addEventListener('DOMContentLoaded', () => initPjax());
}());