-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathread.js
48 lines (34 loc) · 1.02 KB
/
read.js
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
/*
Licensed under AGPL
By Garywill (
https://garywill.github.io
https://space.bilibili.com/2123686105
https://twitter.com/garyw_gh
)
*/
async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function init() {
await chrome.runtime.sendMessage({
"message": "add-reponse-modifyer-to-my-tab"
});
var oURL = new URL(document.location.href);
var url_to_read = decodeURIComponent( oURL.searchParams.get("url") );
if ( url_to_read ) {
var IFRAME = document.getElementById("TBRL_VERT_IFRAME");
// await sleep(200);
IFRAME.src = url_to_read;
await sleep(1000);
await chrome.runtime.sendMessage({
"message": "inject-to-my-tab-iframe"
});
await sleep(2000);
await chrome.runtime.sendMessage({
"message": "inject-to-my-tab-iframe"
});
}
}
document.addEventListener('DOMContentLoaded', async (event) => {
init();
});