mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 22:17:06 +08:00
Update pjax.pug
自定义404.html跳转更平滑,使用 window.location.href = e.request.responseURL 加载,自定义404.html加载速度缓慢,可能会出现loading二次加载
This commit is contained in:
7
layout/includes/third-party/pjax.pug
vendored
7
layout/includes/third-party/pjax.pug
vendored
@@ -59,7 +59,10 @@ script.
|
|||||||
|
|
||||||
document.addEventListener('pjax:error', e => {
|
document.addEventListener('pjax:error', e => {
|
||||||
if (e.request.status === 404) {
|
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
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})()
|
})()
|
||||||
|
|||||||
Reference in New Issue
Block a user