adblock-minus
v1.0.6
Published
Implements core functionality of adblocking
Downloads
24
Readme
A plain JavaScript implementation of adblocking that understands most Adblock Plus filters syntax.
The package also contains a runnable Chrome extension demo, could be a good usage guide and starting point for your work.
To run the demo:
npm install && npm run build
then load the build
folder via Chrome extensions page.
Or quick install via Chrome web store
Install
npm install --save adblock-minus
Usage
const adblock = require('adblock-minus')
const blocker = new adblock.Blocker()
const target = 'http://evil.com/ad.gif'
blocker.match(target) // => false
blocker.add('||evil.com/ad.')
blocker.match(target) // => true
blocker.add('evil.com###adbanner')
for (const selector of blocker.selectors('evil.com')) {
console.log(selector) // => ['#adbanner']
}