Home > Uncategorized > Extending Adsweep, a Google Chrome ads blocker

Extending Adsweep, a Google Chrome ads blocker

Adding a rule to Adsweep is not as easy as in Adblock. Below is a patch for Adsweep 2.0.1 to remove ads on 2 web sites I often use. On Debian the AdSweep.js file can be found in this directory:

$HOME/.config/google-chrome/Default/Extensions/*/2.0.1
diff --git a/AdSweep.js b/AdSweep.js
index a7d0d8b..96dba20 100644
--- a/AdSweep.js
+++ b/AdSweep.js
@@ -91,6 +91,25 @@ function adsweep_removeAdNodes()
        adsweep_YouTube();
        window.setTimeout(function()
        {
+               if(URL.match("meteofrance.com")) {
+                       ad=document.getElementById("topAd");
+                       if(ad) ad.parentNode.removeChild(ad);
+                       ad=document.getElementById("adColumn3");
+                       if(ad) ad.parentNode.removeChild(ad);
+                       ad=document.getElementById("HighDiv_LB");
+                       if(ad) ad.parentNode.removeChild(ad);
+                       ad=document.getElementById("HighDiv_PV");
+                       if(ad) ad.parentNode.removeChild(ad);
+               }
+               if(URL.match("allocine.fr")) {
+                       divs = document.getElementsByTagName("div")
+                       for(var i = 0; i < divs.length; i++) {
+                               var c = divs[i].className
+                               if(c && c.match('adbox'))
+                                       divs[i].parentNode.removeChild(divs[i]);
+                       }
+               }
+
                // AdBrite
                if(document.getElementsByTagName("A")){var anchorTags=document.getElementsByTagName("A");for(var a=0;a<anchorTags.length;a++){for(var x=0;x<anchorTags[a].attributes.length;x++){if(anchorTags[a].attributes[x].nodeName.toLowerCase()=='id'){if(anchorTags[a].attributes[x].nodeValue.indexOf("AdBriteInlineAd")!=-1){var textString=anchorTags[a].innerHTML;var newNode=document.createElement('SPAN');newNode.innerHTML=textString;anchorTags[a].parentNode.insertBefore(newNode,anchorTags[a]);}}}}}
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: