General :  K-Meleon Web Browser Forum
General discussion about K-Meleon. Questions about how to setup it, macro coding, all related to its usage and the project itself, including this website. 
Adblock Plus 0.6
Posted by: CaptnBlack
Date: January 22, 2006 01:23AM

If anyone is interested in trying it out, there's a new Adblock Plus 0.6 that works a lot better in K-M.
Here's a link to the dicussion about it at the Mozzillazine ext. forum:

http://forums.mozillazine.org/viewtopic.php?t=369529

Filters take effect when added with my macros in this version of K-M( 1.8 GRE tested on Dorians newest tab exe, with my own custom chrome), just add a filter and reload the page.
The install is basically the same as other Adblock installs.

Here's the modified macros:

#-----------ADBLOCK MACROS-----------#

$abenable="extensions.adblockplus.enabled";
$abobj="extensions.adblockplus.frameobjects";
$abcol="extensions.adblockplus.fastcollapse";
$abplnk="extensions.adblockplus.linkcheck";
$absort="extensions.adblockplus.listsort";

ABabout{
$xul="chrome://adblockplus/content/about.xul"; &XUL;
}
AdBlock{
$xul="chrome://adblockplus/content/settings.xul"; &XUL;
}

FrmFilter{
$ABlist=getpref(STRING,"extensions.adblockplus.patterns");
$Alist=prompt(New Filter Use Asterisk as Wildcard, Add to Filterlist,$FRAMEURL );
$sites = $ABlist." ".$Alist;
setpref(STRING,"extensions.adblockplus.patterns",$sites);
}

ImgFilter{
$ABlist=getpref(STRING,"extensions.adblockplus.patterns");
$Alist=prompt(New Filter Use Asterisk as Wildcard, Add to Filterlist,$ImageURL );
$sites = $ABlist." ".$Alist;
setpref(STRING,"extensions.adblockplus.patterns",$sites);
}

LnkFilter{
$ABlist=getpref(STRING,"extensions.adblockplus.patterns");
$Alist=prompt(New Filter Use Asterisk as Wildcard, Add to Filterlist,$LinkURL );
$sites = $ABlist." ".$Alist;
setpref(STRING,"extensions.adblockplus.patterns",$sites);
}

ABToggle{
togglepref(BOOL,$abenable); &Sync;
getpref(BOOL,$abenable)==true ? $tip="Enabled":$tip="Disabled";
statusbar("Adblock--- ".$tip);
}
ABobjtab{
togglepref(BOOL,$abobj); &Sync;
getpref(BOOL,$abobj)==false ? $tip="Enabled":$tip="Disabled";
statusbar("Object Tabs --- ".$tip);
}
ABcollapse{
togglepref(BOOL,$abcol); &Sync;
getpref(BOOL,$abcol)==false ? $tip="Enabled":$tip="Disabled";
statusbar("Fast Collapse --- ".$tip);
}
ABparlnk{
togglepref(BOOL,$abplnk); &Sync;
getpref(BOOL,$abplnk)==true ? $tip="Enabled":$tip="Disabled";
statusbar("Parent Links --- ".$tip);
}
ABlstsort{
togglepref(BOOL,$absort); &Sync;
getpref(BOOL,$absort)==true ? $tip="Enabled":$tip="Disabled";
statusbar("Keep List Sorted --- ".$tip);
}

#--------------------------------------AdBlock Setchecks---------------------------------------#

setcheck("macros(ABobjtab)",getpref(BOOL,$abobj)? true:false);
pluginmsg(toolbars,"CheckButton","AdBlock,macros(ABobjtab),".(getpref(BOOL,$abobj)? 1:0));

setcheck("macros(ABToggle)",getpref(BOOL,$abenable)? true:false);
pluginmsg(toolbars,"CheckButton","AdBlock,macros(ABToggle),".(getpref(BOOL,$abenable)? 1:0));

setcheck("macros(ABcollapse)",getpref(BOOL,$abcol)? false:true);
pluginmsg(toolbars,"CheckButton","AdBlock,macros(ABcollapse),".(getpref(BOOL,$abcol)? 1:0));

setcheck("macros(ABparlnk)",getpref(BOOL,$abplnk)? true:false);
pluginmsg(toolbars,"CheckButton","AdBlock,macros(ABparlnk),".(getpref(BOOL,$abplnk)? 1:0));

setcheck("macros(ABlstsort)",getpref(BOOL,$absort)? true:false);
pluginmsg(toolbars,"CheckButton","AdBlock,macros(ABlstsort),".(getpref(BOOL,$absort)? 1:0));


In menus.cfg:


#------------------------AdBlock Menu---------------------------#
AdBlock{
macros(ABobjtab, Show Object Tabs)
macros(ABcollapse, Collapse Blocked Elements)
macros(ABparlnk, Check Parent Links)
macros(ABlstsort, Keep Filters Sorted)
-
macros(AdBlock, AdBlock Preferences)
macros(ABabout, About AdBlock)
}

DocumentImagePopup {

macros(ImgFilter, AdBlock Background Image)

}

