Some Improvements on Adblocker

Philipp Hülsdunk philipp_huelsdunk at yahoo.de
Mon Oct 9 17:02:09 BST 2006


Am Sonntag, 8. Oktober 2006 23:41 schrieb David Faure:
> On Sunday 08 October 2006 12:13, Philipp Hülsdunk wrote:
> > I am trying now to make my idea clear.
> > My Idea of ad blocker contains two parts.
> > The first part is a block-list: It contains regular expressions of
> > sources of imgaes. If one regular expression matches to the a source of
> > an image that image will not be shown. This part is already in khtml
> > implemented. It is the current ad blocker.
> > My second part of my idea is to search the html code with regular
> > expressions and to replace it by regular expressions. These find and
> > replace expressions are stored in a list. This part allows to remove java
> > script ads too. It works should wor like Proxomitron or Privoxy.
> > Look here to know about
> > Proxomitron "http://en.wikipedia.org/wiki/Proxomitron".
> > What I need to implement this is to have direct access to the html code
> > and to manipulate. So could somebody tell me how can I do this. I do not
> > know much of khtml and its functions.
>
> The text comes to khtml in KHTMLPart::write() but that's probably too early
> to filter it; it needs to be converted to the right encoding first...
> Better add your hooks into Tokenizer::write which is called by khtmlpart.
> Make sure to make it fast though, this is speed-critical code...

It would be just like this:
for every pair p of regular expressions in the filter list do
    find the first match of p.first and replace it by p.second

		
___________________________________________________________ 
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de





More information about the kfm-devel mailing list