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

41 lines
1.1 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]',
'head title',
'.columns',
'.navbar-start',
'.navbar-end',
'.searchbox',
'.pjax-reload',
'#back-to-top',
'#comments link',
'#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());
}());