Toggle images button
Posted by: Ismo
Date: May 13, 2003 05:53PM

There is a macro to toggle images on/off at
http://kmeleon.sourceforge.net/resources/macros/library.php?c1=1&c2=3&c3=26

It isn't working very well. I made a few changes to it but I am
wondering if this is the best way to fix it.

Macros.cfg
toggle_images {
togglepref(INT, "network.image.imageBehavior", 0, 2);
ID(ID_NAV_RELOAD);
}

I also added to prefs.js
user_pref("browser.display.show_image_placeholders",false);
to disable the broken image picture.

As you can see I added the reload command because the image
status change didn't occur before that. It is a pity it seems to take
a while to reload. Is there a better/proper way to do this?
The button used here could be better. Maybe you could use the
same button as Opera uses. It is a couple of years since I used that
browser. If I remember correctly it was three-state button (all/site/no
images - K-Meleon also has these modes). Does Mozilla use
images button?

Re: Toggle images button
Posted by: D Rider
Date: May 18, 2003 06:02AM

I changed mine to this:
toggle_images {
# toggle between "accept all images" and "do not load images"
menu=Image loading toggle
togglepref(INT, "network.image.imageBehavior", 0, 2);
$images_tmp = (getpref(INT, "network.image.imageBehavior") ? 2 : 0);
ID(ID_NAV_RELOAD)
alert("Images " . ($images_tmp ? "blocked" : "allowed"), "Images toggle status");
}

I added this so that the popup message box is always properly synchronized:
getpref(INT, "network.image.imageBehavior") ? pluginmsg(toolbars, "CheckButton", "Tool Bar, macros(toggle_images), 0") : pluginmsg(toolbars, "CheckButton", "Tool Bar, macros(toggle_images), 2");

I added is to the buttonSync macro as is part of the PBToggle macro (http://kmeleon.sourceforge.net/resources/macros/library.php?c1=1&c2=3&c3=24).

I tried the other status code (for site images only) and it made no difference when I verified in the Preferences -- always showed as either all or none.

Re: Toggle images button
Posted by: alain.aupeix@wanadoo.fr
Date: May 19, 2003 11:17AM

Here is my solution (adapted from a solution I found on the site, and which don't work for me, because it seems to have an error between imagebehavior and imageBehavior)

In Toolbars.cfg
----------------------
Image {
macros(ImgToggle)
Images >> Visibles ou Cachés
newhot.bmp[14]
newcold.bmp[14]
newdead.bmp[14]
}

where newhot.bmp may be replaced by other thing


In Macros.cfg
--------------------

ImgSync {
getpref(INT, "network.image.imagebehavior") ? pluginmsg(toolbars, "CheckButton", "Policy Buttons, macros(ImgToggle), 1") : pluginmsg(toolbars, "CheckButton", "Policy Buttons, macros(ImgToggle), 0");
}
ImgToggle {
$tmp = (getpref(INT, "network.image.imagebehavior") ? 0: 2 );
setpref(INT, "network.image.imagebehavior", $tmp);
$tmp = ($tmp ? 0: 2 );
statusbar( ($tmp ? ">> Images Visibles" : ">> Images Cachées"));
&ImgSync;
}

OnStartup{
&PBSync;
&LWSync;
&ImgSync;
}

and to be complete, I give the 2 others macros:

In macros.cfg
---------------------
PBSync {
getpref(BOOL, "dom.disable_open_during_load") ? pluginmsg(toolbars, "CheckButton", "Policy Buttons, macros(PBToggle), 1") : pluginmsg(toolbars, "CheckButton", "Tool Bar, macros(PBToggle), 0");
}

PBToggle {
$tmp = (getpref(BOOL, "dom.disable_open_during_load") ? false : true);
setpref(BOOL, "dom.disable_open_during_load", $tmp);
statusbar("Popups " . ($tmp ? "Bloqués" : "Autorisés"));
&PBSync;
}

LWSync {
getpref(BOOL, "kmeleon.plugins.layers.catch") ? pluginmsg(toolbars, "CheckButton", "Policy Buttons, macros(LWToggle), 1") : pluginmsg(toolbars, "CheckButton", "Policy Buttons, macros(LWToggle), 0");
}
LWToggle {
$tmp = (getpref(BOOL, "kmeleon.plugins.layers.catch") ? false : true);
$Layer_default = $tmp
setpref(BOOL, "kmeleon.plugins.layers.catch", $tmp);
statusbar( ($tmp ? ">> Nouvelle fenêtre" : ">> Nouvel onglet"));
&LWSync;
}

In Toolbars.cfg
----------------------
Popup {
macros(PBToggle)
Popup >> Bloque ou Autorise
newhot.bmp[11]
newcold.bmp[11]
newdead.bmp[11]
}
Layer {
macros(LWToggle)
Nouveau >> Fenêtre ou Onglet
newhot.bmp[13]
newcold.bmp[13]
newdead.bmp[13]
}

-------------------------------------------

I don't remember, but I think I must patch exe or dll to modify
imageBehavior >>> imageBehavior

Certainy a bug ...

Re: Toggle images button
Posted by: alain.aupeix@wanadoo.fr
Date: May 19, 2003 07:39PM

I don't remember, but I think I must patch exe or dll to modify
imageBehavior >>> imageBehavior

hum, I must stop drinkin ...

imageBehavior >>> imagebehavior

That's right now ...

K-Meleon forum is powered by Phorum.