Jump to content
IGNORED

attn: web devs


Guest

Recommended Posts

hello,

 

i just had an idea for a thing, namely an inverted adblock browser extension which filters out anything which is not on a adblock blacklist.

 

i.e. you get to see ads only.

 

please note that i do not ask your opinion on why this is a stupid idea. okay? unless it is a lol opinion then it's okay.

 

now, i do know programmering, but haven't ever done anything related to website tinkering.

 

so the question is, what would be the basic steps to implement a content filter in js? it shouldn't block entire sites, but needs to get rid of .html content which is not on the ad-provider whitelist....

Link to comment
Share on other sites

yes, that would be an efficient solution! currently searching for where adblock stores its filter lists.

 

but it would be great if I could distribute this thing, so modifying the adblock source to swap its filter lists would be the way to go probably.

Link to comment
Share on other sites

It would be funny to make a site that replaces all images and coloured rectangles with ads, but keeps the layout intact.

 

yea i'm wondering, that should actually be possible with an extension, e.g. wouldn't this be quite simple with images? like:

 

foreach image request

replace image url with random ad image url instead.

 

as i said, i don't have web dev experience, but isn't all web development basically copy paste from somewhere?

Link to comment
Share on other sites

but what i want to do, with a bit of luck it's simply inverting a bool value at the right spot in the adblock code somewhere, hopefully?

Link to comment
Share on other sites

this is, I think, what adblock uses to match the document against the set of elements to be filtered:

var results = document.querySelectorAll(selector);

it goes on to destroy all elements which are contained in 'results'.

 

do you know if there's a way to invert this, i.e. give me all elements which do NOT match the selector?

Link to comment
Share on other sites

I could be wrong buy I think the '==' is used to assess equality/matches (with the opposite being '!=') wheras the single equals just means it assigns the result on the right to the variable on the left.

Link to comment
Share on other sites

You probably don't want to destroy elements because that will just collapse the page. It wont be as simple as flipping a boolean because you might have an element containing an ad you want to show. If you hide or destroy the outer element you'll just hide everything contained inside. Adblock doesn't need to preserve content within a blocked element. I'd say your best bet would be to add a blank layer over the page, extract the elements and their position you want to show and display them on top of your blank layer. I would use the element matching code of adblock so you can use their filter lists to extract the DOM elements you want to keep.

Link to comment
Share on other sites

yes yes....

so how about, for each matched element, traverse the DOM back to the root, and basically rebuild the DOM containing only the branches which contain ad elements at the end?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.