3 ms·
For those wondering how it works, it seems to be a blacklist. Here's the crux of it: chrome.webRequest.onBeforeRequest.addListener(details => { //
by wyc 9y ago
For those wondering how it works, it seems to be a blacklist. Here's the crux of it:
chrome.webRequest.onBeforeRequest.addListener(details => {
// ...
// Is domain white listed
if (isDomainWhitelisted(domains[details.tabId])) {
return { cancel: false };
}
return { cancel: true };
}, { urls: blacklistedUrls }, ['blocking']);
It's kind of sad how much boilerplate is required to write a simple extension. I wonder if there's a framework for saving labor while building cross-compatible browser extensions. Then again, maybe the world doesn't need yet another JavaScript framework.
- fiatjaf 9y agoThat's what was attempted with Greasemonkey and Tampermonkey, wasn't it? Userscripts and so on.
- wyc 9y agoI loved using those tools, but I think many browser extensions today are more involved than small shim scripts. A lot of them have CRUD operations, data editing interfaces, css/image assets, etc. I was thinking about something a bit more composed like create-react-app.
- jacalata 9y agoI wrote a grease monkey script that allowed you to annotate a website and save the notes permanently to local storage. It had all of the above features. The only real limitation is the sandboxing.
- PrimHelios 9y agoDo you have a link to the script? Sounds like something I'd use.
- jacalata 9y agoI don't think I have a copy since userscripts died, but on cursory inspection this Reddit script looks like it does similar things - http://userscripts-mirror.org/scripts/review/170091 http://userscripts-mirror.org/scripts/review/170091