1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 23:57:59 +01:00

Move config module to config.jsm.

--HG--
rename : common/content/configbase.js => common/modules/config.jsm
This commit is contained in:
Kris Maglione
2010-12-29 14:49:20 -05:00
parent b8b931b901
commit 7a0c7dacbe
13 changed files with 241 additions and 219 deletions

12
common/bootstrap.js vendored
View File

@@ -99,7 +99,6 @@ FactoryProxy.prototype = {
return this.module; return this.module;
}, },
createInstance: function (iids) { createInstance: function (iids) {
dump("dactyl: bootstrap: createInstance: " + this.classID + " " + this.contractID + " " + iids + "\n");
return let (factory = this.module.NSGetFactory(this.classID)) return let (factory = this.module.NSGetFactory(this.classID))
factory.createInstance.apply(factory, arguments) factory.createInstance.apply(factory, arguments)
} }
@@ -155,18 +154,7 @@ function init() {
for each (let component in components) for each (let component in components)
component.register(); component.register();
require(global, "prefs");
require(global, "services"); require(global, "services");
Cu.import("resource://gre/modules/Services.jsm", global);
services.subscriptLoader.loadSubScript(
url("defaults/preferences/dactyl.js"),
{
pref: function pref(name, val) {
if (prefs.get(name, null) == null)
prefs.set(name, val);
}
});
let manifestText = result.map(function (line) line.join(" ")).join("\n"); let manifestText = result.map(function (line) line.join(" ")).join("\n");

View File

@@ -101,14 +101,7 @@ function Dactyl() {
this.pages = {}; this.pages = {};
Cu.import("resource://dactyl/base.jsm"); Cu.import("resource://dactyl/base.jsm");
require(global, "prefs");
require(global, "util"); require(global, "util");
["appName", "fileExt", "host", "hostbin", "idName", "name", "version"].forEach(function (pref)
this.__defineGetter__(pref, function () prefs.get("extensions.dactyl." + pref, "dactyl")),
this);
memoize(this, "addonID", function () this.name + "@dactyl.googlecode.com");
} }
Dactyl.prototype = { Dactyl.prototype = {
contractID: "@mozilla.org/network/protocol;1?name=dactyl", contractID: "@mozilla.org/network/protocol;1?name=dactyl",

View File

@@ -332,9 +332,9 @@ var Tabs = Module("tabs", {
} }
if (focusLeftTab) if (focusLeftTab)
tabs.slice(Math.max(0, index + 1 - count), index + 1).forEach(config.removeTab); tabs.slice(Math.max(0, index + 1 - count), index + 1).forEach(config.closure.removeTab);
else else
tabs.slice(index, index + count).forEach(config.removeTab); tabs.slice(index, index + count).forEach(config.closure.removeTab);
return res; return res;
}, },

View File

