Friday, June 05, 2009

 

Fixing the Adblock plugin for Firefox

I like using the Adblock plugin for Firefox but I am running into two issues. Since it is not maintained anymore and also being curious, I dived right into the code to see what I can find.

#1 Installation
The plugin used to install but ever since the later 2.0 versions and then the current 3.0 versions of Firefox the plugin just doesn't install.

Fix:
Download the plugin
Change the extension from .xpi to .zip
Unzip
Edit install.rdf and change the maxversion of Firefox to some high number, I think I chose 99.9
Zip the files back up, Use .xpi instead of .zip in the zipped filename
Install plugin in Firefox using this local file

#2 The radio buttons for the group "Hide ads" and "Remove ads" are both selected in the Preferences dialog box.

Fix:
Edit the file content/settings.js
This file is extracted from chrome/adblock.jar which is essentially a zipped file.
chrome/adblock.jar on my system is found in:
~/Library/Application Support/Firefox/Profiles/.default/extensions//
On line 39 of content/settings.js, change the entire "if" code block to this:

if (Hide) {
radiohide.setAttribute("selected", true);
radioremove.setAttribute("selected", false);
} else {
radiohide.setAttribute("selected", false);
radioremove.setAttribute("selected", true);
}

Zip up all the files to recreate adblock.jar.
The new adblock.jar file could be smaller in size than the original adblock.jar. That's ok, Firefox will still load the file fine. I think the original adblock.jar was packaged without compression.
Replace the old adblock.jar file with the new one.
Restart Firefox, the radio buttons in the Preference dialog box should now work correctly.

This page is powered by Blogger. Isn't yours?