-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
25 lines (21 loc) · 819 Bytes
/
main.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
declare const __INITIAL_STATE__: any
type Callback = (el: HTMLElement) => void
function waitArrive(sel: string, cb: Callback) {
document.arrive(sel, { existing: true }, element => {
cb(element as HTMLElement)
})
}
function onKeypress(ev: KeyboardEvent) {
ev.code == 'Digit1' && $('.bui-switch-input').trigger('click')
ev.code == 'Backquote' && $('.squirtle-video-fullscreen').trigger('click')
}
function run() {
addEventListener('keypress', onKeypress)
waitArrive('#eplist_module', () => {
$('#eplist_module').after(`<img id="_ep_info_cover_" src="${__INITIAL_STATE__.epInfo.cover}" style="width:320px;margin-bottom:20px">`)
$('#eplist_module ul').on('click', 'li', function () {
$('#_ep_info_cover_').attr('src', this.__vue__.epInfo.cover)
})
})
}
addEventListener('load', run)