mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-10-04 06:22:00 +08:00
fix: 修復開啟anchor後,瀏覽器上一頁/下一頁 跳轉會404的bug (文章頁的url hash 在pjax下變成 undefined)
fix: 修復開啟anchor後,文章頁跳轉回主頁,主頁網址的hash添加上文章頁最後一個標題的 bug improvement: 優化 button tags 標簽外掛
This commit is contained in:
1 parent
c48ce9af8c
commit
597f0d2019
7 files changed
+52
-29
No files matched your search
@@ -12,6 +12,8 @@
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
Demo: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [MYW](https://immyw.com/)
|
Demo: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [MYW](https://immyw.com/)
|
||||||
|
|
||||||
Docs: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/)
|
Docs: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/)
|
||||||
@@ -97,6 +99,9 @@ npm i hexo-theme-butterfly
|
|||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
+6
-1
@@ -12,6 +12,8 @@
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
預覽: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [MYW](https://immyw.com/)
|
預覽: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [MYW](https://immyw.com/)
|
||||||
|
|
||||||
文檔: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/)
|
文檔: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/)
|
||||||
@@ -96,6 +98,9 @@ theme: butterfly
|
|||||||
|
|
||||||
## 截圖
|
## 截圖
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
Vendored
+27
-20
@@ -26,6 +26,29 @@ script.
|
|||||||
scrollRestoration: false
|
scrollRestoration: false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
document.addEventListener('pjax:send', function () {
|
||||||
|
|
||||||
|
// removeEventListener toc scroll
|
||||||
|
window.removeEventListener('scroll', window.tocScrollFn)
|
||||||
|
|
||||||
|
typeof preloader === 'object' && preloader.initLoading()
|
||||||
|
|
||||||
|
if (window.aplayers) {
|
||||||
|
for (let i = 0; i < window.aplayers.length; i++) {
|
||||||
|
if (!window.aplayers[i].options.fixed) {
|
||||||
|
window.aplayers[i].destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typeof typed === 'object' && typed.destroy()
|
||||||
|
|
||||||
|
//reset readmode
|
||||||
|
const $bodyClassList = document.body.classList
|
||||||
|
$bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
document.addEventListener('pjax:complete', function () {
|
document.addEventListener('pjax:complete', function () {
|
||||||
window.refreshFn()
|
window.refreshFn()
|
||||||
|
|
||||||
@@ -61,28 +84,12 @@ script.
|
|||||||
typeof preloader === 'object' && preloader.endLoading()
|
typeof preloader === 'object' && preloader.endLoading()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener('pjax:send', function () {
|
|
||||||
typeof preloader === 'object' && preloader.initLoading()
|
|
||||||
|
|
||||||
if (window.aplayers) {
|
|
||||||
for (let i = 0; i < window.aplayers.length; i++) {
|
|
||||||
if (!window.aplayers[i].options.fixed) {
|
|
||||||
window.aplayers[i].destroy()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typeof typed === 'object' && typed.destroy()
|
|
||||||
|
|
||||||
//reset readmode
|
|
||||||
const $bodyClassList = document.body.classList
|
|
||||||
$bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
document.addEventListener('pjax:error', (e) => {
|
document.addEventListener('pjax:error', (e) => {
|
||||||
if (e.request.status === 404) {
|
if (e.request.status === 404) {
|
||||||
|
if (!{theme.anchor}) {
|
||||||
|
location.hash && e.request.responseURL !== location.href ? pjax.loadUrl(location.href) : pjax.loadUrl('/404.html')
|
||||||
|
return
|
||||||
|
}
|
||||||
pjax.loadUrl('/404.html')
|
pjax.loadUrl('/404.html')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Loaded 3 of 7 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user