mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 21:48:00 +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;
|
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");
|
||||||
|
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -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;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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:
|
||||||
@@ -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;
|
||||||
|
|||||||
@@ -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();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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();"/>)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
@@ -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}
|
||||||
|
|||||||
@@ -7,53 +7,149 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const Config = Module("config", ConfigBase, {
|
const Config = Module("config", ConfigBase, {
|
||||||
init: function init() {
|
name: "pentadactyl",
|
||||||
init.superapply(this, arguments);
|
appName: "Pentadactyl",
|
||||||
|
idName: "PENTADACTYL",
|
||||||
|
fileExt: "penta",
|
||||||
|
host: "Firefox",
|
||||||
|
hostbin: "firefox",
|
||||||
|
|
||||||
util.overlayWindow(window, {
|
Local: function Local(dactyl, modules, window)
|
||||||
append: <e4x xmlns={XUL} xmlns:dactyl={NS}>
|
let ({ config } = modules) ({
|
||||||
<menupopup id="viewSidebarMenu">
|
init: function init() {
|
||||||
<menuitem observes="pentadactyl-viewAddonsSidebar" label="Add-ons" accesskey="A"/>
|
init.superapply(this, arguments);
|
||||||
<menuitem observes="pentadactyl-viewConsoleSidebar" label="Console" accesskey="C"/>
|
|
||||||
<menuitem observes="pentadactyl-viewDownloadsSidebar" label="Downloads" accesskey="D"/>
|
|
||||||
<menuitem observes="pentadactyl-viewPreferencesSidebar" label="Preferences" accesskey="P"/>
|
|
||||||
</menupopup>
|
|
||||||
|
|
||||||
<broadcasterset id="mainBroadcasterSet">
|
util.overlayWindow(window, {
|
||||||
<broadcaster id="pentadactyl-viewAddonsSidebar"
|
append: <e4x xmlns={XUL} xmlns:dactyl={NS}>
|
||||||
autoCheck="false"
|
<menupopup id="viewSidebarMenu">
|
||||||
type="checkbox"
|
<menuitem observes="pentadactyl-viewAddonsSidebar" label="Add-ons" accesskey="A"/>
|
||||||
group="sidebar"
|
<menuitem observes="pentadactyl-viewConsoleSidebar" label="Console" accesskey="C"/>
|
||||||
sidebarurl="chrome://mozapps/content/extensions/extensions.xul"
|
<menuitem observes="pentadactyl-viewDownloadsSidebar" label="Downloads" accesskey="D"/>
|
||||||
sidebartitle="Add-ons"
|
<menuitem observes="pentadactyl-viewPreferencesSidebar" label="Preferences" accesskey="P"/>
|
||||||
oncommand="toggleSidebar(this.id);"/>
|
</menupopup>
|
||||||
<broadcaster id="pentadactyl-viewConsoleSidebar"
|
|
||||||
autoCheck="false"
|
<broadcasterset id="mainBroadcasterSet">
|
||||||
type="checkbox"
|
<broadcaster id="pentadactyl-viewAddonsSidebar"
|
||||||
group="sidebar"
|
autoCheck="false"
|
||||||
sidebarurl="chrome://global/content/console.xul"
|
type="checkbox"
|
||||||
sidebartitle="Console"
|
group="sidebar"
|
||||||
oncommand="toggleSidebar(this.id);"/>
|
sidebarurl="chrome://mozapps/content/extensions/extensions.xul"
|
||||||
<broadcaster id="pentadactyl-viewDownloadsSidebar"
|
sidebartitle="Add-ons"
|
||||||
autoCheck="false"
|
oncommand="toggleSidebar(this.id);"/>
|
||||||
type="checkbox"
|
<broadcaster id="pentadactyl-viewConsoleSidebar"
|
||||||
group="sidebar"
|
autoCheck="false"
|
||||||
sidebarurl="chrome://mozapps/content/downloads/downloads.xul"
|
type="checkbox"
|
||||||
sidebartitle="Downloads"
|
group="sidebar"
|
||||||
oncommand="toggleSidebar(this.id);"/>
|
sidebarurl="chrome://global/content/console.xul"
|
||||||
<broadcaster id="pentadactyl-viewPreferencesSidebar"
|
sidebartitle="Console"
|
||||||
autoCheck="false"
|
oncommand="toggleSidebar(this.id);"/>
|
||||||
type="checkbox"
|
<broadcaster id="pentadactyl-viewDownloadsSidebar"
|
||||||
group="sidebar"
|
autoCheck="false"
|
||||||
sidebarurl="about:config"
|
type="checkbox"
|
||||||
sidebartitle="Preferences"
|
group="sidebar"
|
||||||
oncommand="toggleSidebar(this.id);"/>
|
sidebarurl="chrome://mozapps/content/downloads/downloads.xul"
|
||||||
</broadcasterset>
|
sidebartitle="Downloads"
|
||||||
</e4x>.elements()
|
oncommand="toggleSidebar(this.id);"/>
|
||||||
});
|
<broadcaster id="pentadactyl-viewPreferencesSidebar"
|
||||||
},
|
autoCheck="false"
|
||||||
|
type="checkbox"
|
||||||
|
group="sidebar"
|
||||||
|
sidebarurl="about:config"
|
||||||
|
sidebartitle="Preferences"
|
||||||
|
oncommand="toggleSidebar(this.id);"/>
|
||||||
|
</broadcasterset>
|
||||||
|
</e4x>.elements()
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
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"],
|
||||||
|
|
||||||
get visualbellWindow() getBrowser().mPanelContainer,
|
|
||||||
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
|
||||||
|
|||||||
@@ -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