General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Want to Add Privacy Bar Button
Posted by: clutterless
Date: November 10, 2017 06:17AM

The default buttons on the Privacy Bar (75.1) are Cookies, Java, JavaScript, Popups, Images,
Clear Cache, and Kill Flash.

I frequently tick and untick Tools > Privacy > Block Advertisement. On many websites you
must untick this option and reload the page. Sometimes buttons and other important objects
are blocked when this option is enabled.

Can someone tell me how to create a Block Ad button for the Privacy Bar. Constantly using
the Tools Menu to reach Block Advertisement is tiresome.

Thanks guys.

Options: ReplyQuote
Re: Want to Add Privacy Bar Button
Posted by: rodocop
Date: November 10, 2017 02:34PM

hmm,

I've made recently suach a button for FlashBlock. So sure I can help you to create your one.

But! My FlashBlock button doesn't sync with corresponding pref so doesn't reflect the real state of blockage (on or off).

Adblocking and flashblocking buttons sync routine are defined in the same macro, and I expect your button will not work right way too.

So I need help of folks with macroknowledge about this case.

Why _pref_SyncButtons and _KM_SyncButtons (in main.kmm) do not work the same way being just equally coded?

P.S. I tried this all using Yogi's Privacy bar for Klassic skin



Edited 1 time(s). Last edit at 11/10/2017 02:41PM by rodocop.

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / HowTo new buttons
Posted by: siria
Date: November 10, 2017 02:56PM

Quote
clutterless
Can someone tell me how to create a Block Ad button for the Privacy Bar. Constantly using
the Tools Menu to reach Block Advertisement is tiresome.

====== SHORT VERSION:
Various ways possible, for users easiest probably this one:

1) Edit > Configuration > Toolbars
(This opens toolbars.cfg in the PROGRAM folder, in newer KM versions the DEFAULT TEMPLATE directly, which is slightly dangerous in case of typos, and really modifies the original skin. Better to make a backup copy before changing that file, just in case. Or yet better, manually copy over that file into the currently chosen skin folder and modify it there)
Make sure you have WRITE PERMISSION there.

2) Look if the desired button already exists and is perhaps only hidden (adblock not yet).
If not found, choose a neighbor button, where you want to insert the new one. Copy the lines of that button and modify it

3) Exchange the name (random), the command, the right-click menu (optional), the tooltip, (icon only if needed) etc. for the new function, save and restart. Suggestion:

Adblock{
macros(KM_ToggleAdblock)|_Config_Appearance
Hide most Ad-Banners (could accidentally hide a 'good' image too). Right-click to modify detailed settings.
}


4) make a BACKUP copy of that modified file again in a safe place

PS: Want to see the Privacy menu by right-clicking a button?
=> on a button of your choice, simply write "|&Privacy" after the command name. Done.
Actually nearly all menu names you see in KM will work this way. The important thing is just to replace underscores with &, if they are part of the menu name.
The adblock example above uses the menu "_Config_Appearance", that is a bit trickier because it's only a submenu, the menu name not visible directly. This one was created and found in macro cfg.kmm


====== LONG VERSION AND TRICKS smiling smiley

structure of buttons in toolbars.cfg
Line-1{ = button name = random, no function, only appears as button TEXT and defines the WIDTH
Line-2= action (left-click) | menu (right-click)
Line-3= tooltip, when mouse hovers over button
Line-4 etc: icon, but NOT necessary for pure text bars, or for modern KM versions at all
}

If you prefer smaller buttons in a TEXT-toolbar, like the privbar, simply shorten the button names in Line-1! The LONGEST name defines the width for all buttons in the same toolbar smiling smiley

The help text in default toolbars.cfg is long since outdated, still dating from KM0.X or so
Buttons can be created in different ways, mostly by editing toolbars.cfg or by using a macro
Possible commands and menus are found in various places (menus.cfg, commands.html, *.kmm, wiki etc.) Almost everything is possible incl. new user macro functions. Easiest way to find the command name is to just ask here, as you did ;-)

You can also create own new toolbars if you like, easiest in toolbars.cfg, simply by looking at the syntax of other toolbars

Highly recommand:
Better not modify the default skin, or all your changes will be overwritten and lost when updating to a newer KM version.
To avoid this possible loss, and to avoid syntax typos making KM crash at next start, and to keep the "default" skin still "original default", a great way is to create your own personal skin:
In the Windows file explorer, in ...KM/skins, simply create a manual copy of your current skin folder (default, Klassic, etc) and name it as you wish, e.g. "myskin" or whatever. If there's no toolbars.cfg in it yet, copy over the one from KM/browser/defaults/settings/toolbars.cfg
Now modify what you wish there.
At next browser start, choose this "new skin" in F2/GUI, then restart again.
(If it crashes now, rename the folder to whatever and KM will restart with the native default skin again)

