# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)

# ---------- Flashblock Extension -----------------------------------------------------------------
# Dependencies	: javascript.enabled
# Resources	: Flashblock Extension 1.5.13 for K-Meleon 1.6
# Preferences	: kmeleon.flashblock
#		flashblock.whitelist
#		flashblock.blockLocal
#		flashblock.silverlight.blocked
# Version	: 2.0 2010/08/22
# Author	: desga2
# -------------------------------------------------------------------------------------------------

# ----- PRIVATE

_FB_Options{
macroinfo=_("Open Flashblock whitelist options");
$OpenURL="chrome://flashblock/content/options.xul"; &OpenURL_InNewWindow;
}

_FB_ToggleW{
$_FB_hostname = hostname($URL);
$_FB_whitelist = getpref(STRING, "flashblock.whitelist");
$_FB_wl_leng = length($_FB_whitelist);
$_FB_hostpos = index($_FB_whitelist, $_FB_hostname);
if ($_FB_hostpos >= 0) {
	if ($_FB_hostpos > 0) {
		$_FB_whitelist = sub(",".$_FB_hostname, "", $_FB_whitelist);
	}
	else {
		$_FB_whitelist = sub($_FB_hostname.",", "", $_FB_whitelist);
	}
	setpref(STRING, "flashblock.whitelist", $_FB_whitelist);
}
else {
	if ($_FB_wl_leng > 0) {
		$_FB_whitelist = $_FB_whitelist.",".$_FB_hostname;
		}
	else {
		$_FB_whitelist = $_FB_hostname;
	}
	setpref(STRING, "flashblock.whitelist", $_FB_whitelist);
}
}

_Flashblock_BuildMenu{
# Tools menu -> Privacy -> Permissions -> Flashblock...
$_fb_pm="P&ermissions";
$_fb_fb=_("&Flashblock...");
setmenu($_fb_pm,macro,$_fb_fb,_FB_Options,3);
# Context menu options:
setmenu("DocumentPopup",popup,"Flashblock Options","kFullscreen");
setmenu("Flashblock Options",macro,_("Toggle Site in Whitelist"),_FB_ToggleW);
}

$OnInit=$OnInit."_Flashblock_BuildMenu;";
# -------------------------------------------------------------------------------------------------
$macroModules=$macroModules."Flashblock;";
