Brave-Detection-Blocker-Chr.../content-script.js

20 lines
447 B
JavaScript
Raw Normal View History

2022-03-25 18:10:48 +00:00
const nullthrows = (v) => {
2022-11-01 00:58:19 +00:00
if (v == null) throw new Error('it\'s a null')
return v
}
2022-03-25 18:10:48 +00:00
const injectScript = (src) => {
2022-11-01 00:58:19 +00:00
const script = document.createElement('script')
script.src = src
script.onload = function () {
this.remove()
}
try {
nullthrows(document.head || document.documentElement).prepend(script)
} catch {
// ignore
}
}
2022-03-25 18:10:48 +00:00
2022-11-01 00:58:19 +00:00
injectScript(chrome.runtime.getURL('/block-script.js'))