mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 04:07:59 +01:00
Make Teledactyl minimally functional, albeit with quite a lot of errors on the console.
This commit is contained in:
@@ -1523,7 +1523,7 @@ var Buffer = Module("buffer", {
|
||||
"Go to the root of the website",
|
||||
function () { buffer.climbUrlPath(-1); });
|
||||
|
||||
mappings.add(modes.COMMAND, [".", "<repeat-key>"],
|
||||
mappings.add([modes.COMMAND], [".", "<repeat-key>"],
|
||||
"Repeat the last key event",
|
||||
function (args) {
|
||||
if (mappings.repeat) {
|
||||
@@ -1533,54 +1533,54 @@ var Buffer = Module("buffer", {
|
||||
},
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["i", "<Insert>"],
|
||||
mappings.add([modes.COMMAND], ["i", "<Insert>"],
|
||||
"Start caret mode",
|
||||
function () { modes.push(modes.CARET); });
|
||||
|
||||
mappings.add(modes.COMMAND, ["<C-c>"],
|
||||
mappings.add([modes.COMMAND], ["<C-c>"],
|
||||
"Stop loading the current web page",
|
||||
function () { ex.stop(); });
|
||||
|
||||
// scrolling
|
||||
mappings.add(modes.COMMAND, ["j", "<Down>", "<C-e>", "<scroll-down-line>"],
|
||||
mappings.add([modes.COMMAND], ["j", "<Down>", "<C-e>", "<scroll-down-line>"],
|
||||
"Scroll document down",
|
||||
function (args) { buffer.scrollVertical("lines", Math.max(args.count, 1)); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["k", "<Up>", "<C-y>", "<scroll-up-line>"],
|
||||
mappings.add([modes.COMMAND], ["k", "<Up>", "<C-y>", "<scroll-up-line>"],
|
||||
"Scroll document up",
|
||||
function (args) { buffer.scrollVertical("lines", -Math.max(args.count, 1)); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, dactyl.has("mail") ? ["h", "<scroll-left-column>"] : ["h", "<Left>", "<scroll-left-column>"],
|
||||
mappings.add([modes.COMMAND], dactyl.has("mail") ? ["h", "<scroll-left-column>"] : ["h", "<Left>", "<scroll-left-column>"],
|
||||
"Scroll document to the left",
|
||||
function (args) { buffer.scrollHorizontal("columns", -Math.max(args.count, 1)); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, dactyl.has("mail") ? ["l", "<scroll-right-column>"] : ["l", "<Right>", "<scroll-right-column>"],
|
||||
mappings.add([modes.COMMAND], dactyl.has("mail") ? ["l", "<scroll-right-column>"] : ["l", "<Right>", "<scroll-right-column>"],
|
||||
"Scroll document to the right",
|
||||
function (args) { buffer.scrollHorizontal("columns", Math.max(args.count, 1)); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["0", "^", "<scroll-begin>"],
|
||||
mappings.add([modes.COMMAND], ["0", "^", "<scroll-begin>"],
|
||||
"Scroll to the absolute left of the document",
|
||||
function () { buffer.scrollToPercent(0, null); });
|
||||
|
||||
mappings.add(modes.COMMAND, ["$", "<scroll-end>"],
|
||||
mappings.add([modes.COMMAND], ["$", "<scroll-end>"],
|
||||
"Scroll to the absolute right of the document",
|
||||
function () { buffer.scrollToPercent(100, null); });
|
||||
|
||||
mappings.add(modes.COMMAND, ["gg", "<Home>"],
|
||||
mappings.add([modes.COMMAND], ["gg", "<Home>"],
|
||||
"Go to the top of the document",
|
||||
function (args) { buffer.scrollToPercent(null, args.count != null ? args.count : 0); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["G", "<End>"],
|
||||
mappings.add([modes.COMMAND], ["G", "<End>"],
|
||||
"Go to the end of the document",
|
||||
function (args) { buffer.scrollToPercent(null, args.count != null ? args.count : 100); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["%", "<scroll-percent>"],
|
||||
mappings.add([modes.COMMAND], ["%", "<scroll-percent>"],
|
||||
"Scroll to {count} percent of the document",
|
||||
function (args) {
|
||||
dactyl.assert(args.count > 0 && args.count <= 100);
|
||||
@@ -1588,59 +1588,59 @@ var Buffer = Module("buffer", {
|
||||
},
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["<C-d>", "<scroll-down>"],
|
||||
mappings.add([modes.COMMAND], ["<C-d>", "<scroll-down>"],
|
||||
"Scroll window downwards in the buffer",
|
||||
function (args) { buffer._scrollByScrollSize(args.count, true); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["<C-u>", "<scroll-up>"],
|
||||
mappings.add([modes.COMMAND], ["<C-u>", "<scroll-up>"],
|
||||
"Scroll window upwards in the buffer",
|
||||
function (args) { buffer._scrollByScrollSize(args.count, false); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["<C-b>", "<PageUp>", "<S-Space>", "<scroll-page-up>"],
|
||||
mappings.add([modes.COMMAND], ["<C-b>", "<PageUp>", "<S-Space>", "<scroll-page-up>"],
|
||||
"Scroll up a full page",
|
||||
function (args) { buffer.scrollVertical("pages", -Math.max(args.count, 1)); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["<C-f>", "<PageDown>", "<Space>", "<scroll-page-down>"],
|
||||
mappings.add([modes.COMMAND], ["<C-f>", "<PageDown>", "<Space>", "<scroll-page-down>"],
|
||||
"Scroll down a full page",
|
||||
function (args) { buffer.scrollVertical("pages", Math.max(args.count, 1)); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["]f", "<previous-frame>"],
|
||||
mappings.add([modes.COMMAND], ["]f", "<previous-frame>"],
|
||||
"Focus next frame",
|
||||
function (args) { buffer.shiftFrameFocus(Math.max(args.count, 1)); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["[f", "<next-frame>"],
|
||||
mappings.add([modes.COMMAND], ["[f", "<next-frame>"],
|
||||
"Focus previous frame",
|
||||
function (args) { buffer.shiftFrameFocus(-Math.max(args.count, 1)); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["]]", "<next-page>"],
|
||||
mappings.add([modes.COMMAND], ["]]", "<next-page>"],
|
||||
"Follow the link labeled 'next' or '>' if it exists",
|
||||
function (args) {
|
||||
buffer.findLink("next", options["nextpattern"], (args.count || 1) - 1, true);
|
||||
},
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["[[", "<previous-page>"],
|
||||
mappings.add([modes.COMMAND], ["[[", "<previous-page>"],
|
||||
"Follow the link labeled 'prev', 'previous' or '<' if it exists",
|
||||
function (args) {
|
||||
buffer.findLink("previous", options["previouspattern"], (args.count || 1) - 1, true);
|
||||
},
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["gf", "<view-source>"],
|
||||
mappings.add([modes.COMMAND], ["gf", "<view-source>"],
|
||||
"Toggle between rendered and source view",
|
||||
function () { buffer.viewSource(null, false); });
|
||||
|
||||
mappings.add(modes.COMMAND, ["gF", "<view-source-externally>"],
|
||||
mappings.add([modes.COMMAND], ["gF", "<view-source-externally>"],
|
||||
"View source with an external editor",
|
||||
function () { buffer.viewSource(null, true); });
|
||||
|
||||
mappings.add(modes.COMMAND, ["gi", "<focus-input>"],
|
||||
mappings.add([modes.COMMAND], ["gi", "<focus-input>"],
|
||||
"Focus last used input field",
|
||||
function (args) {
|
||||
let elem = buffer.lastInputField;
|
||||
@@ -1672,15 +1672,15 @@ var Buffer = Module("buffer", {
|
||||
},
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["gP"],
|
||||
"Open (put) a URL based on the current clipboard contents in a new buffer",
|
||||
mappings.add([modes.COMMAND], ["gP"],
|
||||
"Open (]put) a URL based on the current clipboard contents in a new buffer",
|
||||
function () {
|
||||
let url = dactyl.clipboardRead();
|
||||
dactyl.assert(url, "No clipboard data");
|
||||
dactyl.open(url, { from: "paste", where: dactyl.NEW_TAB, background: true });
|
||||
});
|
||||
|
||||
mappings.add(modes.COMMAND, ["p", "<MiddleMouse>", "<open-clipboard-url>"],
|
||||
mappings.add([modes.COMMAND], ["p", "<MiddleMouse>", "<open-clipboard-url>"],
|
||||
"Open (put) a URL based on the current clipboard contents in the current buffer",
|
||||
function () {
|
||||
let url = dactyl.clipboardRead();
|
||||
@@ -1688,7 +1688,7 @@ var Buffer = Module("buffer", {
|
||||
dactyl.open(url);
|
||||
});
|
||||
|
||||
mappings.add(modes.COMMAND, ["P", "<tab-open-clipboard-url>"],
|
||||
mappings.add([modes.COMMAND], ["P", "<tab-open-clipboard-url>"],
|
||||
"Open (put) a URL based on the current clipboard contents in a new buffer",
|
||||
function () {
|
||||
let url = dactyl.clipboardRead();
|
||||
@@ -1697,16 +1697,16 @@ var Buffer = Module("buffer", {
|
||||
});
|
||||
|
||||
// reloading
|
||||
mappings.add(modes.COMMAND, ["r", "<reload>"],
|
||||
mappings.add([modes.COMMAND], ["r", "<reload>"],
|
||||
"Reload the current web page",
|
||||
function () { tabs.reload(tabs.getTab(), false); });
|
||||
|
||||
mappings.add(modes.COMMAND, ["R", "<full-reload>"],
|
||||
mappings.add([modes.COMMAND], ["R", "<full-reload>"],
|
||||
"Reload while skipping the cache",
|
||||
function () { tabs.reload(tabs.getTab(), true); });
|
||||
|
||||
// yanking
|
||||
mappings.add(modes.COMMAND, ["Y", "<yank-word>"],
|
||||
mappings.add([modes.COMMAND], ["Y", "<yank-word>"],
|
||||
"Copy selected text or current word",
|
||||
function () {
|
||||
let sel = buffer.currentWord;
|
||||
@@ -1715,62 +1715,62 @@ var Buffer = Module("buffer", {
|
||||
});
|
||||
|
||||
// zooming
|
||||
mappings.add(modes.COMMAND, ["zi", "+", "<text-zoom-in>"],
|
||||
mappings.add([modes.COMMAND], ["zi", "+", "<text-zoom-in>"],
|
||||
"Enlarge text zoom of current web page",
|
||||
function (args) { buffer.zoomIn(Math.max(args.count, 1), false); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["zm", "<text-zoom-more>"],
|
||||
mappings.add([modes.COMMAND], ["zm", "<text-zoom-more>"],
|
||||
"Enlarge text zoom of current web page by a larger amount",
|
||||
function (args) { buffer.zoomIn(Math.max(args.count, 1) * 3, false); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["zo", "-", "<text-zoom-out>"],
|
||||
mappings.add([modes.COMMAND], ["zo", "-", "<text-zoom-out>"],
|
||||
"Reduce text zoom of current web page",
|
||||
function (args) { buffer.zoomOut(Math.max(args.count, 1), false); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["zr", "<text-zoom-reduce>"],
|
||||
mappings.add([modes.COMMAND], ["zr", "<text-zoom-reduce>"],
|
||||
"Reduce text zoom of current web page by a larger amount",
|
||||
function (args) { buffer.zoomOut(Math.max(args.count, 1) * 3, false); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["zz", "<text-zoom>"],
|
||||
mappings.add([modes.COMMAND], ["zz", "<text-zoom>"],
|
||||
"Set text zoom value of current web page",
|
||||
function (args) { buffer.setZoom(args.count > 1 ? args.count : 100, false); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["ZI", "zI", "<full-zoom-in>"],
|
||||
mappings.add([modes.COMMAND], ["ZI", "zI", "<full-zoom-in>"],
|
||||
"Enlarge full zoom of current web page",
|
||||
function (args) { buffer.zoomIn(Math.max(args.count, 1), true); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["ZM", "zM", "<full-zoom-more>"],
|
||||
mappings.add([modes.COMMAND], ["ZM", "zM", "<full-zoom-more>"],
|
||||
"Enlarge full zoom of current web page by a larger amount",
|
||||
function (args) { buffer.zoomIn(Math.max(args.count, 1) * 3, true); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["ZO", "zO", "<full-zoom-out>"],
|
||||
mappings.add([modes.COMMAND], ["ZO", "zO", "<full-zoom-out>"],
|
||||
"Reduce full zoom of current web page",
|
||||
function (args) { buffer.zoomOut(Math.max(args.count, 1), true); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["ZR", "zR", "<full-zoom-reduce>"],
|
||||
mappings.add([modes.COMMAND], ["ZR", "zR", "<full-zoom-reduce>"],
|
||||
"Reduce full zoom of current web page by a larger amount",
|
||||
function (args) { buffer.zoomOut(Math.max(args.count, 1) * 3, true); },
|
||||
{ count: true });
|
||||
|
||||
mappings.add(modes.COMMAND, ["zZ", "<full-zoom>"],
|
||||
mappings.add([modes.COMMAND], ["zZ", "<full-zoom>"],
|
||||
"Set full zoom value of current web page",
|
||||
function (args) { buffer.setZoom(args.count > 1 ? args.count : 100, true); },
|
||||
{ count: true });
|
||||
|
||||
// page info
|
||||
mappings.add(modes.COMMAND, ["<C-g>", "<page-info>"],
|
||||
mappings.add([modes.COMMAND], ["<C-g>", "<page-info>"],
|
||||
"Print the current file name",
|
||||
function () { buffer.showPageInfo(false); });
|
||||
|
||||
mappings.add(modes.COMMAND, ["g<C-g>", "<more-page-info>"],
|
||||
mappings.add([modes.COMMAND], ["g<C-g>", "<more-page-info>"],
|
||||
"Print file information",
|
||||
function () { buffer.showPageInfo(true); });
|
||||
},
|
||||
|
||||
@@ -1193,7 +1193,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
if (urls.length == 0)
|
||||
return;
|
||||
|
||||
let browser = config.browser;
|
||||
let browser = config.tabbrowser;
|
||||
function open(urls, where) {
|
||||
try {
|
||||
let url = Array.concat(urls)[0];
|
||||
@@ -1214,7 +1214,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
case dactyl.NEW_WINDOW:
|
||||
let win = window.openDialog(document.documentURI, "_blank", "chrome,all,dialog=no");
|
||||
util.waitFor(function () win.document.readyState === "complete");
|
||||
browser = win.getBrowser();
|
||||
browser = win.dactyl && win.dactyl.modules.config.tabbrowser || win.getBrowser();
|
||||
// FALLTHROUGH
|
||||
case dactyl.CURRENT_TAB:
|
||||
browser.loadURIWithFlags(url, flags, null, null, postdata);
|
||||
@@ -1278,12 +1278,12 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
return url.replace(/\s+/g, "");
|
||||
|
||||
// Check for a matching search keyword.
|
||||
let searchURL = bookmarks.getSearchURL(url, false);
|
||||
let searchURL = loaded.bookmarks && bookmarks.getSearchURL(url, false);
|
||||
if (searchURL)
|
||||
return searchURL;
|
||||
|
||||
// If it looks like URL-ish (foo.com/bar), let Gecko figure it out.
|
||||
if (this.urlish.test(url))
|
||||
if (this.urlish.test(url) || !loaded.bookmarks)
|
||||
return util.createURI(url).spec;
|
||||
|
||||
// Pass it off to the default search engine or, failing
|
||||
@@ -1626,9 +1626,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
document.title = document.title.replace(RegExp("(.*)" + util.regexp.escape(old)), "$1" + current);
|
||||
}
|
||||
|
||||
// TODO: remove this FF3.5 test when we no longer support 3.0
|
||||
// : make this a config feature
|
||||
if (services.privateBrowsing) {
|
||||
if (services.has("privateBrowsing")) {
|
||||
let oldValue = win.getAttribute("titlemodifier_normal");
|
||||
let suffix = win.getAttribute("titlemodifier_privatebrowsing").substr(oldValue.length);
|
||||
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
*/
|
||||
var Map = Class("Map", {
|
||||
init: function (modes, keys, description, action, extraInfo) {
|
||||
modes = Array.concat(modes).map(function (m) isObject(m) ? m.mask : m);
|
||||
modes = Array.concat(modes);
|
||||
if (!modes.every(util.identity))
|
||||
throw Error("Invalid modes");
|
||||
throw TypeError("Invalid modes: " + modes);
|
||||
|
||||
this.id = ++Map.id;
|
||||
this.modes = modes;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
/** @scope modules */
|
||||
|
||||
var StatusLine = Module("statusline", {
|
||||
init: function () {
|
||||
init: function init() {
|
||||
this._statusLine = document.getElementById("status-bar");
|
||||
this.statusBar = document.getElementById("addon-bar") || this._statusLine;
|
||||
this.statusBar.collapsed = true;
|
||||
@@ -23,6 +23,8 @@ var StatusLine = Module("statusline", {
|
||||
#addon-bar > xul|toolbarspring { visibility: collapse; }
|
||||
]]></css>);
|
||||
|
||||
util.overlayWindow(window, { append: <><statusbar id="status-bar" ordinal="0"/></> });
|
||||
|
||||
highlight.loadCSS(util.compileMacro(<![CDATA[
|
||||
!AddonBar;#addon-bar {
|
||||
padding-left: 0 !important;
|
||||
@@ -50,7 +52,7 @@ var StatusLine = Module("statusline", {
|
||||
let prepend = <e4x xmlns={XUL} xmlns:dactyl={NS}>
|
||||
<button id="appmenu-button" label="" image="chrome://branding/content/icon16.png" highlight="AppmenuButton" />
|
||||
<toolbarbutton id="appmenu-toolbar-button" label="" image="chrome://branding/content/icon16.png" />
|
||||
<statusbar id="status-bar" highlight="StatusLine" ordinal="0">
|
||||
<statusbar id="status-bar" highlight="StatusLine">
|
||||
<!-- insertbefore="dactyl.statusBefore;" insertafter="dactyl.statusAfter;" -->
|
||||
<hbox key="container" hidden="false" align="center" flex="1">
|
||||
<stack orient="horizontal" align="stretch" flex="1" highlight="CmdLine StatusCmdLine" class="dactyl-container">
|
||||
@@ -82,7 +84,10 @@ var StatusLine = Module("statusline", {
|
||||
prepend: prepend.elements()
|
||||
});
|
||||
|
||||
try {
|
||||
this.security = content.document.dactylSecurity || "insecure";
|
||||
}
|
||||
catch (e) {}
|
||||
},
|
||||
|
||||
get visible() !this.statusBar.collapsed && !this.statusBar.hidden,
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
var Tabs = Module("tabs", {
|
||||
init: function () {
|
||||
this._alternates = [config.tabbrowser.mCurrentTab, null];
|
||||
|
||||
// used for the "gb" and "gB" mappings to remember the last :buffer[!] command
|
||||
this._lastBufferSwitchArgs = "";
|
||||
this._lastBufferSwitchSpecial = true;
|
||||
@@ -47,6 +45,8 @@ var Tabs = Module("tabs", {
|
||||
});
|
||||
},
|
||||
|
||||
_alternates: Class.memoize(function () [config.tabbrowser.mCurrentTab, null]),
|
||||
|
||||
cleanup: function cleanup() {
|
||||
for (let [i, tab] in Iterator(this.allTabs)) {
|
||||
let node = function node(class_) document.getAnonymousElementByAttribute(tab, "class", class_);
|
||||
|
||||
@@ -465,7 +465,7 @@ var Addons = Module("addons", {
|
||||
}
|
||||
});
|
||||
|
||||
if (!("nsIExtensionManager" in Ci) || !services.extensionManager)
|
||||
if (!services.has("extensionManager"))
|
||||
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
||||
else
|
||||
var AddonManager = {
|
||||
|
||||
@@ -873,7 +873,7 @@ Class.prototype = {
|
||||
return services.Timer(timeout_notify, timeout || 0, services.Timer.TYPE_ONE_SHOT);
|
||||
}
|
||||
};
|
||||
memoize(Class.prototype, "closure", function closure() {
|
||||
Class.makeClosure = function makeClosure() {
|
||||
const self = this;
|
||||
function closure(fn) function _closure() {
|
||||
try {
|
||||
@@ -896,7 +896,8 @@ memoize(Class.prototype, "closure", function closure() {
|
||||
});
|
||||
}, this);
|
||||
return closure;
|
||||
});
|
||||
};
|
||||
memoize(Class.prototype, "closure", Class.makeClosure);
|
||||
|
||||
/**
|
||||
* A base class generator for classes which implement XPCOM interfaces.
|
||||
|
||||
@@ -151,6 +151,8 @@ var ConfigBase = Class("ConfigBase", {
|
||||
return version;
|
||||
}),
|
||||
|
||||
get fileExt() this.name.slice(0, -5),
|
||||
|
||||
dtd: memoize({
|
||||
get name() config.name,
|
||||
get home() "http://dactyl.sourceforge.net/",
|
||||
@@ -243,8 +245,6 @@ var ConfigBase = Class("ConfigBase", {
|
||||
*/
|
||||
autocommands: {},
|
||||
|
||||
commandContainer: "browser-bottombox",
|
||||
|
||||
/**
|
||||
* @property {Object} A map of :command-complete option values to completer
|
||||
* function names.
|
||||
@@ -350,6 +350,8 @@ var ConfigBase = Class("ConfigBase", {
|
||||
*/
|
||||
scripts: [],
|
||||
|
||||
sidebars: {},
|
||||
|
||||
/**
|
||||
* @property {string} The leaf name of any temp files created by
|
||||
* {@link io.createTempFile}.
|
||||
|
||||
@@ -166,8 +166,10 @@ var RangeFinder = Module("rangefinder", {
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
modes: function (dactyl, modules, window) {
|
||||
modes: function initModes(dactyl, modules, window) {
|
||||
const { modes } = modules;
|
||||
initModes.superapply("commandline", arguments);
|
||||
|
||||
modes.addMode("FIND", {
|
||||
description: "Find mode, active when typing search input",
|
||||
bases: [modes.COMMAND_LINE],
|
||||
@@ -181,14 +183,14 @@ var RangeFinder = Module("rangefinder", {
|
||||
bases: [modes.FIND]
|
||||
});
|
||||
},
|
||||
commands: function (dactyl, modules, window) {
|
||||
commands: function initCommands(dactyl, modules, window) {
|
||||
const { commands, rangefinder } = modules;
|
||||
commands.add(["noh[lfind]"],
|
||||
"Remove the find highlighting",
|
||||
function () { rangefinder.clear(); },
|
||||
{ argCount: "0" });
|
||||
},
|
||||
commandline: function (dactyl, modules, window) {
|
||||
commandline: function initCommandline(dactyl, modules, window) {
|
||||
const { rangefinder } = modules;
|
||||
rangefinder.CommandMode = Class("CommandFindMode", modules.CommandMode, {
|
||||
init: function init(mode) {
|
||||
|
||||
@@ -69,7 +69,10 @@ var Option = Class("Option", {
|
||||
if (extraInfo)
|
||||
update(this, extraInfo);
|
||||
|
||||
if (arguments.length > 3) {
|
||||
if (set.has(this.modules.config.defaults, this.name))
|
||||
defaultValue = this.modules.config.defaults[this.name];
|
||||
|
||||
if (defaultValue !== undefined) {
|
||||
if (this.type == "string")
|
||||
defaultValue = Commands.quote(defaultValue);
|
||||
|
||||
|
||||
@@ -27,13 +27,13 @@ var ModuleBase = Class("ModuleBase", {
|
||||
});
|
||||
|
||||
var Overlay = Module("Overlay", {
|
||||
init: function () {
|
||||
init: function init() {
|
||||
services["dactyl:"]; // Hack. Force module initialization.
|
||||
|
||||
config.loadStyles();
|
||||
|
||||
util.overlayWindow(config.overlayChrome, function (window) ({
|
||||
init: function (document) {
|
||||
util.overlayWindow(config.overlayChrome, function overlay(window) ({
|
||||
init: function onInit(document) {
|
||||
/**
|
||||
* @constructor Module
|
||||
*
|
||||
@@ -187,48 +187,20 @@ var Overlay = Module("Overlay", {
|
||||
"mow",
|
||||
"statusline"
|
||||
].forEach(function (name) defineModule.time("load", name, modules.load, modules, name));
|
||||
|
||||
config.scripts.forEach(modules.load);
|
||||
}, this);
|
||||
},
|
||||
load: function (document) {
|
||||
load: function onLoad(document) {
|
||||
// This is getting to be horrible. --Kris
|
||||
|
||||
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 deferredInit = { load: {} };
|
||||
const seen = set();
|
||||
const loaded = set();
|
||||
modules.loaded = loaded;
|
||||
|
||||
function init(module) {
|
||||
let name = module.constructor.className;
|
||||
|
||||
function init(func, mod)
|
||||
function () defineModule.time(module.className || module.constructor.className, mod,
|
||||
func, modules[name],
|
||||
modules.dactyl, modules, window);
|
||||
|
||||
set.add(loaded, name);
|
||||
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));
|
||||
}
|
||||
}
|
||||
for (let [, fn] in iter(deferredInit[module.constructor.className] || []))
|
||||
fn();
|
||||
}
|
||||
|
||||
function load(module, prereq, frame) {
|
||||
if (isString(module)) {
|
||||
if (!Module.constructors.hasOwnProperty(module))
|
||||
@@ -255,8 +227,6 @@ var Overlay = Module("Overlay", {
|
||||
loaded[module.className] = true;
|
||||
|
||||
frob(module.className);
|
||||
|
||||
// init(modules[module.className]);
|
||||
}
|
||||
catch (e) {
|
||||
util.dump("Loading " + (module && module.className) + ":");
|
||||
@@ -265,36 +235,48 @@ var Overlay = Module("Overlay", {
|
||||
return modules[module.className];
|
||||
}
|
||||
|
||||
Module.list.forEach(function (mod) {
|
||||
Object.keys(mod.prototype.INIT).forEach(function (name) {
|
||||
deferredInit[name] = deferredInit[name] || [];
|
||||
deferredInit[name].push(function () {
|
||||
// util.dump("INIT: " + mod.className + ":" + name);
|
||||
defineModule.time(mod.className, name,
|
||||
name, mod.prototype.INIT,
|
||||
function deferInit(name, INIT, mod) {
|
||||
let init = deferredInit[name] = deferredInit[name] || {};
|
||||
let className = mod.className || mod.constructor.className;
|
||||
|
||||
init[className] = function callee() {
|
||||
if (!callee.frobbed)
|
||||
defineModule.time(className, name, INIT[name], mod,
|
||||
modules.dactyl, modules, window);
|
||||
callee.frobbed = true;
|
||||
};
|
||||
|
||||
if (name !== "init" && name !== "load")
|
||||
INIT[name].superapply = function (name) { init[name](); };
|
||||
}
|
||||
|
||||
function frobModules() {
|
||||
Module.list.forEach(function frobModule(mod) {
|
||||
if (!mod.frobbed) {
|
||||
modules.__defineGetter__(mod.className, function () {
|
||||
delete modules[mod.className];
|
||||
return load(mod.className, null, Components.stack.caller);
|
||||
});
|
||||
Object.keys(mod.prototype.INIT).forEach(function (name) { deferInit(name, mod.prototype.INIT, mod); });
|
||||
}
|
||||
mod.frobbed = true;
|
||||
});
|
||||
});
|
||||
defineModule.modules.forEach(function (mod) {
|
||||
}
|
||||
defineModule.modules.forEach(function defModule(mod) {
|
||||
let names = set(Object.keys(mod.INIT));
|
||||
if ("init" in mod.INIT)
|
||||
set.add(names, "init");
|
||||
|
||||
keys(names).forEach(function (name) {
|
||||
deferredInit[name] = deferredInit[name] || [];
|
||||
deferredInit[name].push(function () {
|
||||
// util.dump("INIT: " + mod.constructor.className + ":" + name);
|
||||
defineModule.time(mod.constructor.className, name,
|
||||
mod.INIT[name], mod,
|
||||
modules.dactyl, modules, window);
|
||||
});
|
||||
});
|
||||
keys(names).forEach(function (name) { deferInit(name, mod.INIT, mod); });
|
||||
});
|
||||
|
||||
function frob(name) { (deferredInit[name] || []).forEach(call); }
|
||||
function frob(name) { values(deferredInit[name] || {}).forEach(call); }
|
||||
|
||||
frobModules();
|
||||
frob("init");
|
||||
modules.config.scripts.forEach(modules.load);
|
||||
frobModules();
|
||||
|
||||
defineModule.modules.forEach(function ({ lazyInit, constructor: { className } }) {
|
||||
if (!lazyInit) {
|
||||
frob(className);
|
||||
@@ -316,10 +298,13 @@ var Overlay = Module("Overlay", {
|
||||
|
||||
modules.events.listen(window, "unload", function onUnload() {
|
||||
window.removeEventListener("unload", onUnload.wrapped, false);
|
||||
|
||||
for (let prop in properties(modules)) {
|
||||
let mod = Object.getOwnPropertyDescriptor(modules, prop).value;
|
||||
|
||||
if (mod instanceof ModuleBase || mod && mod.isLocalModule) {
|
||||
mod.stale = true;
|
||||
|
||||
if ("destroy" in mod)
|
||||
util.trapErrors("destroy", mod);
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
},
|
||||
override: true
|
||||
});
|
||||
if (services.has("privateBrowsing"))
|
||||
this.addItem("host", {
|
||||
description: "All data from the given host",
|
||||
action: function (range, host) {
|
||||
@@ -547,7 +548,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
},
|
||||
options: function (dactyl, modules) {
|
||||
const options = modules.options;
|
||||
if (services.privateBrowsing)
|
||||
if (services.has("privateBrowsing"))
|
||||
options.add(["private", "pornmode"],
|
||||
"Set the 'private browsing' option",
|
||||
"boolean", false,
|
||||
|
||||
@@ -18,7 +18,6 @@ defineModule("services", {
|
||||
*/
|
||||
var Services = Module("Services", {
|
||||
init: function () {
|
||||
this.classes = {};
|
||||
this.services = {};
|
||||
|
||||
this.add("annotation", "@mozilla.org/browser/annotation-service;1", Ci.nsIAnnotationService);
|
||||
@@ -129,6 +128,7 @@ var Services = Module("Services", {
|
||||
*/
|
||||
add: function (name, class_, ifaces, meth) {
|
||||
const self = this;
|
||||
this.services[name] = { class: class_, interfaces: Array.concat(ifaces || []) };
|
||||
if (name in this && ifaces && !this.__lookupGetter__(name) && !(this[name] instanceof Ci.nsISupports))
|
||||
throw TypeError();
|
||||
memoize(this, name, function () self._create(class_, ifaces, meth));
|
||||
@@ -164,11 +164,18 @@ var Services = Module("Services", {
|
||||
* @param {string} name The service's cache key.
|
||||
*/
|
||||
get: function (name) this[name],
|
||||
|
||||
/**
|
||||
* Returns true if the given service is available.
|
||||
*
|
||||
* @param {string} name The service's cache key.
|
||||
*/
|
||||
has: function (name) set.has(this.services, name) && this.services[name].class in Cc &&
|
||||
this.services[name].interfaces.every(function (iface) iface in Ci)
|
||||
}, {
|
||||
}, {
|
||||
javascript: function (dactyl, modules) {
|
||||
modules.JavaScript.setCompleter(this.get, [function () [[k, v] for ([k, v] in Iterator(services)) if (v instanceof Ci.nsISupports)]]);
|
||||
modules.JavaScript.setCompleter(this.create, [function () [[c, ""] for (c in services.classes)]]);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1430,6 +1430,9 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
if (error.noTrace)
|
||||
return;
|
||||
|
||||
if (isString(error))
|
||||
error = Error(error);
|
||||
|
||||
if (Cu.reportError)
|
||||
Cu.reportError(error);
|
||||
|
||||
|
||||
@@ -156,8 +156,11 @@ statusbarpanel {
|
||||
.statusbar-resizerpanel {
|
||||
display: none;
|
||||
}
|
||||
#statusbar-display, #statusbar-progresspanel {
|
||||
#statusbar-display,
|
||||
#statusbar-progresspanel,
|
||||
#status-bar > #statusTextBox > #statusText {
|
||||
display: none;
|
||||
visibility: collapse;
|
||||
}
|
||||
|
||||
.dactyl-commandline-prompt {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# Firefox
|
||||
resource dactyl-local-content content/
|
||||
resource dactyl-local-skin skin/
|
||||
resource dactyl-local-locale locale/
|
||||
|
||||
@@ -10,10 +10,11 @@ var Config = Module("config", ConfigBase, {
|
||||
name: "pentadactyl",
|
||||
appName: "Pentadactyl",
|
||||
idName: "PENTADACTYL",
|
||||
fileExt: "penta",
|
||||
host: "Firefox",
|
||||
hostbin: "firefox",
|
||||
|
||||
commandContainer: "browser-bottombox",
|
||||
|
||||
Local: function Local(dactyl, modules, window)
|
||||
let ({ config } = modules) ({
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
2009:
|
||||
* Andreas Nerf (biggest Muttator donor so far! thanks a lot)
|
||||
* Kirill Korotaev
|
||||
@@ -1,64 +0,0 @@
|
||||
2009-XX-XX
|
||||
* version 0.6a1pre
|
||||
* asciidoc is no longer required to build Muttator
|
||||
* The full help system now available for Muttator.
|
||||
* add 'titlestring' option
|
||||
* rename *FolderLoaded* autocommand event to *FolderLoad*
|
||||
* add the *DOMLoad* autocommand event
|
||||
* add 'online' option
|
||||
* add 'smtpserver' option
|
||||
* add 'jsdebugger' option - switch on/off javascript debugger service
|
||||
|
||||
2009-03-29
|
||||
* version 0.5
|
||||
* fixes for recent TB nightly changes
|
||||
* new 'threads' option (non-functional for now)
|
||||
* new 'archivefolder' option
|
||||
* small bug fixes
|
||||
|
||||
2008-08-03:
|
||||
* version 0.4
|
||||
* new 'autoexternal' option to edit new messages/reply with the external editor by default.
|
||||
NOTE: You must set this option in your .muttatorrc, as options are not shared between the
|
||||
main thunderbird window and the compose window!
|
||||
* various *l* mappings for labeling messages
|
||||
* [m]p[m] to open RSS message in browser
|
||||
* [m]y[m] to yank sender or RSS URL
|
||||
* [m]Y[m] to yank subject
|
||||
* [m]R[m] to reply to all
|
||||
* new compose mappings: [m]s[m], [m]t[m] and [m]i[m] - Focus subject:, To: or message body
|
||||
* [m]q[m] quits composer now
|
||||
* new [m]x[m] mapping to toggle HTML display (is there a need for "simple HTML"?)
|
||||
* new [m]h[m] mapping to toggle headers
|
||||
|
||||
2008-06-04:
|
||||
* version 0.3
|
||||
* new tab related mappings + commands
|
||||
* new [c]:contacts[c] and [c]:contact[c] commands for address book operations
|
||||
* new [c]:message[c] command
|
||||
* new -- COMPOSE -- mode with mutt-like keybindings ([m]y[m] to send message, [m]e[m] to edit message)
|
||||
* external editor support for sending messages
|
||||
* [m]m[m] to open a new message compose window
|
||||
* new [m]M[m] command to send a new message to the sender of the currently selected message
|
||||
* completions for [c]:goto[c], [c]:copyto[c], [c]:moveto[c] commands
|
||||
* [c]:emptytrash[c] command
|
||||
* new [m]*[m] and [m]#[m] mappings to select next/prev message from same author (not perfect matching however)
|
||||
* [m]J[m], [m]K[m], [m]]s[m], etc. search in closed threads now
|
||||
* [m]gj[m] and [m]gk[m] to select messages in closed threads
|
||||
* [m]t[m] to select current thread, use [m]lr[m] now to label a message as read
|
||||
* KMail-like mode-independent scrolling with [m]<Left>[m]/[m]<Right>[m] and [m]<Up>[m]/[m]<Down>[m]
|
||||
* many small improvements
|
||||
|
||||
2008-04-30:
|
||||
* version 0.2
|
||||
* [m]<C-s>[m] mappings to move messages to an "Archive" folder (inspired by gmail)
|
||||
* new [c]:moveto[c] and [c]:copyto[c] commands
|
||||
* [m]u[m] and [m]<C-r>[m] mappings to undo/redo
|
||||
* new Muttator specific :help screen
|
||||
* small bug fixes
|
||||
|
||||
2008-04-29:
|
||||
* version 0.1
|
||||
* first public release, straight port from Pentadactyl with many basic mappings
|
||||
|
||||
// vim: set filetype=asciidoc:
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
# Thunderbird
|
||||
content teledactyl content/
|
||||
skin teledactyl classic/1.0 skin/
|
||||
locale dactyl en-US locale/en-US/
|
||||
resource dactyl-local-content content/
|
||||
resource dactyl-local-skin skin/
|
||||
resource dactyl-local-locale locale/
|
||||
|
||||
resource dactyl ../common/modules/
|
||||
resource dactyl-content ../common/content/
|
||||
resource dactyl-skin ../common/skin/
|
||||
resource dactyl-locale ../common/locale/
|
||||
|
||||
content dactyl ../common/content/
|
||||
resource dactyl ../common/modules/
|
||||
skin dactyl classic/1.0 ../common/skin/
|
||||
|
||||
override chrome://dactyl/content/dactyl.dtd chrome://teledactyl/content/dactyl.dtd
|
||||
|
||||
overlay chrome://messenger/content/messenger.xul chrome://dactyl/content/dactyl.xul
|
||||
overlay chrome://messenger/content/messenger.xul chrome://teledactyl/content/teledactyl.xul
|
||||
|
||||
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://teledactyl/content/compose/dactyl.xul
|
||||
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://teledactyl/content/compose/compose.xul
|
||||
|
||||
component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js
|
||||
contract @mozilla.org/commandlinehandler/general-startup;1?type=dactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}
|
||||
|
||||
@@ -4,13 +4,8 @@
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
"use strict";
|
||||
|
||||
function Compose() { //{{{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
config.features = ["addressbook"]; // the composer has no special features
|
||||
|
||||
var Compose = Module("compose", {
|
||||
init: function init() {
|
||||
var stateListener = {
|
||||
QueryInterface: function (id) {
|
||||
if (id.equals(Ci.nsIDocumentStateListener))
|
||||
@@ -31,34 +26,20 @@ function Compose() { //{{{
|
||||
NotifyDocumentWillBeDestroyed: function () {}
|
||||
};
|
||||
|
||||
// XXX: Hack!
|
||||
window.document.addEventListener("load", function () {
|
||||
events.listen(window.document, "load", function () {
|
||||
if (window.messageWasEditedExternally === undefined) {
|
||||
window.messageWasEditedExternally = false;
|
||||
GetCurrentEditor().addDocumentStateListener(stateListener);
|
||||
}
|
||||
}, true);
|
||||
|
||||
window.addEventListener("compose-window-close", function () {
|
||||
events.listen(window, "compose-window-close", function () {
|
||||
window.messageWasEditedExternally = false;
|
||||
}, true);
|
||||
|
||||
/*window.document.addEventListener("unload", function () {
|
||||
GetCurrentEditor().removeDocumentStateListener(config.stateListener);
|
||||
}, true);*/
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// OPTIONS /////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// COMMANDS ////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
mappings: function initMappings(dactyl, modules, window) {
|
||||
mappings.add([modes.COMPOSE],
|
||||
["e"], "Edit message",
|
||||
function () { editor.editFieldExternally(); });
|
||||
@@ -91,14 +72,12 @@ function Compose() { //{{{
|
||||
mappings.add([modes.COMPOSE],
|
||||
["Q", "ZQ"], "Force closing composer",
|
||||
function () { MsgComposeCloseWindow(true); /* cache window for better performance*/ });
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////}}}
|
||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////{{{
|
||||
|
||||
return {};
|
||||
|
||||
//}}}
|
||||
} //}}}
|
||||
},
|
||||
modes: function initModes(dactyl, modules, window) {
|
||||
modes.addMode("COMPOSE", {
|
||||
insert: true
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
// vim: set fdm=marker sw=4 ts=4 et:
|
||||
|
||||
@@ -5,23 +5,77 @@
|
||||
"use strict";
|
||||
|
||||
const Config = Module("config", ConfigBase, {
|
||||
name: "teledactyl",
|
||||
appName: "Teledactyl",
|
||||
idName: "TELEDACTYL",
|
||||
host: "Thunderbird",
|
||||
hostbin: "thunderbird",
|
||||
|
||||
Local: function Local(dactyl, modules, window)
|
||||
let ({ config } = modules, { document } = window) {
|
||||
init: function init() {
|
||||
init.supercall(this);
|
||||
// don't wait too long when selecting new messages
|
||||
// GetThreadTree()._selectDelay = 300; // TODO: make configurable
|
||||
init.superapply(this, arguments);
|
||||
|
||||
modules.__defineGetter__("content", function () window.content);
|
||||
|
||||
util.overlayWindow(window, { append: <><hbox id="statusTextBox" flex=""/></> });
|
||||
},
|
||||
|
||||
autocommands: {
|
||||
DOMLoad: "Triggered when a page's DOM content has fully loaded",
|
||||
FolderLoad: "Triggered after switching folders in Thunderbird",
|
||||
PageLoadPre: "Triggered after a page load is initiated",
|
||||
PageLoad: "Triggered when a page gets (re)loaded/opened",
|
||||
Enter: "Triggered after Thunderbird starts",
|
||||
Leave: "Triggered before exiting Thunderbird",
|
||||
LeavePre: "Triggered before exiting Thunderbird"
|
||||
get browser() window.getBrowser(),
|
||||
|
||||
get commandContainer() document.documentElement.id,
|
||||
|
||||
tabbrowser: {
|
||||
__proto__: Class.makeClosure.call(window.document.getElementById("tabmail")),
|
||||
get mTabContainer() this.tabContainer,
|
||||
get mTabs() this.tabContainer.childNodes,
|
||||
get mCurrentTab() this.tabContainer.selectedItem,
|
||||
get mStrip() this.tabStrip,
|
||||
get browsers() [browser for (browser in Iterator(this.mTabs))],
|
||||
|
||||
loadOneTab: function loadOneTab(uri) {
|
||||
return this.openTab("contentTab", { contentPage: uri });
|
||||
},
|
||||
loadURIWithFlags: function loadURIWithFlags() {
|
||||
return this.mCurrentTab.loadURIWithFlags.apply(this.mCurrentTab, arguments);
|
||||
}
|
||||
},
|
||||
|
||||
get browser() getBrowser(),
|
||||
get hasTabbrowser() !this.isComposeWindow,
|
||||
|
||||
get tabStip() this.tabbrowser.tabContainer,
|
||||
|
||||
get isComposeWindow() window.wintype == "msgcompose",
|
||||
|
||||
get mainWidget() this.isComposeWindow ? document.getElementById("content-frame") : window.GetThreadTree(),
|
||||
|
||||
get mainWindowId() this.isComposeWindow ? "msgcomposeWindow" : "messengerWindow",
|
||||
get browserModes() [modules.modes.MESSAGE],
|
||||
get mailModes() [modules.modes.NORMAL],
|
||||
|
||||
// NOTE: as I don't use TB I have no idea how robust this is. --djk
|
||||
get outputHeight() {
|
||||
if (!this.isComposeWindow) {
|
||||
let container = document.getElementById("tabpanelcontainer").boxObject;
|
||||
let deck = document.getElementById("displayDeck");
|
||||
let box = document.getElementById("messagepanebox");
|
||||
let splitter = document.getElementById("threadpane-splitter").boxObject;
|
||||
|
||||
if (splitter.width > splitter.height)
|
||||
return container.height - deck.minHeight - box.minHeight- splitter.height;
|
||||
else
|
||||
return container.height - Math.max(deck.minHeight, box.minHeight);
|
||||
}
|
||||
else
|
||||
return document.getElementById("appcontent").boxObject.height;
|
||||
},
|
||||
|
||||
removeTab: function removeTab(tab) {
|
||||
if (this.tabbrowser.mTabs.length > 1)
|
||||
this.tabbrowser.removeTab(tab);
|
||||
else
|
||||
dactyl.beep();
|
||||
},
|
||||
|
||||
completers: Class.memoize(function () update({ mailfolder: "mailFolder" }, this.__proto__.completers)),
|
||||
|
||||
@@ -41,35 +95,52 @@ const Config = Module("config", ConfigBase, {
|
||||
downloads: ["Manage Downloads",
|
||||
function () { window.toOpenWindowByType('Download:Manager', 'chrome://mozapps/content/downloads/downloads.xul', 'chrome,dialog=no,resizable'); }],
|
||||
preferences: ["Show Thunderbird preferences dialog",
|
||||
function () { openOptionsDialog(); }],
|
||||
function () { window.openOptionsDialog(); }],
|
||||
printsetup: ["Setup the page size and orientation before printing",
|
||||
function () { PrintUtils.showPageSetup(); }],
|
||||
function () { window.PrintUtils.showPageSetup(); }],
|
||||
print: ["Show print dialog",
|
||||
function () { PrintUtils.print(); }],
|
||||
function () { window.PrintUtils.print(); }],
|
||||
saveframe: ["Save frame to disk",
|
||||
function () { window.saveFrameDocument(); }],
|
||||
savepage: ["Save page to disk",
|
||||
function () { window.saveDocument(window.content.document); }],
|
||||
},
|
||||
|
||||
|
||||
focusChange: function focusChange(win) {
|
||||
const { modes } = modules;
|
||||
|
||||
// we switch to -- MESSAGE -- mode for Teledactyl when the main HTML widget gets focus
|
||||
if (win && win.document instanceof Ci.nsIHTMLDocument || dactyl.focus instanceof Ci.nsIHTMLAnchorElement) {
|
||||
if (this.isComposeWindow)
|
||||
modes.set(modes.INSERT, modes.TEXT_EDIT);
|
||||
else if (dactyl.mode != modes.MESSAGE)
|
||||
modes.main = modes.MESSAGE;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
autocommands: {
|
||||
DOMLoad: "Triggered when a page's DOM content has fully loaded",
|
||||
FolderLoad: "Triggered after switching folders in Thunderbird",
|
||||
PageLoadPre: "Triggered after a page load is initiated",
|
||||
PageLoad: "Triggered when a page gets (re)loaded/opened",
|
||||
Enter: "Triggered after Thunderbird starts",
|
||||
Leave: "Triggered before exiting Thunderbird",
|
||||
LeavePre: "Triggered before exiting Thunderbird"
|
||||
},
|
||||
|
||||
defaults: {
|
||||
guioptions: "bfrs",
|
||||
guioptions: "bCfrs",
|
||||
complete: "f",
|
||||
showtabline: 1,
|
||||
titlestring: "Teledactyl"
|
||||
},
|
||||
|
||||
/*** optional options, there are checked for existence and a fallback provided ***/
|
||||
features: ["hints", "mail", "marks", "addressbook", "tabs"],
|
||||
|
||||
focusChange: function (win) {
|
||||
// we switch to -- MESSAGE -- mode for Teledactyl when the main HTML widget gets focus
|
||||
if (win && win.document instanceof HTMLDocument || dactyl.focus instanceof HTMLAnchorElement) {
|
||||
if (config.isComposeWindow)
|
||||
modes.set(modes.INSERT, modes.TEXT_EDIT);
|
||||
else if (dactyl.mode != modes.MESSAGE)
|
||||
dactyl.mode = modes.MESSAGE;
|
||||
}
|
||||
},
|
||||
features: Class.memoize(function () set(
|
||||
this.isComposeWindow ? ["addressbook"]
|
||||
: ["hints", "mail", "marks", "addressbook", "tabs"])),
|
||||
|
||||
guioptions: {
|
||||
m: ["MenuBar", ["mail-toolbar-menubar2"]],
|
||||
@@ -81,74 +152,37 @@ const Config = Module("config", ConfigBase, {
|
||||
// they are sorted by relevance, not alphabetically
|
||||
helpFiles: ["intro.html", "version.html"],
|
||||
|
||||
get isComposeWindow() window.wintype == "msgcompose",
|
||||
|
||||
get mainWidget() this.isComposeWindow ? document.getElementById("content-frame") : GetThreadTree(),
|
||||
|
||||
get mainWindowId() this.isComposeWindow ? "msgcomposeWindow" : "messengerWindow",
|
||||
|
||||
modes: [
|
||||
["MESSAGE", { char: "m" }],
|
||||
["COMPOSE"]
|
||||
],
|
||||
get browserModes() [modes.MESSAGE],
|
||||
get mailModes() [modes.NORMAL],
|
||||
|
||||
// NOTE: as I don't use TB I have no idea how robust this is. --djk
|
||||
get outputHeight() {
|
||||
if (!this.isComposeWindow) {
|
||||
let container = document.getElementById("tabpanelcontainer").boxObject;
|
||||
let deck = document.getElementById("displayDeck");
|
||||
let box = document.getElementById("messagepanebox");
|
||||
let splitter = document.getElementById("threadpane-splitter").boxObject;
|
||||
|
||||
if (splitter.width > splitter.height)
|
||||
return container.height - deck.minHeight - box.minHeight- splitter.height;
|
||||
else
|
||||
return container.height - Math.max(deck.minHeight, box.minHeight);
|
||||
}
|
||||
else
|
||||
return document.getElementById("appcontent").boxObject.height;
|
||||
},
|
||||
|
||||
removeTab: function (tab) {
|
||||
if (config.tabbrowser.mTabs.length > 1)
|
||||
config.tabbrowser.removeTab(tab);
|
||||
else
|
||||
dactyl.beep();
|
||||
},
|
||||
|
||||
get scripts() this.isComposeWindow ? ["compose/compose.js"] : [
|
||||
get scripts() this.isComposeWindow ? ["compose/compose"] : [
|
||||
"addressbook",
|
||||
"mail",
|
||||
"tabs",
|
||||
],
|
||||
|
||||
overlayChrome: ["chrome://messenger/content/messenger.xul",
|
||||
"chrome://messenger/content/messengercompose/messengercompose.xul"],
|
||||
styleableChrome: ["chrome://messenger/content/messenger.xul",
|
||||
"chrome://messenger/content/messengercompose/messengercompose.xul"],
|
||||
|
||||
tabbrowser: {
|
||||
__proto__: document.getElementById("tabmail"),
|
||||
get mTabContainer() this.tabContainer,
|
||||
get mTabs() this.tabContainer.childNodes,
|
||||
get mCurrentTab() this.tabContainer.selectedItem,
|
||||
get mStrip() this.tabStrip,
|
||||
get browsers() [browser for (browser in Iterator(this.mTabs))]
|
||||
},
|
||||
|
||||
// to allow Vim to :set ft=mail automatically
|
||||
tempFile: "mutt-ator-mail",
|
||||
tempFile: "teledactyl.eml"
|
||||
}, {
|
||||
}, {
|
||||
commands: function initCommands(dactyl, modules, window) {
|
||||
const { commands } = modules;
|
||||
|
||||
get visualbellWindow() document.getElementById(this.mainWindowId),
|
||||
}, {
|
||||
}, {
|
||||
commands: function () {
|
||||
commands.add(["pref[erences]", "prefs"],
|
||||
"Show " + config.host + " preferences",
|
||||
function () { window.openOptionsDialog(); },
|
||||
{ argCount: "0" });
|
||||
},
|
||||
modes: function () {
|
||||
modes: function initModes(dactyl, modules, window) {
|
||||
const { modes } = modules;
|
||||
|
||||
this.ignoreKeys = {
|
||||
"<Return>": modes.NORMAL | modes.INSERT,
|
||||
"<Space>": modes.NORMAL | modes.INSERT,
|
||||
@@ -156,7 +190,9 @@ const Config = Module("config", ConfigBase, {
|
||||
"<Down>": modes.NORMAL | modes.INSERT
|
||||
};
|
||||
},
|
||||
options: function () {
|
||||
options: function initOptions(dactyl, modules, window) {
|
||||
const { options } = modules;
|
||||
|
||||
// FIXME: comment obviously incorrect
|
||||
// 0: never automatically edit externally
|
||||
// 1: automatically edit externally when message window is shown the first time
|
||||
@@ -170,11 +206,11 @@ const Config = Module("config", ConfigBase, {
|
||||
"boolean", true,
|
||||
{
|
||||
setter: function (value) {
|
||||
if (MailOfflineMgr.isOnline() != value)
|
||||
MailOfflineMgr.toggleOfflineStatus();
|
||||
if (window.MailOfflineMgr.isOnline() != value)
|
||||
window.MailOfflineMgr.toggleOfflineStatus();
|
||||
return value;
|
||||
},
|
||||
getter: function () MailOfflineMgr.isOnline()
|
||||
getter: function () window.MailOfflineMgr.isOnline()
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
"use strict";
|
||||
|
||||
const Mail = Module("mail", {
|
||||
init: function () {
|
||||
services.add("smtpService", "@mozilla.org/messengercompose/smtp;1", Ci.nsISmtpService);
|
||||
|
||||
init: function init() {
|
||||
// used for asynchronously selecting messages after wrapping folders
|
||||
this._selectMessageKeys = [];
|
||||
this._selectMessageCount = 1;
|
||||
@@ -133,7 +131,7 @@ const Mail = Module("mail", {
|
||||
|
||||
/** @property {nsISmtpServer[]} The list of configured SMTP servers. */
|
||||
get smtpServers() {
|
||||
let servers = services.smtpService.smtpServers;
|
||||
let servers = services.smtp.smtpServers;
|
||||
let ret = [];
|
||||
|
||||
while (servers.hasMoreElements()) {
|
||||
@@ -395,7 +393,7 @@ const Mail = Module("mail", {
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
commands: function () {
|
||||
commands: function initCommands(dactyl, modules, window) {
|
||||
commands.add(["go[to]"],
|
||||
"Select a folder",
|
||||
function (args) {
|
||||
@@ -482,7 +480,7 @@ const Mail = Module("mail", {
|
||||
bang: true,
|
||||
});
|
||||
},
|
||||
completion: function () {
|
||||
completion: function initCompletion(dactyl, modules, window) {
|
||||
completion.mailFolder = function mailFolder(context) {
|
||||
let folders = mail.getFolders(context.filter);
|
||||
context.anchored = false;
|
||||
@@ -492,7 +490,7 @@ const Mail = Module("mail", {
|
||||
"Unread: " + folder.getNumUnread(false)]);
|
||||
};
|
||||
},
|
||||
mappings: function () {
|
||||
mappings: function initMappings(dactyl, modules, window) {
|
||||
var myModes = config.mailModes;
|
||||
|
||||
mappings.add(myModes, ["<Return>", "i"],
|
||||
@@ -876,7 +874,18 @@ const Mail = Module("mail", {
|
||||
}
|
||||
});
|
||||
},
|
||||
options: function () {
|
||||
services: function initServices(dactyl, modules, window) {
|
||||
services.add("smtp", "@mozilla.org/messengercompose/smtp;1", Ci.nsISmtpService);
|
||||
},
|
||||
|
||||
modes: function initModes(dactyl, modules, window) {
|
||||
modes.addMode("MESSAGE", {
|
||||
char: "m",
|
||||
description: "Active the message is focused",
|
||||
bases: [modes.COMMAND]
|
||||
});
|
||||
},
|
||||
options: function initOptions(dactyl, modules, window) {
|
||||
// FIXME: why does this default to "Archive", I don't have one? The default
|
||||
// value won't validate now. mst please fix. --djk
|
||||
options.add(["archivefolder"],
|
||||
@@ -911,12 +920,12 @@ const Mail = Module("mail", {
|
||||
|
||||
options.add(["smtpserver", "smtp"],
|
||||
"Set the default SMTP server",
|
||||
"string", services.smtpService.defaultServer.key, // TODO: how should we handle these persistent external defaults - "inherit" or null?
|
||||
"string", services.smtp.defaultServer.key, // TODO: how should we handle these persistent external defaults - "inherit" or null?
|
||||
{
|
||||
getter: function () services.smtpService.defaultServer.key,
|
||||
getter: function () services.smtp.defaultServer.key,
|
||||
setter: function (value) {
|
||||
let server = mail.smtpServers.filter(function (s) s.key == value)[0];
|
||||
services.smtpService.defaultServer = server;
|
||||
services.smtp.defaultServer = server;
|
||||
return value;
|
||||
},
|
||||
completer: function (context) [[s.key, s.serverURI] for ([, s] in Iterator(mail.smtpServers))]
|
||||
|
||||
Reference in New Issue
Block a user