mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 08:27:59 +01:00
More bootstrap work. Now loadable without restart.
--HG-- branch : bootstrapped rename : common/content/modules.js => common/modules/overlay.jsm
This commit is contained in:
6
common/bootstrap.js
vendored
6
common/bootstrap.js
vendored
@@ -143,15 +143,17 @@ function init() {
|
||||
});
|
||||
|
||||
if (manifestURI instanceof Ci.nsIFileURL)
|
||||
manager.autoRegister(file.QueryInterface(Ci.nsIFileURL).file);
|
||||
manager.autoRegister(manifestURI.QueryInterface(Ci.nsIFileURL).file);
|
||||
else {
|
||||
var file = basePath.parent;
|
||||
file.append(addon.id + ".manifest");
|
||||
|
||||
writeFile(file, result.map(function (line) line.join(" ")).join("\n"));
|
||||
manager.autoRegister(file);
|
||||
//file.remove(false);
|
||||
file.remove(false);
|
||||
}
|
||||
|
||||
require(global, "overlay");
|
||||
}
|
||||
|
||||
function reasonToString(reason) {
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
// Copyright (c) 2008-2010 Kris Maglione <maglione.k at Gmail>
|
||||
//
|
||||
// This work is licensed for reuse under an MIT license. Details are
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
"use strict";
|
||||
|
||||
(function () {
|
||||
function newContext(proto) {
|
||||
let sandbox = Components.utils.Sandbox(window, { sandboxPrototype: proto || modules, wantXrays: false });
|
||||
// Hack:
|
||||
sandbox.Object = jsmodules.Object;
|
||||
sandbox.Math = jsmodules.Math;
|
||||
sandbox.__proto__ = proto || modules;
|
||||
return sandbox;
|
||||
}
|
||||
const jsmodules = {};
|
||||
const modules = {
|
||||
__proto__: jsmodules,
|
||||
get content() this.config.browser.contentWindow || window.content,
|
||||
jsmodules: jsmodules,
|
||||
newContext: newContext,
|
||||
window: window
|
||||
};
|
||||
modules.modules = modules;
|
||||
|
||||
const BASE = "chrome://dactyl/content/";
|
||||
const loader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Components.interfaces.mozIJSSubScriptLoader);
|
||||
|
||||
modules.load = function load(script) {
|
||||
for (let [i, base] in Iterator(prefix)) {
|
||||
try {
|
||||
loader.loadSubScript(base + script + ".js", modules, "UTF-8");
|
||||
return;
|
||||
}
|
||||
catch (e) {
|
||||
if (typeof e !== "string") {
|
||||
dump("dactyl: Trying: " + (base + script + ".js") + ": " + e + "\n" + e.stack + "\n");
|
||||
Components.utils.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
Components.utils.import("resource://dactyl/" + script + ".jsm", jsmodules);
|
||||
}
|
||||
catch (e) {
|
||||
dump("dactyl: Loading script " + script + ": " + e.result + " " + e + "\n");
|
||||
dump(Error().stack + "\n");
|
||||
Components.utils.reportError(e);
|
||||
}
|
||||
};
|
||||
|
||||
let prefix = [BASE];
|
||||
|
||||
modules.load("util");
|
||||
modules.load("services");
|
||||
prefix.unshift("chrome://" + modules.services["dactyl:"].name + "/content/");
|
||||
|
||||
["base",
|
||||
"modules",
|
||||
"prefs",
|
||||
"storage",
|
||||
"javascript",
|
||||
"dactyl",
|
||||
"modes",
|
||||
"abbreviations",
|
||||
"autocommands",
|
||||
"buffer",
|
||||
"commandline",
|
||||
"commands",
|
||||
"completion",
|
||||
"configbase",
|
||||
"config",
|
||||
"editor",
|
||||
"events",
|
||||
"finder",
|
||||
"highlight",
|
||||
"hints",
|
||||
"io",
|
||||
"mappings",
|
||||
"marks",
|
||||
"options",
|
||||
"statusline",
|
||||
"styles",
|
||||
"template"
|
||||
].forEach(modules.load);
|
||||
|
||||
modules.Config.prototype.scripts.forEach(modules.load);
|
||||
})();
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
|
||||
Copyright (c) 2007-2009 by Kris Maglione <maglione.k at Gmail>
|
||||
|
||||
This work is licensed for reuse under an MIT license. Details are
|
||||
given in the LICENSE.txt file included with this file.
|
||||
-->
|
||||
|
||||
<!DOCTYPE overlay SYSTEM "dactyl.dtd" [
|
||||
<!ENTITY dactyl.content "chrome://dactyl/content/">
|
||||
]>
|
||||
|
||||
<overlay id="dactyl"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<script type="application/x-javascript;version=1.8" src="&dactyl.content;dactyl-overlay.js"/>
|
||||
</overlay>
|
||||
|
||||
<!-- vim: set fdm=marker sw=4 ts=4 et: -->
|
||||
@@ -1,157 +0,0 @@
|
||||
// Copyright (c) 2009-2010 by Kris Maglione <maglione.k@gmail.com>
|
||||
//
|
||||
// This work is licensed for reuse under an MIT license. Details are
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @class ModuleBase
|
||||
* The base class for all modules.
|
||||
*/
|
||||
const ModuleBase = Class("ModuleBase", {
|
||||
/**
|
||||
* @property {[string]} A list of module prerequisites which
|
||||
* must be initialized before this module is loaded.
|
||||
*/
|
||||
requires: [],
|
||||
|
||||
toString: function () "[module " + this.constructor.className + "]"
|
||||
});
|
||||
|
||||
/**
|
||||
* @constructor Module
|
||||
*
|
||||
* Constructs a new ModuleBase class and makes arrangements for its
|
||||
* initialization. Arguments marked as optional must be either
|
||||
* entirely elided, or they must have the exact type specified.
|
||||
* Loading semantics are as follows:
|
||||
*
|
||||
* - A module is guaranteed not to be initialized before any of its
|
||||
* prerequisites as listed in its {@see ModuleBase#requires} member.
|
||||
* - A module is considered initialized once it's been instantiated,
|
||||
* its {@see Class#init} method has been called, and its
|
||||
* instance has been installed into the top-level {@see modules}
|
||||
* object.
|
||||
* - Once the module has been initialized, its module-dependent
|
||||
* initialization functions will be called as described hereafter.
|
||||
* @param {string} name The module's name as it will appear in the
|
||||
* top-level {@see modules} object.
|
||||
* @param {ModuleBase} base The base class for this module.
|
||||
* @optional
|
||||
* @param {Object} prototype The prototype for instances of this
|
||||
* object. The object itself is copied and not used as a prototype
|
||||
* directly.
|
||||
* @param {Object} classProperties The class properties for the new
|
||||
* module constructor.
|
||||
* @optional
|
||||
* @param {Object} moduleInit The module initialization functions
|
||||
* for the new module. Each function is called as soon as the named module
|
||||
* has been initialized, but after the module itself. The constructors are
|
||||
* guaranteed to be called in the same order that the dependent modules
|
||||
* were initialized.
|
||||
* @optional
|
||||
*
|
||||
* @returns {function} The constructor for the resulting module.
|
||||
*/
|
||||
function Module(name) {
|
||||
let args = Array.slice(arguments);
|
||||
|
||||
var base = ModuleBase;
|
||||
if (callable(args[1]))
|
||||
base = args.splice(1, 1)[0];
|
||||
let [, prototype, classProperties, moduleInit] = args;
|
||||
const module = Class(name, base, prototype, classProperties);
|
||||
|
||||
module.INIT = moduleInit || {};
|
||||
module.prototype.INIT = module.INIT;
|
||||
module.requires = prototype.requires || [];
|
||||
Module.list.push(module);
|
||||
Module.constructors[name] = module;
|
||||
return module;
|
||||
}
|
||||
Module.list = [];
|
||||
Module.constructors = {};
|
||||
|
||||
window.addEventListener("load", function onLoad() {
|
||||
window.removeEventListener("load", onLoad, false);
|
||||
|
||||
Module.list.forEach(function (module) {
|
||||
modules.__defineGetter__(module.className, function () {
|
||||
delete modules[module.className];
|
||||
return load(module.className, null, Components.stack.caller);
|
||||
});
|
||||
});
|
||||
|
||||
const start = Date.now();
|
||||
const deferredInit = { load: [] };
|
||||
const seen = set();
|
||||
const loaded = set(["init"]);
|
||||
modules.loaded = loaded;
|
||||
|
||||
function init(module) {
|
||||
function init(func, mod)
|
||||
function () defineModule.time(module.className || module.constructor.className, mod,
|
||||
func, module,
|
||||
dactyl, modules, window);
|
||||
|
||||
set.add(loaded, module.constructor.className);
|
||||
for (let [mod, func] in Iterator(module.INIT)) {
|
||||
if (mod in loaded)
|
||||
init(func, mod)();
|
||||
else {
|
||||
deferredInit[mod] = deferredInit[mod] || [];
|
||||
deferredInit[mod].push(init(func, mod));
|
||||
}
|
||||
}
|
||||
}
|
||||
defineModule.modules.map(init);
|
||||
|
||||
function load(module, prereq, frame) {
|
||||
if (isString(module)) {
|
||||
if (!Module.constructors.hasOwnProperty(module))
|
||||
modules.load(module);
|
||||
module = Module.constructors[module];
|
||||
}
|
||||
|
||||
try {
|
||||
if (module.className in loaded)
|
||||
return;
|
||||
if (module.className in seen)
|
||||
throw Error("Module dependency loop.");
|
||||
set.add(seen, module.className);
|
||||
|
||||
for (let dep in values(module.requires))
|
||||
load(Module.constructors[dep], module.className);
|
||||
|
||||
defineModule.loadLog.push("Load" + (isString(prereq) ? " " + prereq + " dependency: " : ": ") + module.className);
|
||||
if (frame && frame.filename)
|
||||
defineModule.loadLog.push(" from: " + frame.filename + ":" + frame.lineNumber);
|
||||
|
||||
delete modules[module.className];
|
||||
modules[module.className] = defineModule.time(module.className, "init", module);
|
||||
|
||||
init(modules[module.className]);
|
||||
for (let [, fn] in iter(deferredInit[module.className] || []))
|
||||
fn();
|
||||
}
|
||||
catch (e) {
|
||||
util.dump("Loading " + (module && module.className) + ": " + e + "\n" + (e.stack || ""));
|
||||
}
|
||||
return modules[module.className];
|
||||
}
|
||||
|
||||
Module.list.forEach(load);
|
||||
deferredInit["load"].forEach(call);
|
||||
modules.times = update({}, defineModule.times);
|
||||
|
||||
util.dump("Loaded in " + (Date.now() - start) + "ms");
|
||||
}, false);
|
||||
|
||||
window.addEventListener("unload", function onUnload() {
|
||||
window.removeEventListener("unload", onUnload, false);
|
||||
for (let [, mod] in iter(modules))
|
||||
if (mod instanceof ModuleBase && "destroy" in mod)
|
||||
mod.destroy();
|
||||
}, false);
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
@@ -152,8 +152,10 @@ defineModule.time = function time(major, minor, func, self) {
|
||||
|
||||
function endModule() {
|
||||
defineModule.loadLog.push("endModule " + currentModule.NAME);
|
||||
|
||||
for (let [, mod] in Iterator(use[currentModule.NAME] || []))
|
||||
require(mod, currentModule.NAME, "use");
|
||||
|
||||
loaded[currentModule.NAME] = 1;
|
||||
}
|
||||
|
||||
|
||||
259
common/modules/overlay.jsm
Normal file
259
common/modules/overlay.jsm
Normal file
@@ -0,0 +1,259 @@
|
||||
// Copyright (c) 2009-2010 by Kris Maglione <maglione.k@gmail.com>
|
||||
//
|
||||
// This work is licensed for reuse under an MIT license. Details are
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
"use strict";
|
||||
|
||||
Components.utils.import("resource://dactyl/base.jsm");
|
||||
defineModule("overlay", {
|
||||
exports: ["ModuleBase"],
|
||||
require: ["sanitizer", "services", "template", "util"],
|
||||
});
|
||||
|
||||
/**
|
||||
* @class ModuleBase
|
||||
* The base class for all modules.
|
||||
*/
|
||||
const ModuleBase = Class("ModuleBase", {
|
||||
/**
|
||||
* @property {[string]} A list of module prerequisites which
|
||||
* must be initialized before this module is loaded.
|
||||
*/
|
||||
requires: [],
|
||||
|
||||
toString: function () "[module " + this.constructor.className + "]"
|
||||
});
|
||||
|
||||
util.overlayWindow("chrome://browser/content/browser.xul", function (window) ({
|
||||
init: function (document) {
|
||||
/**
|
||||
* @constructor Module
|
||||
*
|
||||
* Constructs a new ModuleBase class and makes arrangements for its
|
||||
* initialization. Arguments marked as optional must be either
|
||||
* entirely elided, or they must have the exact type specified.
|
||||
* Loading semantics are as follows:
|
||||
*
|
||||
* - A module is guaranteed not to be initialized before any of its
|
||||
* prerequisites as listed in its {@see ModuleBase#requires} member.
|
||||
* - A module is considered initialized once it's been instantiated,
|
||||
* its {@see Class#init} method has been called, and its
|
||||
* instance has been installed into the top-level {@see modules}
|
||||
* object.
|
||||
* - Once the module has been initialized, its module-dependent
|
||||
* initialization functions will be called as described hereafter.
|
||||
* @param {string} name The module's name as it will appear in the
|
||||
* top-level {@see modules} object.
|
||||
* @param {ModuleBase} base The base class for this module.
|
||||
* @optional
|
||||
* @param {Object} prototype The prototype for instances of this
|
||||
* object. The object itself is copied and not used as a prototype
|
||||
* directly.
|
||||
* @param {Object} classProperties The class properties for the new
|
||||
* module constructor.
|
||||
* @optional
|
||||
* @param {Object} moduleInit The module initialization functions
|
||||
* for the new module. Each function is called as soon as the named module
|
||||
* has been initialized, but after the module itself. The constructors are
|
||||
* guaranteed to be called in the same order that the dependent modules
|
||||
* were initialized.
|
||||
* @optional
|
||||
*
|
||||
* @returns {function} The constructor for the resulting module.
|
||||
*/
|
||||
function Module(name) {
|
||||
let args = Array.slice(arguments);
|
||||
|
||||
var base = ModuleBase;
|
||||
if (callable(args[1]))
|
||||
base = args.splice(1, 1)[0];
|
||||
let [, prototype, classProperties, moduleInit] = args;
|
||||
const module = Class(name, base, prototype, classProperties);
|
||||
|
||||
module.INIT = moduleInit || {};
|
||||
module.prototype.INIT = module.INIT;
|
||||
module.requires = prototype.requires || [];
|
||||
Module.list.push(module);
|
||||
Module.constructors[name] = module;
|
||||
return module;
|
||||
}
|
||||
Module.list = [];
|
||||
Module.constructors = {};
|
||||
|
||||
const create = window.Object.create || function (proto) {
|
||||
let res = window.Object();
|
||||
object.__proto__ = proto;
|
||||
return object;
|
||||
}
|
||||
|
||||
const jsmodules = {};
|
||||
const modules = update(create(jsmodules), {
|
||||
|
||||
jsmodules: jsmodules,
|
||||
|
||||
get content() this.config.browser.contentWindow || window.content,
|
||||
|
||||
window: window,
|
||||
|
||||
Module: Module,
|
||||
|
||||
load: function load(script) {
|
||||
for (let [i, base] in Iterator(prefix)) {
|
||||
try {
|
||||
services.subscriptLoader.loadSubScript(base + script + ".js", modules, "UTF-8");
|
||||
return;
|
||||
}
|
||||
catch (e) {
|
||||
if (typeof e !== "string") {
|
||||
util.dump("Trying: " + (base + script + ".js") + ":");
|
||||
util.reportError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
Cu.import("resource://dactyl/" + script + ".jsm", jsmodules);
|
||||
}
|
||||
catch (e) {
|
||||
util.dump("Loading script " + script + ":");
|
||||
util.reportError(e);
|
||||
}
|
||||
},
|
||||
|
||||
newContext: function newContext(proto) {
|
||||
let sandbox = Components.utils.Sandbox(window, { sandboxPrototype: proto || modules, wantXrays: false });
|
||||
// Hack:
|
||||
sandbox.Object = jsmodules.Object;
|
||||
sandbox.Math = jsmodules.Math;
|
||||
sandbox.__proto__ = proto || modules;
|
||||
return sandbox;
|
||||
}
|
||||
});
|
||||
modules.modules = modules;
|
||||
window.dactyl = { modules: modules };
|
||||
|
||||
const BASE = "chrome://dactyl/content/";
|
||||
|
||||
let prefix = [BASE];
|
||||
|
||||
modules.load("util");
|
||||
modules.load("services");
|
||||
prefix.unshift("chrome://" + modules.services["dactyl:"].name + "/content/");
|
||||
|
||||
["base",
|
||||
"overlay",
|
||||
"prefs",
|
||||
"storage",
|
||||
"javascript",
|
||||
"dactyl",
|
||||
"modes",
|
||||
"abbreviations",
|
||||
"autocommands",
|
||||
"buffer",
|
||||
"commandline",
|
||||
"commands",
|
||||
"completion",
|
||||
"configbase",
|
||||
"config",
|
||||
"editor",
|
||||
"events",
|
||||
"finder",
|
||||
"highlight",
|
||||
"hints",
|
||||
"io",
|
||||
"mappings",
|
||||
"marks",
|
||||
"options",
|
||||
"statusline",
|
||||
"styles",
|
||||
"template"
|
||||
].forEach(modules.load);
|
||||
|
||||
modules.Config.prototype.scripts.forEach(modules.load);
|
||||
},
|
||||
load: function (document) {
|
||||
var { modules, Module } = window.dactyl.modules;
|
||||
delete window.dactyl;
|
||||
|
||||
Module.list.forEach(function (module) {
|
||||
modules.__defineGetter__(module.className, function () {
|
||||
delete modules[module.className];
|
||||
return load(module.className, null, Components.stack.caller);
|
||||
});
|
||||
});
|
||||
|
||||
const start = Date.now();
|
||||
const deferredInit = { load: [] };
|
||||
const seen = set();
|
||||
const loaded = set(["init"]);
|
||||
modules.loaded = loaded;
|
||||
|
||||
function init(module) {
|
||||
function init(func, mod)
|
||||
function () defineModule.time(module.className || module.constructor.className, mod,
|
||||
func, module,
|
||||
modules.dactyl, modules, window);
|
||||
|
||||
set.add(loaded, module.constructor.className);
|
||||
for (let [mod, func] in Iterator(module.INIT)) {
|
||||
if (mod in loaded)
|
||||
init(func, mod)();
|
||||
else {
|
||||
deferredInit[mod] = deferredInit[mod] || [];
|
||||
deferredInit[mod].push(init(func, mod));
|
||||
}
|
||||
}
|
||||
}
|
||||
defineModule.modules.map(init);
|
||||
|
||||
function load(module, prereq, frame) {
|
||||
if (isString(module)) {
|
||||
if (!Module.constructors.hasOwnProperty(module))
|
||||
modules.load(module);
|
||||
module = Module.constructors[module];
|
||||
}
|
||||
|
||||
try {
|
||||
if (module.className in loaded)
|
||||
return;
|
||||
if (module.className in seen)
|
||||
throw Error("Module dependency loop.");
|
||||
set.add(seen, module.className);
|
||||
|
||||
for (let dep in values(module.requires))
|
||||
load(Module.constructors[dep], module.className);
|
||||
|
||||
defineModule.loadLog.push("Load" + (isString(prereq) ? " " + prereq + " dependency: " : ": ") + module.className);
|
||||
if (frame && frame.filename)
|
||||
defineModule.loadLog.push(" from: " + frame.filename + ":" + frame.lineNumber);
|
||||
|
||||
delete modules[module.className];
|
||||
modules[module.className] = defineModule.time(module.className, "init", module);
|
||||
|
||||
init(modules[module.className]);
|
||||
for (let [, fn] in iter(deferredInit[module.className] || []))
|
||||
fn();
|
||||
}
|
||||
catch (e) {
|
||||
util.dump("Loading " + (module && module.className) + ":");
|
||||
util.reportError(e);
|
||||
}
|
||||
return modules[module.className];
|
||||
}
|
||||
|
||||
Module.list.forEach(load);
|
||||
deferredInit["load"].forEach(call);
|
||||
modules.times = update({}, defineModule.times);
|
||||
|
||||
util.dump("Loaded in " + (Date.now() - start) + "ms");
|
||||
|
||||
modules.events.addSessionListener(window, "unload", function onUnload() {
|
||||
window.removeEventListener("unload", onUnload, false);
|
||||
for (let [, mod] in iter(modules))
|
||||
if (mod instanceof ModuleBase && "destroy" in mod)
|
||||
mod.destroy();
|
||||
}, false);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
@@ -12,6 +12,8 @@
|
||||
// FIXME:
|
||||
// - finish 1.9.0 support if we're going to support sanitizing in Melodactyl
|
||||
|
||||
try {
|
||||
|
||||
Components.utils.import("resource://dactyl/base.jsm");
|
||||
defineModule("sanitizer", {
|
||||
exports: ["Range", "Sanitizer", "sanitizer"],
|
||||
@@ -641,6 +643,6 @@ const Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakR
|
||||
|
||||
endModule();
|
||||
|
||||
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
|
||||
} catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
|
||||
|
||||
@@ -908,6 +908,8 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
||||
if (!window.dactylOverlays)
|
||||
window.dactylOverlays = [];
|
||||
|
||||
util.dump("load overlays", window.document.documentURI);
|
||||
|
||||
for each (let obj in util.overlays[window.document.documentURI] || []) {
|
||||
if (window.dactylOverlays.indexOf(obj) >= 0)
|
||||
continue;
|
||||
@@ -979,6 +981,7 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
||||
},
|
||||
"toplevel-window-ready": function (window, data) {
|
||||
window.addEventListener("DOMContentLoaded", wrapCallback(function listener(event) {
|
||||
window.dactylDOMLoaded = false;
|
||||
if (event.originalTarget === window.document) {
|
||||
window.removeEventListener("DOMContentLoaded", listener.wrapper, true);
|
||||
window.document.dactylDOMLoaded = event;
|
||||
@@ -998,9 +1001,13 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
||||
this.overlays[url].push(fn);
|
||||
}, this);
|
||||
|
||||
for (let win in iter(services.windowMediator.getEnumerator(null)))
|
||||
if (win.document.dactylDOMLoaded)
|
||||
for (let win in iter(services.windowMediator.getEnumerator(null))) {
|
||||
util.dump("checkOverlay", win.document.dactylDOMLoaded, win.document.location.href);
|
||||
if (win.document.dactylDOMLoaded || win.dactylDOMLoaded !== false)
|
||||
this._loadOverlays(win);
|
||||
else
|
||||
this.observe(win, "toplevel-window-ready");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1152,8 +1159,11 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
|
||||
this.dump("");
|
||||
}
|
||||
catch (e) {
|
||||
this.dump(e);
|
||||
try { util.dump(e.stack) } catch (e) {}
|
||||
try {
|
||||
this.dump(String(error));
|
||||
this.dump(error.stack)
|
||||
}
|
||||
catch (e) { dump(e + "\n"); }
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -10,9 +10,6 @@ skin dactyl classic/1.0 ../common/skin/
|
||||
|
||||
override chrome://dactyl/content/dactyl.dtd chrome://pentadactyl/content/dactyl.dtd
|
||||
|
||||
overlay chrome://browser/content/browser.xul chrome://dactyl/content/dactyl.xul
|
||||
overlay chrome://browser/content/browser.xul chrome://pentadactyl/content/pentadactyl.xul
|
||||
|
||||
component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js
|
||||
contract @mozilla.org/commandlinehandler/general-startup;1?type=pentadactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}
|
||||
category command-line-handler m-pentadactyl @mozilla.org/commandlinehandler/general-startup;1?type=pentadactyl
|
||||
|
||||
@@ -7,6 +7,52 @@
|
||||
"use strict";
|
||||
|
||||
const Config = Module("config", ConfigBase, {
|
||||
init: function init() {
|
||||
init.superapply(this, arguments);
|
||||
|
||||
util.overlayWindow(window, {
|
||||
append: <e4x xmlns={XUL} xmlns:dactyl={NS}>
|
||||
<menupopup id="viewSidebarMenu">
|
||||
<menuitem observes="pentadactyl-viewAddonsSidebar" label="Add-ons" accesskey="A"/>
|
||||
<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">
|
||||
<broadcaster id="pentadactyl-viewAddonsSidebar"
|
||||
autoCheck="false"
|
||||
type="checkbox"
|
||||
group="sidebar"
|
||||
sidebarurl="chrome://mozapps/content/extensions/extensions.xul"
|
||||
sidebartitle="Add-ons"
|
||||
oncommand="toggleSidebar('pentadactyl-viewAddonsSidebar');"/>
|
||||
<broadcaster id="pentadactyl-viewConsoleSidebar"
|
||||
autoCheck="false"
|
||||
type="checkbox"
|
||||
group="sidebar"
|
||||
sidebarurl="chrome://global/content/console.xul"
|
||||
sidebartitle="Console"
|
||||
oncommand="toggleSidebar('pentadactyl-viewConsoleSidebar');"/>
|
||||
<broadcaster id="pentadactyl-viewDownloadsSidebar"
|
||||
autoCheck="false"
|
||||
type="checkbox"
|
||||
group="sidebar"
|
||||
sidebarurl="chrome://mozapps/content/downloads/downloads.xul"
|
||||
sidebartitle="Downloads"
|
||||
oncommand="toggleSidebar('pentadactyl-viewDownloadsSidebar');"/>
|
||||
<broadcaster id="pentadactyl-viewPreferencesSidebar"
|
||||
autoCheck="false"
|
||||
type="checkbox"
|
||||
group="sidebar"
|
||||
sidebarurl="about:config"
|
||||
sidebartitle="Preferences"
|
||||
oncommand="toggleSidebar('pentadactyl-viewPreferencesSidebar');"/>
|
||||
</broadcasterset>
|
||||
</e4x>.elements()
|
||||
});
|
||||
},
|
||||
|
||||
get visualbellWindow() getBrowser().mPanelContainer,
|
||||
styleableChrome: ["chrome://browser/content/browser.xul"],
|
||||
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- ***** BEGIN LICENSE BLOCK ***** {{{
|
||||
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
|
||||
|
||||
This work is licensed for reuse under an MIT license. Details are
|
||||
given in the LICENSE.txt file included with this file.
|
||||
}}} ***** END LICENSE BLOCK ***** -->
|
||||
|
||||
<!-- <?xml-stylesheet href="chrome://browser/skin/" type="text/css"?> -->
|
||||
|
||||
<overlay id="pentadactyl"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:nc="http://home.netscape.com/NC-rdf#"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<menupopup id="viewSidebarMenu">
|
||||
<menuitem observes="pentadactyl-viewAddonsSidebar" label="Add-ons" accesskey="A"/>
|
||||
<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">
|
||||
<broadcaster id="pentadactyl-viewAddonsSidebar"
|
||||
autoCheck="false"
|
||||
type="checkbox"
|
||||
group="sidebar"
|
||||
sidebarurl="chrome://mozapps/content/extensions/extensions.xul"
|
||||
sidebartitle="Add-ons"
|
||||
oncommand="toggleSidebar('pentadactyl-viewAddonsSidebar');"/>
|
||||
<broadcaster id="pentadactyl-viewConsoleSidebar"
|
||||
autoCheck="false"
|
||||
type="checkbox"
|
||||
group="sidebar"
|
||||
sidebarurl="chrome://global/content/console.xul"
|
||||
sidebartitle="Console"
|
||||
oncommand="toggleSidebar('pentadactyl-viewConsoleSidebar');"/>
|
||||
<broadcaster id="pentadactyl-viewDownloadsSidebar"
|
||||
autoCheck="false"
|
||||
type="checkbox"
|
||||
group="sidebar"
|
||||
sidebarurl="chrome://mozapps/content/downloads/downloads.xul"
|
||||
sidebartitle="Downloads"
|
||||
oncommand="toggleSidebar('pentadactyl-viewDownloadsSidebar');"/>
|
||||
<broadcaster id="pentadactyl-viewPreferencesSidebar"
|
||||
autoCheck="false"
|
||||
type="checkbox"
|
||||
group="sidebar"
|
||||
sidebarurl="about:config"
|
||||
sidebartitle="Preferences"
|
||||
oncommand="toggleSidebar('pentadactyl-viewPreferencesSidebar');"/>
|
||||
</broadcasterset>
|
||||
|
||||
</overlay>
|
||||
|
||||
<!-- vim: set fdm=marker sw=4 ts=4 et: -->
|
||||
Reference in New Issue
Block a user