Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/armandgrillet/adios-engine
ABP rules => Safari content blocker rules
https://github.com/armandgrillet/adios-engine
Last synced: about 1 month ago
JSON representation
ABP rules => Safari content blocker rules
- Host: GitHub
- URL: https://github.com/armandgrillet/adios-engine
- Owner: armandgrillet
- Created: 2015-06-20T13:18:54.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-29T07:56:45.000Z (about 9 years ago)
- Last Synced: 2024-04-29T12:23:04.764Z (8 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/adios-engine
- Size: 766 KB
- Stars: 13
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Adios Engine
A small library to transform standard AdBlock Plus rules like [EasyList](https://easylist-downloads.adblockplus.org/easylist.txt) into [rules working in Safari](https://www.webkit.org/blog/3476/content-blockers-first-look/).
## Demo
You can visit [this website](http://armand.gr/Adios-Engine-Demo/) to try the engine.## Working example
If you want to see how to use Adios Engine, check [this project](https://github.com/ArmandGrillet/Adios-Engine-Example).## Installation
```
npm install adios-engine --save
```## Usage
```javascript
var parser = require('adios-engine');
var rule = 'savevideo.me,sddt.com,~search.yahoo.com,yahoo.com,youthedesigner.com,yuku.com##.ads';
var rules = ['@@|http://example.com', 'http://example.com/banner/foo/bar/img?param'];
var wrongRule = '|http://*.com^*|*$script,third-party,domain=lύ.com';for (var rule of parser.parseRule(rule)) {
console.log(rule); // The original rule created two parsed rules, parseRule() always returns an array even if the output is only one parsed rule.
}for (var rule of parser.parseRules(rules)) {
console.log(rule); // Will print all the parsed rules from the original rules array, can be used to parse an entire list like EasyList.
}for (var rule of parser.parseRule(wrongRule)) {
console.log(rule); // Nothing will be printed because the array returned is empty, the original rule contains characters that are not ASCII compliant.
}
```## Documentation
Only two functions:
``parseRule(rule)``: takes a String as an argument and returns an array containing the parsed rules. If the rule given cannot be parsed the method returns an empty array.
``parseRules(rules)``: takes a String array as an argument and returns the same thing as ``parseRule()``.
## Tests
```
npm test
```