Link{

macros(LnkFilter, AdBlock Image Link)

}

LinkPopup {

macros(LnkFilter, AdBlock Image Link)

}

Image{

macros(ImgFilter, AdBlock Image)

}

Frame{

macros(FrmFilter, AdBlock This Frame)

}

FrameDocumentImagePopup {

macros(ImgFilter, AdBlock Image)

}

This needs to be added to installed-chrome.txt:

content,install,url,jar:resource:/chrome/adblockplus.jar!/content/
locale,install,url,jar:resource:/chrome/adblockplus.jar!/locale/en-US/
skin,install,url,jar:resource:/chrome/adblockplus.jar!/skin/classic/


There's still a few prefs I haven't added yet, just thought I'd let anyone that wants to play with what I got so far.

Options: ReplyQuote
Re: Adblock Plus 0.6
Posted by: CaptnBlack
Date: January 22, 2006 01:37AM

Here's a link to the homepage of Adblock Plus 0.6:

http://adblockplus.mozdev.org/

This version has a lot of the useless crap stripped out, and the code has been cleaned up a lot( the jar file is a lot smaller now), seems faster than other versions of Adblock.

Options: ReplyQuote
Re: Adblock Plus 0.6
Posted by: ndebord
Date: January 22, 2006 07:02AM

CaptnBlack,

I like what you've done with AdBlock. Can't wait for your refinements with it, but what you have done so far is nice.

N

Options: ReplyQuote
Re: Adblock Plus 0.6
Posted by: alain aupeix chez wanadoo fr
Date: January 22, 2006 11:26AM

@CaptnBlack,

Does this version works with 1.7.12 ? As I can't make 0.5 (last build) with 1.7.12, I think it doesn't work.

Thank's to confirm if it just works with 1.8.

A+

Options: ReplyQuote
Re: Adblock Plus 0.6
Posted by: CaptnBlack
Date: January 22, 2006 12:34PM

I've not had time to try it with 1.7.12 yet.
Hopefully I will be able to find time for testing other GREs soon.

I don't think there should be any problems getting it to work with 1.7.12.
There could be problems with versions that use a minimal chrome.

Options: ReplyQuote
Re: Adblock Plus 0.6
Posted by: CaptnBlack
Date: January 22, 2006 01:48PM

Preliminary tests show that Adblock Plus 0.6 works with 1.7.12 GRE.
However, in the version I tested (K-Meleon0.9-original-updated-1.7.12-plus8) frame blocking didn't work for some reason.

Options: ReplyQuote
Re: Adblock Plus 0.6
Posted by: rainman
Date: January 22, 2006 01:53PM

Captnblack,

I really want to try it on my K-meleon . Since I'm not a programmer could you tell me how could I install the adblock plus 6.01.xpi in my K-meleon?

thanks,

Rainman

Options: ReplyQuote
Re: Adblock Plus 0.6
Posted by: alain aupeix chez wanadoo fr
Date: January 22, 2006 08:40PM

@CaptnBlack,

ok, I'll try it with Fr4 (chrome is the same as Plus8)

Thanks ...

A+

Options: ReplyQuote
Re: Adblock Plus 0.6
Posted by: alain aupeix chez wanadoo fr
Date: January 22, 2006 09:26PM

@CaptnBlack,

My first tests with Fr4 aren't ok:

1) impossible to quit preference with ok, just with cancel.

2) Checked options aren't checked in preferences.

I'll test with Plus8

A+

Options: ReplyQuote
Re: Adblock Plus 0.6
Posted by: alain aupeix chez wanadoo fr
Date: January 22, 2006 09:29PM

@rainman,

To install it, open xpi file with a zipper (Izarc, winzip, ...)

Extract the file from components in k-meleon components folder
Extract the file from chrome in k-meleon chrome folder
Extract the file from default/preference in profiles\<profilename>\slt folder

and modify macros.cfg and menus.cfg

A+

Options: ReplyQuote
Re: Adblock Plus 0.6
Posted by: alain aupeix chez wanadoo fr
Date: January 23, 2006 08:36PM

@CaptnBlack,

All the menus work with Fr4 and Plus8.

The impossibility to validate the changes in preferences was due to the non-deletion of xpti and compreg.dat in components.

I've don't test for frame.

A+

Options: ReplyQuote
Re: Adblock Plus 0.6
Posted by: CaptnBlack
Date: January 23, 2006 11:42PM

You can add pages to Adblock Plus whitelist by adding this to macros.cfg:

DocFilter{
$ABlist=getpref(STRING,"extensions.adblockplus.patterns");
$Alist=prompt(New Filter Use Asterisk as Wildcard, Add to Whitelist, @@.$URL );
$sites = $ABlist." ".$Alist;
setpref(STRING,"extensions.adblockplus.patterns",$sites);
}

Add this to menus.cfg:

DocumentPopup {

macros(DocFilter, Add Page To Adblock Whitelist)

}

I noticed that the checks don't appear on the Adblock Options menu with minimal chrome versions, you can fix it by copying the menu folder located here: "chrome\classic\skin\classic\global\menu\" back into classic.jar from a jar file of the same version chrome.

