This is my first extension, and i am noob with macro language... but is working xD
How long do you spend seting a proxy? Yep mostly of us dont need change this, but sometimes is usefuly and find a good proxy server at a proxy list can b harder. So with this extension all u need is select the proxy, click and voilà is done!
The proxy must b at "ip
:
port" format.
the basic code is
Proxy_Changer{
macroinfo=_("Muda o Proxy");
$iiip= $URLBAR;
$posicao = index($iiip, ":");
$porta = substr($iiip, ($posicao + 1));
$proxyip = sub(":" . $porta, "", $iiip);
alert("Proxy " .$proxyip . " at " . $porta . " port seted.");
setpref(INT, "network.proxy.type", 1);
setpref(STRING, "network.proxy.http", $proxyip);
setpref(INT, "network.proxy.http_port", $porta);
}
Proxy_Desactive{
macroinfo=_("Muda o Proxy");
$proxiado = getpref(INT, "network.proxy.type");
if ($proxiado == 0)
{
setpref(INT, "network.proxy.type", 1);
alert("proxy activated");
}
else
{
setpref(INT, "network.proxy.type", 0);
alert("proxy desactivated");
}
}
Proxy_Change_Selected{
macroinfo=_("Muda o Proxy");
$iiip= $SelectedText;
$posicao = index($iiip, ":");
$porta = substr($iiip, ($posicao + 1));
$proxyip = sub(":" . $porta, "", $iiip);
alert("Proxy " .$proxyip . " at " . $porta . " port seted.");
setpref(INT, "network.proxy.type", 1);
setpref(STRING, "network.proxy.http", $proxyip);
setpref(INT, "network.proxy.http_port", $porta);
}
_Proxy_BuildMenu{
setmenu(Selection,macro,"Set Proxy", Proxy_Change_Selected);
}
Hey, submit better ideas for this code.
Edited 2 time(s). Last edit at 03/30/2010 04:30PM by senna.