Secret special trick for personal skins:
(but not sure if it only works with named skins or also with "default" skin?):
name that copied skin folder the SAME and add something in brackets, e.g. "Klassic(mine)" or "default(clut1)" etc.
This way, only the modified stuff must be inside, in this case only the file toolbars.cfg, otherwise the whole folder can be EMPTY! All the rest KM will automatically look up in the "family folder" without brackets, e.g. "Klassic".
Generally, if something is not found there either, KM looks it up in "shared" or "default". The highest priority though have skins in the user profile folder.
If unsure about that bracket() method, download KM1.5.4 or older and take a look at the Phoenity skin folders. There it was used for different icon sizes, 16 or 24px



Edited 1 time(s). Last edit at 11/10/2017 03:01PM by siria.

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: siria
Date: November 10, 2017 05:44PM

Quote
rodocop
My FlashBlock button doesn't sync with corresponding pref so doesn't reflect the real state of blockage (on or off).

First thought I had forgotten above to create a "pressed" lock for blocked state, but actually this function is already contained in main.kmm (KM75.1), so not necessary to create again.

If your toggle doesn't work, are your buttons moved to another toolbar perhaps...?
The one in main.kmm so far only toggles looks if flashblock+adblock are part of the normal Privacy bar.

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: siria
Date: November 10, 2017 06:01PM

Quote
rodocop
My FlashBlock button doesn't sync with corresponding pref so doesn't reflect the real state of blockage (on or off).

Think I found it - this one?
http://kmeleonbrowser.org/forum/read.php?9,124236,140828#msg-140828

But insisde this one you're using "SetButtonImage" instead of "checkbutton", that means you intentionally do NOT want that it shows checkered gray background when pressed, but instead shall show another icon pic - because you like that look better. Right??

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: clutterless
Date: November 10, 2017 09:46PM

WOW! I didn't know adding a new button was so tricky.

I create scripts that automate many tedious processes in my home office, however, correctly
editing that toolbars.cfg file requires expertise about K-Meleon I don't have.

There are two files named toolbars.cfg:

K-Meleon\skins\Klassic\toolbars.cfg
K-Meleon\browser\defaults\settings\toolbars.cfg

The file you see at Edit > Configuration > Toolbars is located in the settings folder.

You're correct about right-clicking a button to see the Privacy Menu. All the buttons on my
Privacy Bar have that feature. I jump back and forth between sites. Quickly toggling those
Privacy Bar buttons is another reason I keep using K-Meleon. That's why I want a Block Ad
button.

Traditional file backups are a good idea, but I do all my work in a virtual operating system.
I can destroy critical system files, the Registry, it doesn't matter! Anything can be fully
restored in 60-to-90 seconds.

siria, I could tinker with that toolbars.cfg file for hours. I might get lucky and edit it correctly
on the first try, but that's not very likely. If I uploaded toolbars.cfg could you edit this file
for me?

This forum doesn't have a typical attach file feature, but I've noticed attached files with many
posts. Not sure how it's done.

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: JohnHell
Date: November 10, 2017 10:14PM

Open your toolbars.cfg that depends on your skin by Edit > Configuration > Toolbars


Append the following to the privacy bar (you can find it by searching "Privacy Bar" text).


All buttons inside the Privacy bar will look as the next text. So place it wherever you like, between the curly brackets that define the privacy bar {}.

	Advertising{
	macros(KM_ToggleAdblock)
	Block Advertising
	privbar_red.bmp[0]
	privbar_green.bmp[0]
	}




Further explanations:
http://kmeleonbrowser.org/wiki/ConfigFiles#toolbars



Edited 1 time(s). Last edit at 11/10/2017 10:14PM by JohnHell.

Options: ReplyQuote
Re: Want to Add Privacy Bar Button
Posted by: siria
Date: November 10, 2017 10:50PM

Quote
clutterless
WOW! I didn't know adding a new button was so tricky.
I could tinker with that toolbars.cfg file for hours. I might get lucky and edit it correctly on the first try, but that's not very likely.

Sigh. My text was too long, looking scary, but really:
you're not a computer phobic obviously, and the minimum action you need to do is just copy over the already finished button text above. You can do that, trust me :cool: Just read the RED WORDS in points 1)-3)

Yes there are several toolbars.cfg, because there are several skins to choose, but the menu above automatically opens the RIGHT one, the currently active one.

