hexo-theme-keep/layout/_partial/pjax/pjax.ejs

31 lines
893 B
Plaintext

<%- __js('js/libs/pjax.min.js') %>
<script>
window.addEventListener('DOMContentLoaded', () => {
const pjax = new Pjax({
selectors: [
'head title',
'.page-container',
'.pjax'
],
history: true,
debug: false,
cacheBust: false,
timeout: 0,
analytics: false,
currentUrlFullReload: false,
scrollRestoration: false,
// scrollTo: true,
});
document.addEventListener('pjax:send', () => {
KEEP.utils.pjaxProgressBarStart();
});
document.addEventListener('pjax:complete', () => {
KEEP.utils.pjaxProgressBarEnd();
pjax.executeScripts(document.querySelectorAll('script[data-pjax], .pjax script'));
KEEP.refresh();
});
});
</script>