-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinject.js
31 lines (27 loc) · 935 Bytes
/
inject.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
(function () {
const domain = psl.get(window.location.hostname)
const hostname = window.location.hostname
if (domain) {
chrome.storage.local.get({ '__injector': [] }, function(result) {
const found = result['__injector'].filter(r => {
if (r?.match_sub) {
return domain === r.url
}
return hostname === r.url
})?.[0]
if (!found) { return }
if (found?.enabled && found?.code) {
try {
eval(found.code)
chrome.extension.sendMessage(
{ kind: 'badge' },
() => {}
)
}
catch (e) {
console.error('Exception thrown when evaluating your js. Check the syntax.')
}
}
})
}
}())