Update pjax.pug

自定义404.html跳转更平滑,使用 window.location.href = e.request.responseURL 加载,自定义404.html加载速度缓慢,可能会出现loading二次加载
This commit is contained in:
冰梦
2025-02-20 14:10:13 +08:00
committed by GitHub
parent 13720bd94d
commit 4b8a610c08

View File

@@ -59,7 +59,10 @@ script.
document.addEventListener('pjax:error', e => {
if (e.request.status === 404) {
window.location.href = e.request.responseURL
const usePjax = !{theme.pjax && theme.pjax.enable}
!{theme.error_404 && theme.error_404.enable}
? (usePjax ? pjax.loadUrl('!{url_for("/404.html")}') : window.location.href = '!{url_for("/404.html")}')
: window.location.href = e.request.responseURL
}
})
})()