@@ -163,7 +163,7 @@ defineModule.dump = function dump_() {
msg = util.objectToString(msg); msg = util.objectToString(msg);
return msg; return msg;
}).join(", "); }).join(", ");
let name = loaded.services && loaded.prefs && services["dactyl:"] ? services["dactyl:"].name : "dactyl"; let name = loaded.services && loaded.config ? config.name.name : "dactyl";
dump(String.replace(msg, /\n?$/, "\n") dump(String.replace(msg, /\n?$/, "\n")
.replace(/^./gm, name + ": $&")); .replace(/^./gm, name + ": $&"));
} }
@@ -221,7 +221,7 @@ defineModule("base", {
"keys", "memoize", "octal", "properties", "require", "set", "update", "keys", "memoize", "octal", "properties", "require", "set", "update",
"values", "withCallerGlobal" "values", "withCallerGlobal"
], ],
use: ["services", "util"] use: ["config", "services", "util"]
}); });
function Runnable(self, func, args) { function Runnable(self, func, args) {

View File

@@ -6,16 +6,20 @@
// given in the LICENSE.txt file included with this file. // given in the LICENSE.txt file included with this file.
"use strict"; "use strict";
var ConfigBase = Class(ModuleBase, { try {
Components.utils.import("resource://dactyl/base.jsm");
defineModule("config", {
exports: ["ConfigBase", "Config", "config"],
require: ["highlight", "services", "storage", "util", "template"]
});
var ConfigBase = Class("ConfigBase", {
/** /**
* Called on dactyl startup to allow for any arbitrary application-specific * Called on dactyl startup to allow for any arbitrary application-specific
* initialization code. Must call superclass's init function. * initialization code. Must call superclass's init function.
*/ */
init: function () { init: function () {
this.name = services["dactyl:"].name;
this.idName = services["dactyl:"].idName;
this.appName = services["dactyl:"].appName;
this.host = services["dactyl:"].host;
highlight.styleableChrome = this.styleableChrome; highlight.styleableChrome = this.styleableChrome;
highlight.loadCSS(this.CSS); highlight.loadCSS(this.CSS);
@@ -31,22 +35,12 @@ var ConfigBase = Class(ModuleBase, {
} }
]]>); ]]>);
let img = Image();
img.src = this.logo || "chrome://" + this.name + "/content/logo.png";
img.onload = function () {
highlight.loadCSS(<>{"!Logo {"}
display: inline-block;
background: url({img.src});
width: {img.width}px;
height: {img.height}px;
{"}"}</>);
img = null;
};
if (util.haveGecko("2b")) if (util.haveGecko("2b"))
this.features.push("Gecko2"); this.features.push("Gecko2");
}, },
get addonID() this.name + "@dactyl.googlecode.com",
styleHelp: function () { styleHelp: function () {
if (!this.helpStyled) if (!this.helpStyled)
for (let k in keys(highlight.loaded)) for (let k in keys(highlight.loaded))
@@ -55,6 +49,28 @@ var ConfigBase = Class(ModuleBase, {
this.helpCSS = true; this.helpCSS = true;
}, },
Local: function Local(dactyl, modules, window)
let ({modes} = modules) ({
get browser() window.gBrowser,
get tabbrowser() window.gBrowser,
get browserModes() [modes.NORMAL],
/**
* @property {string} The ID of the application's main XUL window.
*/
mainWindowId: window.document.documentElement.id,
/**
* @property {number} The height (px) that is available to the output
* window.
*/
get outputHeight() this.browser.mPanelContainer.boxObject.height,
tabStrip: Class.memoize(function () window.document.getElementById("TabsToolbar") || this.tabbrowser.mTabContainer),
}),
/** /**
* @property {[["string", "string"]]} A sequence of names and descriptions * @property {[["string", "string"]]} A sequence of names and descriptions
* of the autocommands available in this application. Primarily used * of the autocommands available in this application. Primarily used
@@ -62,11 +78,6 @@ var ConfigBase = Class(ModuleBase, {
*/ */
autocommands: [], autocommands: [],
get browser() window.gBrowser,
get tabbrowser() window.gBrowser,
get browserModes() [modes.NORMAL],
commandContainer: "browser-bottombox", commandContainer: "browser-bottombox",
/** /**
@@ -118,11 +129,6 @@ var ConfigBase = Class(ModuleBase, {
*/ */
ignoreKeys: {}, // NOTE: be aware you can't put useful values in here, as "modes.NORMAL" etc. are not defined at this time ignoreKeys: {}, // NOTE: be aware you can't put useful values in here, as "modes.NORMAL" etc. are not defined at this time
/**
* @property {string} The ID of the application's main XUL window.
*/
mainWindowId: window.document.documentElement.id,
/** /**
* @property {[[]]} An array of application specific mode specifications. * @property {[[]]} An array of application specific mode specifications.
* The values of each mode are passed to modes.addMode during * The values of each mode are passed to modes.addMode during
@@ -136,12 +142,6 @@ var ConfigBase = Class(ModuleBase, {
*/ */
name: null, name: null,
/**
* @property {number} The height (px) that is available to the output
* window.
*/
get outputHeight() this.browser.mPanelContainer.boxObject.height,
/** /**
* @property {[string]} A list of extra scripts in the dactyl or * @property {[string]} A list of extra scripts in the dactyl or
* application namespaces which should be loaded before dactyl * application namespaces which should be loaded before dactyl
@@ -149,8 +149,6 @@ var ConfigBase = Class(ModuleBase, {
*/ */
scripts: [], scripts: [],
tabStrip: Class.memoize(function () window.document.getElementById("TabsToolbar") || this.tabbrowser.mTabContainer),
/** /**
* @property {string} The leaf name of any temp files created by * @property {string} The leaf name of any temp files created by
* {@link io.createTempFile}. * {@link io.createTempFile}.
@@ -455,4 +453,34 @@ var ConfigBase = Class(ModuleBase, {
]]></>) ]]></>)
}); });
services.subscriptLoader.loadSubScript("chrome://dactyl/content/config.js", this);
config.INIT = update(Object.create(config.INIT), config.INIT, {
init: function init(dactyl, modules, window) {
init.superapply(this, arguments);
// Hmm...
let config1 = Object.create(config);
let config2 = Object.create(config1);
update(config1, config.Local.superapply(config2, arguments));
update(config2, config.Local.apply(config2, arguments));
modules.config = config2;
modules.config.init();
let img = window.Image();
img.src = this.logo || "chrome://" + this.name + "/content/logo.png";
img.onload = function () {
highlight.loadCSS(<>{"!Logo {"}
display: inline-block;
background: url({img.src});
width: {img.width}px;
height: {img.height}px;
{"}"}</>);
img = null;
};
}
});
} catch(e){ if (isString(e)) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
// vim: set fdm=marker sw=4 ts=4 et: // vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -7,7 +7,7 @@
Components.utils.import("resource://dactyl/base.jsm"); Components.utils.import("resource://dactyl/base.jsm");
defineModule("overlay", { defineModule("overlay", {
exports: ["ModuleBase"], exports: ["ModuleBase"],
require: ["highlight", "sanitizer", "services", "template", "util"], require: ["config", "sanitizer", "services", "util"]
}); });
/** /**
@@ -26,7 +26,7 @@ var ModuleBase = Class("ModuleBase", {
var Overlay = Module("Overlay", { var Overlay = Module("Overlay", {
init: function () { init: function () {
util.overlayWindow("chrome://browser/content/browser.xul", function (window) ({ util.overlayWindow(config.overlayChrome, function (window) ({
init: function (document) { init: function (document) {
/** /**
* @constructor Module * @constructor Module
@@ -94,7 +94,7 @@ var Overlay = Module("Overlay", {
return res; return res;
})(); })();
const jsmodules = {}; const jsmodules = { NAME: "jsmodules" };
const modules = update(create(jsmodules), { const modules = update(create(jsmodules), {
jsmodules: jsmodules, jsmodules: jsmodules,
@@ -119,7 +119,7 @@ var Overlay = Module("Overlay", {
} }
} }
try { try {
Cu.import("resource://dactyl/" + script + ".jsm", jsmodules); require(jsmodules, script);
} }
catch (e) { catch (e) {
util.dump("Loading script " + script + ":"); util.dump("Loading script " + script + ":");
@@ -141,15 +141,17 @@ var Overlay = Module("Overlay", {
let prefix = [BASE]; let prefix = [BASE];
modules.load("util");
modules.load("services");
prefix.unshift("chrome://" + modules.services["dactyl:"].name + "/content/");
["base", ["base",
"config",
"util",
"services",
"overlay", "overlay",
"prefs", "prefs",
"storage", "storage"
"javascript", ].forEach(function (name) require(jsmodules, name));
prefix.unshift("chrome://" + config.name + "/content/");
["javascript",
"dactyl", "dactyl",
"modes", "modes",
"abbreviations", "abbreviations",
@@ -158,8 +160,6 @@ var Overlay = Module("Overlay", {
"commandline", "commandline",
"commands", "commands",
"completion", "completion",
"configbase",
"config",
"editor", "editor",
"events", "events",
"finder", "finder",
@@ -174,7 +174,7 @@ var Overlay = Module("Overlay", {
"template" "template"
].forEach(modules.load); ].forEach(modules.load);
modules.Config.prototype.scripts.forEach(modules.load); config.scripts.forEach(modules.load);
}, },
load: function (document) { load: function (document) {
var { modules, Module } = window.dactyl.modules; var { modules, Module } = window.dactyl.modules;

View File

@@ -96,7 +96,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
} }
}; };
return template.options(services["dactyl:"].host + " Preferences", prefs.call(this)); return template.options(config.host + " Preferences", prefs.call(this));
}, },
/** /**
@@ -332,7 +332,7 @@ var Prefs = Module("prefs", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
completion: function (dactyl, modules) { completion: function (dactyl, modules) {
modules.completion.preference = function preference(context) { modules.completion.preference = function preference(context) {
context.anchored = false; context.anchored = false;
context.title = [services["dactyl:"].host + " Preference", "Value"]; context.title = [config.host + " Preference", "Value"];
context.keys = { text: function (item) item, description: function (item) prefs.get(item) }; context.keys = { text: function (item) item, description: function (item) prefs.get(item) };
context.completions = prefs.getNames(); context.completions = prefs.getNames();
}; };

View File

@@ -158,7 +158,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
append: { append: {
SanitizeDialogPane: SanitizeDialogPane:
<groupbox orient="horizontal" xmlns={XUL}> <groupbox orient="horizontal" xmlns={XUL}>
<caption label={services["dactyl:"].appName + " (see :help privacy)"}/> <caption label={config.appName + " (see :help privacy)"}/>
<grid flex="1"> <grid flex="1">
<columns><column flex="1"/><column flex="1"/></columns> <columns><column flex="1"/><column flex="1"/></columns>
<rows>{ <rows>{
@@ -183,7 +183,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
{ {
template.map(ourItems(), function ([item, desc]) template.map(ourItems(), function ([item, desc])
<listitem xmlns={XUL} type="checkbox" <listitem xmlns={XUL} type="checkbox"
label={services["dactyl:"].appName + " " + desc} label={config.appName + " " + desc}
preference={branch + item} preference={branch + item}
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>) onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>)
} }

View File

@@ -9,7 +9,7 @@ try {
var global = this; var global = this;
Components.utils.import("resource://dactyl/base.jsm"); Components.utils.import("resource://dactyl/base.jsm");
defineModule("services", { defineModule("services", {
exports: ["AddonManager", "Services", "services"], exports: ["AddonManager", "services"],
use: ["util"] use: ["util"]
}); });

View File

@@ -62,7 +62,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
addon: Class.memoize(function () { addon: Class.memoize(function () {
let addon = services.fuel.storage.get("dactyl.bootstrap", {}).addon; let addon = services.fuel.storage.get("dactyl.bootstrap", {}).addon;
if (!addon) if (!addon)
addon = AddonManager.getAddonByID(services["dactyl:"].addonID); addon = AddonManager.getAddonByID(config.addonID);
return addon; return addon;
}), }),

View File

@@ -9,6 +9,7 @@ resource dactyl ../common/modules/
skin dactyl classic/1.0 ../common/skin/ skin dactyl classic/1.0 ../common/skin/
override chrome://dactyl/content/dactyl.dtd chrome://pentadactyl/content/dactyl.dtd override chrome://dactyl/content/dactyl.dtd chrome://pentadactyl/content/dactyl.dtd
override chrome://dactyl/content/config.js chrome://pentadactyl/content/config.js
component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js
contract @mozilla.org/commandlinehandler/general-startup;1?type=pentadactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} contract @mozilla.org/commandlinehandler/general-startup;1?type=pentadactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}

View File

@@ -7,6 +7,15 @@
"use strict"; "use strict";
const Config = Module("config", ConfigBase, { const Config = Module("config", ConfigBase, {
name: "pentadactyl",
appName: "Pentadactyl",
idName: "PENTADACTYL",
fileExt: "penta",
host: "Firefox",
hostbin: "firefox",
Local: function Local(dactyl, modules, window)
let ({ config } = modules) ({
init: function init() { init: function init() {
init.superapply(this, arguments); init.superapply(this, arguments);
@@ -53,7 +62,94 @@ const Config = Module("config", ConfigBase, {
}); });
}, },
get visualbellWindow() getBrowser().mPanelContainer, dialogs: {
about: ["About Firefox",
function () { window.openDialog("chrome://browser/content/aboutDialog.xul", "_blank", "chrome,dialog,modal,centerscreen"); }],
addbookmark: ["Add bookmark for the current page",
function () { window.PlacesCommandHook.bookmarkCurrentPage(true, window.PlacesUtils.bookmarksRootId); }],
addons: ["Manage Add-ons",
function () { window.BrowserOpenAddonsMgr(); }],
bookmarks: ["List your bookmarks",
function () { window.openDialog("chrome://browser/content/bookmarks/bookmarksPanel.xul", "Bookmarks", "dialog,centerscreen,width=600,height=600"); }],
checkupdates: ["Check for updates",
function () { window.checkForUpdates(); },
function () "checkForUpdates" in window],
cleardata: ["Clear private data",
function () { Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIBrowserGlue).sanitize(window || null); }],
cookies: ["List your cookies",
function () { window.toOpenWindowByType("Browser:Cookies", "chrome://browser/content/preferences/cookies.xul", "chrome,dialog=no,resizable"); }],
console: ["JavaScript console",
function () { window.toJavaScriptConsole(); }],
customizetoolbar: ["Customize the Toolbar",
function () { window.BrowserCustomizeToolbar(); }],
dominspector: ["DOM Inspector",
function () { window.inspectDOMDocument(window.content.document); },
function () "inspectDOMDocument" in window],
downloads: ["Manage Downloads",
function () { window.toOpenWindowByType("Download:Manager", "chrome://mozapps/content/downloads/downloads.xul", "chrome,dialog=no,resizable"); }],
history: ["List your history",
function () { window.openDialog("chrome://browser/content/history/history-panel.xul", "History", "dialog,centerscreen,width=600,height=600"); }],
import: ["Import Preferences, Bookmarks, History, etc. from other browsers",
function () { window.BrowserImport(); }],
openfile: ["Open the file selector dialog",
function () { window.BrowserOpenFileWindow(); }],
pageinfo: ["Show information about the current page",
function () { window.BrowserPageInfo(); }],
pagesource: ["View page source",
function () { window.BrowserViewSourceOfDocument(window.content.document); }],
passwords: ["Passwords dialog",
function () { window.openDialog("chrome://passwordmgr/content/passwordManager.xul"); }],
places: ["Places Organizer: Manage your bookmarks and history",
function () { window.PlacesCommandHook.showPlacesOrganizer(window.ORGANIZER_ROOT_BOOKMARKS); }],
preferences: ["Show Firefox preferences dialog",
function () { window.openPreferences(); }],
printpreview: ["Preview the page before printing",
function () { PrintUtils.printPreview(window.PrintPreviewListener || onEnterPrintPreview, window.onExitPrintPreview); }],
printsetup: ["Setup the page size and orientation before printing",
function () { PrintUtils.showPageSetup(); }],
print: ["Show print dialog",
function () { PrintUtils.print(); }],
saveframe: ["Save frame to disk",
function () { window.saveFrameDocument(); }],
savepage: ["Save page to disk",
function () { window.saveDocument(window.content.document); }],
searchengines: ["Manage installed search engines",
function () { window.openDialog("chrome://browser/content/search/engineManager.xul", "_blank", "chrome,dialog,modal,centerscreen"); }],
selectionsource: ["View selection source",
function () { buffer.viewSelectionSource(); }],
venkman: ["The JavaScript debugger",
function () { dactyl.assert("start_venkman" in window, "Venkman is not installed"); window.start_venkman() },
function () "start_venkman" in window]
},
get visualbellWindow() this.browser.mPanelContainer,
removeTab: function (tab) {
if (this.tabbrowser.mTabs.length > 1)
this.tabbrowser.removeTab(tab);
else {
if (buffer.URL != "about:blank" || window.getWebNavigation().sessionHistory.count > 0) {
dactyl.open("about:blank", dactyl.NEW_BACKGROUND_TAB);
this.tabbrowser.removeTab(tab);
}
else
dactyl.beep();
}
},
get tempFile() {
let prefix = this.name.toLowerCase();
try {
prefix += "-" + window.content.document.location.hostname;
}
catch (e) {}
return prefix + ".tmp";
}
}),
overlayChrome: ["chrome://browser/content/browser.xul"],
styleableChrome: ["chrome://browser/content/browser.xul"], styleableChrome: ["chrome://browser/content/browser.xul"],
autocommands: { autocommands: {
@@ -82,66 +178,6 @@ const Config = Module("config", ConfigBase, {
titlestring: "Pentadactyl" titlestring: "Pentadactyl"
}, },
dialogs: {
about: ["About Firefox",
function () { window.openDialog("chrome://browser/content/aboutDialog.xul", "_blank", "chrome,dialog,modal,centerscreen"); }],
addbookmark: ["Add bookmark for the current page",
function () { PlacesCommandHook.bookmarkCurrentPage(true, PlacesUtils.bookmarksRootId); }],
addons: ["Manage Add-ons",
function () { window.BrowserOpenAddonsMgr(); }],
bookmarks: ["List your bookmarks",
function () { window.openDialog("chrome://browser/content/bookmarks/bookmarksPanel.xul", "Bookmarks", "dialog,centerscreen,width=600,height=600"); }],
checkupdates: ["Check for updates",
function () { window.checkForUpdates(); },
function () "checkForUpdates" in window],
cleardata: ["Clear private data",
function () { Cc["@mozilla.org/browser/browserglue;1"].getService(Ci.nsIBrowserGlue).sanitize(window || null); }],
cookies: ["List your cookies",
function () { window.toOpenWindowByType("Browser:Cookies", "chrome://browser/content/preferences/cookies.xul", "chrome,dialog=no,resizable"); }],
console: ["JavaScript console",
function () { window.toJavaScriptConsole(); }],
customizetoolbar: ["Customize the Toolbar",
function () { window.BrowserCustomizeToolbar(); }],
dominspector: ["DOM Inspector",
function () { window.inspectDOMDocument(content.document); },
function () "inspectDOMDocument" in window],
downloads: ["Manage Downloads",
function () { window.toOpenWindowByType("Download:Manager", "chrome://mozapps/content/downloads/downloads.xul", "chrome,dialog=no,resizable"); }],
history: ["List your history",
function () { window.openDialog("chrome://browser/content/history/history-panel.xul", "History", "dialog,centerscreen,width=600,height=600"); }],
import: ["Import Preferences, Bookmarks, History, etc. from other browsers",
function () { window.BrowserImport(); }],
openfile: ["Open the file selector dialog",
function () { window.BrowserOpenFileWindow(); }],
pageinfo: ["Show information about the current page",
function () { window.BrowserPageInfo(); }],
pagesource: ["View page source",
function () { window.BrowserViewSourceOfDocument(content.document); }],
passwords: ["Passwords dialog",
function () { window.openDialog("chrome://passwordmgr/content/passwordManager.xul"); }],
places: ["Places Organizer: Manage your bookmarks and history",
function () { PlacesCommandHook.showPlacesOrganizer(ORGANIZER_ROOT_BOOKMARKS); }],
preferences: ["Show Firefox preferences dialog",
function () { window.openPreferences(); }],
printpreview: ["Preview the page before printing",
function () { PrintUtils.printPreview(window.PrintPreviewListener || onEnterPrintPreview, window.onExitPrintPreview); }],
printsetup: ["Setup the page size and orientation before printing",
function () { PrintUtils.showPageSetup(); }],
print: ["Show print dialog",
function () { PrintUtils.print(); }],
saveframe: ["Save frame to disk",
function () { window.saveFrameDocument(); }],
savepage: ["Save page to disk",
function () { window.saveDocument(window.content.document); }],
searchengines: ["Manage installed search engines",
function () { window.openDialog("chrome://browser/content/search/engineManager.xul", "_blank", "chrome,dialog,modal,centerscreen"); }],
selectionsource: ["View selection source",
function () { buffer.viewSelectionSource(); }],
venkman: ["The JavaScript debugger",
function () { dactyl.assert("start_venkman" in window, "Venkman is not installed"); start_venkman() },
function () "start_venkman" in window]
},
features: [ features: [
"bookmarks", "hints", "history", "marks", "quickmarks", "sanitizer", "bookmarks", "hints", "history", "marks", "quickmarks", "sanitizer",
"session", "tabs", "tabs_undo", "windows" "session", "tabs", "tabs_undo", "windows"
@@ -155,21 +191,6 @@ const Config = Module("config", ConfigBase, {
hasTabbrowser: true, hasTabbrowser: true,
ignoreKeys: {},
removeTab: function (tab) {
if (config.tabbrowser.mTabs.length > 1)
config.tabbrowser.removeTab(tab);
else {
if (buffer.URL != "about:blank" || window.getWebNavigation().sessionHistory.count > 0) {
dactyl.open("about:blank", dactyl.NEW_BACKGROUND_TAB);
config.tabbrowser.removeTab(tab);
}
else
dactyl.beep();
}
},
scripts: [ scripts: [
"browser", "browser",
"bookmarkcache", "bookmarkcache",
@@ -179,19 +200,12 @@ const Config = Module("config", ConfigBase, {
"sanitizer", "sanitizer",
"tabs" "tabs"
], ],
get tempFile() {
let prefix = this.name.toLowerCase();
try {
prefix += "-" + window.content.document.location.hostname;
}
catch (e) {}
return prefix + ".tmp";
}
}, { }, {
}, { }, {
commands: function () { commands: function (dactyl, modules, window) {
const { commands, completion } = modules;
const { document } = window;
commands.add(["winon[ly]"], commands.add(["winon[ly]"],
"Close all other windows", "Close all other windows",
function () { function () {
@@ -284,7 +298,10 @@ const Config = Module("config", ConfigBase, {
privateData: true privateData: true
}); });
}, },
completion: function () { completion: function (dactyl, modules, window) {
const { CompletionContext, completion } = modules;
const { document } = window;
var searchRunning = false; // only until Firefox fixes https://bugzilla.mozilla.org/show_bug.cgi?id=510589 var searchRunning = false; // only until Firefox fixes https://bugzilla.mozilla.org/show_bug.cgi?id=510589
completion.location = function location(context) { completion.location = function location(context) {
if (!services.autoCompleteSearch) if (!services.autoCompleteSearch)
@@ -337,8 +354,9 @@ const Config = Module("config", ConfigBase, {
"Firefox location bar entries (bookmarks and history sorted in an intelligent way)", "Firefox location bar entries (bookmarks and history sorted in an intelligent way)",
completion.location); completion.location);
}, },
modes: function () { modes: function (dactyl, modules, window) {
this.ignoreKeys = { const { config, modes } = modules;
config.ignoreKeys = {
"<Return>": modes.NORMAL | modes.INSERT, "<Return>": modes.NORMAL | modes.INSERT,
"<Space>": modes.NORMAL | modes.INSERT, "<Space>": modes.NORMAL | modes.INSERT,
"<Up>": modes.NORMAL | modes.INSERT, "<Up>": modes.NORMAL | modes.INSERT,
@@ -346,14 +364,14 @@ const Config = Module("config", ConfigBase, {
}; };
config.modes.forEach(function (mode) { modes.addMode.apply(this, mode); }); config.modes.forEach(function (mode) { modes.addMode.apply(this, mode); });
}, },
options: function () { options: function (dactyl, modules, window) {
options.add(["online"], modules.options.add(["online"],
"Set the 'work offline' option", "Set the 'work offline' option",
"boolean", true, "boolean", true,
{ {
setter: function (value) { setter: function (value) {
if (services.io.offline == value) if (services.io.offline == value)
BrowserOffline.toggleOfflineStatus(); window.BrowserOffline.toggleOfflineStatus();
return value; return value;
}, },
getter: function () !services.io.offline getter: function () !services.io.offline

View File

@@ -1,6 +0,0 @@
pref("extensions.dactyl.name", "pentadactyl");
pref("extensions.dactyl.appName", "Pentadactyl");
pref("extensions.dactyl.idName", "PENTADACTYL");
pref("extensions.dactyl.fileExt", "penta");
pref("extensions.dactyl.host", "Firefox");
pref("extensions.dactyl.hostbin", "firefox");