2024-04-30 03:47:08 +00:00
|
|
|
(function() {
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
|
let pjax;
|
|
|
|
|
|
|
|
function initPjax() {
|
|
|
|
try {
|
|
|
|
const Pjax = window.Pjax || function() {};
|
|
|
|
pjax = new Pjax({
|
|
|
|
selectors: [
|
2024-07-14 03:27:26 +00:00
|
|
|
'[data-pjax]',
|
2024-07-14 03:33:29 +00:00
|
|
|
'.pjax-reload',
|
2024-04-30 03:47:08 +00:00
|
|
|
'head title',
|
|
|
|
'.columns',
|
|
|
|
'.navbar-start',
|
|
|
|
'.navbar-end',
|
2024-07-14 03:33:29 +00:00
|
|
|
'.searchbox link',
|
|
|
|
'.searchbox script',
|
2024-04-30 03:47:08 +00:00
|
|
|
'#back-to-top',
|
2024-07-14 03:27:26 +00:00
|
|
|
'#comments link',
|
2024-07-14 03:35:08 +00:00
|
|
|
'#comments script'
|
2024-08-19 05:07:21 +00:00
|
|
|
],
|
|
|
|
cacheBust: false
|
2024-04-30 03:47:08 +00:00
|
|
|
});
|
|
|
|
} catch (e) {
|
|
|
|
console.warn('PJAX error: ' + e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// // Listen for start of Pjax
|
|
|
|
// document.addEventListener('pjax:send', function() {
|
|
|
|
// return;
|
|
|
|
// // TODO pace start loading animation
|
|
|
|
// })
|
|
|
|
|
2024-12-19 06:28:54 +00:00
|
|
|
// Listen for completion of Pjax
|
|
|
|
document.addEventListener('pjax:complete', () => {
|
2024-12-24 14:07:51 +00:00
|
|
|
// Plugin [MathJax] reload logic
|
2024-12-19 06:28:54 +00:00
|
|
|
if (window.MathJax) {
|
|
|
|
try {
|
|
|
|
window.MathJax.typesetPromise && window.MathJax.typesetPromise();
|
|
|
|
} catch (e) {
|
|
|
|
console.error('MathJax reload error:', e);
|
|
|
|
}
|
|
|
|
}
|
2024-12-24 14:07:51 +00:00
|
|
|
// Plugin [Busuanzi] reload logic
|
|
|
|
if (window.bszCaller && window.bszTag) {
|
|
|
|
window.bszCaller.fetch('//busuanzi.ibruce.info/busuanzi?jsonpCallback=BusuanziCallback', a => {
|
|
|
|
window.bszTag.texts(a);
|
|
|
|
window.bszTag.shows();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-12-19 06:28:54 +00:00
|
|
|
// TODO pace stop loading animation
|
|
|
|
});
|
2024-04-30 03:47:08 +00:00
|
|
|
|
|
|
|
document.addEventListener('DOMContentLoaded', () => initPjax());
|
|
|
|
}());
|