@John: he's obviously using a modern version, that has no icons any more, just pure text buttons

Options: ReplyQuote
Re: Want to Add Privacy Bar Button
Posted by: JohnHell
Date: November 10, 2017 11:10PM

Quote
siria
@John: he's obviously using a modern version, that has no icons any more, just pure text buttons

Oh, true, skin.cfg was introduced in 75 or 75.1

Anyway, this text is still valid:
	Advertising{
	macros(KM_ToggleAdblock)
	Block Advertising
	}


Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: rodocop
Date: November 13, 2017 10:59AM


NoNoNo! That was my early try of creating macro using old one as template (and it works)
But now I just add new button to Privacy Bar through toolbars.cfg using neighbour existing button as template and relying on main.kmm macros _pref_SyncButtons and _KM_SyncButtons.

They are just identical but first does work and second - mystically doesn't

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: siria
Date: November 13, 2017 02:34PM

@rodocop
I have your 76RC-pro from april unzipped, but cannot find any adblock or flashblock buttons in the toolbar.cfg's?
In most cases, if "checkbutton" doesn't work, the toolbar names are culprits. Or perhaps the new skin system? Or perhaps a mix of different button types, "text" buttons or with icon pics? Or perhaps you confuse the flash-KILL with flash-BLOCK? Cannot check anything without finding those prob files ;-)



Edited 2 time(s). Last edit at 11/13/2017 02:44PM by siria.

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: rodocop
Date: November 13, 2017 03:47PM

nonono again!

It's just new test install with added Yogi's klassic skin where graphic buttons are used and flashblock one is added by myself using COPYING of existing one (same syntax etc.). It's for sure flashblock not killflash.

Simple mystery.

Attachments: main.kmm (30.5 KB)  
Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: rodocop
Date: November 13, 2017 03:48PM

and toolbars config

Attachments: toolbars.cfg (7.5 KB)  
Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: siria
Date: November 13, 2017 05:48PM

Quote
rodocop
klassic skin where graphic buttons are used and flashblock one is added by myself using COPYING of existing one (same syntax etc.).

Okay, riddling too... So far can't find nothing, so what I'd try as off-chance, although no idea if it matters: give the UA-button a second pic line (can be the same as first)... remove the minus between the buttons (perhaps it's the blanks before?)... remove the flashbutton menu (is it created somewhere?)... check if you have other macros that accidentally create the same button too...

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: rodocop
Date: November 14, 2017 05:27AM

Tried replacing with checkbutton() statement - with the same no luck.

No changes in toolbars.cfg also working...

So - puzzled, perplexed, confused, baffled, bewildered, taken aback, befogged...

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: siria
Date: November 14, 2017 04:50PM

Such mysterious stuff sometimes has its reasons completely elsewhere as assumed. For example other macros or whatever. Have you tried in other KM installations, non-Pro? Or with bmp/png pics? And to see the size directly at each button seems very strange to me, while the toolbar has explicitely [0,0] set, although it seems to work for your neighbor buttons. Or some skin.cfg containing another flashblock-pic already? Or perhaps the "menugrayed" line is a prob?? Just wild thoughts, tapping in the dark too ;-)



Edited 1 time(s). Last edit at 11/14/2017 04:53PM by siria.

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: rodocop
Date: November 14, 2017 06:53PM

This is now being tested exactly in non-Pro build.

Forced dimensions for every button are needed to ensure that right ico size is choosed (I should refresh all the logic now but can firmly say that syntax found was almost obligatory to get things look right).

I promised the tutorial about working with multisize ico-files in KM but it will take some time to formulate right logic of handling them by KM toolbars (through both cfg-files and marros)

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: Yogi
Date: November 15, 2017 11:17AM

Sorry if my question sounds naive.
Are you referring to the build-in css ad-blocking?
- I'm asking since I've never used it and I don't know how it performs.
- I'm also asking because it seems to work on this simple test.
I did test with an icon (png) on my privacy-bar and the icon is changing showing the status. (the status-bar also shows "CSS Ad-Blocking enabled/disabled")
Once I make sure that your answers are "yes" and I didn't misunderstood something, I'll post the lines from my toolbars.cfg (Klassic skin).

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: rodocop
Date: November 15, 2017 11:33AM

Yogi,

topicstarter speaks - yes - about CSS adblock. But my bad experience touches FlashBlock button which is in single macro block with CSS adblocking command.

I haven't tried CSS-button but I should.

Well, tested: in my config css-adblock button behaves just the same way like Flashblock one. Doesn't sync.

