mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 01:27:59 +01:00
Move config module to config.jsm.
--HG-- rename : common/content/configbase.js => common/modules/config.jsm
This commit is contained in:
12
common/bootstrap.js
vendored
12
common/bootstrap.js
vendored
@@ -99,7 +99,6 @@ FactoryProxy.prototype = {
|
||||
return this.module;
|
||||
},
|
||||
createInstance: function (iids) {
|
||||
dump("dactyl: bootstrap: createInstance: " + this.classID + " " + this.contractID + " " + iids + "\n");
|
||||
return let (factory = this.module.NSGetFactory(this.classID))
|
||||
factory.createInstance.apply(factory, arguments)
|
||||
}
|
||||
@@ -155,18 +154,7 @@ function init() {
|
||||
for each (let component in components)
|
||||
component.register();
|
||||
|
||||
require(global, "prefs");
|
||||
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");
|
||||
|
||||
|
||||
@@ -101,14 +101,7 @@ function Dactyl() {
|
||||
this.pages = {};
|
||||
|
||||
Cu.import("resource://dactyl/base.jsm");
|
||||
require(global, "prefs");
|
||||
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 = {
|
||||
contractID: "@mozilla.org/network/protocol;1?name=dactyl",
|
||||
|
||||
@@ -332,9 +332,9 @@ var Tabs = Module("tabs", {
|
||||
}
|
||||
|
||||
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
|
||||
tabs.slice(index, index + count).forEach(config.removeTab);
|
||||
tabs.slice(index, index + count).forEach(config.closure.removeTab);
|
||||
return res;
|
||||
},
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ defineModule.dump = function dump_() {
|
||||
msg = util.objectToString(msg);
|
||||
return msg;
|
||||
}).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")
|
||||
.replace(/^./gm, name + ": $&"));
|
||||
}
|
||||
@@ -221,7 +221,7 @@ defineModule("base", {
|
||||
"keys", "memoize", "octal", "properties", "require", "set", "update",
|
||||
"values", "withCallerGlobal"
|
||||
],
|
||||
use: ["services", "util"]
|
||||
use: ["config", "services", "util"]
|
||||
});
|
||||
|
||||
function Runnable(self, func, args) {
|
||||
|
||||
@@ -6,16 +6,20 @@
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
"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
|
||||
* initialization code. Must call superclass's 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.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"))
|
||||
this.features.push("Gecko2");
|
||||
},
|
||||
|
||||
get addonID() this.name + "@dactyl.googlecode.com",
|
||||
|
||||
styleHelp: function () {
|
||||
if (!this.helpStyled)
|
||||
for (let k in keys(highlight.loaded))
|
||||
@@ -55,6 +49,28 @@ var ConfigBase = Class(ModuleBase, {
|
||||
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
|
||||
* of the autocommands available in this application. Primarily used
|
||||
@@ -62,11 +78,6 @@ var ConfigBase = Class(ModuleBase, {
|
||||
*/
|
||||
autocommands: [],
|
||||
|
||||
get browser() window.gBrowser,
|
||||
get tabbrowser() window.gBrowser,
|
||||
|
||||
get browserModes() [modes.NORMAL],
|
||||
|
||||
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
|
||||
|
||||
/**
|
||||
* @property {string} The ID of the application's main XUL window.
|
||||
*/
|
||||
mainWindowId: window.document.documentElement.id,
|
||||
|
||||
/**
|
||||
* @property {[[]]} An array of application specific mode specifications.
|
||||
* The values of each mode are passed to modes.addMode during
|
||||
@@ -136,12 +142,6 @@ var ConfigBase = Class(ModuleBase, {
|
||||
*/
|
||||
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
|
||||
* application namespaces which should be loaded before dactyl
|
||||
@@ -149,8 +149,6 @@ var ConfigBase = Class(ModuleBase, {
|
||||
*/
|
||||
scripts: [],
|
||||
|
||||
tabStrip: Class.memoize(function () window.document.getElementById("TabsToolbar") || this.tabbrowser.mTabContainer),
|
||||
|
||||
/**
|
||||
* @property {string} The leaf name of any temp files created by
|
||||
* {@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:
|
||||
@@ -7,7 +7,7 @@
|
||||
Components.utils.import("resource://dactyl/base.jsm");
|
||||
defineModule("overlay", {
|
||||
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", {
|
||||
init: function () {
|
||||
util.overlayWindow("chrome://browser/content/browser.xul", function (window) ({
|
||||
util.overlayWindow(config.overlayChrome, function (window) ({
|
||||
init: function (document) {
|
||||
/**
|
||||
* @constructor Module
|
||||
@@ -94,7 +94,7 @@ var Overlay = Module("Overlay", {
|
||||
return res;
|
||||
})();
|
||||
|
||||
const jsmodules = {};
|
||||
const jsmodules = { NAME: "jsmodules" };
|
||||
const modules = update(create(jsmodules), {
|
||||
|
||||
jsmodules: jsmodules,
|
||||
@@ -119,7 +119,7 @@ var Overlay = Module("Overlay", {
|
||||
}
|
||||
}
|
||||
try {
|
||||
Cu.import("resource://dactyl/" + script + ".jsm", jsmodules);
|
||||
require(jsmodules, script);
|
||||
}
|
||||
catch (e) {
|
||||
util.dump("Loading script " + script + ":");
|
||||
@@ -141,15 +141,17 @@ var Overlay = Module("Overlay", {
|
||||
|
||||
let prefix = [BASE];
|
||||
|
||||
modules.load("util");
|
||||
modules.load("services");
|
||||
prefix.unshift("chrome://" + modules.services["dactyl:"].name + "/content/");
|
||||
|
||||
["base",
|
||||
"config",
|
||||
"util",
|
||||
"services",
|
||||
"overlay",
|
||||
"prefs",
|
||||
"storage",
|
||||
"javascript",
|
||||
"storage"
|
||||
].forEach(function (name) require(jsmodules, name));
|
||||
prefix.unshift("chrome://" + config.name + "/content/");
|
||||
|
||||
["javascript",
|
||||
"dactyl",
|
||||
"modes",
|
||||
"abbreviations",
|
||||
@@ -158,8 +160,6 @@ var Overlay = Module("Overlay", {
|
||||
"commandline",
|
||||
"commands",
|
||||
"completion",
|
||||
"configbase",
|
||||
"config",
|
||||
"editor",
|
||||
"events",
|
||||
"finder",
|
||||
@@ -174,7 +174,7 @@ var Overlay = Module("Overlay", {
|
||||
"template"
|
||||
].forEach(modules.load);
|
||||
|
||||
modules.Config.prototype.scripts.forEach(modules.load);
|
||||
config.scripts.forEach(modules.load);
|
||||
},
|
||||
load: function (document) {
|
||||
var { modules, Module } = window.dactyl.modules;
|
||||
|
||||
@@ -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) {
|
||||
modules.completion.preference = function preference(context) {
|
||||
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.completions = prefs.getNames();
|
||||
};
|
||||
|
||||
@@ -158,7 +158,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
append: {
|
||||
SanitizeDialogPane:
|
||||
<groupbox orient="horizontal" xmlns={XUL}>
|
||||
<caption label={services["dactyl:"].appName + " (see :help privacy)"}/>
|
||||
<caption label={config.appName + " (see :help privacy)"}/>
|
||||
<grid flex="1">
|
||||
<columns><column flex="1"/><column flex="1"/></columns>
|
||||
<rows>{
|
||||
@@ -183,7 +183,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
{
|
||||
template.map(ourItems(), function ([item, desc])
|
||||
<listitem xmlns={XUL} type="checkbox"
|
||||
label={services["dactyl:"].appName + " " + desc}
|
||||
label={config.appName + " " + desc}
|
||||
preference={branch + item}
|
||||
onsyncfrompreference="return gSanitizePromptDialog.onReadGeneric();"/>)
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ try {
|
||||
var global = this;
|
||||
Components.utils.import("resource://dactyl/base.jsm");
|
||||
defineModule("services", {
|
||||
exports: ["AddonManager", "Services", "services"],
|
||||
exports: ["AddonManager", "services"],
|
||||
use: ["util"]
|
||||
});
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
addon: Class.memoize(function () {
|
||||
let addon = services.fuel.storage.get("dactyl.bootstrap", {}).addon;
|
||||
if (!addon)
|
||||
addon = AddonManager.getAddonByID(services["dactyl:"].addonID);
|
||||
addon = AddonManager.getAddonByID(config.addonID);
|
||||
return addon;
|
||||
}),
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ resource dactyl ../common/modules/
|
||||
skin dactyl classic/1.0 ../common/skin/
|
||||
|
||||
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
|
||||
contract @mozilla.org/commandlinehandler/general-startup;1?type=pentadactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}
|
||||
|
||||
@@ -7,6 +7,15 @@
|
||||
"use strict";
|
||||
|
||||
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.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"],
|
||||
|
||||
autocommands: {
|
||||
@@ -82,66 +178,6 @@ const Config = Module("config", ConfigBase, {
|
||||
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: [
|
||||
"bookmarks", "hints", "history", "marks", "quickmarks", "sanitizer",
|
||||
"session", "tabs", "tabs_undo", "windows"
|
||||
@@ -155,21 +191,6 @@ const Config = Module("config", ConfigBase, {
|
||||
|
||||
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: [
|
||||
"browser",
|
||||
"bookmarkcache",
|
||||
@@ -179,19 +200,12 @@ const Config = Module("config", ConfigBase, {
|
||||
"sanitizer",
|
||||
"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]"],
|
||||
"Close all other windows",
|
||||
function () {
|
||||
@@ -284,7 +298,10 @@ const Config = Module("config", ConfigBase, {
|
||||
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
|
||||
completion.location = function location(context) {
|
||||
if (!services.autoCompleteSearch)
|
||||
@@ -337,8 +354,9 @@ const Config = Module("config", ConfigBase, {
|
||||
"Firefox location bar entries (bookmarks and history sorted in an intelligent way)",
|
||||
completion.location);
|
||||
},
|
||||
modes: function () {
|
||||
this.ignoreKeys = {
|
||||
modes: function (dactyl, modules, window) {
|
||||
const { config, modes } = modules;
|
||||
config.ignoreKeys = {
|
||||
"<Return>": modes.NORMAL | modes.INSERT,
|
||||
"<Space>": 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); });
|
||||
},
|
||||
options: function () {
|
||||
options.add(["online"],
|
||||
options: function (dactyl, modules, window) {
|
||||
modules.options.add(["online"],
|
||||
"Set the 'work offline' option",
|
||||
"boolean", true,
|
||||
{
|
||||
setter: function (value) {
|
||||
if (services.io.offline == value)
|
||||
BrowserOffline.toggleOfflineStatus();
|
||||
window.BrowserOffline.toggleOfflineStatus();
|
||||
return value;
|
||||
},
|
||||
getter: function () !services.io.offline
|
||||
|
||||
@@ -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");
|
||||
Reference in New Issue
Block a user