Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryc127 committed Jul 2, 2023
1 parent c533079 commit eab013f
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package-lock.json
*.log
node_modules/
public/
public-en/
.deploy*/
.history/
source/_backup/
Expand Down
4 changes: 3 additions & 1 deletion _config.butterfly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -942,8 +942,10 @@ css_prefix: true
inject:
head:
- <link rel="preconnect" href="https://file.crazywong.com">
- '<style type="text/css">.card-announcement .social-button{margin:.6rem 0 0 0;text-align:center}.card-announcement .social-button a{display:block;background-color:var(--btn-bg);color:var(--btn-color);text-align:center;line-height:2.4;margin:4px 0}.card-announcement .social-button a:hover{background-color:var(--btn-hover-color)}</style>'
- <link href="/self/btf.css" rel="stylesheet">

bottom:
- <script data-pjax src="/self/btf.js"></script>

# CDN
# Don't modify the following settings unless you know how they work
Expand Down
1 change: 1 addition & 0 deletions config-butterfly-en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,7 @@ inject:
- <link rel="preconnect" href="https://file.crazywong.com">
- <link href="/en/self/btf.css" rel="stylesheet">
bottom:
- <script data-pjax src="/self/btf.js"></script>

# CDN
# Don't modify the following settings unless you know how they work
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"show": "hexo clean && hexo g && hexo s",
"update": "git init && git add . && git commit -m 'backup' && git push origin main",
"kk": "hexo clean && hexo g && hexo deploy",
"en": "hexo clean && hexo g --config config-en.yml && hexo s --config config-en.yml"
"en": "hexo clean && hexo g && hexo g --config config-en.yml -f && hexo s"

},
"hexo": {
Expand Down
37 changes: 37 additions & 0 deletions source-en/self/btf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// document.addEventListener('pjax:send', function (e) {

// const checkInclude = (item1, item2) => {
// const key = '/en/'
// const item1Has = item1.includes(key)
// const item2Has = item2.includes(key)
// return item1Has && !item2Has || !item1Has && item2Has
// }
// console.log(e);


// const src = window.location.href
// const target = e.triggerElement.href || ''

// if (checkInclude(src, target)) {
// e.preventDefault()
// e.stopImmediatePropagation()
// e.stopPropagation()
// console.log(e);
// console.log('preventDefault');
// window.location.href = target
// return
// }
// })

// document.addEventListener('pjax:success', function (e) {
// console.log('pjax:success');
// })

// window.openNew = function (url) {
// window.location.href = url
// }

document.querySelectorAll('a[href^="https://butterfly.js.org]').forEach(item => {
item.setAttribute("data-pjax-state", 'load')
})

37 changes: 37 additions & 0 deletions source/self/btf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// document.addEventListener('pjax:send', function (e) {

// const checkInclude = (item1, item2) => {
// const key = '/en/'
// const item1Has = item1.includes(key)
// const item2Has = item2.includes(key)
// return item1Has && !item2Has || !item1Has && item2Has
// }
// console.log(e);


// const src = window.location.href
// const target = e.triggerElement.href || ''

// if (checkInclude(src, target)) {
// e.preventDefault()
// e.stopImmediatePropagation()
// e.stopPropagation()
// console.log(e);
// console.log('preventDefault');
// window.location.href = target
// return
// }
// })

// document.addEventListener('pjax:success', function (e) {
// console.log('pjax:success');
// })

// window.openNew = function (url) {
// window.location.href = url
// }

document.querySelectorAll('a[href^="/en/"]').forEach(item => {
item.setAttribute("data-pjax-state", 'load')
})

1 comment on commit eab013f

@vercel
Copy link

@vercel vercel bot commented on eab013f Jul 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

butterfly-demo – ./

butterfly-demo.vercel.app
butterfly-demo-myw.vercel.app
butterfly.js.org
butterfly-demo-git-main-myw.vercel.app

Please sign in to comment.