Skip to content

Commit 62cb6b1

Browse files
committed
update custom js from pakeplus
1 parent 3964055 commit 62cb6b1

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

src-tauri/data/custom.js

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
1-
console.log('custom.js ----')
2-
3-
window.addEventListener('DOMContentLoaded', () => {
4-
console.log('DOMContentLoaded')
5-
})
1+
console.log(
2+
'%cbuild from PakePlus: https://github.com/Sjj1024/PakePlus',
3+
'color:orangered;font-weight:bolder'
4+
)
5+
6+
// very important, if you don't know what it is, don't touch it
7+
// 非常重要,不懂代码不要动,这里可以解决80%的问题,也可以生产1000+的bug
8+
const hookClick = (e) => {
9+
const origin = e.target.closest('a')
10+
const isBaseTargetBlank = document.querySelector(
11+
'head base[target="_blank"]'
12+
)
13+
console.log('origin', origin, isBaseTargetBlank)
14+
if (
15+
(origin && origin.href && origin.target === '_blank') ||
16+
(origin && origin.href && isBaseTargetBlank)
17+
) {
18+
e.preventDefault()
19+
console.log('handle origin', origin)
20+
location.href = origin.href
21+
} else {
22+
console.log('not handle origin', origin)
23+
}
24+
}
25+
26+
document.addEventListener('click', hookClick, { capture: true })
27+
28+
var vConsole = new window.VConsole()

0 commit comments

Comments
 (0)