-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent-script.js
More file actions
31 lines (30 loc) · 1 KB
/
content-script.js
File metadata and controls
31 lines (30 loc) · 1 KB
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
//注入页面用于控制DOM
chrome.storage.sync.get('search', data => {
let { search } = data
if (!search.is) {
console.log('not search', search)
return
}
chrome.storage.sync.set({ search: { is: false } }, () => {
console.log(`search = ${search.said}`)
let loop = num => {
if(num > 60){
console.log('search failed:wait time out!')
return
}
try{
let bm = document.getElementsByName('bottom')[0].contentWindow.document
let lm = bm.getElementsByName('left')[0].contentWindow.document
lm.getElementById('TextBox1').value = search.said
lm.getElementById('Button1').click()
console.log('search successed')
}catch(error){
setTimeout(() => {
console.log(`wait for server...${num}`)
loop(++num)
},500)
}
}
loop(1)
})
})