-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.ts
50 lines (47 loc) · 1.24 KB
/
content.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import type { PlasmoCSConfig } from "plasmo"
export const config: PlasmoCSConfig = {
matches: ["https://riderx-l3b.jing-chi.com/*"]
// matches: ["https://riderx-l3.jing-chi.com/*"]
}
// 触发事件
document.addEventListener("keypress", keyboard)
function paiZiFun(paiZhi) {
paiZhi[0].dispatchEvent(boxClick)
paiZhi[0].dispatchEvent(boxClick)
}
function A(key, box) {
// 判断是否是绑定的键
if (key == "g") {
// 事件派发
console.log(key)
box[0].dispatchEvent(boxClick)
}
if (key == "h") {
// 事件派发
console.log(key)
box[1].dispatchEvent(boxClick)
}
}
// 回调
async function keyboard(eve) {
// 提取点击的键
let x = eve.keyCode || eve.which
let key = String.fromCharCode(x)
//
// const newPaiZi = new Promise((resolve, reject) => {
// paiZiFun(paiziClick)
// })
let paiziClick = document.querySelectorAll(
".src-components-AppBar-AppBarIcon-module__appbar_icon_container--2RT8u"
)
let box = document.querySelectorAll(".ant-checkbox-input")
if (box[1] == undefined) {
await paiZiFun(paiziClick)
}
await A(key, box)
}
var boxClick = new MouseEvent("click", {
bubbles: true,
cancelable: true,
view: window
})