NeliyZar 16:42 19-09-2010 Цитата: Если знаешь ссыль по быстрому на топик то ткни носиком где)))
Это проблематично, не сохранил)) Могу только предложить код, со своей скопировал.
[more=Код]var name, image, uri;
var bu = "";
var buts = document. getElementsByTagName ("toolbarbutton");
for (var i = 0; i < buts. length; i++)
{
if (buts [i]. getAttribute ("id"). indexOf ("custombuttons-button") == 0)
{
name = buts [i]. name;
image = buts [i]. image || buts [i]. cbStdIcon;
uri = buts [i]. URI;
butmp = bu;
urltmp ="<img src=" + image + "> <a href=" + uri + ">" + name +"</a><br>\n";
bu = butmp + urltmp;
//alert(name);
}
};
butmp = bu;
bu = butmp + "<hr>";
function setText (doc, nodeName, text, make_CDATASection)
{
var node = doc. getElementsByTagName (nodeName) [0], cds;
if (!node)
return;
if (make_CDATASection)
{
try
{
cds = doc. createCDATASection (text || "");
}
catch (e)
{
cds = doc. createTextNode (text || "");
}
node. appendChild (cds);
}
else
{
node. textContent = text;
}
}
var buts, doc, name, image, uri, mode, code, initCode, accelkey, help;
buts = custombuttons. palette. getElementsByTagName ("toolbarbutton");
for (var i = 0; i < buts. length; i++)
{
if (buts [i]. getAttribute ("id"). indexOf ("custombuttons-button") == 0)
{
name = buts [i]. getAttribute ("label");
image = buts [i]. getAttribute ("image") || buts [i]. getAttribute ("cb-stdicon");
mode = buts [i]. getAttribute ("cb-mode");
code = buts [i]. getAttribute ("cb-oncommand");
initCode = buts [i]. getAttribute ("cb-init");
accelkey = buts [i]. getAttribute ("cb-accelkey");
help = buts [i]. getAttribute ("Help") || buts [i]. getAttribute ("help") || "";
doc = document. implementation. createDocument ("", "", null);
doc. async = false;
doc. load ("chrome://custombuttons/content/nbftemplate.xml");
setText (doc, "name", name, false);
setText (doc, "mode", mode, false);
setText (doc, "image", image, true);
setText (doc, "code", code, true);
setText (doc, "initcode", initCode, true);
setText (doc, "accelkey", accelkey, true);
setText (doc, "help", help, true);
var ser = new XMLSerializer ();
var data = ser. serializeToString (doc);
uri = "custombutton://" + escape (data);
//alert (uri);
butmp = bu;
urltmp ="<img src=" + image + "> <a href=" + uri + ">" + name +"</a><br>\n";
bu = butmp + urltmp;
}
}
var uc = Components. classes ["@mozilla.org/intl/scriptableunicodeconverter"]. createInstance (Components. interfaces. nsIScriptableUnicodeConverter);
uc. charset = "utf-8";
bu = uc. ConvertFromUnicode (bu);
var head = "<html>\n<head>\n<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>\n</head>\n<body>\n";
var fileend = "\n</body>\n</html>"
var htmlSource = head + bu + fileend;
var nsIFilePicker = Components.interfaces.nsIFilePicker;
var fp = Components.classes["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
fp.init(window, "", fp.modeSave);
fp.defaultString = "my_cbuttons.html";
fp.appendFilters(fp.filterHTML);
fp.appendFilters(fp.filterAll);
if(fp.show() == fp.returnCancel) return;
var stream = Components.classes['@mozilla.org/network/file-output-stream;1']
.createInstance(Components.interfaces.nsIFileOutputStream);
stream.init(fp.file, 0x02|0x20|0x08, 0666, 0);
stream.write(htmlSource, htmlSource.length);
stream.close();[/more]
Добавлено: Вот
здесь есть немного модифицированная
Цитата: upd добавил добавление даты-времени к имени файла.