зеркало из https://github.com/mozilla/pjs.git
Initial CCK Wizard checkin
This commit is contained in:
Родитель
c58662b3ea
Коммит
c0453d9fca
|
@ -0,0 +1,4 @@
|
|||
overlay chrome://browser/content/browser.xul chrome://cckwizard/content/cckwizard-browser-overlay.xul
|
||||
content cckwizard jar:chrome/cckwizard.jar!/content/cckwizard/
|
||||
#content cckwizard chrome/cckwizard/content/cckwizard/
|
||||
|
|
@ -0,0 +1,984 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Client Customization Kit (CCK).
|
||||
*
|
||||
* The Initial Developer of the Original Code is IBM Corp.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var currentconfigname;
|
||||
var currentconfigpath;
|
||||
var haveplugins = false;
|
||||
var havesearchplugins = false;
|
||||
|
||||
|
||||
var gPrefBranch = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
function choosefile(labelname)
|
||||
{
|
||||
try {
|
||||
var nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
|
||||
fp.init(window, "Choose File...", nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterText |
|
||||
nsIFilePicker.filterAll | nsIFilePicker.filterImages | nsIFilePicker.filterXML);
|
||||
|
||||
if (fp.show() == nsIFilePicker.returnOK && fp.fileURL.spec && fp.fileURL.spec.length > 0) {
|
||||
var label = document.getElementById(labelname);
|
||||
label.value = fp.file.path;
|
||||
}
|
||||
}
|
||||
catch(ex) {
|
||||
}
|
||||
}
|
||||
|
||||
function choosedir(labelname)
|
||||
{
|
||||
try {
|
||||
var keepgoing = true;
|
||||
while (keepgoing) {
|
||||
var nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
|
||||
fp.init(window, "Choose File...", nsIFilePicker.modeGetFolder);
|
||||
fp.appendFilters(nsIFilePicker.filterHTML | nsIFilePicker.filterText |
|
||||
nsIFilePicker.filterAll | nsIFilePicker.filterImages | nsIFilePicker.filterXML);
|
||||
|
||||
if (fp.show() == nsIFilePicker.returnOK && fp.fileURL.spec && fp.fileURL.spec.length > 0) {
|
||||
var label = document.getElementById(labelname);
|
||||
label.value = fp.file.path;
|
||||
}
|
||||
keepgoing = false;
|
||||
}
|
||||
}
|
||||
catch(ex) {
|
||||
}
|
||||
}
|
||||
|
||||
function chooseimage(labelname, imagename)
|
||||
{
|
||||
try {
|
||||
var nsIFilePicker = Components.interfaces.nsIFilePicker;
|
||||
var fp = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
|
||||
fp.init(window, "Choose File...", nsIFilePicker.modeOpen);
|
||||
fp.appendFilters(nsIFilePicker.filterImages | nsIFilePicker.filterA);
|
||||
|
||||
if (fp.show() == nsIFilePicker.returnOK && fp.fileURL.spec && fp.fileURL.spec.length > 0) {
|
||||
var label = document.getElementById(labelname);
|
||||
label.value = fp.file.path;
|
||||
document.getElementById(imagename).src = fp.fileURL.spec;
|
||||
}
|
||||
}
|
||||
catch(ex) {
|
||||
}
|
||||
}
|
||||
|
||||
function initimage(labelname, imagename)
|
||||
{
|
||||
var sourcefile = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
sourcefile.initWithPath(document.getElementById(labelname).value);
|
||||
var ioServ = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var foo = ioServ.newFileURI(sourcefile);
|
||||
document.getElementById(imagename).src = foo.spec;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function CreateConfig()
|
||||
{
|
||||
window.openDialog("chrome://cckwizard/content/config.xul","createconfig","chrome,modal");
|
||||
updateconfiglist();
|
||||
}
|
||||
|
||||
function CopyConfig()
|
||||
{
|
||||
window.openDialog("chrome://cckwizard/content/config.xul","copyconfig","chrome,modal");
|
||||
|
||||
updateconfiglist();
|
||||
}
|
||||
|
||||
function DeleteConfig()
|
||||
{
|
||||
var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Components.interfaces.nsIPromptService);
|
||||
var rv = ps.confirmEx(window, "WizardMachine", "Are you sure you want to delete this configuration?",
|
||||
ps.BUTTON_TITLE_IS_STRING * ps.BUTTON_POS_0 +
|
||||
ps.BUTTON_TITLE_IS_STRING * ps.BUTTON_POS_1,
|
||||
"Yes", "No", null, null, {});
|
||||
if (rv == false) {
|
||||
gPrefBranch.deleteBranch("cck.config."+currentconfigname);
|
||||
updateconfiglist();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function ShowMain()
|
||||
{
|
||||
updateconfiglist();
|
||||
}
|
||||
|
||||
function updateconfiglist()
|
||||
{
|
||||
var menulist = document.getElementById('byb-configs')
|
||||
menulist.selectedIndex = -1;
|
||||
menulist.removeAllItems();
|
||||
var configname;
|
||||
var selecteditem = false;
|
||||
|
||||
|
||||
|
||||
var list = gPrefBranch.getChildList("cck.config.", {});
|
||||
for (var i = 0; i < list.length; ++i) {
|
||||
configname = list[i].replace(/cck.config./g, "");
|
||||
var menulistitem = menulist.appendItem(configname,configname);
|
||||
menulistitem.minWidth=menulist.width;
|
||||
if (configname == currentconfigname) {
|
||||
menulist.selectedItem = menulistitem;
|
||||
selecteditem = true;
|
||||
document.getElementById('example-window').canAdvance = true;
|
||||
document.getElementById('deleteconfig').disabled = false;
|
||||
}
|
||||
}
|
||||
if ((!selecteditem) && (list.length > 0)) {
|
||||
menulist.selectedIndex = 0;
|
||||
setcurrentconfig(list[0].replace(/cck.config./g, ""));
|
||||
}
|
||||
if (list.length == 0) {
|
||||
document.getElementById('example-window').canAdvance = false;
|
||||
document.getElementById('deleteconfig').disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
function setcurrentconfig(newconfig)
|
||||
{
|
||||
var destdir = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
|
||||
if (currentconfigpath) {
|
||||
destdir.initWithPath(currentconfigpath);
|
||||
CCKWriteConfigFile(destdir);
|
||||
}
|
||||
currentconfigname = newconfig;
|
||||
currentconfigpath = gPrefBranch.getCharPref("cck.config." + currentconfigname);
|
||||
destdir.initWithPath(currentconfigpath);
|
||||
CCKReadConfigFile(destdir);
|
||||
}
|
||||
|
||||
function saveconfig()
|
||||
{
|
||||
|
||||
|
||||
if (currentconfigpath) {
|
||||
var destdir = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
|
||||
|
||||
|
||||
destdir.initWithPath(currentconfigpath);
|
||||
CCKWriteConfigFile(destdir);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function OnConfigOK()
|
||||
{
|
||||
var configname = document.getElementById('cnc-name').value;
|
||||
var configlocation = document.getElementById('cnc-location').value;
|
||||
if ((configname) && (configlocation)) {
|
||||
gPrefBranch.setCharPref("cck.config." + configname, configlocation);
|
||||
this.opener.setcurrentconfig(configname);
|
||||
if (window.name = 'copyconfig') {
|
||||
/* copy prefs from current config */
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function CreateCCK()
|
||||
{
|
||||
/* ---------- */
|
||||
var destdir = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
destdir.initWithPath(currentconfigpath);
|
||||
|
||||
CCKWriteConfigFile(destdir);
|
||||
|
||||
destdir.append("jar");
|
||||
destdir.append("content");
|
||||
destdir.append("cck");
|
||||
try {
|
||||
destdir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0775);
|
||||
} catch(ex) {}
|
||||
|
||||
CCKWriteXULOverlay(destdir);
|
||||
CCKWriteDTD(destdir);
|
||||
CCKWriteCSS(destdir);
|
||||
CCKWriteProperties(destdir);
|
||||
CCKCopyFile(document.getElementById("iconURL").value, destdir);
|
||||
CCKCopyFile(document.getElementById("LargeAnimPath").value, destdir);
|
||||
CCKCopyFile(document.getElementById("LargeStillPath").value, destdir);
|
||||
CCKCopyChromeToFile("cck.js", destdir)
|
||||
/* copy/create contents.rdf if 1.0 */
|
||||
var zipdir = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
zipdir.initWithPath(currentconfigpath);
|
||||
zipdir.append("jar");
|
||||
CCKZip("cck.jar", zipdir, "content");
|
||||
|
||||
/* ---------- */
|
||||
|
||||
destdir.initWithPath(currentconfigpath);
|
||||
destdir.append("xpi");
|
||||
destdir.append("chrome");
|
||||
try {
|
||||
destdir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0775);
|
||||
} catch(ex) {}
|
||||
|
||||
zipdir.append("cck.jar");
|
||||
|
||||
CCKCopyFile(zipdir.path, destdir);
|
||||
|
||||
/* ---------- */
|
||||
|
||||
destdir.initWithPath(currentconfigpath);
|
||||
destdir.append("xpi");
|
||||
destdir.append("components");
|
||||
try {
|
||||
destdir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0775);
|
||||
} catch(ex) {}
|
||||
|
||||
CCKCopyChromeToFile("cckService.js", destdir);
|
||||
|
||||
/* ---------- */
|
||||
|
||||
destdir.initWithPath(currentconfigpath);
|
||||
destdir.append("xpi");
|
||||
destdir.append("defaults");
|
||||
destdir.append("preferences");
|
||||
try {
|
||||
destdir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0775);
|
||||
} catch(ex) {}
|
||||
|
||||
CCKWriteDefaultJS(destdir)
|
||||
|
||||
/* ---------- */
|
||||
|
||||
destdir.initWithPath(currentconfigpath);
|
||||
destdir.append("xpi");
|
||||
destdir.append("plugins");
|
||||
try {
|
||||
destdir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0775);
|
||||
} catch(ex) {}
|
||||
|
||||
|
||||
haveplugins = CCKCopyFile(document.getElementById("BrowserPluginPath1").value, destdir);
|
||||
haveplugins |= CCKCopyFile(document.getElementById("BrowserPluginPath2").value, destdir);
|
||||
haveplugins |= CCKCopyFile(document.getElementById("BrowserPluginPath3").value, destdir);
|
||||
haveplugins |= CCKCopyFile(document.getElementById("BrowserPluginPath4").value, destdir);
|
||||
haveplugins |=CCKCopyFile(document.getElementById("BrowserPluginPath5").value, destdir);
|
||||
|
||||
destdir.initWithPath(currentconfigpath);
|
||||
destdir.append("xpi");
|
||||
destdir.append("searchplugins");
|
||||
try {
|
||||
destdir.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0775);
|
||||
} catch(ex) {}
|
||||
|
||||
havesearchplugins = CCKCopyFile(document.getElementById("SearchPlugin1").value, destdir);
|
||||
CCKCopyFile(document.getElementById("SearchPluginIcon1").value, destdir);
|
||||
havesearchplugins |= CCKCopyFile(document.getElementById("SearchPlugin2").value, destdir);
|
||||
CCKCopyFile(document.getElementById("SearchPluginIcon2").value, destdir);
|
||||
havesearchplugins |= CCKCopyFile(document.getElementById("SearchPlugin3").value, destdir);
|
||||
CCKCopyFile(document.getElementById("SearchPluginIcon3").value, destdir);
|
||||
havesearchplugins |= CCKCopyFile(document.getElementById("SearchPlugin4").value, destdir);
|
||||
CCKCopyFile(document.getElementById("SearchPluginIcon4").value, destdir);
|
||||
havesearchplugins |= CCKCopyFile(document.getElementById("SearchPlugin5").value, destdir);
|
||||
CCKCopyFile(document.getElementById("SearchPluginIcon5").value, destdir);
|
||||
|
||||
destdir.initWithPath(currentconfigpath);
|
||||
destdir.append("xpi");
|
||||
|
||||
CCKCopyChromeToFile("chrome.manifest", destdir)
|
||||
CCKWriteInstallRDF(destdir);
|
||||
CCKWriteInstallJS(destdir);
|
||||
CCKZip("cck.xpi", destdir,
|
||||
"chrome", "components", "defaults", "plugins", "searchplugins", "chrome.manifest", "install.rdf");
|
||||
}
|
||||
|
||||
/* This function takes a file in the chromedir and creates a real file */
|
||||
|
||||
function CCKCopyChromeToFile(chromefile, location)
|
||||
{
|
||||
var file = location.clone();
|
||||
file.append(chromefile);
|
||||
|
||||
try {
|
||||
file.remove(false);
|
||||
} catch (ex) {
|
||||
}
|
||||
var fos = Components.classes["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
|
||||
fos.init(file, -1, -1, false);
|
||||
|
||||
var ioService=Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var scriptableStream=Components
|
||||
.classes["@mozilla.org/scriptableinputstream;1"]
|
||||
.getService(Components.interfaces.nsIScriptableInputStream);
|
||||
|
||||
var channel=ioService.newChannel("chrome://cckwizard/content/srcfiles/" + chromefile + ".in",null,null);
|
||||
var input=channel.open();
|
||||
scriptableStream.init(input);
|
||||
var str=scriptableStream.read(input.available());
|
||||
scriptableStream.close();
|
||||
input.close();
|
||||
|
||||
fos.write(str, str.length);
|
||||
fos.close();
|
||||
}
|
||||
|
||||
/* This function creates a given zipfile in a given location */
|
||||
/* It takes as parameters the names of all the files/directories to be contained in the ZIP file */
|
||||
/* It works by creating a CMD file to generate the ZIP */
|
||||
|
||||
function CCKZip(zipfile, location)
|
||||
{
|
||||
platform = navigator.platform;
|
||||
var file = location.clone();
|
||||
|
||||
if (navigator.platform == "Win32")
|
||||
file.append("ccktemp.cmd");
|
||||
else
|
||||
file.append("ccktemp.sh");
|
||||
var fos = Components.classes["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
fos.init(file, -1, -1, false);
|
||||
var line;
|
||||
line = "cd \"" + location.path + "\"\n";
|
||||
fos.write(line, line.length);
|
||||
if (navigator.platform == "Win32")
|
||||
line = "zip -r \"" + location.path + "\\" + zipfile + "\"";
|
||||
else
|
||||
line = "zip -r \"" + location.path + "/" + zipfile + "\"";
|
||||
for (var i=2; i < arguments.length; i++) {
|
||||
line += " " + arguments[i];
|
||||
}
|
||||
line += "\n";
|
||||
fos.write(line, line.length);
|
||||
fos.close();
|
||||
|
||||
var file = location.clone();
|
||||
file.append(zipfile);
|
||||
try {
|
||||
file.remove(false);
|
||||
} catch (ex) {}
|
||||
|
||||
var sh;
|
||||
|
||||
// create an nsILocalFile for the executable
|
||||
var file = location.clone();
|
||||
if (navigator.platform == "Win32")
|
||||
file.append("ccktemp.cmd");
|
||||
else {
|
||||
file.append("ccktemp.sh");
|
||||
sh = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
sh.initWithPath("/bin/sh");
|
||||
}
|
||||
// create an nsIProcess
|
||||
var process = Components.classes["@mozilla.org/process/util;1"]
|
||||
.createInstance(Components.interfaces.nsIProcess);
|
||||
|
||||
if (navigator.platform == "Win32")
|
||||
process.init(file);
|
||||
else
|
||||
process.init(sh);
|
||||
|
||||
var args = [file.path];
|
||||
|
||||
process.run(true, args, args.length);
|
||||
file.remove(false);
|
||||
}
|
||||
|
||||
function CCKWriteXULOverlay(destdir)
|
||||
{
|
||||
var tooltipXUL = ' <button id="navigator-throbber" tooltiptext="&throbber.tooltip;"/>\n';
|
||||
|
||||
var titlebarXUL = ' <window id="main-window" titlemodifier="&mainWindow.titlemodifier;"/>\n';
|
||||
|
||||
var helpmenu1 = ' <menupopup id="menu_HelpPopup">\n';
|
||||
var helpmenu2 = ' <menuseparator insertafter="aboutSeparator"/>\n';
|
||||
var helpmenu3 = ' <menuitem label="&cckHelp.label;" insertafter="aboutSeparator"\n';
|
||||
var helpmenu4 = ' accesskey="&cckHelp.accesskey;"\n';
|
||||
var helpmenu5 = ' oncommand="openUILink(getCCKLink(\'cckhelp.url\'), event, false, true);"\n';
|
||||
var helpmenu6 = ' onclick="checkForMiddleClick(this, event);"/>\n';
|
||||
var helpmenu7 = ' </menupopup>\n';
|
||||
|
||||
var file = destdir.clone();
|
||||
file.append("cck-browser-overlay.xul");
|
||||
try {
|
||||
file.remove(false);
|
||||
} catch (ex) {}
|
||||
var fos = Components.classes["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
|
||||
fos.init(file, -1, -1, false);
|
||||
|
||||
var ioService=Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var scriptableStream=Components.classes["@mozilla.org/scriptableinputstream;1"]
|
||||
.getService(Components.interfaces.nsIScriptableInputStream);
|
||||
|
||||
var channel=ioService.newChannel("chrome://cckwizard/content/srcfiles/cck-browser-overlay.xul.in",null,null);
|
||||
var input=channel.open();
|
||||
scriptableStream.init(input);
|
||||
var str=scriptableStream.read(input.available());
|
||||
scriptableStream.close();
|
||||
input.close();
|
||||
|
||||
var tooltip = document.getElementById("AnimatedLogoTooltip").value;
|
||||
if (tooltip && (tooltip.length > 0))
|
||||
str = str.replace(/%button%/g, tooltipXUL);
|
||||
else
|
||||
str = str.replace(/%button%/g, "");
|
||||
|
||||
var titlebar = document.getElementById("CompanyName").value;
|
||||
if (titlebar && (titlebar.length > 0))
|
||||
str = str.replace(/%window%/g, titlebarXUL);
|
||||
else
|
||||
str = str.replace(/%window%/g, "");
|
||||
|
||||
var helpmenu = document.getElementById("HelpMenuCommandName").value;
|
||||
if (helpmenu && (helpmenu.length > 0)) {
|
||||
var helpmenuXUL = helpmenu1 + helpmenu2 + helpmenu3;
|
||||
var helpmenuakey = document.getElementById("HelpMenuCommandAccesskey").value;
|
||||
if (helpmenuakey && (helpmenuakey.length > 0)) {
|
||||
helpmenuXUL += helpmenu4;
|
||||
}
|
||||
helpmenuXUL += helpmenu5 + helpmenu6 + helpmenu7;
|
||||
str = str.replace(/%menupopup%/g, helpmenuXUL);
|
||||
} else {
|
||||
str = str.replace(/%menupopup%/g, "");
|
||||
}
|
||||
|
||||
fos.write(str, str.length);
|
||||
fos.close();
|
||||
}
|
||||
|
||||
function CCKWriteCSS(destdir)
|
||||
{
|
||||
|
||||
var animated1 = '#navigator-throbber[busy="true"] {\n';
|
||||
var animated2 = 'toolbar[iconsize="small"] #navigator-throbber[busy="true"],\n';
|
||||
var animated3 = 'toolbar[mode="text"] #navigator-throbber[busy="true"] {\n';
|
||||
var atrest1 = '#navigator-throbber {\n';
|
||||
var atrest2 = 'toolbar[iconsize="small"] #navigator-throbber,\n';
|
||||
var atrest3 = 'toolbar[mode="text"] #navigator-throbber {\n';
|
||||
var liststyleimage = ' list-style-image: url("chrome://cck/content/';
|
||||
var liststyleimageend = '");\n}\n';
|
||||
|
||||
var file = destdir.clone();
|
||||
file.append("cck.css");
|
||||
var fos = Components.classes["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
fos.init(file, -1, -1, false);
|
||||
|
||||
var animatedlogopath = document.getElementById("LargeAnimPath").value;
|
||||
if (animatedlogopath && (animatedlogopath.length > 0)) {
|
||||
var file = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
file.initWithPath(document.getElementById("LargeAnimPath").value);
|
||||
|
||||
fos.write(animated1, animated1.length);
|
||||
fos.write(liststyleimage, liststyleimage.length);
|
||||
fos.write(file.leafName, file.leafName.length);
|
||||
fos.write(liststyleimageend, liststyleimageend.length);
|
||||
|
||||
fos.write(animated2, animated2.length);
|
||||
fos.write(animated3, animated3.length);
|
||||
fos.write(liststyleimage, liststyleimage.length);
|
||||
fos.write(file.leafName, file.leafName.length);
|
||||
fos.write(liststyleimageend, liststyleimageend.length);
|
||||
}
|
||||
var atrestlogopath = document.getElementById("LargeStillPath").value;
|
||||
if (atrestlogopath && (animatedlogopath.length > 0)) {
|
||||
var file = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
file.initWithPath(document.getElementById("LargeStillPath").value);
|
||||
|
||||
fos.write(atrest1, atrest1.length);
|
||||
fos.write(liststyleimage, liststyleimage.length);
|
||||
fos.write(file.leafName, file.leafName.length);
|
||||
fos.write(liststyleimageend, liststyleimageend.length);
|
||||
|
||||
fos.write(atrest2, atrest2.length);
|
||||
fos.write(atrest3, atrest3.length);
|
||||
fos.write(liststyleimage, liststyleimage.length);
|
||||
fos.write(file.leafName, file.leafName.length);
|
||||
fos.write(liststyleimageend, liststyleimageend.length);
|
||||
}
|
||||
fos.close();
|
||||
}
|
||||
|
||||
function CCKWriteDTD(destdir)
|
||||
{
|
||||
var file = destdir.clone();
|
||||
file.append("cck.dtd");
|
||||
try {
|
||||
file.remove(false);
|
||||
} catch (ex) {}
|
||||
var fos = Components.classes["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
|
||||
fos.init(file, -1, -1, false);
|
||||
|
||||
var ioService=Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var scriptableStream=Components.classes["@mozilla.org/scriptableinputstream;1"]
|
||||
.getService(Components.interfaces.nsIScriptableInputStream);
|
||||
|
||||
var channel=ioService.newChannel("chrome://cckwizard/content/srcfiles/cck.dtd.in",null,null);
|
||||
var input=channel.open();
|
||||
scriptableStream.init(input);
|
||||
var str=scriptableStream.read(input.available());
|
||||
scriptableStream.close();
|
||||
input.close();
|
||||
|
||||
str = str.replace(/%throbber.tooltip%/g, document.getElementById("AnimatedLogoTooltip").value);
|
||||
str = str.replace(/%mainWindow.titlemodifier%/g, document.getElementById("CompanyName").value);
|
||||
str = str.replace(/%cckHelp.label%/g, document.getElementById("HelpMenuCommandName").value);
|
||||
str = str.replace(/%cckHelp.accesskey%/g, document.getElementById("HelpMenuCommandAccesskey").value);
|
||||
fos.write(str, str.length);
|
||||
fos.close();
|
||||
}
|
||||
|
||||
|
||||
function CCKWriteProperties(destdir)
|
||||
{
|
||||
var file = destdir.clone();
|
||||
file.append("cck.properties");
|
||||
|
||||
try {
|
||||
file.remove(false);
|
||||
} catch (ex) {}
|
||||
var fos = Components.classes["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
|
||||
fos.init(file, -1, -1, false);
|
||||
|
||||
var ioService=Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var scriptableStream=Components.classes["@mozilla.org/scriptableinputstream;1"]
|
||||
.getService(Components.interfaces.nsIScriptableInputStream);
|
||||
|
||||
var channel=ioService.newChannel("chrome://cckwizard/content/srcfiles/cck.properties.in",null,null);
|
||||
var input=channel.open();
|
||||
scriptableStream.init(input);
|
||||
var str=scriptableStream.read(input.available());
|
||||
scriptableStream.close();
|
||||
input.close();
|
||||
|
||||
str = str.replace(/%browser.throbber.url%/g, document.getElementById("AnimatedLogoURL").value);
|
||||
str = str.replace(/%cckhelp.url%/g, document.getElementById("HelpMenuCommandURL").value);
|
||||
str = str.replace(/%browser.startup.homepage%/g, document.getElementById("HomePageURL").value);
|
||||
str = str.replace(/%PopupAllowedSites%/g, document.getElementById("PopupAllowedSites").value);
|
||||
str = str.replace(/%InstallAllowedSites%/g, document.getElementById("InstallAllowedSites").value);
|
||||
fos.write(str, str.length);
|
||||
|
||||
/* Add toolbar/bookmark stuff at end */
|
||||
|
||||
str = document.getElementById('ToolbarFolder1').value;
|
||||
if (str && str.length) {
|
||||
str = "ToolbarFolder1=" + str + "\n";
|
||||
fos.write(str, str.length);
|
||||
for (var i=1; i <= 5; i++) {
|
||||
str = document.getElementById("ToolbarFolder1.BookmarkTitle" + i).value;
|
||||
if (str && str.length) {
|
||||
str = "ToolbarFolder1.BookmarkTitle" + i + "=" + str + "\n";
|
||||
fos.write(str, str.length);
|
||||
}
|
||||
str = document.getElementById("ToolbarFolder1.BookmarkURL" + i).value;
|
||||
if (str && str.length) {
|
||||
str = "ToolbarFolder1.BookmarkURL" + i + "=" + str + "\n";
|
||||
fos.write(str, str.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i=1; i <= 5; i++) {
|
||||
str = document.getElementById("ToolbarBookmarkTitle" + i).value;
|
||||
if (str && str.length) {
|
||||
str = "ToolbarBookmarkTitle" + i + "=" + str + "\n";
|
||||
fos.write(str, str.length);
|
||||
}
|
||||
str = document.getElementById("ToolbarBookmarkURL" + i).value;
|
||||
if (str && str.length) {
|
||||
str = "ToolbarBookmarkURL" + i + "=" + str + "\n";
|
||||
fos.write(str, str.length);
|
||||
}
|
||||
}
|
||||
|
||||
str = document.getElementById('BookmarkFolder1').value;
|
||||
if (str && str.length) {
|
||||
str = "BookmarkFolder1=" + str + "\n";
|
||||
fos.write(str, str.length);
|
||||
for (var i=1; i <= 5; i++) {
|
||||
str = document.getElementById("BookmarkFolder1.BookmarkTitle" + i).value;
|
||||
if (str && str.length) {
|
||||
str = "BookmarkFolder1.BookmarkTitle" + i + "=" + str + "\n";
|
||||
fos.write(str, str.length);
|
||||
}
|
||||
str = document.getElementById("BookmarkFolder1.BookmarkURL" + i).value;
|
||||
if (str && str.length) {
|
||||
str = "BookmarkFolder1.BookmarkURL" + i + "=" + str + "\n";
|
||||
fos.write(str, str.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i=1; i <= 5; i++) {
|
||||
str = document.getElementById("BookmarkTitle" + i).value;
|
||||
if (str && str.length) {
|
||||
str = "BookmarkTitle" + i + "=" + str + "\n";
|
||||
fos.write(str, str.length);
|
||||
}
|
||||
str = document.getElementById("BookmarkURL" + i).value;
|
||||
if (str && str.length) {
|
||||
str = "BookmarkURL" + i + "=" + str + "\n";
|
||||
fos.write(str, str.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
fos.close();
|
||||
}
|
||||
|
||||
function CCKWriteDefaultJS(destdir)
|
||||
{
|
||||
var throbber1 = 'pref("browser.throbber.url", "chrome://cck/content/cck.properties");\n';
|
||||
var homepage1 = 'pref("browser.startup.homepage", "chrome://cck/content/cck.properties");\n';
|
||||
var homepage2 = 'pref("browser.startup.homepage_reset", "chrome://cck/content/cck.properties");\n';
|
||||
var useragent1begin = 'pref("general.useragent.vendorComment", "CK-';
|
||||
var useragent2begin = 'pref("general.useragent.extra.cck", "(CK-';
|
||||
|
||||
var useragent1end = '");\n';
|
||||
var useragent2end = ')");\n';
|
||||
|
||||
var file = destdir.clone();
|
||||
file.append("firefox-cck.js");
|
||||
|
||||
var fos = Components.classes["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
fos.init(file, -1, -1, false);
|
||||
|
||||
var logobuttonurl = document.getElementById("AnimatedLogoURL").value;
|
||||
if (logobuttonurl && (logobuttonurl.length > 0)) {
|
||||
fos.write(throbber1, throbber1.length);
|
||||
}
|
||||
|
||||
var browserstartuppage = document.getElementById("HomePageURL").value;
|
||||
if (browserstartuppage && (browserstartuppage.length > 0)) {
|
||||
fos.write(homepage1, homepage1.length);
|
||||
fos.write(homepage2, homepage2.length);
|
||||
}
|
||||
|
||||
var useragent = document.getElementById("OrganizationName").value;
|
||||
if (useragent && (useragent.length > 0)) {
|
||||
fos.write(useragent1begin, useragent1begin.length);
|
||||
fos.write(useragent, useragent.length);
|
||||
fos.write(useragent1end, useragent1end.length);
|
||||
fos.write(useragent2begin, useragent2begin.length);
|
||||
fos.write(useragent, useragent.length);
|
||||
fos.write(useragent2end, useragent2end.length);
|
||||
}
|
||||
|
||||
|
||||
fos.close();
|
||||
}
|
||||
|
||||
function CCKWriteInstallRDF(destdir)
|
||||
{
|
||||
var idline = "<em:id>%id%</em:id>";
|
||||
var nameline = "<em:name>%name%</em:name>";
|
||||
var versionline = "<em:version>%version%</em:version>";
|
||||
var descriptionline = "<em:description>%description%</em:description>";
|
||||
var creatorline = "<em:creator>%creator%</em:creator>";
|
||||
var homepageURLline = "<em:homepageURL>%homepageURL%</em:homepageURL>";
|
||||
var iconURLline = "<em:iconURL>chrome://cck/content/%iconURL%</em:iconURL>";
|
||||
|
||||
|
||||
var file = destdir.clone();
|
||||
file.append("install.rdf");
|
||||
try {
|
||||
file.remove(false);
|
||||
} catch (ex) {
|
||||
}
|
||||
var fos = Components.classes["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
|
||||
fos.init(file, -1, -1, false);
|
||||
var ioService=Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var scriptableStream=Components
|
||||
.classes["@mozilla.org/scriptableinputstream;1"]
|
||||
.getService(Components.interfaces.nsIScriptableInputStream);
|
||||
|
||||
var channel=ioService.newChannel("chrome://cckwizard/content/srcfiles/install.rdf.in",null,null);
|
||||
var input=channel.open();
|
||||
scriptableStream.init(input);
|
||||
var str=scriptableStream.read(input.available());
|
||||
scriptableStream.close();
|
||||
input.close();
|
||||
|
||||
var id = document.getElementById("id").value;
|
||||
if (id && (id.length > 0)) {
|
||||
str = str.replace(/%idline%/g, idline);
|
||||
str = str.replace(/%id%/g, document.getElementById("id").value);
|
||||
}
|
||||
|
||||
var name = document.getElementById("name").value;
|
||||
if (name && (name.length > 0)) {
|
||||
str = str.replace(/%nameline%/g, nameline);
|
||||
str = str.replace(/%name%/g, document.getElementById("name").value);
|
||||
} else {
|
||||
str = str.replace(/%nameline%/g, "");
|
||||
}
|
||||
|
||||
var version = document.getElementById("version").value;
|
||||
if (version && (version.length > 0)) {
|
||||
str = str.replace(/%versionline%/g, versionline);
|
||||
str = str.replace(/%version%/g, document.getElementById("version").value);
|
||||
} else {
|
||||
str = str.replace(/%versionline%/g, "");
|
||||
}
|
||||
|
||||
var description = document.getElementById("description").value;
|
||||
if (description && (description.length > 0)) {
|
||||
str = str.replace(/%descriptionline%/g, descriptionline);
|
||||
str = str.replace(/%description%/g, document.getElementById("description").value);
|
||||
} else {
|
||||
str = str.replace(/%descrptionline%/g, "");
|
||||
}
|
||||
|
||||
var creator = document.getElementById("creator").value;
|
||||
if (creator && (creator.length > 0)) {
|
||||
str = str.replace(/%creatorline%/g, creatorline);
|
||||
str = str.replace(/%creator%/g, document.getElementById("creator").value);
|
||||
} else {
|
||||
str = str.replace(/%creatorline%/g, "");
|
||||
}
|
||||
|
||||
var homepageURL = document.getElementById("homepageURL").value;
|
||||
if (homepageURL && (homepageURL.length > 0)) {
|
||||
str = str.replace(/%homepageURLline%/g, homepageURLline);
|
||||
str = str.replace(/%homepageURL%/g, document.getElementById("homepageURL").value);
|
||||
} else {
|
||||
str = str.replace(/%homepageURLline%/g, "");
|
||||
}
|
||||
|
||||
var iconURL = document.getElementById("iconURL").value;
|
||||
if (iconURL && (iconURL.length > 0)) {
|
||||
var sourcefile = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
sourcefile.initWithPath(iconURL);
|
||||
str = str.replace(/%iconURLline%/g, iconURLline);
|
||||
str = str.replace(/%iconURL%/g, sourcefile.leafName);
|
||||
} else {
|
||||
str = str.replace(/%iconURLline%/g, "");
|
||||
}
|
||||
|
||||
fos.write(str, str.length);
|
||||
fos.close();
|
||||
}
|
||||
|
||||
function CCKWriteInstallJS(destdir)
|
||||
{
|
||||
var file = destdir.clone();
|
||||
file.append("install.js");
|
||||
try {
|
||||
file.remove(false);
|
||||
} catch (ex) {
|
||||
}
|
||||
var fos = Components.classes["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
|
||||
fos.init(file, -1, -1, false);
|
||||
var ioService=Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var scriptableStream=Components
|
||||
.classes["@mozilla.org/scriptableinputstream;1"]
|
||||
.getService(Components.interfaces.nsIScriptableInputStream);
|
||||
|
||||
var channel=ioService.newChannel("chrome://cckwizard/content/srcfiles/install.js.in",null,null);
|
||||
var input=channel.open();
|
||||
scriptableStream.init(input);
|
||||
var str=scriptableStream.read(input.available());
|
||||
scriptableStream.close();
|
||||
input.close();
|
||||
|
||||
str = str.replace(/%id%/g, document.getElementById("id").value);
|
||||
str = str.replace(/%name%/g, document.getElementById("name").value);
|
||||
|
||||
if (haveplugins)
|
||||
str = str.replace(/%plugins%/g, 'addDirectory("", "%version%", "plugins", cckextensiondir, "plugins", true);');
|
||||
else
|
||||
str = str.replace(/%plugins%/g, '');
|
||||
|
||||
if (havesearchplugins)
|
||||
str = str.replace(/%searchplugins%/g, 'addDirectory("", "%version%", "searchplugins", cckextensiondir, "searchplugins", true);');
|
||||
else
|
||||
str = str.replace(/%searchplugins%/g, '');
|
||||
|
||||
str = str.replace(/%version%/g, document.getElementById("version").value);
|
||||
|
||||
|
||||
fos.write(str, str.length);
|
||||
fos.close();
|
||||
}
|
||||
|
||||
|
||||
/* This function copies a source file to a destination directory, including */
|
||||
/* deleting the file at the destination if it exists */
|
||||
|
||||
function CCKCopyFile(source, destination)
|
||||
{
|
||||
if (source.length == 0)
|
||||
return false;
|
||||
|
||||
var sourcefile = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
sourcefile.initWithPath(source);
|
||||
|
||||
var destfile = destination.clone();
|
||||
destfile.append(sourcefile.leafName);
|
||||
|
||||
try {
|
||||
destfile.remove(false);
|
||||
} catch (ex) {}
|
||||
|
||||
sourcefile.copyTo(destination, "");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function ShowConfigInfo()
|
||||
{
|
||||
window.openDialog("chrome://cckwizard/content/showconfig.xul","showconfig","chrome,modal");
|
||||
}
|
||||
|
||||
function InitConfigInfo()
|
||||
{
|
||||
var file = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
file.initWithPath(this.opener.currentconfigpath);
|
||||
|
||||
file.append("cck.config");
|
||||
|
||||
if (!file.exists())
|
||||
return;
|
||||
|
||||
var stream = Components.classes["@mozilla.org/network/file-input-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIFileInputStream);
|
||||
|
||||
stream.init(file, 0x01, 0644, 0);
|
||||
|
||||
var lis = stream.QueryInterface(Components.interfaces.nsILineInputStream);
|
||||
var line = {value:null};
|
||||
|
||||
var box = document.getElementById("showconfigy");
|
||||
|
||||
do {
|
||||
var more = lis.readLine(line);
|
||||
var str = line.value;
|
||||
box.value += str;
|
||||
box.value += "\n";
|
||||
} while (more);
|
||||
|
||||
stream.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function CCKWriteConfigFile(destdir)
|
||||
{
|
||||
var file = destdir.clone();
|
||||
file.append("cck.config");
|
||||
|
||||
var fos = Components.classes["@mozilla.org/network/file-output-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
fos.init(file, -1, -1, false);
|
||||
|
||||
var elements = document.getElementsByAttribute("id", "*")
|
||||
for (var i=0; i < elements.length; i++) {
|
||||
if (elements[i].nodeName == "textbox") {
|
||||
var line = elements[i].getAttribute("id") + "=" + elements[i].value + "\n";
|
||||
fos.write(line, line.length);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fos.close();
|
||||
}
|
||||
|
||||
function CCKReadConfigFile(srcdir)
|
||||
{
|
||||
var file = srcdir.clone();
|
||||
file.append("cck.config");
|
||||
|
||||
if (!file.exists())
|
||||
return;
|
||||
|
||||
var stream = Components.classes["@mozilla.org/network/file-input-stream;1"]
|
||||
.createInstance(Components.interfaces.nsIFileInputStream);
|
||||
|
||||
stream.init(file, 0x01, 0644, 0);
|
||||
var lis = stream.QueryInterface(Components.interfaces.nsILineInputStream);
|
||||
var line = {value:null};
|
||||
|
||||
do {
|
||||
var more = lis.readLine(line);
|
||||
var str = line.value;
|
||||
var linearray = str.split("=");
|
||||
if (linearray[0].length)
|
||||
document.getElementById(linearray[0]).value = linearray[1];
|
||||
} while (more);
|
||||
|
||||
stream.close();
|
||||
}
|
||||
|
|
@ -0,0 +1,523 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!-- ***** BEGIN LICENSE BLOCK *****
|
||||
#if 0
|
||||
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
-
|
||||
- The contents of this file are subject to the Mozilla Public License Version
|
||||
- 1.1 (the "License"); you may not use this file except in compliance with
|
||||
- the License. You may obtain a copy of the License at
|
||||
- http://www.mozilla.org/MPL/
|
||||
-
|
||||
- Software distributed under the License is distributed on an "AS IS" basis,
|
||||
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
- for the specific language governing rights and limitations under the
|
||||
- License.
|
||||
-
|
||||
- The Original Code is the Client Customization Kit (CCK).
|
||||
-
|
||||
- The Initial Developer of the Original Code is IBM Corp.
|
||||
- Portions created by the Initial Developer are Copyright (C) 2005
|
||||
- the Initial Developer. All Rights Reserved.
|
||||
-
|
||||
- Contributor(s):
|
||||
-
|
||||
- Alternatively, the contents of this file may be used under the terms of
|
||||
- either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
- in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
- of those above. If you wish to allow use of your version of this file only
|
||||
- under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
- use your version of this file under the terms of the MPL, indicate your
|
||||
- decision by deleting the provisions above and replace them with the notice
|
||||
- and other provisions required by the LGPL or the GPL. If you do not delete
|
||||
- the provisions above, a recipient may use your version of this file under
|
||||
- the terms of any one of the MPL, the GPL or the LGPL.
|
||||
-
|
||||
#endif
|
||||
- ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
|
||||
<wizard id="example-window" title="Firefox Client Customization Kit"
|
||||
height="480"
|
||||
width="640"
|
||||
onwizardcancel="alert('All changed data will be saved');saveconfig();"
|
||||
onwizardfinish="CreateCCK();"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script src="chrome://cckwizard/content/cckwizard.js"/>
|
||||
|
||||
<wizardpage onpageshow="ShowMain();">
|
||||
<description>Welcome to the Firefox Client Customization Kit (CCK). This
|
||||
wizard helps you create a Firefox extension that customizes
|
||||
Firefox for your users. This extension can either be installed
|
||||
by the user or included in a Firefox install package.
|
||||
</description>
|
||||
<groupbox>
|
||||
<caption label="Before You Begin"/>
|
||||
<description>Decide which customizations you want to make and
|
||||
create/collect the customized files, such as:
|
||||
</description>
|
||||
<html:ul>
|
||||
<html:li>Custom animation files for browser's animated logo</html:li>
|
||||
<html:li>Search plugins</html:li>
|
||||
<html:li>Browser plug-ins</html:li>
|
||||
</html:ul>
|
||||
</groupbox>
|
||||
<groupbox>
|
||||
<caption label="Select an Existing Configuration or Create a New One"/>
|
||||
<description>
|
||||
Select an existing configuration, or click "New" to create a new installer
|
||||
configuration and workspace in which to store your custom files. To edit
|
||||
an existing configuration without overwriting the original configuration,
|
||||
select it from the list and click "Copy".
|
||||
</description>
|
||||
<hbox>
|
||||
<menulist style="min-width: 50px;" flex="1" id="byb-configs" sizetopopup="false" oncommand="setcurrentconfig(this.selectedItem.value);">
|
||||
<menupopup>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<button label="Show Config Info" oncommand="ShowConfigInfo()"/>
|
||||
<button label="New" oncommand="CreateConfig();"/>
|
||||
<button label="Copy" disabled="true" oncommand="CopyConfig();"/>/>
|
||||
<button label="Delete" id="deleteconfig" oncommand="DeleteConfig();"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</wizardpage>
|
||||
|
||||
<wizardpage description="Extension Information" onpageshow="initimage('iconURL','icon');">
|
||||
<groupbox>
|
||||
<caption label="Extension Information"/>
|
||||
<description>
|
||||
|
||||
</description>
|
||||
<hbox align="center">
|
||||
<spacer flex="1"/>
|
||||
<label>Unique ID:</label>
|
||||
<textbox id="id" style="width: 350px;" tooltiptext="Format: cck-companyname@extensions.domainname.tld"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<spacer flex="1"/>
|
||||
<label>Name:</label>
|
||||
<textbox id="name" style="width: 350px;"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<spacer flex="1"/>
|
||||
<label>Version:</label>
|
||||
<textbox id="version" style="width: 350px;"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<spacer flex="1"/>
|
||||
<label>Description:</label>
|
||||
<textbox id="description" style="width: 350px;"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<spacer flex="1"/>
|
||||
<label>Creator:</label>
|
||||
<textbox id="creator" style="width: 350px;"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<spacer flex="1"/>
|
||||
<label>Homepage URL:</label>
|
||||
<textbox id="homepageURL" style="width: 350px;"/>
|
||||
</hbox>
|
||||
<hbox align="center">
|
||||
<spacer flex="1"/>
|
||||
<label>Icon:</label>
|
||||
<hbox>
|
||||
<textbox style="min-width: 226px;" flex="1" readonly="true" id="iconURL"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<image id="icon" src='' width='32' height='32'/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<button label="Choose File..." oncommand="chooseimage('iconURL','icon');"/>
|
||||
|
||||
</hbox>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</wizardpage>
|
||||
|
||||
<wizardpage>
|
||||
<groupbox>
|
||||
<caption label="Company Identifier"/>
|
||||
<description>
|
||||
The Company Identifier is included as part of the browser's user agent
|
||||
string which appears when you open the Help menu and select About
|
||||
Mozilla Firefox.
|
||||
</description>
|
||||
<hbox align="center">
|
||||
<label>Enter Your Company Identifier (up to 10 characters; no spaces):</label>
|
||||
<textbox id="OrganizationName" maxlength="10" flex="1"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
<groupbox>
|
||||
<caption label="Default Home Page"/>
|
||||
<description>
|
||||
This page is displayed when users first start the Firefox browser, or when they click the Home button.
|
||||
</description>
|
||||
<hbox align="center">
|
||||
<label>Home Page URL:</label>
|
||||
<textbox id="HomePageURL" flex="1"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
<groupbox>
|
||||
<caption label="Browser Window's Title Bar Text"/>
|
||||
<description>
|
||||
The text you enter (for example, your company name) appears after the
|
||||
page title in the title bar. It is recommended that you use the format
|
||||
<html:i>Mozilla Firefox: Companyname Edition</html:i>
|
||||
</description>
|
||||
<hbox align="center">
|
||||
<label>Custom Title Bar Text:</label>
|
||||
<textbox id="CompanyName" flex="1"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</wizardpage>
|
||||
|
||||
|
||||
|
||||
<wizardpage onpageshow="initimage('LargeStillPath','LargeStill');initimage('LargeAnimPath','LargeAnim');">
|
||||
<groupbox>
|
||||
<caption label="Animated Logo"/>
|
||||
<description>
|
||||
Enter the URL that users will go to when they click the animated logo button.
|
||||
</description>
|
||||
<hbox align="center">
|
||||
<label>Logo Button URL:</label>
|
||||
<textbox flex="1" id="AnimatedLogoURL"/>
|
||||
</hbox>
|
||||
<description>
|
||||
Enter the tooltip that users will see when they mouse over the animated logo button.
|
||||
</description>
|
||||
<hbox align="center">
|
||||
<label>Logo Button Tooltip:</label>
|
||||
<textbox flex="1" id="AnimatedLogoTooltip"/>
|
||||
</hbox>
|
||||
<description>
|
||||
Path to Your Animated GIF File (16x16 pixels):
|
||||
</description>
|
||||
<hbox align="center">
|
||||
<textbox readonly="true" id="LargeAnimPath" flex="1"/>
|
||||
<image id="LargeAnim" src='' width='16' height='16'/>
|
||||
<button label="Choose File..." oncommand="chooseimage('LargeAnimPath','LargeAnim');"/>
|
||||
</hbox>
|
||||
<description>
|
||||
Path to Your At Rest GIF or PNG File (16x16 pixels):
|
||||
</description>
|
||||
<hbox align="center">
|
||||
<textbox readonly="true" id="LargeStillPath" flex="1"/>
|
||||
<image id="LargeStill" src='' width='16' height='16'/>
|
||||
<button label="Choose File..." oncommand="chooseimage('LargeStillPath','LargeStill');"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</wizardpage>
|
||||
|
||||
<wizardpage>
|
||||
<groupbox>
|
||||
<caption label="Help Menu"/>
|
||||
<description>
|
||||
You can add an item to the Help Menu which provides a link to your online customer support page.
|
||||
</description>
|
||||
<vbox>
|
||||
<label>Menu Item Text:</label>
|
||||
<textbox id="HelpMenuCommandName" flex="1"/>
|
||||
</vbox>
|
||||
<vbox>
|
||||
<label>Help Menu Item URL:</label>
|
||||
<textbox id="HelpMenuCommandURL" flex="1"/>
|
||||
</vbox>
|
||||
<vbox>
|
||||
<label>Help Menu Item Accesskey:</label>
|
||||
<textbox id="HelpMenuCommandAccesskey" flex="1"/>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
<groupbox>
|
||||
<caption label="Allowed Sites"/>
|
||||
<description>
|
||||
You can specify domains for which popups and/or XPI installs are allowed. List the domains, separated by a comma.
|
||||
</description>
|
||||
<vbox>
|
||||
<label>Popup Allowed Sites:</label>
|
||||
<textbox id="PopupAllowedSites" flex="1"/>
|
||||
</vbox>
|
||||
<vbox>
|
||||
<label>Install Allowed Sites:</label>
|
||||
<textbox id="InstallAllowedSites" flex="1"/>
|
||||
</vbox>
|
||||
</groupbox>
|
||||
</wizardpage>
|
||||
|
||||
|
||||
<wizardpage>
|
||||
<groupbox>
|
||||
<caption label="Browser Plug-ins"/>
|
||||
<description>
|
||||
You may select up to five browser plug-ins to be preinstalled.
|
||||
</description>
|
||||
<hbox>
|
||||
<textbox readonly="true" id="BrowserPluginPath1" flex="1"/>
|
||||
<button label="Choose File..." oncommand="choosefile('BrowserPluginPath1');"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<textbox readonly="true" id="BrowserPluginPath2" flex="1"/>
|
||||
<button label="Choose File..." oncommand="choosefile('BrowserPluginPath3');"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<textbox readonly="true" id="BrowserPluginPath3" flex="1"/>
|
||||
<button label="Choose File..." oncommand="choosefile('BrowserPluginPath3');"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<textbox readonly="true" id="BrowserPluginPath4" flex="1"/>
|
||||
<button label="Choose File..." oncommand="choosefile('BrowserPluginPath4');"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<textbox readonly="true" id="BrowserPluginPath5" flex="1"/>
|
||||
<button label="Choose File..." oncommand="choosefile('BrowserPluginPath5');"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</wizardpage>
|
||||
|
||||
<wizardpage>
|
||||
<groupbox>
|
||||
<caption label="Search Plugins"/>
|
||||
<description>
|
||||
You may select up to five search plugins to be preinstalled.
|
||||
</description>
|
||||
<html:hr/>
|
||||
<hbox align="center">
|
||||
<spacer flex="1"/>
|
||||
<label>File:</label>
|
||||
<textbox readonly="true" id="SearchPlugin1" style="min-width: 375px;" flex="1" />
|
||||
<button label="Choose File..." oncommand="choosefile('SearchPlugin1');"/>
|
||||
</hbox>
|
||||
<hbox style="width: 350px;">
|
||||
<spacer flex="1"/>
|
||||
<label>Icon:</label>
|
||||
<textbox readonly="true" id="SearchPluginIcon1" style="min-width: 380px;" flex="1" />
|
||||
<button label="Choose File..." oncommand="choosefile('SearchPluginIcon1');"/>
|
||||
</hbox>
|
||||
<html:hr/>
|
||||
<hbox align="center">
|
||||
<spacer flex="1"/>
|
||||
<label>File:</label>
|
||||
<textbox readonly="true" id="SearchPlugin2" style="min-width: 375px;" flex="1" />
|
||||
<button label="Choose File..." oncommand="choosefile('SearchPlugin2');"/>
|
||||
</hbox>
|
||||
<hbox style="width: 350px;">
|
||||
<spacer flex="1"/>
|
||||
<label>Icon:</label>
|
||||
<textbox readonly="true" id="SearchPluginIcon2" style="min-width: 380px;" flex="1" />
|
||||
<button label="Choose File..." oncommand="choosefile('SearchPluginIcon2');"/>
|
||||
</hbox>
|
||||
<html:hr/>
|
||||
<hbox align="center">
|
||||
<spacer flex="1"/>
|
||||
<label>File:</label>
|
||||
<textbox readonly="true" id="SearchPlugin3" style="min-width: 375px;" flex="1" />
|
||||
<button label="Choose File..." oncommand="choosefile('SearchPlugin3');"/>
|
||||
</hbox>
|
||||
<hbox style="width: 350px;">
|
||||
<spacer flex="1"/>
|
||||
<label>Icon:</label>
|
||||
<textbox readonly="true" id="SearchPluginIcon3" style="min-width: 380px;" flex="1" />
|
||||
<button label="Choose File..." oncommand="choosefile('SearchPluginIcon3');"/>
|
||||
</hbox>
|
||||
<html:hr/>
|
||||
<hbox align="center">
|
||||
<spacer flex="1"/>
|
||||
<label>File:</label>
|
||||
<textbox readonly="true" id="SearchPlugin4" style="min-width: 375px;" flex="1" />
|
||||
<button label="Choose File..." oncommand="choosefile('SearchPlugin4');"/>
|
||||
</hbox>
|
||||
<hbox style="width: 350px;">
|
||||
<spacer flex="1"/>
|
||||
<label>Icon:</label>
|
||||
<textbox readonly="true" id="SearchPluginIcon4" style="min-width: 380px;" flex="1" />
|
||||
<button label="Choose File..." oncommand="choosefile('SearchPluginIcon4');"/>
|
||||
</hbox>
|
||||
<html:hr/>
|
||||
<hbox align="center">
|
||||
<spacer flex="1"/>
|
||||
<label>File:</label>
|
||||
<textbox readonly="true" id="SearchPlugin5" style="min-width: 375px;" flex="1" />
|
||||
<button label="Choose File..." oncommand="choosefile('SearchPlugin5');"/>
|
||||
</hbox>
|
||||
<hbox style="width: 350px;">
|
||||
<spacer flex="1"/>
|
||||
<label>Icon:</label>
|
||||
<textbox readonly="true" id="SearchPluginIcon5" style="min-width: 380px;" flex="1" />
|
||||
<button label="Choose File..." oncommand="choosefile('SearchPluginIcon5');"/>
|
||||
</hbox>
|
||||
<html:hr/>
|
||||
</groupbox>
|
||||
</wizardpage>
|
||||
|
||||
<wizardpage>
|
||||
<groupbox>
|
||||
<caption label="Add a folder to the personal toolbar"/>
|
||||
<description>
|
||||
You can add a folder with up to five bookmarks to the personal toolbar.
|
||||
</description>
|
||||
<hbox>
|
||||
<label>Folder Title:</label>
|
||||
<textbox id="ToolbarFolder1"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title1:</label>
|
||||
<textbox id="ToolbarFolder1.BookmarkTitle1"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="ToolbarFolder1.BookmarkURL1"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title2:</label>
|
||||
<textbox id="ToolbarFolder1.BookmarkTitle2"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="ToolbarFolder1.BookmarkURL2"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title3:</label>
|
||||
<textbox id="ToolbarFolder1.BookmarkTitle3"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="ToolbarFolder1.BookmarkURL3"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title4:</label>
|
||||
<textbox id="ToolbarFolder1.BookmarkTitle4"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="ToolbarFolder1.BookmarkURL4"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title5:</label>
|
||||
<textbox id="ToolbarFolder1.BookmarkTitle5"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="ToolbarFolder1.BookmarkURL5"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</wizardpage>
|
||||
|
||||
<wizardpage>
|
||||
<groupbox>
|
||||
<caption label="Add bookmarks to the personal toolbar"/>
|
||||
<description>
|
||||
You can add up to five bookmarks to the personal toolbar.
|
||||
</description>
|
||||
<hbox>
|
||||
<label>Bookmark Title1:</label>
|
||||
<textbox id="ToolbarBookmarkTitle1"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="ToolbarBookmarkURL1"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title2:</label>
|
||||
<textbox id="ToolbarBookmarkTitle2"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="ToolbarBookmarkURL2"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title3:</label>
|
||||
<textbox id="ToolbarBookmarkTitle3"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="ToolbarBookmarkURL3"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title4:</label>
|
||||
<textbox id="ToolbarBookmarkTitle4"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="ToolbarBookmarkURL4"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title5:</label>
|
||||
<textbox id="ToolbarBookmarkTitle5"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="ToolbarBookmarkURL5"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</wizardpage>
|
||||
|
||||
|
||||
|
||||
<wizardpage>
|
||||
<groupbox>
|
||||
<caption label="Add a folder to bookmarks"/>
|
||||
<description>
|
||||
You can add a folder with up to five bookmarks to bookmarks.
|
||||
</description>
|
||||
<hbox>
|
||||
<label>Folder Title:</label>
|
||||
<textbox id="BookmarkFolder1"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title1:</label>
|
||||
<textbox id="BookmarkFolder1.BookmarkTitle1"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="BookmarkFolder1.BookmarkURL1"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title2:</label>
|
||||
<textbox id="BookmarkFolder1.BookmarkTitle2"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="BookmarkFolder1.BookmarkURL2"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title3:</label>
|
||||
<textbox id="BookmarkFolder1.BookmarkTitle3"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="BookmarkFolder1.BookmarkURL3"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title4:</label>
|
||||
<textbox id="BookmarkFolder1.BookmarkTitle4"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="BookmarkFolder1.BookmarkURL4"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title5:</label>
|
||||
<textbox id="BookmarkFolder1.BookmarkTitle5"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="BookmarkFolder1.BookmarkURL5"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</wizardpage>
|
||||
|
||||
<wizardpage>
|
||||
<groupbox>
|
||||
<caption label="Add bookmarks"/>
|
||||
<description>
|
||||
You can add up to five bookmarks.
|
||||
</description>
|
||||
<hbox>
|
||||
<label>Bookmark Title1:</label>
|
||||
<textbox id="BookmarkTitle1"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="BookmarkURL1"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title2:</label>
|
||||
<textbox id="BookmarkTitle2"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="BookmarkURL2"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title3:</label>
|
||||
<textbox id="BookmarkTitle3"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="BookmarkURL3"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title4:</label>
|
||||
<textbox id="BookmarkTitle4"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="BookmarkURL4"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label>Bookmark Title5:</label>
|
||||
<textbox id="BookmarkTitle5"/>
|
||||
<label>URL1:</label>
|
||||
<textbox id="BookmarkURL5"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
</wizardpage>
|
||||
|
||||
</wizard>
|
|
@ -0,0 +1,6 @@
|
|||
browser.throbber.url=%browser.throbber.url%
|
||||
cckhelp.url=%cckhelp.url%
|
||||
browser.startup.homepage=%browser.startup.homepage%
|
||||
browser.startup.homepage_reset=%browser.startup.homepage%
|
||||
PopupAllowedSites=%PopupAllowedSites%
|
||||
InstallAllowedSites=%InstallAllowedSites%
|
|
@ -0,0 +1,424 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Client Customization Kit (CCK).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Giorgio Maonem <g.maone@informaction.com>
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* IBM Corp.
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function CCKService() {
|
||||
this.register();
|
||||
}
|
||||
|
||||
CCKService.prototype={
|
||||
get wrappedJSObject() {
|
||||
return this;
|
||||
}
|
||||
,
|
||||
QueryInterface: function(iid) {
|
||||
this.queryInterfaceSupport(iid,SERVICE_IIDS);
|
||||
return this;
|
||||
}
|
||||
,
|
||||
// nsIObserver implementation
|
||||
observe: function(subject, topic, data) {
|
||||
// dump(SERVICE_NAME+" notified of "+subject+","+topic+","+data); //DDEBUG
|
||||
|
||||
switch(topic) {
|
||||
case "xpcom-shutdown":
|
||||
this.unregister();
|
||||
break;
|
||||
case "profile-after-change":
|
||||
this.init();
|
||||
break;
|
||||
}
|
||||
}
|
||||
,
|
||||
register: function() {
|
||||
const osvr=Components.classes['@mozilla.org/observer-service;1'].getService(
|
||||
Components.interfaces.nsIObserverService);
|
||||
osvr.addObserver(this,"xpcom-shutdown",false);
|
||||
osvr.addObserver(this,"profile-after-change",false);
|
||||
}
|
||||
,
|
||||
unregister: function() {
|
||||
const osvr=Components.classes['@mozilla.org/observer-service;1'].getService(
|
||||
Components.interfaces.nsIObserverService);
|
||||
osvr.removeObserver(this,"xpcom-shutdown");
|
||||
osvr.removeObserver(this,"profile-after-change");
|
||||
}
|
||||
,
|
||||
_inited: false
|
||||
,
|
||||
init: function() {
|
||||
if(this._inited) return;
|
||||
this._inited=true;
|
||||
var prefbranch;
|
||||
try {
|
||||
prefbranch=Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
|
||||
} catch (ex) {
|
||||
return;
|
||||
}
|
||||
var cckinited;
|
||||
try {
|
||||
cckinited = prefbranch.getBoolPref("cck.initialized");
|
||||
} catch (ex) {
|
||||
cckinited = false;
|
||||
}
|
||||
|
||||
var sbs;
|
||||
var bundle;
|
||||
var pm;
|
||||
var ioService;
|
||||
try {
|
||||
sbs = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService );
|
||||
bundle = sbs.createBundle("chrome://cck/content/cck.properties");
|
||||
pm = Components.classes["@mozilla.org/permissionmanager;1"].getService(Components.interfaces.nsIPermissionManager);
|
||||
ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
|
||||
} catch (ex) {
|
||||
return;
|
||||
}
|
||||
|
||||
var popupAllowedSites;
|
||||
try {
|
||||
popupAllowedSites = bundle.GetStringFromName("PopupAllowedSites");
|
||||
} catch (ex) {}
|
||||
if (popupAllowedSites) {
|
||||
var popupAllowedSitesArray = popupAllowedSites.split(",");
|
||||
for (var i=0; i < popupAllowedSitesArray.length; i++) {
|
||||
try {
|
||||
var uri = ioService.newURI("http://" + popupAllowedSitesArray[i], null, null);
|
||||
pm.add(uri, "popup", 1);
|
||||
} catch (ex) {}
|
||||
}
|
||||
}
|
||||
|
||||
var installAllowedSites;
|
||||
try {
|
||||
installAllowedSites = bundle.GetStringFromName("InstallAllowedSites");
|
||||
} catch (ex) {}
|
||||
if (popupAllowedSites) {
|
||||
var installAllowedSitesArray = installAllowedSites.split(",");
|
||||
for (var i=0; i < installAllowedSitesArray.length; i++) {
|
||||
try {
|
||||
var uri = ioService.newURI("http://" + installAllowedSitesArray[i], null, null);
|
||||
pm.add(uri, "install", 1);
|
||||
} catch (ex) {}
|
||||
}
|
||||
}
|
||||
|
||||
/* Only do bookmarks if we haven't been inited to avoid duplicated */
|
||||
if (!cckinited) {
|
||||
var RDF;
|
||||
var BMSVC;
|
||||
var bmRoot;
|
||||
|
||||
try {
|
||||
RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService)
|
||||
BMSVC = RDF.GetDataSource("rdf:bookmarks").QueryInterface(Components.interfaces.nsIBookmarksService);;
|
||||
BMSVC.readBookmarks();
|
||||
bmRoot = RDF.GetResource("NC:BookmarksRoot");
|
||||
} catch (ex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var ToolbarLocation;
|
||||
var tbIndex = -1; // last
|
||||
|
||||
try {
|
||||
ToolbarLocation = bundle.GetStringFromName("ToolbarLocation");
|
||||
} catch (ex) {}
|
||||
if ((ToolbarLocation) && (ToolbarLocation == "First")) {
|
||||
tbIndex = 1;
|
||||
addBookmarks(bundle, BMSVC, "Toolbar", BMSVC.getBookmarksToolbarFolder(), tbIndex);
|
||||
addLivemarks(bundle, BMSVC, "Toolbar", BMSVC.getBookmarksToolbarFolder(), tbIndex);
|
||||
addFolder(bundle, BMSVC, "Toolbar", BMSVC.getBookmarksToolbarFolder(), tbIndex);
|
||||
} else {
|
||||
addFolder(bundle, BMSVC, "Toolbar", BMSVC.getBookmarksToolbarFolder(), tbIndex);
|
||||
addLivemarks(bundle, BMSVC, "Toolbar", BMSVC.getBookmarksToolbarFolder(), tbIndex);
|
||||
addBookmarks(bundle, BMSVC, "Toolbar", BMSVC.getBookmarksToolbarFolder(), tbIndex);
|
||||
}
|
||||
|
||||
var BookmarkLocation;
|
||||
var bmIndex = -1; // last
|
||||
|
||||
try {
|
||||
BookmarkLocation = bundle.GetStringFromName("BookmarkLocation");
|
||||
} catch (ex) {}
|
||||
if ((BookmarkLocation) && (BookmarkLocation == "First")) {
|
||||
bmIndex = 1;
|
||||
addLivemarks(bundle, BMSVC, "Bookmark", bmRoot, bmIndex);
|
||||
addBookmarks(bundle, BMSVC, "", bmRoot, bmIndex);
|
||||
addFolder(bundle, BMSVC, "Bookmark", bmRoot, bmIndex);
|
||||
} else {
|
||||
addFolder(bundle, BMSVC, "Bookmark", bmRoot, bmIndex);
|
||||
addBookmarks(bundle, BMSVC, "", bmRoot, bmIndex);
|
||||
addLivemarks(bundle, BMSVC, "Bookmark", bmRoot, bmIndex);
|
||||
}
|
||||
|
||||
prefbranch.setBoolPref("cck.initialized", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addLivemarks(bundle, BMSVC, prefix, folder, location)
|
||||
{
|
||||
var LivemarkTitle;
|
||||
var LivemarkRSSURL;
|
||||
|
||||
// items are added in reverse order if we are set to "First"
|
||||
var start, end, increment;
|
||||
|
||||
if (location == -1) {
|
||||
start = 1;
|
||||
end = 6;
|
||||
increment = 1;
|
||||
} else {
|
||||
start = 5;
|
||||
end = 0;
|
||||
increment = -1;
|
||||
}
|
||||
|
||||
for (var i=start; i!=end; i+=increment) {
|
||||
try {
|
||||
LivemarkTitle = bundle.GetStringFromName(prefix + "LivemarkTitle" + i);
|
||||
} catch (ex) {
|
||||
LivemarkTitle = "";
|
||||
}
|
||||
if ((LivemarkTitle) && (LivemarkTitle.length)) {
|
||||
try {
|
||||
LivemarkRSSURL = bundle.GetStringFromName(prefix + "LivemarkRSSURL" + i);
|
||||
} catch (ex) {
|
||||
LivemarkRSSURL = "";
|
||||
}
|
||||
if ((LivemarkRSSURL) && (LivemarkRSSURL.length)) {
|
||||
if (BMSVC.createLivemarkInContainer)
|
||||
BMSVC.createLivemarkInContainer(LivemarkTitle, "", LivemarkRSSURL, "", folder, location);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addBookmarks(bundle, BMSVC, prefix, folder, location)
|
||||
{
|
||||
var BookmarkTitle;
|
||||
var BookmarkURL;
|
||||
|
||||
// items are added in reverse order if we are set to "First"
|
||||
var start, end, increment;
|
||||
|
||||
if (location == -1) {
|
||||
start = 1;
|
||||
end = 6;
|
||||
increment = 1;
|
||||
} else {
|
||||
start = 5;
|
||||
end = 0;
|
||||
increment = -1;
|
||||
}
|
||||
|
||||
for (var i=start; i!=end; i+=increment) {
|
||||
try {
|
||||
BookmarkTitle = bundle.GetStringFromName(prefix + "BookmarkTitle" + i);
|
||||
} catch (ex) {
|
||||
BookmarkTitle = "";
|
||||
}
|
||||
if ((BookmarkTitle) && (BookmarkTitle.length)) {
|
||||
try {
|
||||
BookmarkURL = bundle.GetStringFromName(prefix + "BookmarkURL" + i);
|
||||
} catch (ex) {
|
||||
BookmarkURL = "";
|
||||
}
|
||||
if ((BookmarkURL) && (BookmarkURL.length)) {
|
||||
if (BMSVC.createBookmarkInContainer.length == 8)
|
||||
BMSVC.createBookmarkInContainer(BookmarkTitle, BookmarkURL, "", "", "", "", folder, location);
|
||||
else
|
||||
BMSVC.createBookmarkInContainer(BookmarkTitle, BookmarkURL, "", "", "", folder, location);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function addFolder(bundle, BMSVC, prefix, folder, location)
|
||||
{
|
||||
var BookmarkFolder;
|
||||
var BookmarkTitle;
|
||||
var BookmarkURL;
|
||||
|
||||
// items are added in reverse order if we are set to "First"
|
||||
var start, end, increment;
|
||||
|
||||
if (location == -1) {
|
||||
start = 1;
|
||||
end = 6;
|
||||
increment = 1;
|
||||
} else {
|
||||
start = 5;
|
||||
end = 0;
|
||||
increment = -1;
|
||||
}
|
||||
|
||||
// Bookmarks folder with bookmarks
|
||||
for (var i=start; i!=end; i+=increment) {
|
||||
try {
|
||||
BookmarkFolder = bundle.GetStringFromName(prefix + "Folder" + i);
|
||||
} catch (ex) {
|
||||
BookmarkFolder = "";
|
||||
}
|
||||
if ((BookmarkFolder) && (BookmarkFolder.length)) {
|
||||
var newfolder;
|
||||
if (BMSVC.createBookmarkInContainer.length == 8)
|
||||
newfolder = BMSVC.createFolderInContainer(BookmarkFolder, folder, location);
|
||||
else
|
||||
newfolder = BMSVC.createFolderInContainer(BookmarkFolder, folder, location);
|
||||
for (var j=1; j<=5; j++) {
|
||||
try {
|
||||
BookmarkTitle = bundle.GetStringFromName(prefix + "Folder" + i + ".BookmarkTitle" + j);
|
||||
} catch (ex) {
|
||||
BookmarkTitle = "";
|
||||
}
|
||||
if ((BookmarkTitle) && (BookmarkTitle.length)) {
|
||||
try {
|
||||
BookmarkURL = bundle.GetStringFromName(prefix + "Folder" + i + ".BookmarkURL" + j);
|
||||
} catch (ex) {
|
||||
BookmarkURL = "";
|
||||
}
|
||||
if ((BookmarkURL) && (BookmarkURL.length)) {
|
||||
if (BMSVC.createBookmarkInContainer.length == 8)
|
||||
BMSVC.createBookmarkInContainer(BookmarkTitle, BookmarkURL, "", "", "", "", newfolder, -1);
|
||||
else
|
||||
BMSVC.createBookmarkInContainer(BookmarkTitle, BookmarkURL, "", "", "", newfolder, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// XPCOM Scaffolding code
|
||||
|
||||
// component defined in this file
|
||||
const EXTENSION_ID="{73a6fe31-595d-460b-a920-fcc0f8843233}";
|
||||
const SERVICE_NAME="CCK Service";
|
||||
const SERVICE_ID="{31aec909-8e86-4397-9380-63a59e0c5ff6}";
|
||||
const SERVICE_CTRID = "@mozilla.org/cck-service;1";
|
||||
const SERVICE_CONSTRUCTOR=CCKService;
|
||||
|
||||
const SERVICE_CID = Components.ID(SERVICE_ID);
|
||||
|
||||
// interfaces implemented by this component
|
||||
const SERVICE_IIDS =
|
||||
[
|
||||
Components.interfaces.nsIObserver,
|
||||
Components.interfaces.nsISupports,
|
||||
Components.interfaces.nsISupportsWeakReference
|
||||
];
|
||||
|
||||
// Factory object
|
||||
const SERVICE_FACTORY = {
|
||||
_instance: new SERVICE_CONSTRUCTOR(),
|
||||
createInstance: function (outer, iid) {
|
||||
if (outer != null)
|
||||
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
||||
|
||||
xpcom_checkInterfaces(iid,SERVICE_IIDS,Components.results.NS_ERROR_INVALID_ARG);
|
||||
// kept this for flexibility sake, but we're really adopting an
|
||||
// early instantiation and late init singleton pattern
|
||||
return this._instance==null?this._instance=new SERVICE_CONSTRUCTOR():this._instance;
|
||||
}
|
||||
};
|
||||
|
||||
function xpcom_checkInterfaces(iid,iids,ex) {
|
||||
for(var j=iids.length; j-- >0;) {
|
||||
if(iid.equals(iids[j])) return true;
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
|
||||
// Module
|
||||
|
||||
var Module = new Object();
|
||||
Module.firstTime=true;
|
||||
Module.registerSelf = function (compMgr, fileSpec, location, type) {
|
||||
if(this.firstTime) {
|
||||
|
||||
debug("*** Registering "+SERVICE_CTRID+".\n");
|
||||
|
||||
compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar
|
||||
).registerFactoryLocation(SERVICE_CID,
|
||||
SERVICE_NAME,
|
||||
SERVICE_CTRID,
|
||||
fileSpec,
|
||||
location,
|
||||
type);
|
||||
|
||||
Components.classes['@mozilla.org/categorymanager;1'].getService(
|
||||
Components.interfaces.nsICategoryManager
|
||||
).addCategoryEntry("app-startup",
|
||||
SERVICE_NAME, "service," + SERVICE_CTRID, true, true, null);
|
||||
|
||||
this.firstTime=false;
|
||||
}
|
||||
}
|
||||
Module.unregisterSelf = function(compMgr, fileSpec, location) {
|
||||
compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar
|
||||
).unregisterFactoryLocation(SERVICE_CID, fileSpec);
|
||||
Components.classes['@mozilla.org/categorymanager;1'].getService(
|
||||
Components.interfaces.nsICategoryManager
|
||||
).deleteCategoryEntry("app-startup",SERVICE_NAME, true);
|
||||
}
|
||||
|
||||
Module.getClassObject = function (compMgr, cid, iid) {
|
||||
if(cid.equals(SERVICE_CID))
|
||||
return SERVICE_FACTORY;
|
||||
|
||||
if (!iid.equals(Components.interfaces.nsIFactory))
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
throw Components.results.NS_ERROR_NO_INTERFACE;
|
||||
|
||||
}
|
||||
|
||||
Module.canUnload = function(compMgr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// entrypoint
|
||||
function NSGetModule(compMgr, fileSpec) {
|
||||
return Module;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
|
||||
%idline%
|
||||
%nameline%
|
||||
%versionline%
|
||||
%descriptionline%
|
||||
%creatorline%
|
||||
%homepageURLline%
|
||||
%iconURLline%
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||
<em:minVersion>1.0+</em:minVersion>
|
||||
<em:maxVersion>1.5</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
</Description>
|
||||
|
||||
</RDF>
|
|
@ -0,0 +1,24 @@
|
|||
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
|
||||
|
||||
<Description about="urn:mozilla:install-manifest">
|
||||
|
||||
<em:id>cckwizard@extensions.mozilla.org</em:id>
|
||||
<em:name>CCK Wizard</em:name>
|
||||
<em:version>0.2</em:version>
|
||||
<em:description>XUL Wizard to create CCK Packages</em:description>
|
||||
<em:creator>Michael Kaply</em:creator>
|
||||
<em:homepageURL>http://www.mozilla.org/projects/cck/firefox</em:homepageURL>
|
||||
<em:iconURL>chrome://cckwizard/content/cckwizard.png</em:iconURL>
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||
<em:minVersion>1.0+</em:minVersion>
|
||||
<em:maxVersion>1.5</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
</Description>
|
||||
|
||||
</RDF>
|
Загрузка…
Ссылка в новой задаче