Options: ReplyQuote
Re: Adblock Plus 0.6
Posted by: alain aupeix chez wanadoo fr
Date: January 24, 2006 09:03AM

@CaptnBlack,

Thanks for info, I'll have a look for chrome.

The menu already exists in Plus8, but was commented (I suppose Fred has tested AdBlock and AdBlockPlus).

In your menus, there's lines which aren't needed:

For example:

LinkPopup {

macros(LnkFilter, AdBlock Image Link)

}


is not needed, because this line is already added in Link()

LinkPopup {
!Link
-
!Sélection
#bmpmenu()
}

This is the same with all menus including Link() or Frame().

A+

Options: ReplyQuote
Re: Adblock Plus 0.6
Posted by: alain aupeix chez wanadoo fr
Date: January 25, 2006 07:20AM

@CaptnBlack

During my test, I've discovered a bug in K-meleon. It crashes when I want to add a page in whitelist or an address in blacklist (no crashlog report).

The bug is probably due to macros.dll function getpref() or setpref(). Can you test it ?

The way I use to make it crash:

I used the I opens prefs.js and replace addblockplus.patterns by the content of addblock.patterns (which is about 5 Ko).

When opening preferences, all the patterns are ok.
When trying to add a page to blacklist or other thing, in fact when we use macros to add something in patterns, it crashes.

I've test to see where is the size limit, it seems to be when pref line lenth is about 4270 characters.

I don't know if this limit is due to my avalaible memory or a length limitation of setpref() or (and) getpref().

Perhaps Dorian can confirm if there is limitation or not.

I don't remember it happens with adblock0.5b2 (test must perhaps be made again), and I haven't tile to to the test of adding a pattern in addblockplus preference, with this pref length..

A+

Options: ReplyQuote
Re: Adblock Plus 0.6
Posted by: alain aupeix chez wanadoo fr
Date: January 26, 2006 02:21PM

I confirm, getpref() and setpref() are buggy, the string tail is limited to a value about 4200 bytes. There's no problem with Adblock preferences.

I'm trying to make these functions with luamacros to bypass these limitations, but I have some problems.

Here is my macros.lua (in slt profile folder):

LUA_PATH=PREFPATH.."/../../../luamacros/?.lua;"..PREFPATH.."/../../../luamacros/?.lc"
require "compat"
require "copyaslink"
require "hook"
require "proxy"
require "groups"
require "search"
require "adblock"

-- in menu.cfg
-- luamacros(proxy.change(gateway), Default Proxy)
-- luamacros(proxy.change(local), Local Proxy)

proxy["gateway"] = {
host = "192.168.0.1",
port = 8080
}
proxy["local"] = {
host = "127.0.0.1",
port = 8080
}

function Eval(hwnd)
local a, b
a = prompt(hwnd, "lua", "k-meleon", "")
if a then
b = loadstring(a)
if b then
alert(hwnd, b(), "lua", ICON_INFO)
end
end
end

Here is my adblock.lua ( in luamacros folder under K-Meleon)

--[[ Add an AdBlockPlus filter

luamacros(adblock,adblock.blackfilter($FrameURL), Filtrer le cadre avec AdBlock)
luamacros(adblock,adblock.blackfilter($ImageURL), Filtrer l'image avec AdBlock)
luamacros(adblock.adblock.blackfilter($LinkURL), Filtrer le lien Image avec AdBlock)

luamacros(adblock,adblock.whitefilter($URL), Filtrer le cadre avec AdBlock)

]]

adblock.pat = "extensions.adblockplus.patterns"
Adblock.patterns = getpref(TYPE_STRING,adblock.pat)

function adblock.addfilter(hwnd,type)
local url


local function adblock.blackfilter(hwnd,url)
local new
new = adblock.patterns .. " " .. url
setpref(TYPE_STRING, adblock.pat, new)
end

local function adblock.whitefilter(hwnd,url)
local new
new = adblock.patterns .. " @@" .. url
setpref(TYPE_STRING, adblock.pat, new)
end

Here are the modifications of my menus.cfg:

# macros(DocFilter, Ajouter la page à la liste blanche de Adblock)
luamacros(adblock,adblock.whitefilter($URL), Filtrer le cadre avec AdBlock)

# macros(ImgFilter, Filtrer l'image avec AdBlock)
luamacros(adblock,adblock.blackfilter($ImageURL), Filtrer l'image avec AdBlock)

# macros(LnkFilter, Filtrer le lien Image avec AdBlock)
luamacros(adblock.adblock.blackfilter($LinkURL), Filtrer le lien Image avec AdBlock)

# macros(FrmFilter, Filtrer le cadre avec AdBlock)
luamacros(adblock,adblock.blackfilter($FrameURL), Filtrer le cadre avec AdBlock)

The first problem: No menu entry ... and without menu entry, I can't do anything...

I somebody kwons where I'm wrong ...

A+

Options: ReplyQuote


K-Meleon forum is powered by Phorum.