Coder Social home page Coder Social logo

blockrz's Introduction

Blockrz

Build yourself an adblocker in less than 100 lines of TypeScript! This is a minimal WebExtension doing adblocking/antitracking using most popular block-lists. It is meant as a very thin wrapper around the adblocker library which does most of the heavy-lifting. The code is also heavily commented and aims at explaining how a modern content-blocker works. This is a didactic project and contributions to improve it are more than welcome.

Building

  1. Build the extension: npm ci && npm run bundle
  2. Load it in Firefox or Chromium by using the "Load unpacked extension" feature

FAQ

Is it really less than 100 lines of code?

Yes.

$ loc content-script.ts background.ts

--------------------------------------------------------------------------------
 Language             Files        Lines        Blank      Comment         Code
--------------------------------------------------------------------------------
 TypeScript               2          143           15           70           58
--------------------------------------------------------------------------------
 Total                    2          143           15           70           58
--------------------------------------------------------------------------------

It's tiny, does it actually perform like other blocker extensions?

Yes it is small, but it leverages @cliqz/adblocker to do the heavy-lifting. This means that the extension is doing as much as any other content-blocker (if you make abstraction of the UI, of course, which only consists in a counter of blocked requests). At the time of this writing, this is still the fastest and most memory efficient adblocker around.

Which filters lists is it using?

Currently, it is using a pre-built engine distributed on Cliqz' CDN. This means that no parsing is required client-side to load the engine (super-fast loading cached between sessions!). The default lists at the time of this writing are:

blockrz's People

Contributors

dependabot-preview[bot] avatar remusao avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.