Curious about your configs (both skin one and main.kmm)



Edited 2 time(s). Last edit at 11/15/2017 11:39AM by rodocop.

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: Yogi
Date: November 15, 2017 11:41AM

AdBlock{
 	macros(KM_ToggleAdblock)
 	Block Ads
 	privhot.png[1]
 	privcold.png[1]
 	}

I didn't made any change to main.kmm.

You can simply test with my mod Klassic skin.
For testing I've only replaced the lines for ImageAnimation keeping the icons (png).
Of course, I could upload the test-skin as well if you wish so.

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: rodocop
Date: November 15, 2017 11:57AM

heh,

it doesn't work for me here. May I look at your main.kmm? I think there are some differencies there with my own...




heh-2!
transferring checkbuttons for FlashBlock and CSS Adblock from _KM_SyncButtons{} to _pref_SyncButtons{} - makes adblock button to start sync properly.

But Flashblock still DOESN'T!

OMG!



Edited 1 time(s). Last edit at 11/15/2017 12:15PM by rodocop.

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: Yogi
Date: November 15, 2017 12:03PM

OK, I'll upload both, the test-skin and main.kmm in the Graphics forum since I don't see any option for attachemets here.

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: Yogi
Date: November 15, 2017 01:10PM

I did misuse the button for ImageAnimation [GIF] since I was too lazy to make a new one.
Otherwise it seems to work.

screenshot

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: siria
Date: November 15, 2017 02:12PM

Curious what will turnout as reason...

Quote
Yogi
Are you referring to the build-in css ad-blocking?
- I'm asking since I've never used it and I don't know how it performs

That's just an ancient css file dating from 2006, in profile/chrome, which is blocking almost everything starting with "adv*", incl. ADVance... ADVenture... etc. Have modified my own file heavily over the years with personal stuff.

But I thought Dorian had meanwhile included (additionally?) another basic tool with updated french lists.

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: Yogi
Date: November 15, 2017 03:08PM

Quote
siria

But I thought Dorian had meanwhile included (additionally?) another basic tool with updated french lists.

< Filter Rules collected by Fred (taken from K-Meleon 0.9.12) >

IMHO just a waste of time.
I prefer a hosts file I don't have to babysit and that works systemwide.
It's not perfect (you might need to disable it temporary to watch some content) but it's still the best solution - for me at least.

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: rodocop
Date: November 15, 2017 03:54PM

There is a number of good and convenient ways to block that ads instead using outdated CSS-adblocker:

1) hosts
2) system-wide web filters like K9 Web Protection or Forticlient's inbuilt one
3) Privoxy and other filtering proxies (Proxomitron, Proxydomo etc.)
4) Filtering DNS services like FoolDNS, NortonDNS, YandexDNS, AdguardDNS etc.
5) AdBlock Plus itself

6) basic adblock - KM inbuilt. But this one now leads to big freezes in surfing (started from some beta of KM 76. Works fine though in KM 75.1)

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: Yogi
Date: November 15, 2017 04:01PM

Rodocop,

does it work for you with my test-skin at least?

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: rodocop
Date: November 15, 2017 07:40PM

I should make fully fresh reinstall as all that result was already got with your skin, published here some time ago grinning smiley

Need some more time to answer, sorry. And thanks for files!

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: rodocop
Date: November 15, 2017 10:07PM

What can I say...

Your button (CSS Adblock) works fine here and there.

And FLASHBLOCK button - works NOWHERE. Never sync.

UPD.: But if switch off JS (by button, menu or pref) - Flashblock button autochanges image from the 'hot' image to 'cold' one. While doesn't change it's 'checkage' state



Edited 1 time(s). Last edit at 11/15/2017 10:11PM by rodocop.

Options: ReplyQuote
Re: Want to Add Privacy Bar Button / show pressed
Posted by: siria
Date: November 15, 2017 11:11PM

Quote
rodocop
UPD.: But if switch off JS (by button, menu or pref) - Flashblock button autochanges image from the 'hot' image to 'cold' one. While doesn't change it's 'checkage' state

That makes sense. This macro contains a "menugrayed" line. Gray menu, and gray (dead) button.
Have you tried disabling that line (perhaps causes a bug?)
Hm, another wild thought: exchange the positions of adblock and flashblock in toolbars.cfg, to see if perhaps the "last" buttons gets hit by some bug...
And do a text search over all macros (or perhaps all root?) for "flashblock", to discover possible duplicates?



Edited 2 time(s). Last edit at 11/15/2017 11:15PM by siria.

Options: ReplyQuote


K-Meleon forum is powered by Phorum.