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",
|
"Go to the root of the website",
|
||||||
function () { buffer.climbUrlPath(-1); });
|
function () { buffer.climbUrlPath(-1); });
|
||||||
|
|
||||||
mappings.add(modes.COMMAND, [".", "<repeat-key>"],
|
mappings.add([modes.COMMAND], [".", "<repeat-key>"],
|
||||||
"Repeat the last key event",
|
"Repeat the last key event",
|
||||||
function (args) {
|
function (args) {
|
||||||
if (mappings.repeat) {
|
if (mappings.repeat) {
|
||||||
@@ -1533,54 +1533,54 @@ var Buffer = Module("buffer", {
|
|||||||
},
|
},
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
mappings.add(modes.COMMAND, ["i", "<Insert>"],
|
mappings.add([modes.COMMAND], ["i", "<Insert>"],
|
||||||
"Start caret mode",
|
"Start caret mode",
|
||||||
function () { modes.push(modes.CARET); });
|
function () { modes.push(modes.CARET); });
|
||||||
|
|
||||||
mappings.add(modes.COMMAND, ["<C-c>"],
|
mappings.add([modes.COMMAND], ["<C-c>"],
|
||||||
"Stop loading the current web page",
|
"Stop loading the current web page",
|
||||||
function () { ex.stop(); });
|
function () { ex.stop(); });
|
||||||
|
|
||||||
// scrolling
|
// 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",
|
"Scroll document down",
|
||||||
function (args) { buffer.scrollVertical("lines", Math.max(args.count, 1)); },
|
function (args) { buffer.scrollVertical("lines", Math.max(args.count, 1)); },
|
||||||
{ count: true });
|
{ 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",
|
"Scroll document up",
|
||||||
function (args) { buffer.scrollVertical("lines", -Math.max(args.count, 1)); },
|
function (args) { buffer.scrollVertical("lines", -Math.max(args.count, 1)); },
|
||||||
{ count: true });
|
{ 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",
|
"Scroll document to the left",
|
||||||
function (args) { buffer.scrollHorizontal("columns", -Math.max(args.count, 1)); },
|
function (args) { buffer.scrollHorizontal("columns", -Math.max(args.count, 1)); },
|
||||||
{ count: true });
|
{ 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",
|
"Scroll document to the right",
|
||||||
function (args) { buffer.scrollHorizontal("columns", Math.max(args.count, 1)); },
|
function (args) { buffer.scrollHorizontal("columns", Math.max(args.count, 1)); },
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
mappings.add(modes.COMMAND, ["0", "^", "<scroll-begin>"],
|
mappings.add([modes.COMMAND], ["0", "^", "<scroll-begin>"],
|
||||||
"Scroll to the absolute left of the document",
|
"Scroll to the absolute left of the document",
|
||||||
function () { buffer.scrollToPercent(0, null); });
|
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",
|
"Scroll to the absolute right of the document",
|
||||||
function () { buffer.scrollToPercent(100, null); });
|
function () { buffer.scrollToPercent(100, null); });
|
||||||
|
|
||||||
mappings.add(modes.COMMAND, ["gg", "<Home>"],
|
mappings.add([modes.COMMAND], ["gg", "<Home>"],
|
||||||
"Go to the top of the document",
|
"Go to the top of the document",
|
||||||
function (args) { buffer.scrollToPercent(null, args.count != null ? args.count : 0); },
|
function (args) { buffer.scrollToPercent(null, args.count != null ? args.count : 0); },
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
mappings.add(modes.COMMAND, ["G", "<End>"],
|
mappings.add([modes.COMMAND], ["G", "<End>"],
|
||||||
"Go to the end of the document",
|
"Go to the end of the document",
|
||||||
function (args) { buffer.scrollToPercent(null, args.count != null ? args.count : 100); },
|
function (args) { buffer.scrollToPercent(null, args.count != null ? args.count : 100); },
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
mappings.add(modes.COMMAND, ["%", "<scroll-percent>"],
|
mappings.add([modes.COMMAND], ["%", "<scroll-percent>"],
|
||||||
"Scroll to {count} percent of the document",
|
"Scroll to {count} percent of the document",
|
||||||
function (args) {
|
function (args) {
|
||||||
dactyl.assert(args.count > 0 && args.count <= 100);
|
dactyl.assert(args.count > 0 && args.count <= 100);
|
||||||
@@ -1588,59 +1588,59 @@ var Buffer = Module("buffer", {
|
|||||||
},
|
},
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
mappings.add(modes.COMMAND, ["<C-d>", "<scroll-down>"],
|
mappings.add([modes.COMMAND], ["<C-d>", "<scroll-down>"],
|
||||||
"Scroll window downwards in the buffer",
|
"Scroll window downwards in the buffer",
|
||||||
function (args) { buffer._scrollByScrollSize(args.count, true); },
|
function (args) { buffer._scrollByScrollSize(args.count, true); },
|
||||||
{ 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",
|
"Scroll window upwards in the buffer",
|
||||||
function (args) { buffer._scrollByScrollSize(args.count, false); },
|
function (args) { buffer._scrollByScrollSize(args.count, false); },
|
||||||
{ count: true });
|
{ 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",
|
"Scroll up a full page",
|
||||||
function (args) { buffer.scrollVertical("pages", -Math.max(args.count, 1)); },
|
function (args) { buffer.scrollVertical("pages", -Math.max(args.count, 1)); },
|
||||||
{ count: true });
|
{ 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",
|
"Scroll down a full page",
|
||||||
function (args) { buffer.scrollVertical("pages", Math.max(args.count, 1)); },
|
function (args) { buffer.scrollVertical("pages", Math.max(args.count, 1)); },
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
mappings.add(modes.COMMAND, ["]f", "<previous-frame>"],
|
mappings.add([modes.COMMAND], ["]f", "<previous-frame>"],
|
||||||
"Focus next frame",
|
"Focus next frame",
|
||||||
function (args) { buffer.shiftFrameFocus(Math.max(args.count, 1)); },
|
function (args) { buffer.shiftFrameFocus(Math.max(args.count, 1)); },
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
mappings.add(modes.COMMAND, ["[f", "<next-frame>"],
|
mappings.add([modes.COMMAND], ["[f", "<next-frame>"],
|
||||||
"Focus previous frame",
|
"Focus previous frame",
|
||||||
function (args) { buffer.shiftFrameFocus(-Math.max(args.count, 1)); },
|
function (args) { buffer.shiftFrameFocus(-Math.max(args.count, 1)); },
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
mappings.add(modes.COMMAND, ["]]", "<next-page>"],
|
mappings.add([modes.COMMAND], ["]]", "<next-page>"],
|
||||||
"Follow the link labeled 'next' or '>' if it exists",
|
"Follow the link labeled 'next' or '>' if it exists",
|
||||||
function (args) {
|
function (args) {
|
||||||
buffer.findLink("next", options["nextpattern"], (args.count || 1) - 1, true);
|
buffer.findLink("next", options["nextpattern"], (args.count || 1) - 1, true);
|
||||||
},
|
},
|
||||||
{ count: 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",
|
"Follow the link labeled 'prev', 'previous' or '<' if it exists",
|
||||||
function (args) {
|
function (args) {
|
||||||
buffer.findLink("previous", options["previouspattern"], (args.count || 1) - 1, true);
|
buffer.findLink("previous", options["previouspattern"], (args.count || 1) - 1, true);
|
||||||
},
|
},
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
mappings.add(modes.COMMAND, ["gf", "<view-source>"],
|
mappings.add([modes.COMMAND], ["gf", "<view-source>"],
|
||||||
"Toggle between rendered and source view",
|
"Toggle between rendered and source view",
|
||||||
function () { buffer.viewSource(null, false); });
|
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",
|
"View source with an external editor",
|
||||||
function () { buffer.viewSource(null, true); });
|
function () { buffer.viewSource(null, true); });
|
||||||
|
|
||||||
mappings.add(modes.COMMAND, ["gi", "<focus-input>"],
|
mappings.add([modes.COMMAND], ["gi", "<focus-input>"],
|
||||||
"Focus last used input field",
|
"Focus last used input field",
|
||||||
function (args) {
|
function (args) {
|
||||||
let elem = buffer.lastInputField;
|
let elem = buffer.lastInputField;
|
||||||
@@ -1672,15 +1672,15 @@ var Buffer = Module("buffer", {
|
|||||||
},
|
},
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
mappings.add(modes.COMMAND, ["gP"],
|
mappings.add([modes.COMMAND], ["gP"],
|
||||||
"Open (put) a URL based on the current clipboard contents in a new buffer",
|
"Open (]put) a URL based on the current clipboard contents in a new buffer",
|
||||||
function () {
|
function () {
|
||||||
let url = dactyl.clipboardRead();
|
let url = dactyl.clipboardRead();
|
||||||
dactyl.assert(url, "No clipboard data");
|
dactyl.assert(url, "No clipboard data");
|
||||||
dactyl.open(url, { from: "paste", where: dactyl.NEW_TAB, background: true });
|
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",
|
"Open (put) a URL based on the current clipboard contents in the current buffer",
|
||||||
function () {
|
function () {
|
||||||
let url = dactyl.clipboardRead();
|
let url = dactyl.clipboardRead();
|
||||||
@@ -1688,7 +1688,7 @@ var Buffer = Module("buffer", {
|
|||||||
dactyl.open(url);
|
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",
|
"Open (put) a URL based on the current clipboard contents in a new buffer",
|
||||||
function () {
|
function () {
|
||||||
let url = dactyl.clipboardRead();
|
let url = dactyl.clipboardRead();
|
||||||
@@ -1697,16 +1697,16 @@ var Buffer = Module("buffer", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// reloading
|
// reloading
|
||||||
mappings.add(modes.COMMAND, ["r", "<reload>"],
|
mappings.add([modes.COMMAND], ["r", "<reload>"],
|
||||||
"Reload the current web page",
|
"Reload the current web page",
|
||||||
function () { tabs.reload(tabs.getTab(), false); });
|
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",
|
"Reload while skipping the cache",
|
||||||
function () { tabs.reload(tabs.getTab(), true); });
|
function () { tabs.reload(tabs.getTab(), true); });
|
||||||
|
|
||||||
// yanking
|
// yanking
|
||||||
mappings.add(modes.COMMAND, ["Y", "<yank-word>"],
|
mappings.add([modes.COMMAND], ["Y", "<yank-word>"],
|
||||||
"Copy selected text or current word",
|
"Copy selected text or current word",
|
||||||
function () {
|
function () {
|
||||||
let sel = buffer.currentWord;
|
let sel = buffer.currentWord;
|
||||||
@@ -1715,62 +1715,62 @@ var Buffer = Module("buffer", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// zooming
|
// zooming
|
||||||
mappings.add(modes.COMMAND, ["zi", "+", "<text-zoom-in>"],
|
mappings.add([modes.COMMAND], ["zi", "+", "<text-zoom-in>"],
|
||||||
"Enlarge text zoom of current web page",
|
"Enlarge text zoom of current web page",
|
||||||
function (args) { buffer.zoomIn(Math.max(args.count, 1), false); },
|
function (args) { buffer.zoomIn(Math.max(args.count, 1), false); },
|
||||||
{ count: true });
|
{ 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",
|
"Enlarge text zoom of current web page by a larger amount",
|
||||||
function (args) { buffer.zoomIn(Math.max(args.count, 1) * 3, false); },
|
function (args) { buffer.zoomIn(Math.max(args.count, 1) * 3, false); },
|
||||||
{ count: true });
|
{ 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",
|
"Reduce text zoom of current web page",
|
||||||
function (args) { buffer.zoomOut(Math.max(args.count, 1), false); },
|
function (args) { buffer.zoomOut(Math.max(args.count, 1), false); },
|
||||||
{ count: true });
|
{ 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",
|
"Reduce text zoom of current web page by a larger amount",
|
||||||
function (args) { buffer.zoomOut(Math.max(args.count, 1) * 3, false); },
|
function (args) { buffer.zoomOut(Math.max(args.count, 1) * 3, false); },
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
mappings.add(modes.COMMAND, ["zz", "<text-zoom>"],
|
mappings.add([modes.COMMAND], ["zz", "<text-zoom>"],
|
||||||
"Set text zoom value of current web page",
|
"Set text zoom value of current web page",
|
||||||
function (args) { buffer.setZoom(args.count > 1 ? args.count : 100, false); },
|
function (args) { buffer.setZoom(args.count > 1 ? args.count : 100, false); },
|
||||||
{ count: true });
|
{ 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",
|
"Enlarge full zoom of current web page",
|
||||||
function (args) { buffer.zoomIn(Math.max(args.count, 1), true); },
|
function (args) { buffer.zoomIn(Math.max(args.count, 1), true); },
|
||||||
{ count: 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",
|
"Enlarge full zoom of current web page by a larger amount",
|
||||||
function (args) { buffer.zoomIn(Math.max(args.count, 1) * 3, true); },
|
function (args) { buffer.zoomIn(Math.max(args.count, 1) * 3, true); },
|
||||||
{ count: 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",
|
"Reduce full zoom of current web page",
|
||||||
function (args) { buffer.zoomOut(Math.max(args.count, 1), true); },
|
function (args) { buffer.zoomOut(Math.max(args.count, 1), true); },
|
||||||
{ count: 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",
|
"Reduce full zoom of current web page by a larger amount",
|
||||||
function (args) { buffer.zoomOut(Math.max(args.count, 1) * 3, true); },
|
function (args) { buffer.zoomOut(Math.max(args.count, 1) * 3, true); },
|
||||||
{ count: 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",
|
"Set full zoom value of current web page",
|
||||||
function (args) { buffer.setZoom(args.count > 1 ? args.count : 100, true); },
|
function (args) { buffer.setZoom(args.count > 1 ? args.count : 100, true); },
|
||||||
{ count: true });
|
{ count: true });
|
||||||
|
|
||||||
// page info
|
// page info
|
||||||
mappings.add(modes.COMMAND, ["<C-g>", "<page-info>"],
|
mappings.add([modes.COMMAND], ["<C-g>", "<page-info>"],
|
||||||
"Print the current file name",
|
"Print the current file name",
|
||||||
function () { buffer.showPageInfo(false); });
|
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",
|
"Print file information",
|
||||||
function () { buffer.showPageInfo(true); });
|
function () { buffer.showPageInfo(true); });
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1193,7 +1193,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
if (urls.length == 0)
|
if (urls.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let browser = config.browser;
|
let browser = config.tabbrowser;
|
||||||
function open(urls, where) {
|
function open(urls, where) {
|
||||||
try {
|
try {
|
||||||
let url = Array.concat(urls)[0];
|
let url = Array.concat(urls)[0];
|
||||||
@@ -1214,7 +1214,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
case dactyl.NEW_WINDOW:
|
case dactyl.NEW_WINDOW:
|
||||||
let win = window.openDialog(document.documentURI, "_blank", "chrome,all,dialog=no");
|
let win = window.openDialog(document.documentURI, "_blank", "chrome,all,dialog=no");
|
||||||
util.waitFor(function () win.document.readyState === "complete");
|
util.waitFor(function () win.document.readyState === "complete");
|
||||||
browser = win.getBrowser();
|
browser = win.dactyl && win.dactyl.modules.config.tabbrowser || win.getBrowser();
|
||||||
// FALLTHROUGH
|
// FALLTHROUGH
|
||||||
case dactyl.CURRENT_TAB:
|
case dactyl.CURRENT_TAB:
|
||||||
browser.loadURIWithFlags(url, flags, null, null, postdata);
|
browser.loadURIWithFlags(url, flags, null, null, postdata);
|
||||||
@@ -1278,12 +1278,12 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
return url.replace(/\s+/g, "");
|
return url.replace(/\s+/g, "");
|
||||||
|
|
||||||
// Check for a matching search keyword.
|
// Check for a matching search keyword.
|
||||||
let searchURL = bookmarks.getSearchURL(url, false);
|
let searchURL = loaded.bookmarks && bookmarks.getSearchURL(url, false);
|
||||||
if (searchURL)
|
if (searchURL)
|
||||||
return searchURL;
|
return searchURL;
|
||||||
|
|
||||||
// If it looks like URL-ish (foo.com/bar), let Gecko figure it out.
|
// 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;
|
return util.createURI(url).spec;
|
||||||
|
|
||||||
// Pass it off to the default search engine or, failing
|
// 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);
|
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
|
if (services.has("privateBrowsing")) {
|
||||||
// : make this a config feature
|
|
||||||
if (services.privateBrowsing) {
|
|
||||||
let oldValue = win.getAttribute("titlemodifier_normal");
|
let oldValue = win.getAttribute("titlemodifier_normal");
|
||||||
let suffix = win.getAttribute("titlemodifier_privatebrowsing").substr(oldValue.length);
|
let suffix = win.getAttribute("titlemodifier_privatebrowsing").substr(oldValue.length);
|
||||||
|
|
||||||
|
|||||||
@@ -30,9 +30,9 @@
|
|||||||
*/
|
*/
|
||||||
var Map = Class("Map", {
|
var Map = Class("Map", {
|
||||||
init: function (modes, keys, description, action, extraInfo) {
|
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))
|
if (!modes.every(util.identity))
|
||||||
throw Error("Invalid modes");
|
throw TypeError("Invalid modes: " + modes);
|
||||||
|
|
||||||
this.id = ++Map.id;
|
this.id = ++Map.id;
|
||||||
this.modes = modes;
|
this.modes = modes;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
/** @scope modules */
|
/** @scope modules */
|
||||||
|
|
||||||
var StatusLine = Module("statusline", {
|
var StatusLine = Module("statusline", {
|
||||||
init: function () {
|
init: function init() {
|
||||||
this._statusLine = document.getElementById("status-bar");
|
this._statusLine = document.getElementById("status-bar");
|
||||||
this.statusBar = document.getElementById("addon-bar") || this._statusLine;
|
this.statusBar = document.getElementById("addon-bar") || this._statusLine;
|
||||||
this.statusBar.collapsed = true;
|
this.statusBar.collapsed = true;
|
||||||
@@ -23,6 +23,8 @@ var StatusLine = Module("statusline", {
|
|||||||
#addon-bar > xul|toolbarspring { visibility: collapse; }
|
#addon-bar > xul|toolbarspring { visibility: collapse; }
|
||||||
]]></css>);
|
]]></css>);
|
||||||
|
|
||||||
|
util.overlayWindow(window, { append: <><statusbar id="status-bar" ordinal="0"/></> });
|
||||||
|
|
||||||
highlight.loadCSS(util.compileMacro(<![CDATA[
|
highlight.loadCSS(util.compileMacro(<![CDATA[
|
||||||
!AddonBar;#addon-bar {
|
!AddonBar;#addon-bar {
|
||||||
padding-left: 0 !important;
|
padding-left: 0 !important;
|
||||||
@@ -50,7 +52,7 @@ var StatusLine = Module("statusline", {
|
|||||||
let prepend = <e4x xmlns={XUL} xmlns:dactyl={NS}>
|
let prepend = <e4x xmlns={XUL} xmlns:dactyl={NS}>
|
||||||
<button id="appmenu-button" label="" image="chrome://branding/content/icon16.png" highlight="AppmenuButton" />
|
<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" />
|
<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;" -->
|
<!-- insertbefore="dactyl.statusBefore;" insertafter="dactyl.statusAfter;" -->
|
||||||
<hbox key="container" hidden="false" align="center" flex="1">
|
<hbox key="container" hidden="false" align="center" flex="1">
|
||||||
<stack orient="horizontal" align="stretch" flex="1" highlight="CmdLine StatusCmdLine" class="dactyl-container">
|
<stack orient="horizontal" align="stretch" flex="1" highlight="CmdLine StatusCmdLine" class="dactyl-container">
|
||||||
@@ -82,7 +84,10 @@ var StatusLine = Module("statusline", {
|
|||||||
prepend: prepend.elements()
|
prepend: prepend.elements()
|
||||||
});
|
});
|
||||||
|
|
||||||
this.security = content.document.dactylSecurity || "insecure";
|
try {
|
||||||
|
this.security = content.document.dactylSecurity || "insecure";
|
||||||
|
}
|
||||||
|
catch (e) {}
|
||||||
},
|
},
|
||||||
|
|
||||||
get visible() !this.statusBar.collapsed && !this.statusBar.hidden,
|
get visible() !this.statusBar.collapsed && !this.statusBar.hidden,
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
var Tabs = Module("tabs", {
|
var Tabs = Module("tabs", {
|
||||||
init: function () {
|
init: function () {
|
||||||
this._alternates = [config.tabbrowser.mCurrentTab, null];
|
|
||||||
|
|
||||||
// used for the "gb" and "gB" mappings to remember the last :buffer[!] command
|
// used for the "gb" and "gB" mappings to remember the last :buffer[!] command
|
||||||
this._lastBufferSwitchArgs = "";
|
this._lastBufferSwitchArgs = "";
|
||||||
this._lastBufferSwitchSpecial = true;
|
this._lastBufferSwitchSpecial = true;
|
||||||
@@ -27,9 +25,9 @@ var Tabs = Module("tabs", {
|
|||||||
config.tabStrip.collapsed = true;
|
config.tabStrip.collapsed = true;
|
||||||
|
|
||||||
this.tabStyle = styles.system.add("tab-strip-hiding", config.styleableChrome,
|
this.tabStyle = styles.system.add("tab-strip-hiding", config.styleableChrome,
|
||||||
(config.tabStrip.id ? "#" + config.tabStrip.id : ".tabbrowser-strip") +
|
(config.tabStrip.id ? "#" + config.tabStrip.id : ".tabbrowser-strip") +
|
||||||
"{ visibility: collapse; }",
|
"{ visibility: collapse; }",
|
||||||
false, true);
|
false, true);
|
||||||
|
|
||||||
dactyl.commands["tabs.select"] = function (event) {
|
dactyl.commands["tabs.select"] = function (event) {
|
||||||
tabs.select(event.originalTarget.getAttribute("identifier"));
|
tabs.select(event.originalTarget.getAttribute("identifier"));
|
||||||
@@ -47,6 +45,8 @@ var Tabs = Module("tabs", {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_alternates: Class.memoize(function () [config.tabbrowser.mCurrentTab, null]),
|
||||||
|
|
||||||
cleanup: function cleanup() {
|
cleanup: function cleanup() {
|
||||||
for (let [i, tab] in Iterator(this.allTabs)) {
|
for (let [i, tab] in Iterator(this.allTabs)) {
|
||||||
let node = function node(class_) document.getAnonymousElementByAttribute(tab, "class", class_);
|
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");
|
Components.utils.import("resource://gre/modules/AddonManager.jsm");
|
||||||
else
|
else
|
||||||
var AddonManager = {
|
var AddonManager = {
|
||||||
|
|||||||
@@ -873,7 +873,7 @@ Class.prototype = {
|
|||||||
return services.Timer(timeout_notify, timeout || 0, services.Timer.TYPE_ONE_SHOT);
|
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;
|
const self = this;
|
||||||
function closure(fn) function _closure() {
|
function closure(fn) function _closure() {
|
||||||
try {
|
try {
|
||||||
@@ -896,7 +896,8 @@ memoize(Class.prototype, "closure", function closure() {
|
|||||||
});
|
});
|
||||||
}, this);
|
}, this);
|
||||||
return closure;
|
return closure;
|
||||||
});
|
};
|
||||||
|
memoize(Class.prototype, "closure", Class.makeClosure);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A base class generator for classes which implement XPCOM interfaces.
|
* A base class generator for classes which implement XPCOM interfaces.
|
||||||
|
|||||||
@@ -151,6 +151,8 @@ var ConfigBase = Class("ConfigBase", {
|
|||||||
return version;
|
return version;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
get fileExt() this.name.slice(0, -5),
|
||||||
|
|
||||||
dtd: memoize({
|
dtd: memoize({
|
||||||
get name() config.name,
|
get name() config.name,
|
||||||
get home() "http://dactyl.sourceforge.net/",
|
get home() "http://dactyl.sourceforge.net/",
|
||||||
@@ -243,8 +245,6 @@ var ConfigBase = Class("ConfigBase", {
|
|||||||
*/
|
*/
|
||||||
autocommands: {},
|
autocommands: {},
|
||||||
|
|
||||||
commandContainer: "browser-bottombox",
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {Object} A map of :command-complete option values to completer
|
* @property {Object} A map of :command-complete option values to completer
|
||||||
* function names.
|
* function names.
|
||||||
@@ -350,6 +350,8 @@ var ConfigBase = Class("ConfigBase", {
|
|||||||
*/
|
*/
|
||||||
scripts: [],
|
scripts: [],
|
||||||
|
|
||||||
|
sidebars: {},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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}.
|
||||||
|
|||||||
@@ -166,8 +166,10 @@ var RangeFinder = Module("rangefinder", {
|
|||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
}, {
|
}, {
|
||||||
modes: function (dactyl, modules, window) {
|
modes: function initModes(dactyl, modules, window) {
|
||||||
const { modes } = modules;
|
const { modes } = modules;
|
||||||
|
initModes.superapply("commandline", arguments);
|
||||||
|
|
||||||
modes.addMode("FIND", {
|
modes.addMode("FIND", {
|
||||||
description: "Find mode, active when typing search input",
|
description: "Find mode, active when typing search input",
|
||||||
bases: [modes.COMMAND_LINE],
|
bases: [modes.COMMAND_LINE],
|
||||||
@@ -181,14 +183,14 @@ var RangeFinder = Module("rangefinder", {
|
|||||||
bases: [modes.FIND]
|
bases: [modes.FIND]
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
commands: function (dactyl, modules, window) {
|
commands: function initCommands(dactyl, modules, window) {
|
||||||
const { commands, rangefinder } = modules;
|
const { commands, rangefinder } = modules;
|
||||||
commands.add(["noh[lfind]"],
|
commands.add(["noh[lfind]"],
|
||||||
"Remove the find highlighting",
|
"Remove the find highlighting",
|
||||||
function () { rangefinder.clear(); },
|
function () { rangefinder.clear(); },
|
||||||
{ argCount: "0" });
|
{ argCount: "0" });
|
||||||
},
|
},
|
||||||
commandline: function (dactyl, modules, window) {
|
commandline: function initCommandline(dactyl, modules, window) {
|
||||||
const { rangefinder } = modules;
|
const { rangefinder } = modules;
|
||||||
rangefinder.CommandMode = Class("CommandFindMode", modules.CommandMode, {
|
rangefinder.CommandMode = Class("CommandFindMode", modules.CommandMode, {
|
||||||
init: function init(mode) {
|
init: function init(mode) {
|
||||||
|
|||||||
@@ -69,7 +69,10 @@ var Option = Class("Option", {
|
|||||||
if (extraInfo)
|
if (extraInfo)
|
||||||
update(this, 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")
|
if (this.type == "string")
|
||||||
defaultValue = Commands.quote(defaultValue);
|
defaultValue = Commands.quote(defaultValue);
|
||||||
|
|
||||||
|
|||||||
@@ -27,13 +27,13 @@ var ModuleBase = Class("ModuleBase", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
var Overlay = Module("Overlay", {
|
var Overlay = Module("Overlay", {
|
||||||
init: function () {
|
init: function init() {
|
||||||
services["dactyl:"]; // Hack. Force module initialization.
|
services["dactyl:"]; // Hack. Force module initialization.
|
||||||
|
|
||||||
config.loadStyles();
|
config.loadStyles();
|
||||||
|
|
||||||
util.overlayWindow(config.overlayChrome, function (window) ({
|
util.overlayWindow(config.overlayChrome, function overlay(window) ({
|
||||||
init: function (document) {
|
init: function onInit(document) {
|
||||||
/**
|
/**
|
||||||
* @constructor Module
|
* @constructor Module
|
||||||
*
|
*
|
||||||
@@ -187,48 +187,20 @@ var Overlay = Module("Overlay", {
|
|||||||
"mow",
|
"mow",
|
||||||
"statusline"
|
"statusline"
|
||||||
].forEach(function (name) defineModule.time("load", name, modules.load, modules, name));
|
].forEach(function (name) defineModule.time("load", name, modules.load, modules, name));
|
||||||
|
|
||||||
config.scripts.forEach(modules.load);
|
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
load: function (document) {
|
load: function onLoad(document) {
|
||||||
|
// This is getting to be horrible. --Kris
|
||||||
|
|
||||||
var { modules, Module } = window.dactyl.modules;
|
var { modules, Module } = window.dactyl.modules;
|
||||||
delete window.dactyl;
|
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 start = Date.now();
|
||||||
const deferredInit = { load: [] };
|
const deferredInit = { load: {} };
|
||||||
const seen = set();
|
const seen = set();
|
||||||
const loaded = set();
|
const loaded = set();
|
||||||
modules.loaded = loaded;
|
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) {
|
function load(module, prereq, frame) {
|
||||||
if (isString(module)) {
|
if (isString(module)) {
|
||||||
if (!Module.constructors.hasOwnProperty(module))
|
if (!Module.constructors.hasOwnProperty(module))
|
||||||
@@ -255,8 +227,6 @@ var Overlay = Module("Overlay", {
|
|||||||
loaded[module.className] = true;
|
loaded[module.className] = true;
|
||||||
|
|
||||||
frob(module.className);
|
frob(module.className);
|
||||||
|
|
||||||
// init(modules[module.className]);
|
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
util.dump("Loading " + (module && module.className) + ":");
|
util.dump("Loading " + (module && module.className) + ":");
|
||||||
@@ -265,36 +235,48 @@ var Overlay = Module("Overlay", {
|
|||||||
return modules[module.className];
|
return modules[module.className];
|
||||||
}
|
}
|
||||||
|
|
||||||
Module.list.forEach(function (mod) {
|
function deferInit(name, INIT, mod) {
|
||||||
Object.keys(mod.prototype.INIT).forEach(function (name) {
|
let init = deferredInit[name] = deferredInit[name] || {};
|
||||||
deferredInit[name] = deferredInit[name] || [];
|
let className = mod.className || mod.constructor.className;
|
||||||
deferredInit[name].push(function () {
|
|
||||||
// util.dump("INIT: " + mod.className + ":" + name);
|
init[className] = function callee() {
|
||||||
defineModule.time(mod.className, name,
|
if (!callee.frobbed)
|
||||||
name, mod.prototype.INIT,
|
defineModule.time(className, name, INIT[name], mod,
|
||||||
modules.dactyl, modules, window);
|
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));
|
let names = set(Object.keys(mod.INIT));
|
||||||
if ("init" in mod.INIT)
|
if ("init" in mod.INIT)
|
||||||
set.add(names, "init");
|
set.add(names, "init");
|
||||||
|
|
||||||
keys(names).forEach(function (name) {
|
keys(names).forEach(function (name) { deferInit(name, mod.INIT, mod); });
|
||||||
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);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function frob(name) { (deferredInit[name] || []).forEach(call); }
|
function frob(name) { values(deferredInit[name] || {}).forEach(call); }
|
||||||
|
|
||||||
|
frobModules();
|
||||||
frob("init");
|
frob("init");
|
||||||
|
modules.config.scripts.forEach(modules.load);
|
||||||
|
frobModules();
|
||||||
|
|
||||||
defineModule.modules.forEach(function ({ lazyInit, constructor: { className } }) {
|
defineModule.modules.forEach(function ({ lazyInit, constructor: { className } }) {
|
||||||
if (!lazyInit) {
|
if (!lazyInit) {
|
||||||
frob(className);
|
frob(className);
|
||||||
@@ -316,10 +298,13 @@ var Overlay = Module("Overlay", {
|
|||||||
|
|
||||||
modules.events.listen(window, "unload", function onUnload() {
|
modules.events.listen(window, "unload", function onUnload() {
|
||||||
window.removeEventListener("unload", onUnload.wrapped, false);
|
window.removeEventListener("unload", onUnload.wrapped, false);
|
||||||
|
|
||||||
for (let prop in properties(modules)) {
|
for (let prop in properties(modules)) {
|
||||||
let mod = Object.getOwnPropertyDescriptor(modules, prop).value;
|
let mod = Object.getOwnPropertyDescriptor(modules, prop).value;
|
||||||
|
|
||||||
if (mod instanceof ModuleBase || mod && mod.isLocalModule) {
|
if (mod instanceof ModuleBase || mod && mod.isLocalModule) {
|
||||||
mod.stale = true;
|
mod.stale = true;
|
||||||
|
|
||||||
if ("destroy" in mod)
|
if ("destroy" in mod)
|
||||||
util.trapErrors("destroy", mod);
|
util.trapErrors("destroy", mod);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,13 +114,14 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
|||||||
},
|
},
|
||||||
override: true
|
override: true
|
||||||
});
|
});
|
||||||
this.addItem("host", {
|
if (services.has("privateBrowsing"))
|
||||||
description: "All data from the given host",
|
this.addItem("host", {
|
||||||
action: function (range, host) {
|
description: "All data from the given host",
|
||||||
if (host)
|
action: function (range, host) {
|
||||||
services.privateBrowsing.removeDataFromDomain(host);
|
if (host)
|
||||||
}
|
services.privateBrowsing.removeDataFromDomain(host);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
this.addItem("sitesettings", {
|
this.addItem("sitesettings", {
|
||||||
builtin: true,
|
builtin: true,
|
||||||
description: "Site preferences",
|
description: "Site preferences",
|
||||||
@@ -547,7 +548,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
|||||||
},
|
},
|
||||||
options: function (dactyl, modules) {
|
options: function (dactyl, modules) {
|
||||||
const options = modules.options;
|
const options = modules.options;
|
||||||
if (services.privateBrowsing)
|
if (services.has("privateBrowsing"))
|
||||||
options.add(["private", "pornmode"],
|
options.add(["private", "pornmode"],
|
||||||
"Set the 'private browsing' option",
|
"Set the 'private browsing' option",
|
||||||
"boolean", false,
|
"boolean", false,
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ defineModule("services", {
|
|||||||
*/
|
*/
|
||||||
var Services = Module("Services", {
|
var Services = Module("Services", {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.classes = {};
|
|
||||||
this.services = {};
|
this.services = {};
|
||||||
|
|
||||||
this.add("annotation", "@mozilla.org/browser/annotation-service;1", Ci.nsIAnnotationService);
|
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) {
|
add: function (name, class_, ifaces, meth) {
|
||||||
const self = this;
|
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))
|
if (name in this && ifaces && !this.__lookupGetter__(name) && !(this[name] instanceof Ci.nsISupports))
|
||||||
throw TypeError();
|
throw TypeError();
|
||||||
memoize(this, name, function () self._create(class_, ifaces, meth));
|
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.
|
* @param {string} name The service's cache key.
|
||||||
*/
|
*/
|
||||||
get: function (name) this[name],
|
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) {
|
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.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)
|
if (error.noTrace)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (isString(error))
|
||||||
|
error = Error(error);
|
||||||
|
|
||||||
if (Cu.reportError)
|
if (Cu.reportError)
|
||||||
Cu.reportError(error);
|
Cu.reportError(error);
|
||||||
|
|
||||||
|
|||||||
@@ -156,8 +156,11 @@ statusbarpanel {
|
|||||||
.statusbar-resizerpanel {
|
.statusbar-resizerpanel {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#statusbar-display, #statusbar-progresspanel {
|
#statusbar-display,
|
||||||
|
#statusbar-progresspanel,
|
||||||
|
#status-bar > #statusTextBox > #statusText {
|
||||||
display: none;
|
display: none;
|
||||||
|
visibility: collapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dactyl-commandline-prompt {
|
.dactyl-commandline-prompt {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# Firefox
|
|
||||||
resource dactyl-local-content content/
|
resource dactyl-local-content content/
|
||||||
resource dactyl-local-skin skin/
|
resource dactyl-local-skin skin/
|
||||||
resource dactyl-local-locale locale/
|
resource dactyl-local-locale locale/
|
||||||
|
|||||||
@@ -10,10 +10,11 @@ var Config = Module("config", ConfigBase, {
|
|||||||
name: "pentadactyl",
|
name: "pentadactyl",
|
||||||
appName: "Pentadactyl",
|
appName: "Pentadactyl",
|
||||||
idName: "PENTADACTYL",
|
idName: "PENTADACTYL",
|
||||||
fileExt: "penta",
|
|
||||||
host: "Firefox",
|
host: "Firefox",
|
||||||
hostbin: "firefox",
|
hostbin: "firefox",
|
||||||
|
|
||||||
|
commandContainer: "browser-bottombox",
|
||||||
|
|
||||||
Local: function Local(dactyl, modules, window)
|
Local: function Local(dactyl, modules, window)
|
||||||
let ({ config } = modules) ({
|
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
|
resource dactyl-local-content content/
|
||||||
content teledactyl content/
|
resource dactyl-local-skin skin/
|
||||||
skin teledactyl classic/1.0 skin/
|
resource dactyl-local-locale locale/
|
||||||
locale dactyl en-US locale/en-US/
|
|
||||||
|
|
||||||
content dactyl ../common/content/
|
|
||||||
resource dactyl ../common/modules/
|
resource dactyl ../common/modules/
|
||||||
skin dactyl classic/1.0 ../common/skin/
|
resource dactyl-content ../common/content/
|
||||||
|
resource dactyl-skin ../common/skin/
|
||||||
|
resource dactyl-locale ../common/locale/
|
||||||
|
|
||||||
override chrome://dactyl/content/dactyl.dtd chrome://teledactyl/content/dactyl.dtd
|
content dactyl ../common/content/
|
||||||
|
|
||||||
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
|
component {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69} components/commandline-handler.js
|
||||||
contract @mozilla.org/commandlinehandler/general-startup;1?type=dactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}
|
contract @mozilla.org/commandlinehandler/general-startup;1?type=dactyl {16dc34f7-6d22-4aa4-a67f-2921fb5dcb69}
|
||||||
|
|||||||
@@ -4,101 +4,80 @@
|
|||||||
// given in the LICENSE.txt file included with this file.
|
// given in the LICENSE.txt file included with this file.
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function Compose() { //{{{
|
var Compose = Module("compose", {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
init: function init() {
|
||||||
////////////////////// PRIVATE SECTION /////////////////////////////////////////
|
var stateListener = {
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
QueryInterface: function (id) {
|
||||||
|
if (id.equals(Ci.nsIDocumentStateListener))
|
||||||
|
return this;
|
||||||
|
throw Cr.NS_NOINTERFACE;
|
||||||
|
},
|
||||||
|
|
||||||
config.features = ["addressbook"]; // the composer has no special features
|
// this is (also) fired once the new compose window loaded the message for the first time
|
||||||
|
NotifyDocumentStateChanged: function (nowDirty) {
|
||||||
|
// only edit with external editor if this window was not cached!
|
||||||
|
if (options["autoexternal"] && !window.messageWasEditedExternally/* && !gMsgCompose.recycledWindow*/) {
|
||||||
|
window.messageWasEditedExternally = true;
|
||||||
|
editor.editFieldExternally();
|
||||||
|
}
|
||||||
|
|
||||||
var stateListener = {
|
},
|
||||||
QueryInterface: function (id) {
|
NotifyDocumentCreated: function () {},
|
||||||
if (id.equals(Ci.nsIDocumentStateListener))
|
NotifyDocumentWillBeDestroyed: function () {}
|
||||||
return this;
|
};
|
||||||
throw Cr.NS_NOINTERFACE;
|
|
||||||
},
|
|
||||||
|
|
||||||
// this is (also) fired once the new compose window loaded the message for the first time
|
events.listen(window.document, "load", function () {
|
||||||
NotifyDocumentStateChanged: function (nowDirty) {
|
if (window.messageWasEditedExternally === undefined) {
|
||||||
// only edit with external editor if this window was not cached!
|
window.messageWasEditedExternally = false;
|
||||||
if (options["autoexternal"] && !window.messageWasEditedExternally/* && !gMsgCompose.recycledWindow*/) {
|
GetCurrentEditor().addDocumentStateListener(stateListener);
|
||||||
window.messageWasEditedExternally = true;
|
}
|
||||||
editor.editFieldExternally();
|
}, true);
|
||||||
}
|
|
||||||
|
|
||||||
},
|
events.listen(window, "compose-window-close", function () {
|
||||||
NotifyDocumentCreated: function () {},
|
|
||||||
NotifyDocumentWillBeDestroyed: function () {}
|
|
||||||
};
|
|
||||||
|
|
||||||
// XXX: Hack!
|
|
||||||
window.document.addEventListener("load", function () {
|
|
||||||
if (window.messageWasEditedExternally === undefined) {
|
|
||||||
window.messageWasEditedExternally = false;
|
window.messageWasEditedExternally = false;
|
||||||
GetCurrentEditor().addDocumentStateListener(stateListener);
|
}, true);
|
||||||
}
|
}
|
||||||
}, true);
|
}, {
|
||||||
|
}, {
|
||||||
|
mappings: function initMappings(dactyl, modules, window) {
|
||||||
|
mappings.add([modes.COMPOSE],
|
||||||
|
["e"], "Edit message",
|
||||||
|
function () { editor.editFieldExternally(); });
|
||||||
|
|
||||||
window.addEventListener("compose-window-close", function () {
|
mappings.add([modes.COMPOSE],
|
||||||
window.messageWasEditedExternally = false;
|
["y"], "Send message now",
|
||||||
}, true);
|
function () { window.goDoCommand("cmd_sendNow"); });
|
||||||
|
|
||||||
/*window.document.addEventListener("unload", function () {
|
mappings.add([modes.COMPOSE],
|
||||||
GetCurrentEditor().removeDocumentStateListener(config.stateListener);
|
["Y"], "Send message later",
|
||||||
}, true);*/
|
function () { window.goDoCommand("cmd_sendLater"); });
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
// FIXME: does not really work reliably
|
||||||
////////////////////// OPTIONS /////////////////////////////////////////////////
|
mappings.add([modes.COMPOSE],
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
["t"], "Select To: field",
|
||||||
|
function () { awSetFocus(0, awGetInputElement(1)); });
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
mappings.add([modes.COMPOSE],
|
||||||
////////////////////// MAPPINGS ////////////////////////////////////////////////
|
["s"], "Select Subject: field",
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
function () { GetMsgSubjectElement().focus(); });
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
mappings.add([modes.COMPOSE],
|
||||||
////////////////////// COMMANDS ////////////////////////////////////////////////
|
["i"], "Select message body",
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
function () { SetMsgBodyFrameFocus(); });
|
||||||
|
|
||||||
mappings.add([modes.COMPOSE],
|
mappings.add([modes.COMPOSE],
|
||||||
["e"], "Edit message",
|
["q"], "Close composer, ask when for unsaved changes",
|
||||||
function () { editor.editFieldExternally(); });
|
function () { DoCommandClose(); });
|
||||||
|
|
||||||
mappings.add([modes.COMPOSE],
|
mappings.add([modes.COMPOSE],
|
||||||
["y"], "Send message now",
|
["Q", "ZQ"], "Force closing composer",
|
||||||
function () { window.goDoCommand("cmd_sendNow"); });
|
function () { MsgComposeCloseWindow(true); /* cache window for better performance*/ });
|
||||||
|
},
|
||||||
mappings.add([modes.COMPOSE],
|
modes: function initModes(dactyl, modules, window) {
|
||||||
["Y"], "Send message later",
|
modes.addMode("COMPOSE", {
|
||||||
function () { window.goDoCommand("cmd_sendLater"); });
|
insert: true
|
||||||
|
});
|
||||||
// FIXME: does not really work reliably
|
}
|
||||||
mappings.add([modes.COMPOSE],
|
})
|
||||||
["t"], "Select To: field",
|
|
||||||
function () { awSetFocus(0, awGetInputElement(1)); });
|
|
||||||
|
|
||||||
mappings.add([modes.COMPOSE],
|
|
||||||
["s"], "Select Subject: field",
|
|
||||||
function () { GetMsgSubjectElement().focus(); });
|
|
||||||
|
|
||||||
mappings.add([modes.COMPOSE],
|
|
||||||
["i"], "Select message body",
|
|
||||||
function () { SetMsgBodyFrameFocus(); });
|
|
||||||
|
|
||||||
mappings.add([modes.COMPOSE],
|
|
||||||
["q"], "Close composer, ask when for unsaved changes",
|
|
||||||
function () { DoCommandClose(); });
|
|
||||||
|
|
||||||
mappings.add([modes.COMPOSE],
|
|
||||||
["Q", "ZQ"], "Force closing composer",
|
|
||||||
function () { MsgComposeCloseWindow(true); /* cache window for better performance*/ });
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
|
||||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
|
||||||
/////////////////////////////////////////////////////////////////////////////{{{
|
|
||||||
|
|
||||||
return {};
|
|
||||||
|
|
||||||
//}}}
|
|
||||||
} //}}}
|
|
||||||
|
|
||||||
// vim: set fdm=marker sw=4 ts=4 et:
|
// vim: set fdm=marker sw=4 ts=4 et:
|
||||||
|
|||||||
@@ -5,10 +5,119 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const Config = Module("config", ConfigBase, {
|
const Config = Module("config", ConfigBase, {
|
||||||
init: function init() {
|
name: "teledactyl",
|
||||||
init.supercall(this);
|
appName: "Teledactyl",
|
||||||
// don't wait too long when selecting new messages
|
idName: "TELEDACTYL",
|
||||||
// GetThreadTree()._selectDelay = 300; // TODO: make configurable
|
host: "Thunderbird",
|
||||||
|
hostbin: "thunderbird",
|
||||||
|
|
||||||
|
Local: function Local(dactyl, modules, window)
|
||||||
|
let ({ config } = modules, { document } = window) {
|
||||||
|
init: function init() {
|
||||||
|
init.superapply(this, arguments);
|
||||||
|
|
||||||
|
modules.__defineGetter__("content", function () window.content);
|
||||||
|
|
||||||
|
util.overlayWindow(window, { append: <><hbox id="statusTextBox" flex=""/></> });
|
||||||
|
},
|
||||||
|
|
||||||
|
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 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)),
|
||||||
|
|
||||||
|
dialogs: {
|
||||||
|
about: ["About Thunderbird",
|
||||||
|
function () { window.openAboutDialog(); }],
|
||||||
|
addons: ["Manage Add-ons",
|
||||||
|
function () { window.openAddonsMgr(); }],
|
||||||
|
addressbook: ["Address book",
|
||||||
|
function () { window.toAddressBook(); }],
|
||||||
|
checkupdates: ["Check for updates",
|
||||||
|
function () { window.checkForUpdates(); }],
|
||||||
|
console: ["JavaScript console",
|
||||||
|
function () { window.toJavaScriptConsole(); }],
|
||||||
|
dominspector: ["DOM Inspector",
|
||||||
|
function () { window.inspectDOMDocument(content.document); }],
|
||||||
|
downloads: ["Manage Downloads",
|
||||||
|
function () { window.toOpenWindowByType('Download:Manager', 'chrome://mozapps/content/downloads/downloads.xul', 'chrome,dialog=no,resizable'); }],
|
||||||
|
preferences: ["Show Thunderbird preferences dialog",
|
||||||
|
function () { window.openOptionsDialog(); }],
|
||||||
|
printsetup: ["Setup the page size and orientation before printing",
|
||||||
|
function () { window.PrintUtils.showPageSetup(); }],
|
||||||
|
print: ["Show print dialog",
|
||||||
|
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: {
|
autocommands: {
|
||||||
@@ -21,55 +130,17 @@ const Config = Module("config", ConfigBase, {
|
|||||||
LeavePre: "Triggered before exiting Thunderbird"
|
LeavePre: "Triggered before exiting Thunderbird"
|
||||||
},
|
},
|
||||||
|
|
||||||
get browser() getBrowser(),
|
|
||||||
|
|
||||||
completers: Class.memoize(function () update({ mailfolder: "mailFolder" }, this.__proto__.completers)),
|
|
||||||
|
|
||||||
dialogs: {
|
|
||||||
about: ["About Thunderbird",
|
|
||||||
function () { window.openAboutDialog(); }],
|
|
||||||
addons: ["Manage Add-ons",
|
|
||||||
function () { window.openAddonsMgr(); }],
|
|
||||||
addressbook: ["Address book",
|
|
||||||
function () { window.toAddressBook(); }],
|
|
||||||
checkupdates: ["Check for updates",
|
|
||||||
function () { window.checkForUpdates(); }],
|
|
||||||
console: ["JavaScript console",
|
|
||||||
function () { window.toJavaScriptConsole(); }],
|
|
||||||
dominspector: ["DOM Inspector",
|
|
||||||
function () { window.inspectDOMDocument(content.document); }],
|
|
||||||
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(); }],
|
|
||||||
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); }],
|
|
||||||
},
|
|
||||||
|
|
||||||
defaults: {
|
defaults: {
|
||||||
guioptions: "bfrs",
|
guioptions: "bCfrs",
|
||||||
|
complete: "f",
|
||||||
showtabline: 1,
|
showtabline: 1,
|
||||||
titlestring: "Teledactyl"
|
titlestring: "Teledactyl"
|
||||||
},
|
},
|
||||||
|
|
||||||
/*** optional options, there are checked for existence and a fallback provided ***/
|
/*** optional options, there are checked for existence and a fallback provided ***/
|
||||||
features: ["hints", "mail", "marks", "addressbook", "tabs"],
|
features: Class.memoize(function () set(
|
||||||
|
this.isComposeWindow ? ["addressbook"]
|
||||||
focusChange: function (win) {
|
: ["hints", "mail", "marks", "addressbook", "tabs"])),
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
guioptions: {
|
guioptions: {
|
||||||
m: ["MenuBar", ["mail-toolbar-menubar2"]],
|
m: ["MenuBar", ["mail-toolbar-menubar2"]],
|
||||||
@@ -81,74 +152,37 @@ const Config = Module("config", ConfigBase, {
|
|||||||
// they are sorted by relevance, not alphabetically
|
// they are sorted by relevance, not alphabetically
|
||||||
helpFiles: ["intro.html", "version.html"],
|
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: [
|
modes: [
|
||||||
["MESSAGE", { char: "m" }],
|
["MESSAGE", { char: "m" }],
|
||||||
["COMPOSE"]
|
["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 scripts() this.isComposeWindow ? ["compose/compose"] : [
|
||||||
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"] : [
|
|
||||||
"addressbook",
|
"addressbook",
|
||||||
"mail",
|
"mail",
|
||||||
"tabs",
|
"tabs",
|
||||||
],
|
],
|
||||||
|
|
||||||
|
overlayChrome: ["chrome://messenger/content/messenger.xul",
|
||||||
|
"chrome://messenger/content/messengercompose/messengercompose.xul"],
|
||||||
styleableChrome: ["chrome://messenger/content/messenger.xul",
|
styleableChrome: ["chrome://messenger/content/messenger.xul",
|
||||||
"chrome://messenger/content/messengercompose/messengercompose.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
|
// 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"],
|
commands.add(["pref[erences]", "prefs"],
|
||||||
"Show " + config.host + " preferences",
|
"Show " + config.host + " preferences",
|
||||||
function () { window.openOptionsDialog(); },
|
function () { window.openOptionsDialog(); },
|
||||||
{ argCount: "0" });
|
{ argCount: "0" });
|
||||||
},
|
},
|
||||||
modes: function () {
|
modes: function initModes(dactyl, modules, window) {
|
||||||
|
const { modes } = modules;
|
||||||
|
|
||||||
this.ignoreKeys = {
|
this.ignoreKeys = {
|
||||||
"<Return>": modes.NORMAL | modes.INSERT,
|
"<Return>": modes.NORMAL | modes.INSERT,
|
||||||
"<Space>": modes.NORMAL | modes.INSERT,
|
"<Space>": modes.NORMAL | modes.INSERT,
|
||||||
@@ -156,7 +190,9 @@ const Config = Module("config", ConfigBase, {
|
|||||||
"<Down>": modes.NORMAL | modes.INSERT
|
"<Down>": modes.NORMAL | modes.INSERT
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
options: function () {
|
options: function initOptions(dactyl, modules, window) {
|
||||||
|
const { options } = modules;
|
||||||
|
|
||||||
// FIXME: comment obviously incorrect
|
// FIXME: comment obviously incorrect
|
||||||
// 0: never automatically edit externally
|
// 0: never automatically edit externally
|
||||||
// 1: automatically edit externally when message window is shown the first time
|
// 1: automatically edit externally when message window is shown the first time
|
||||||
@@ -170,11 +206,11 @@ const Config = Module("config", ConfigBase, {
|
|||||||
"boolean", true,
|
"boolean", true,
|
||||||
{
|
{
|
||||||
setter: function (value) {
|
setter: function (value) {
|
||||||
if (MailOfflineMgr.isOnline() != value)
|
if (window.MailOfflineMgr.isOnline() != value)
|
||||||
MailOfflineMgr.toggleOfflineStatus();
|
window.MailOfflineMgr.toggleOfflineStatus();
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
getter: function () MailOfflineMgr.isOnline()
|
getter: function () window.MailOfflineMgr.isOnline()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,9 +5,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
const Mail = Module("mail", {
|
const Mail = Module("mail", {
|
||||||
init: function () {
|
init: function init() {
|
||||||
services.add("smtpService", "@mozilla.org/messengercompose/smtp;1", Ci.nsISmtpService);
|
|
||||||
|
|
||||||
// used for asynchronously selecting messages after wrapping folders
|
// used for asynchronously selecting messages after wrapping folders
|
||||||
this._selectMessageKeys = [];
|
this._selectMessageKeys = [];
|
||||||
this._selectMessageCount = 1;
|
this._selectMessageCount = 1;
|
||||||
@@ -133,7 +131,7 @@ const Mail = Module("mail", {
|
|||||||
|
|
||||||
/** @property {nsISmtpServer[]} The list of configured SMTP servers. */
|
/** @property {nsISmtpServer[]} The list of configured SMTP servers. */
|
||||||
get smtpServers() {
|
get smtpServers() {
|
||||||
let servers = services.smtpService.smtpServers;
|
let servers = services.smtp.smtpServers;
|
||||||
let ret = [];
|
let ret = [];
|
||||||
|
|
||||||
while (servers.hasMoreElements()) {
|
while (servers.hasMoreElements()) {
|
||||||
@@ -395,7 +393,7 @@ const Mail = Module("mail", {
|
|||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
}, {
|
}, {
|
||||||
commands: function () {
|
commands: function initCommands(dactyl, modules, window) {
|
||||||
commands.add(["go[to]"],
|
commands.add(["go[to]"],
|
||||||
"Select a folder",
|
"Select a folder",
|
||||||
function (args) {
|
function (args) {
|
||||||
@@ -482,7 +480,7 @@ const Mail = Module("mail", {
|
|||||||
bang: true,
|
bang: true,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
completion: function () {
|
completion: function initCompletion(dactyl, modules, window) {
|
||||||
completion.mailFolder = function mailFolder(context) {
|
completion.mailFolder = function mailFolder(context) {
|
||||||
let folders = mail.getFolders(context.filter);
|
let folders = mail.getFolders(context.filter);
|
||||||
context.anchored = false;
|
context.anchored = false;
|
||||||
@@ -492,7 +490,7 @@ const Mail = Module("mail", {
|
|||||||
"Unread: " + folder.getNumUnread(false)]);
|
"Unread: " + folder.getNumUnread(false)]);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mappings: function () {
|
mappings: function initMappings(dactyl, modules, window) {
|
||||||
var myModes = config.mailModes;
|
var myModes = config.mailModes;
|
||||||
|
|
||||||
mappings.add(myModes, ["<Return>", "i"],
|
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
|
// FIXME: why does this default to "Archive", I don't have one? The default
|
||||||
// value won't validate now. mst please fix. --djk
|
// value won't validate now. mst please fix. --djk
|
||||||
options.add(["archivefolder"],
|
options.add(["archivefolder"],
|
||||||
@@ -911,12 +920,12 @@ const Mail = Module("mail", {
|
|||||||
|
|
||||||
options.add(["smtpserver", "smtp"],
|
options.add(["smtpserver", "smtp"],
|
||||||
"Set the default SMTP server",
|
"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) {
|
setter: function (value) {
|
||||||
let server = mail.smtpServers.filter(function (s) s.key == value)[0];
|
let server = mail.smtpServers.filter(function (s) s.key == value)[0];
|
||||||
services.smtpService.defaultServer = server;
|
services.smtp.defaultServer = server;
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
completer: function (context) [[s.key, s.serverURI] for ([, s] in Iterator(mail.smtpServers))]
|
completer: function (context) [[s.key, s.serverURI] for ([, s] in Iterator(mail.smtpServers))]
|
||||||
|
|||||||
Reference in New Issue
Block a user