Skip to content

Commit

Permalink
fix: cloudflare patch生成错误
Browse files Browse the repository at this point in the history
  • Loading branch information
zkz098 committed Nov 1, 2024
1 parent 1dde590 commit 99d9a2b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexo-theme-shokax",
"version": "0.4.15",
"version": "0.4.16",
"description": "a hexo theme based on shoka",
"main": "index.js",
"repository": "https://github.com/theme-shoka-x/hexo-theme-shokaX",
Expand Down
2 changes: 1 addition & 1 deletion scripts/generaters/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ hexo.extend.generator.register('script', function (locals) {
res.push({
path: theme.js + '/cf-patch.js',
data: function () {
return result
return fs.readFileSync('./cf-patch.js', { encoding: 'utf-8' })
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion source/js/_app/components/cloudflare.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// rocket-loader & Auto minify(cloudflare) 补丁
// cloudflare 的上述功能会导致DOMContentLoaded事件无法触发,此补丁会将DOMContentLoaded重定向为load事件
function cloudflareInit () {
export function cloudflareInit () {
let inCloudFlare = true
window.addEventListener('DOMContentLoaded', function () {
inCloudFlare = false
Expand Down
2 changes: 1 addition & 1 deletion source/js/_app/pjax/siteInit.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import domInit from './domInit'
import { pjaxReload, siteRefresh } from './refresh'
import { cloudflareInit } from '../library/scriptPjax'
import { cloudflareInit } from '../components/cloudflare'
import { BODY, CONFIG, pjax, setPjax, setSiteSearch, siteSearch } from '../globals/globalVars'
import { autoDarkmode, themeColorListener } from '../globals/themeColor'
import { resizeHandle, scrollHandle, visibilityListener } from '../globals/handles'
Expand Down

0 comments on commit 99d9a2b

Please sign in to comment.