Skip to content

Commit

Permalink
refactor: 优化fireworks
Browse files Browse the repository at this point in the history
  • Loading branch information
zkz098 committed Apr 22, 2023
1 parent c737c4a commit 7fba5bf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
25 changes: 12 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexo-theme-shokax",
"version": "0.2.3",
"version": "0.2.4",
"description": "a hexo theme based on shoka",
"main": "index.js",
"repository": "https://github.com/zkz098/hexo-theme-shokaX",
Expand All @@ -19,31 +19,30 @@
"@types/jquery": "^3.5.16",
"@types/js-yaml": "^4.0.5",
"@types/lozad": "^1.16.1",
"@types/node": "^18.15.6",
"@types/shelljs": "^0.8.11",
"@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.56.0",
"@types/node": "^18.15.13",
"@typescript-eslint/eslint-plugin": "^5.59.0",
"@typescript-eslint/parser": "^5.59.0",
"@vuepress/client": "2.0.0-beta.61",
"@vuepress/plugin-docsearch": "2.0.0-beta.61",
"algoliasearch": "^4.16.0",
"eslint": "^8.36.0",
"algoliasearch": "^4.17.0",
"eslint": "^8.39.0",
"eslint-config-standard": "^17.0.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^15.6.1",
"eslint-plugin-n": "^15.7.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.10.0",
"eslint-plugin-vue": "^9.11.0",
"hexo-fs": "^4.1.1",
"hexo-util": "^3.0.1",
"instantsearch.js": "^4.53.0",
"instantsearch.js": "^4.54.1",
"pjax": "^0.2.8",
"theme-shokax-anime": "^0.0.4",
"typescript": "^5.0.2",
"typescript": "^5.0.4",
"vue": "^3.2.47",
"vuepress": "2.0.0-beta.61",
"vuepress-plugin-sitemap2": "2.0.0-beta.203"
"vuepress-plugin-sitemap2": "2.0.0-beta.205"
},
"dependencies": {
"js-yaml": "^4.1.0",
"sass": "^1.60.0"
"sass": "^1.62.0"
}
}
5 changes: 2 additions & 3 deletions source/js/_app/fireworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function createCircle (x:number, y:number):fireworksP {
// 渲染烟花粒子
function renderParticule (targets:any):void {
// 遍历所有可动画的对象
for (let target of targets) {
for (const target of targets) {
// 调用对象上的draw函数来绘制烟花粒子
target.draw()
}
Expand Down Expand Up @@ -203,13 +203,12 @@ const hasAncestor = function (node:any, name:string):boolean {
do {
if (node === null || node === undefined) break
if (node.nodeName === name) return true
} while (node = node.parentNode)
} while ((node = node.parentNode) !== null)
return false
}

document.addEventListener(tap, function (e) {
// 禁用A标签的Fireworks动画以修复动画不消失问题
// @ts-ignore
if (hasAncestor(e.target, 'a')) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"esModuleInterop": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"typeRoots": ["node_modules","node_modules/@types"],

"types": ["theme-shokax-anime","lozad","jquery","fancybox"]
},
"typeAcquisition": {
Expand Down

0 comments on commit 7fba5bf

Please sign in to comment.