mirror of
https://github.com/andrei0x309/Brave-Detection-Blocker-Chrome-Extension.git
synced 2024-11-22 08:03:49 +00:00
20 lines
447 B
JavaScript
20 lines
447 B
JavaScript
const nullthrows = (v) => {
|
|
if (v == null) throw new Error('it\'s a null')
|
|
return v
|
|
}
|
|
|
|
const injectScript = (src) => {
|
|
const script = document.createElement('script')
|
|
script.src = src
|
|
script.onload = function () {
|
|
this.remove()
|
|
}
|
|
try {
|
|
nullthrows(document.head || document.documentElement).prepend(script)
|
|
} catch {
|
|
// ignore
|
|
}
|
|
}
|
|
|
|
injectScript(chrome.runtime.getURL('/block-script.js'))
|