#  K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- DisableCSS.kmm for K-Meleon 1.5.x ----------------------------------------------------
#
# Dependencies        : main.kmm, JavaScript
# Resources           : -
# Preferences         : kmeleon.disablecss
# Version             : 1.0
# -------------------------------------------------------------------------------------------------
#

DisableCSS{
macroinfo=_("Toggle CSS Styles");
menuchecked=getpref(BOOL,"kmeleon.disablecss");
menugrayed=!getpref(BOOL,$pref_JavaScript);
togglepref(BOOL,"kmeleon.disablecss");
&Toggle_CSS;
statusbar(sub("%s",getpref(BOOL,"kmeleon.disablecss")?$off:$on,_("CSS Styles %s")));
}

Toggle_CSS{
getpref(BOOL,"kmeleon.disablecss")?$JS_doit="(function(){var i,x;for(i=0;x=document.styleSheets[i];++i)x.disabled=true;})();":$JS_doit="(function(){var i,x;for(i=0;x=document.styleSheets[i];++i)x.disabled=false;})();";
&JS_hndlDoc;
}

_DisableCSS_BuildMenu{
# Tools -> Privacy:
setmenu("_Privacy_Settings",macro,_("Disable CSS"),"DisableCSS","Block Image Ani&mation");
# View and Page properties context menu:
#setmenu("Page &Properties",macro,_("Disable CSS"),"DisableCSS",-1);
setaccel("VK_F10","macros(DisableCSS)");
}

# -------------------------------------------------------------------------------------------------
$OnInit=$OnInit."_DisableCSS_BuildMenu;";
$macroModules=$macroModules."DisableCSS;";