1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-14 00:55:46 +01:00

imported patch dactylify

--HG--
rename : common/content/liberator-overlay.js => common/content/dactyl-overlay.js
rename : common/content/liberator.js => common/content/dactyl.js
rename : common/content/liberator.xul => common/content/dactyl.xul
rename : common/skin/liberator.css => common/skin/dactyl.css
rename : muttator/content/compose/liberator.dtd => muttator/content/compose/dactyl.dtd
rename : muttator/content/compose/liberator.xul => muttator/content/compose/dactyl.xul
rename : muttator/content/liberator.dtd => muttator/content/dactyl.dtd
rename : vimperator/AUTHORS => pentadactyl/AUTHORS
rename : vimperator/Donors => pentadactyl/Donors
rename : vimperator/Makefile => pentadactyl/Makefile
rename : vimperator/NEWS => pentadactyl/NEWS
rename : vimperator/TODO => pentadactyl/TODO
rename : vimperator/chrome.manifest => pentadactyl/chrome.manifest
rename : vimperator/components/about-handler.js => pentadactyl/components/about-handler.js
rename : vimperator/components/commandline-handler.js => pentadactyl/components/commandline-handler.js
rename : vimperator/components/protocols.js => pentadactyl/components/protocols.js
rename : vimperator/content/about.html => pentadactyl/content/about.html
rename : vimperator/content/about_background.png => pentadactyl/content/about_background.png
rename : vimperator/content/config.js => pentadactyl/content/config.js
rename : vimperator/content/liberator.dtd => pentadactyl/content/dactyl.dtd
rename : vimperator/content/logo.png => pentadactyl/content/logo.png
rename : vimperator/content/vimperator.svg => pentadactyl/content/pentadactyl.svg
rename : vimperator/content/vimperator.xul => pentadactyl/content/pentadactyl.xul
rename : vimperator/contrib/vim/Makefile => pentadactyl/contrib/vim/Makefile
rename : vimperator/contrib/vim/ftdetect/vimperator.vim => pentadactyl/contrib/vim/ftdetect/pentadactyl.vim
rename : vimperator/contrib/vim/mkvimball.txt => pentadactyl/contrib/vim/mkvimball.txt
rename : vimperator/contrib/vim/syntax/vimperator.vim => pentadactyl/contrib/vim/syntax/pentadactyl.vim
rename : vimperator/install.rdf => pentadactyl/install.rdf
rename : vimperator/locale/en-US/all.xml => pentadactyl/locale/en-US/all.xml
rename : vimperator/locale/en-US/autocommands.xml => pentadactyl/locale/en-US/autocommands.xml
rename : vimperator/locale/en-US/liberator.dtd => pentadactyl/locale/en-US/dactyl.dtd
rename : vimperator/locale/en-US/gui.xml => pentadactyl/locale/en-US/gui.xml
rename : vimperator/locale/en-US/intro.xml => pentadactyl/locale/en-US/intro.xml
rename : vimperator/locale/en-US/options.xml => pentadactyl/locale/en-US/options.xml
rename : vimperator/locale/en-US/tutorial.xml => pentadactyl/locale/en-US/tutorial.xml
rename : vimperator/vimperatorrc.example => pentadactyl/pentadactylrc.example
rename : vimperator/regressions.js => pentadactyl/regressions.js
rename : vimperator/skin/about.css => pentadactyl/skin/about.css
rename : vimperator/skin/icon.png => pentadactyl/skin/icon.png
rename : xulmus/content/liberator.dtd => xulmus/content/dactyl.dtd
rename : xulmus/locale/en-US/liberator.dtd => xulmus/locale/en-US/dactyl.dtd
This commit is contained in:
Kris Maglione
2010-08-28 18:02:03 -04:00
parent 2e830d380a
commit 924863cd61
141 changed files with 1836 additions and 1850 deletions

View File

@@ -35,7 +35,7 @@ const AutoCommands = Module("autocommands", {
add: function (events, regex, cmd) {
if (typeof events == "string") {
events = events.split(",");
liberator.log("DEPRECATED: the events list arg to autocommands.add() should be an array of event names");
dactyl.log("DEPRECATED: the events list arg to autocommands.add() should be an array of event names");
}
events.forEach(function (event) {
this._store.push(AutoCommand(event, RegExp(regex), cmd));
@@ -119,7 +119,7 @@ const AutoCommands = Module("autocommands", {
let autoCmds = this._store.filter(function (autoCmd) autoCmd.event == event);
liberator.echomsg("Executing " + event + " Auto commands for \"*\"", 8);
dactyl.echomsg("Executing " + event + " Auto commands for \"*\"", 8);
let lastPattern = null;
let url = args.url || "";
@@ -127,22 +127,22 @@ const AutoCommands = Module("autocommands", {
for (let [, autoCmd] in Iterator(autoCmds)) {
if (autoCmd.pattern.test(url)) {
if (!lastPattern || lastPattern.source != autoCmd.pattern.source)
liberator.echomsg("Executing " + event + " Auto commands for \"" + autoCmd.pattern.source + "\"", 8);
dactyl.echomsg("Executing " + event + " Auto commands for \"" + autoCmd.pattern.source + "\"", 8);
lastPattern = autoCmd.pattern;
liberator.echomsg("autocommand " + autoCmd.command, 9);
dactyl.echomsg("autocommand " + autoCmd.command, 9);
if (typeof autoCmd.command == "function") {
try {
autoCmd.command.call(autoCmd, args);
}
catch (e) {
liberator.reportError(e);
liberator.echoerr(e);
dactyl.reportError(e);
dactyl.echoerr(e);
}
}
else
liberator.execute(commands.replaceTokens(autoCmd.command, args), null, true);
dactyl.execute(commands.replaceTokens(autoCmd.command, args), null, true);
}
}
}
@@ -162,7 +162,7 @@ const AutoCommands = Module("autocommands", {
RegExp(regex);
}
catch (e) {
liberator.assert(false, "E475: Invalid argument: " + regex);
dactyl.assert(false, "E475: Invalid argument: " + regex);
}
if (event) {
@@ -171,7 +171,7 @@ const AutoCommands = Module("autocommands", {
validEvents.push("*");
events = event.split(",");
liberator.assert(events.every(function (event) validEvents.indexOf(event) >= 0),
dactyl.assert(events.every(function (event) validEvents.indexOf(event) >= 0),
"E216: No such group or event: " + event);
}
@@ -221,7 +221,7 @@ const AutoCommands = Module("autocommands", {
function (args) {
// Vim compatible
if (args.length == 0) {
liberator.echomsg("No matching autocommands");
dactyl.echomsg("No matching autocommands");
return;
}
@@ -230,14 +230,14 @@ const AutoCommands = Module("autocommands", {
let validEvents = config.autocommands.map(function (e) e[0]);
// TODO: add command validators
liberator.assert(event != "*",
dactyl.assert(event != "*",
"E217: Can't execute autocommands for ALL events");
liberator.assert(validEvents.indexOf(event) >= 0,
dactyl.assert(validEvents.indexOf(event) >= 0,
"E216: No such group or event: " + args);
liberator.assert(autocommands.get(event).some(function (c) c.pattern.test(defaultURL)),
dactyl.assert(autocommands.get(event).some(function (c) c.pattern.test(defaultURL)),
"No matching autocommands");
if (this.name == "doautoall" && liberator.has("tabs")) {
if (this.name == "doautoall" && dactyl.has("tabs")) {
let current = tabs.index();
for (let i = 0; i < tabs.count; i++) {

View File

@@ -1,14 +1,14 @@
<?xml version="1.0"?>
<bindings xmlns="http://www.mozilla.org/xbl"
xmlns:liberator="http://vimperator.org/namespaces/liberator"
xmlns:dactyl="http://vimperator.org/namespaces/liberator"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml">
<binding id="frame">
<content>
<html:div liberator:highlight="FrameIndicator"/>
<html:div dactyl:highlight="FrameIndicator"/>
<children/>
</content>
</binding>
@@ -19,17 +19,17 @@
<binding id="tab" display="xul:hbox"
extends="chrome://global/content/bindings/tabbox.xml#tab">
<content chromedir="ltr" closetabtext="Close Tab">
<xul:stack class="tab-icon liberator-tab-stack">
<xul:image xbl:inherits="validate,src=image" class="tab-icon-image" liberator:highlight="TabIcon"/>
<xul:stack class="tab-icon dactyl-tab-stack">
<xul:image xbl:inherits="validate,src=image" class="tab-icon-image" dactyl:highlight="TabIcon"/>
<xul:vbox>
<xul:spring flex="1"/>
<xul:label xbl:inherits="value=ordinal" liberator:highlight="TabIconNumber"/>
<xul:label xbl:inherits="value=ordinal" dactyl:highlight="TabIconNumber"/>
<xul:spring flex="1"/>
</xul:vbox>
</xul:stack>
<xul:label xbl:inherits="value=ordinal" liberator:highlight="TabNumber"/>
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" class="tab-text" liberator:highlight="TabText"/>
<xul:toolbarbutton anonid="close-button" tabindex="-1" class="tab-close-button" liberator:highlight="TabClose"/>
<xul:label xbl:inherits="value=ordinal" dactyl:highlight="TabNumber"/>
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" class="tab-text" dactyl:highlight="TabText"/>
<xul:toolbarbutton anonid="close-button" tabindex="-1" class="tab-close-button" dactyl:highlight="TabClose"/>
</content>
</binding>
<binding id="tab-mac"
@@ -37,17 +37,17 @@
<content chromedir="ltr" closetabtext="Close Tab">
<xul:hbox class="tab-image-left" xbl:inherits="selected"/>
<xul:hbox class="tab-image-middle" flex="1" align="center" xbl:inherits="selected">
<xul:stack class="tab-icon liberator-tab-stack">
<xul:stack class="tab-icon dactyl-tab-stack">
<xul:image xbl:inherits="validate,src=image" class="tab-icon-image"/>
<xul:image class="tab-extra-status"/>
<xul:vbox>
<xul:spring flex="1"/>
<xul:label xbl:inherits="value=ordinal" liberator:highlight="TabIconNumber"/>
<xul:label xbl:inherits="value=ordinal" dactyl:highlight="TabIconNumber"/>
<xul:spring flex="1"/>
</xul:vbox>
</xul:stack>
<xul:stack class="tab-text-stack">
<xul:label xbl:inherits="value=ordinal" class="tab-text" liberator:highlight="TabNumber"/>
<xul:label xbl:inherits="value=ordinal" class="tab-text" dactyl:highlight="TabNumber"/>
</xul:stack>
<xul:stack class="tab-text-stack" flex="1">
<xul:label flex="1" xbl:inherits="value=label,crop,accesskey" crop="right" class="tab-text"/>

View File

@@ -10,7 +10,7 @@ const DEFAULT_FAVICON = "chrome://mozapps/skin/places/defaultFavicon.png";
// also includes methods for dealing with keywords and search engines
const Bookmarks = Module("bookmarks", {
requires: ["autocommands", "config", "liberator", "storage", "services"],
requires: ["autocommands", "config", "dactyl", "storage", "services"],
init: function () {
const faviconService = services.get("favicon");
@@ -47,7 +47,7 @@ const Bookmarks = Module("bookmarks", {
const storage = modules.storage;
function Cache(name, store) {
const rootFolders = [bookmarksService.toolbarFolder, bookmarksService.bookmarksMenuFolder, bookmarksService.unfiledBookmarksFolder];
const sleep = liberator.sleep; // Storage objects are global to all windows, 'liberator' isn't.
const sleep = dactyl.sleep; // Storage objects are global to all windows, 'dactyl' isn't.
let bookmarks = [];
let self = this;
@@ -154,7 +154,7 @@ const Bookmarks = Module("bookmarks", {
onItemVisited: function onItemVisited() {},
onItemMoved: function onItemMoved() {},
onItemAdded: function onItemAdded(itemId, folder, index) {
// liberator.dump("onItemAdded(" + itemId + ", " + folder + ", " + index + ")\n");
// dactyl.dump("onItemAdded(" + itemId + ", " + folder + ", " + index + ")\n");
if (bookmarksService.getItemType(itemId) == bookmarksService.TYPE_BOOKMARK) {
if (self.isBookmark(itemId)) {
let bmark = loadBookmark(readBookmark(itemId));
@@ -163,14 +163,14 @@ const Bookmarks = Module("bookmarks", {
}
},
onItemRemoved: function onItemRemoved(itemId, folder, index) {
// liberator.dump("onItemRemoved(" + itemId + ", " + folder + ", " + index + ")\n");
// dactyl.dump("onItemRemoved(" + itemId + ", " + folder + ", " + index + ")\n");
if (deleteBookmark(itemId))
storage.fireEvent(name, "remove", itemId);
},
onItemChanged: function onItemChanged(itemId, property, isAnnotation, value) {
if (isAnnotation)
return;
// liberator.dump("onItemChanged(" + itemId + ", " + property + ", " + value + ")\n");
// dactyl.dump("onItemChanged(" + itemId + ", " + property + ", " + value + ")\n");
let bookmark = bookmarks.filter(function (item) item.id == itemId)[0];
if (bookmark) {
if (property == "tags")
@@ -241,7 +241,7 @@ const Bookmarks = Module("bookmarks", {
}
}
catch (e) {
liberator.log(e, 0);
dactyl.log(e, 0);
return false;
}
@@ -285,13 +285,13 @@ const Bookmarks = Module("bookmarks", {
return bmarks.length;
}
catch (e) {
liberator.log(e, 0);
dactyl.log(e, 0);
return 0;
}
},
// TODO: add filtering
// also ensures that each search engine has a Liberator-friendly alias
// also ensures that each search engine has a Dactyl-friendly alias
getSearchEngines: function getSearchEngines() {
let searchEngines = [];
for (let [, engine] in Iterator(services.get("browserSearch").getVisibleEngines({}))) {
@@ -432,16 +432,16 @@ const Bookmarks = Module("bookmarks", {
let items = completion.runCompleter("bookmark", filter, maxItems, tags);
if (items.length)
return liberator.open(items.map(function (i) i.url), liberator.NEW_TAB);
return dactyl.open(items.map(function (i) i.url), dactyl.NEW_TAB);
if (filter.length > 0 && tags.length > 0)
liberator.echoerr("E283: No bookmarks matching tags: \"" + tags + "\" and string: \"" + filter + "\"");
dactyl.echoerr("E283: No bookmarks matching tags: \"" + tags + "\" and string: \"" + filter + "\"");
else if (filter.length > 0)
liberator.echoerr("E283: No bookmarks matching string: \"" + filter + "\"");
dactyl.echoerr("E283: No bookmarks matching string: \"" + filter + "\"");
else if (tags.length > 0)
liberator.echoerr("E283: No bookmarks matching tags: \"" + tags + "\"");
dactyl.echoerr("E283: No bookmarks matching tags: \"" + tags + "\"");
else
liberator.echoerr("No bookmarks set");
dactyl.echoerr("No bookmarks set");
return null;
}
}, {
@@ -494,10 +494,10 @@ const Bookmarks = Module("bookmarks", {
if (bookmarks.add(false, title, url, keyword, tags, args.bang)) {
let extra = (title == url) ? "" : " (" + title + ")";
liberator.echomsg("Added bookmark: " + url + extra, 1, commandline.FORCE_SINGLELINE);
dactyl.echomsg("Added bookmark: " + url + extra, 1, commandline.FORCE_SINGLELINE);
}
else
liberator.echoerr("Exxx: Could not add bookmark `" + title + "'", commandline.FORCE_SINGLELINE);
dactyl.echoerr("Exxx: Could not add bookmark `" + title + "'", commandline.FORCE_SINGLELINE);
}, {
argCount: "?",
bang: true,
@@ -537,7 +537,7 @@ const Bookmarks = Module("bookmarks", {
function (resp) {
if (resp && resp.match(/^y(es)?$/i)) {
bookmarks._cache.bookmarks.forEach(function (bmark) { services.get("bookmarks").removeItem(bmark.id); });
liberator.echomsg("All bookmarks deleted", 1, commandline.FORCE_SINGLELINE);
dactyl.echomsg("All bookmarks deleted", 1, commandline.FORCE_SINGLELINE);
}
});
}
@@ -545,7 +545,7 @@ const Bookmarks = Module("bookmarks", {
let url = args.string || buffer.URL;
let deletedCount = bookmarks.remove(url);
liberator.echomsg(deletedCount + " bookmark(s) with url " + url.quote() + " deleted", 1, commandline.FORCE_SINGLELINE);
dactyl.echomsg(deletedCount + " bookmark(s) with url " + url.quote() + " deleted", 1, commandline.FORCE_SINGLELINE);
}
},

View File

@@ -16,7 +16,7 @@ const Browser = Module("browser", {
// TODO: support 'nrformats'? -> probably not worth it --mst
incrementURL: function (count) {
let matches = buffer.URL.match(/(.*?)(\d+)(\D*)$/);
liberator.assert(matches);
dactyl.assert(matches);
let [, pre, number, post] = matches;
let newNumber = parseInt(number, 10) + count;
@@ -26,7 +26,7 @@ const Browser = Module("browser", {
newNumberStr = "0" + newNumberStr;
}
liberator.open(pre + newNumberStr + post);
dactyl.open(pre + newNumberStr + post);
}
}, {
options: function () {
@@ -46,7 +46,7 @@ const Browser = Module("browser", {
PlacesUtils.history.setCharsetForURI(getWebNavigation().currentURI, val);
getWebNavigation().reload(Ci.nsIWebNavigation.LOAD_FLAGS_CHARSET_CHANGE);
}
catch (e) { liberator.reportError(e); }
catch (e) { dactyl.reportError(e); }
return null;
},
completer: function (context) completion.charset(context)
@@ -138,7 +138,7 @@ const Browser = Module("browser", {
mappings.add([modes.NORMAL], ["~"],
"Open home directory",
function () { liberator.open("~"); });
function () { dactyl.open("~"); });
mappings.add([modes.NORMAL], ["gh"],
"Open homepage",
@@ -148,7 +148,7 @@ const Browser = Module("browser", {
"Open homepage in a new tab",
function () {
let homepages = gHomeButton.getHomePage();
liberator.open(homepages, { from: "homepage", where: liberator.NEW_TAB });
dactyl.open(homepages, { from: "homepage", where: dactyl.NEW_TAB });
});
mappings.add([modes.NORMAL], ["gu"],
@@ -179,9 +179,9 @@ const Browser = Module("browser", {
url = url.replace(/^(.*:\/+.*?)\/+$/, "$1/"); // get rid of more than 1 / at the end
if (url == buffer.URL)
liberator.beep();
dactyl.beep();
else
liberator.open(url);
dactyl.open(url);
},
{ count: true });
@@ -189,8 +189,8 @@ const Browser = Module("browser", {
"Go to the root of the website",
function () {
let uri = content.document.location;
liberator.assert(!/(about|mailto):/.test(uri.protocol)); // exclude these special protocols for now
liberator.open(uri.protocol + "//" + (uri.host || "") + "/");
dactyl.assert(!/(about|mailto):/.test(uri.protocol)); // exclude these special protocols for now
dactyl.open(uri.protocol + "//" + (uri.host || "") + "/");
});
mappings.add([modes.NORMAL], ["<C-l>"],
@@ -202,7 +202,7 @@ const Browser = Module("browser", {
commands.add(["downl[oads]", "dl"],
"Show progress of current downloads",
function () {
liberator.open("chrome://mozapps/content/downloads/downloads.xul",
dactyl.open("chrome://mozapps/content/downloads/downloads.xul",
{ from: "downloads"});
},
{ argCount: "0" });
@@ -213,9 +213,9 @@ const Browser = Module("browser", {
args = args.string;
if (args)
liberator.open(args);
dactyl.open(args);
else
liberator.open("about:blank");
dactyl.open("about:blank");
}, {
completer: function (context) completion.url(context),
literal: 0,

View File

@@ -158,7 +158,7 @@ const Buffer = Module("buffer", {
title: doc.title
};
if (liberator.has("tabs")) {
if (dactyl.has("tabs")) {
args.tab = tabs.getContentIndex(doc) + 1;
args.doc = "tabs.getTab(" + (args.tab - 1) + ").linkedBrowser.contentDocument";
}
@@ -182,6 +182,10 @@ const Buffer = Module("buffer", {
// event listener which is is called on each page load, even if the
// page is loaded in a background tab
onPageLoad: function onPageLoad(event) {
if (!dactyl.helpInitialized && event.originalTarget instanceof Document)
if (/^dactyl:/.test(event.originalTarget.location.href))
dactyl.initHelp();
if (event.originalTarget instanceof HTMLDocument) {
let doc = event.originalTarget;
// document is part of a frameset
@@ -201,7 +205,7 @@ const Buffer = Module("buffer", {
doc.pageIsFullyLoaded = 1;
if (doc != config.browser.contentDocument)
liberator.echomsg("Background tab loaded: " + doc.title || doc.location.href, 3);
dactyl.echomsg("Background tab loaded: " + doc.title || doc.location.href, 3);
this._triggerLoadAutocmd("PageLoad", doc);
}
@@ -233,7 +237,7 @@ const Buffer = Module("buffer", {
// is not the focused frame
if (document.commandDispatcher.focusedWindow == webProgress.DOMWindow) {
setTimeout(function () { modes.reset(false); },
liberator.mode == modes.HINTS ? 500 : 0);
dactyl.mode == modes.HINTS ? 500 : 0);
}
}
else if (flags & Ci.nsIWebProgressListener.STATE_STOP) {
@@ -284,7 +288,7 @@ const Buffer = Module("buffer", {
if (ssli == 1)
statusline.updateUrl("Link: " + link);
else if (ssli == 2)
liberator.echo("Link: " + link, commandline.DISALLOW_MULTILINE);
dactyl.echo("Link: " + link, commandline.DISALLOW_MULTILINE);
}
if (link == "") {
@@ -343,9 +347,9 @@ const Buffer = Module("buffer", {
* tab.
*/
get localStore() {
if (!content.liberatorStore)
content.liberatorStore = {};
return content.liberatorStore;
if (!content.dactylStore)
content.dactylStore = {};
return content.dactylStore;
},
@@ -471,7 +475,7 @@ const Buffer = Module("buffer", {
*/
focusAllowed: function (elem) {
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
return !options["strictfocus"] || elem.liberatorFocusAllowed;
return !options["strictfocus"] || elem.dactylFocusAllowed;
},
/**
@@ -484,7 +488,7 @@ const Buffer = Module("buffer", {
focusElement: function (elem) {
let doc = window.content.document;
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
win.liberatorFocusAllowed = true;
win.dactylFocusAllowed = true;
if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement]))
elem.contentWindow.focus();
@@ -531,14 +535,14 @@ const Buffer = Module("buffer", {
// <link>s have higher priority than normal <a> hrefs
let elems = frame.document.getElementsByTagName("link");
for (let elem in iter(elems)) {
liberator.open(elem.href);
dactyl.open(elem.href);
return true;
}
// no links? ok, look for hrefs
elems = frame.document.getElementsByTagName("a");
for (let elem in iter(elems)) {
buffer.followLink(elem, liberator.CURRENT_TAB);
buffer.followLink(elem, dactyl.CURRENT_TAB);
return true;
}
@@ -548,7 +552,7 @@ const Buffer = Module("buffer", {
let elem = res.snapshotItem(i);
if (regex.test(elem.textContent) || regex.test(elem.title) ||
Array.some(elem.childNodes, function (child) regex.test(child.alt))) {
buffer.followLink(elem, liberator.CURRENT_TAB);
buffer.followLink(elem, dactyl.CURRENT_TAB);
return true;
}
}
@@ -562,7 +566,7 @@ const Buffer = Module("buffer", {
ret = Array.some(window.content.frames, followFrame);
if (!ret)
liberator.beep();
dactyl.beep();
},
/**
@@ -570,7 +574,7 @@ const Buffer = Module("buffer", {
*
* @param {Node} elem The element to click.
* @param {number} where Where to open the link. See
* {@link liberator.open}.
* {@link dactyl.open}.
*/
followLink: function (elem, where) {
let doc = elem.ownerDocument;
@@ -594,18 +598,18 @@ const Buffer = Module("buffer", {
let ctrlKey = false, shiftKey = false;
switch (where) {
case liberator.NEW_TAB:
case liberator.NEW_BACKGROUND_TAB:
case dactyl.NEW_TAB:
case dactyl.NEW_BACKGROUND_TAB:
ctrlKey = true;
shiftKey = (where != liberator.NEW_BACKGROUND_TAB);
shiftKey = (where != dactyl.NEW_BACKGROUND_TAB);
break;
case liberator.NEW_WINDOW:
case dactyl.NEW_WINDOW:
shiftKey = true;
break;
case liberator.CURRENT_TAB:
case dactyl.CURRENT_TAB:
break;
default:
liberator.log("Invalid where argument for followLink()", 0);
dactyl.log("Invalid where argument for followLink()", 0);
}
buffer.focusElement(elem);
@@ -660,7 +664,7 @@ const Buffer = Module("buffer", {
window.saveURL(url, text, null, true, skipPrompt, makeURI(url, doc.characterSet));
}
catch (e) {
liberator.echoerr(e);
dactyl.echoerr(e);
}
},
@@ -818,7 +822,7 @@ const Buffer = Module("buffer", {
if (next > frames.length - 1) {
if (current == frames.length - 1)
liberator.beep();
dactyl.beep();
next = frames.length - 1; // still allow the frame indicator to be activated
}
}
@@ -827,7 +831,7 @@ const Buffer = Module("buffer", {
if (next < 0) {
if (current == 0)
liberator.beep();
dactyl.beep();
next = 0; // still allow the frame indicator to be activated
}
}
@@ -857,7 +861,7 @@ const Buffer = Module("buffer", {
* @param {Node} elem The element to query.
*/
showElementInfo: function (elem) {
liberator.echo(<>Element:<br/>{util.objectToString(elem, true)}</>, commandline.FORCE_MULTILINE);
dactyl.echo(<>Element:<br/>{util.objectToString(elem, true)}</>, commandline.FORCE_MULTILINE);
},
/**
@@ -881,7 +885,7 @@ const Buffer = Module("buffer", {
info += ", bookmarked";
let pageInfoText = <>{file.quote()} [{info}] {title}</>;
liberator.echo(pageInfoText, commandline.FORCE_SINGLELINE);
dactyl.echo(pageInfoText, commandline.FORCE_SINGLELINE);
return;
}
@@ -890,7 +894,7 @@ const Buffer = Module("buffer", {
let opt = buffer.pageInfo[option];
return opt ? template.table(opt[1], opt[0](true)) : undefined;
}, <br/>);
liberator.echo(list, commandline.FORCE_MULTILINE);
dactyl.echo(list, commandline.FORCE_MULTILINE);
},
/**
@@ -936,7 +940,7 @@ const Buffer = Module("buffer", {
url = url.substr(PREFIX.length);
else
url = PREFIX + url;
liberator.open(url, { hide: true });
dactyl.open(url, { hide: true });
}
},
@@ -964,7 +968,7 @@ const Buffer = Module("buffer", {
ZOOM_MAX: "ZoomManager" in window && Math.round(ZoomManager.MAX * 100),
setZoom: function setZoom(value, fullZoom) {
liberator.assert(value >= Buffer.ZOOM_MIN || value <= Buffer.ZOOM_MAX,
dactyl.assert(value >= Buffer.ZOOM_MIN || value <= Buffer.ZOOM_MAX,
"Zoom value out of range (" + Buffer.ZOOM_MIN + " - " + Buffer.ZOOM_MAX + "%)");
if (fullZoom !== undefined)
@@ -986,7 +990,7 @@ const Buffer = Module("buffer", {
let i = util.Math.constrain(cur + steps, 0, values.length - 1);
if (i == cur && fullZoom == ZoomManager.useFullZoom)
liberator.beep();
dactyl.beep();
Buffer.setZoom(Math.round(values[i] * 100), fullZoom);
},
@@ -994,7 +998,7 @@ const Buffer = Module("buffer", {
checkScrollYBounds: function checkScrollYBounds(win, direction) {
// NOTE: it's possible to have scrollY > scrollMaxY - FF bug?
if (direction > 0 && win.scrollY >= win.scrollMaxY || direction < 0 && win.scrollY == 0)
liberator.beep();
dactyl.beep();
},
findScrollableWindow: function findScrollableWindow() {
@@ -1103,7 +1107,7 @@ const Buffer = Module("buffer", {
openUploadPrompt: function openUploadPrompt(elem) {
commandline.input("Upload file: ", function (path) {
let file = io.File(path);
liberator.assert(file.exists());
dactyl.assert(file.exists());
elem.value = file.path;
}, {
@@ -1116,7 +1120,7 @@ const Buffer = Module("buffer", {
commands.add(["frameo[nly]"],
"Show only the current frame's page",
function (args) {
liberator.open(tabs.localStore.focusedFrame.document.documentURI);
dactyl.open(tabs.localStore.focusedFrame.document.documentURI);
},
{ argCount: "0" });
@@ -1126,17 +1130,17 @@ const Buffer = Module("buffer", {
let arg = args[0];
// FIXME: arg handling is a bit of a mess, check for filename
liberator.assert(!arg || arg[0] == ">" && !liberator.has("Win32"),
dactyl.assert(!arg || arg[0] == ">" && !dactyl.has("Win32"),
"E488: Trailing characters");
options.withContext(function () {
if (arg) {
options.setPref("print.print_to_file", "true");
options.setPref("print.print_to_filename", io.File(arg.substr(1)).path);
liberator.echomsg("Printing to file: " + arg.substr(1));
dactyl.echomsg("Printing to file: " + arg.substr(1));
}
else
liberator.echomsg("Sending to printer...");
dactyl.echomsg("Sending to printer...");
options.setPref("print.always_print_silent", args.bang);
options.setPref("print.show_print_progress", !args.bang);
@@ -1145,9 +1149,9 @@ const Buffer = Module("buffer", {
});
if (arg)
liberator.echomsg("Printed: " + arg.substr(1));
dactyl.echomsg("Printed: " + arg.substr(1));
else
liberator.echomsg("Print job sent.");
dactyl.echomsg("Print job sent.");
},
{
argCount: "?",
@@ -1173,7 +1177,7 @@ const Buffer = Module("buffer", {
let titles = buffer.alternateStyleSheets.map(function (stylesheet) stylesheet.title);
liberator.assert(!arg || titles.indexOf(arg) >= 0,
dactyl.assert(!arg || titles.indexOf(arg) >= 0,
"E475: Invalid argument: " + arg);
if (options["usermode"])
@@ -1206,7 +1210,7 @@ const Buffer = Module("buffer", {
if (filename) {
let file = io.File(filename);
liberator.assert(!file.exists() || args.bang,
dactyl.assert(!file.exists() || args.bang,
"E13: File exists (add ! to override)");
chosenData = { file: file, uri: window.makeURI(doc.location.href, doc.characterSet) };
@@ -1269,7 +1273,7 @@ const Buffer = Module("buffer", {
level = util.Math.constrain(level, Buffer.ZOOM_MIN, Buffer.ZOOM_MAX);
}
else
liberator.assert(false, "E488: Trailing characters");
dactyl.assert(false, "E488: Trailing characters");
if (args.bang)
buffer.fullZoom = level;
@@ -1389,12 +1393,12 @@ const Buffer = Module("buffer", {
function (count) { buffer.scrollLines(-Math.max(count, 1)); },
{ count: true });
mappings.add(myModes, liberator.has("mail") ? ["h"] : ["h", "<Left>"],
mappings.add(myModes, dactyl.has("mail") ? ["h"] : ["h", "<Left>"],
"Scroll document to the left",
function (count) { buffer.scrollColumns(-Math.max(count, 1)); },
{ count: true });
mappings.add(myModes, liberator.has("mail") ? ["l"] : ["l", "<Right>"],
mappings.add(myModes, dactyl.has("mail") ? ["l"] : ["l", "<Right>"],
"Scroll document to the right",
function (count) { buffer.scrollColumns(Math.max(count, 1)); },
{ count: true });
@@ -1420,7 +1424,7 @@ const Buffer = Module("buffer", {
mappings.add(myModes, ["%"],
"Scroll to {count} percent of the document",
function (count) {
liberator.assert(count > 0 && count <= 100);
dactyl.assert(count > 0 && count <= 100);
buffer.scrollToPercent(buffer.scrollXPercent, count);
},
{ count: true });
@@ -1492,7 +1496,7 @@ const Buffer = Module("buffer", {
return computedStyle.visibility != "hidden" && computedStyle.display != "none";
});
liberator.assert(elements.length > 0);
dactyl.assert(elements.length > 0);
let elem = elements[util.Math.constrain(count, 1, elements.length) - 1];
buffer.focusElement(elem);
util.scrollIntoView(elem);
@@ -1503,24 +1507,24 @@ const Buffer = Module("buffer", {
mappings.add(myModes, ["gP"],
"Open (put) a URL based on the current clipboard contents in a new buffer",
function () {
liberator.open(util.readFromClipboard(),
liberator[options.get("activate").has("paste") ? "NEW_BACKGROUND_TAB" : "NEW_TAB"]);
dactyl.open(util.readFromClipboard(),
dactyl[options.get("activate").has("paste") ? "NEW_BACKGROUND_TAB" : "NEW_TAB"]);
});
mappings.add(myModes, ["p", "<MiddleMouse>"],
"Open (put) a URL based on the current clipboard contents in the current buffer",
function () {
let url = util.readFromClipboard();
liberator.assert(url);
liberator.open(url);
dactyl.assert(url);
dactyl.open(url);
});
mappings.add(myModes, ["P"],
"Open (put) a URL based on the current clipboard contents in a new buffer",
function () {
let url = util.readFromClipboard();
liberator.assert(url);
liberator.open(url, { from: "paste", where: liberator.NEW_TAB });
dactyl.assert(url);
dactyl.open(url, { from: "paste", where: dactyl.NEW_TAB });
});
// reloading
@@ -1537,7 +1541,7 @@ const Buffer = Module("buffer", {
"Copy selected text or current word",
function () {
let sel = buffer.getCurrentWord();
liberator.assert(sel);
dactyl.assert(sel);
util.copyToClipboard(sel, true);
});

View File

@@ -15,7 +15,7 @@
* this class when the chrome is ready.
*/
const CommandLine = Module("commandline", {
requires: ["config", "liberator", "modes", "services", "storage", "template", "util"],
requires: ["config", "dactyl", "modes", "services", "storage", "template", "util"],
init: function () {
const self = this;
@@ -124,7 +124,7 @@ const CommandLine = Module("commandline", {
////////////////////// VARIABLES ///////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
this._completionList = ItemList("liberator-completions");
this._completionList = ItemList("dactyl-completions");
this._completions = null;
this._history = null;
@@ -132,25 +132,25 @@ const CommandLine = Module("commandline", {
this._lastSubstring = "";
// the containing box for the this._promptWidget and this._commandWidget
this._commandlineWidget = document.getElementById("liberator-commandline");
this._commandlineWidget = document.getElementById("dactyl-commandline");
// the prompt for the current command, for example : or /. Can be blank
this._promptWidget = document.getElementById("liberator-commandline-prompt");
this._promptWidget = document.getElementById("dactyl-commandline-prompt");
// the command bar which contains the current command
this._commandWidget = document.getElementById("liberator-commandline-command");
this._commandWidget = document.getElementById("dactyl-commandline-command");
this._messageBox = document.getElementById("liberator-message");
this._messageBox = document.getElementById("dactyl-message");
this._commandWidget.inputField.QueryInterface(Ci.nsIDOMNSEditableElement);
this._messageBox.inputField.QueryInterface(Ci.nsIDOMNSEditableElement);
// the widget used for multiline output
this._multilineOutputWidget = document.getElementById("liberator-multiline-output");
this._multilineOutputWidget = document.getElementById("dactyl-multiline-output");
this._outputContainer = this._multilineOutputWidget.parentNode;
this._multilineOutputWidget.contentDocument.body.id = "liberator-multiline-output-content";
this._multilineOutputWidget.contentDocument.body.id = "dactyl-multiline-output-content";
// the widget used for multiline intput
this._multilineInputWidget = document.getElementById("liberator-multiline-input");
this._multilineInputWidget = document.getElementById("dactyl-multiline-input");
// we need to save the mode which were in before opening the command line
// this is then used if we focus the command line again without the "official"
@@ -167,7 +167,7 @@ const CommandLine = Module("commandline", {
this.registerCallback("submit", modes.EX, function (command) {
commands.repeat = command;
liberator.execute(command);
dactyl.execute(command);
});
this.registerCallback("complete", modes.EX, function (context) {
context.fork("ex", 0, completion, "ex");
@@ -256,7 +256,7 @@ const CommandLine = Module("commandline", {
this._setHighlightGroup(highlightGroup);
this._messageBox.value = str;
liberator.triggerObserver("echoLine", str, highlightGroup, forceSingle);
dactyl.triggerObserver("echoLine", str, highlightGroup, forceSingle);
if (!this._commandShown())
commandline.hide();
@@ -277,7 +277,7 @@ const CommandLine = Module("commandline", {
let doc = this._multilineOutputWidget.contentDocument;
let win = this._multilineOutputWidget.contentWindow;
liberator.triggerObserver("echoMultiline", str, highlightGroup);
dactyl.triggerObserver("echoMultiline", str, highlightGroup);
// If it's already XML, assume it knows what it's doing.
// Otherwise, white space is significant.
@@ -350,7 +350,7 @@ const CommandLine = Module("commandline", {
get quiet() this._quiet,
set quiet(val) {
this._quiet = val;
Array.forEach(document.getElementById("liberator-commandline").childNodes, function (node) {
Array.forEach(document.getElementById("dactyl-commandline").childNodes, function (node) {
node.style.opacity = this._quiet || this._silent ? "0" : "";
});
},
@@ -448,7 +448,7 @@ const CommandLine = Module("commandline", {
this._history = null;
statusline.updateProgress(""); // we may have a "match x of y" visible
liberator.focusContent(false);
dactyl.focusContent(false);
this._multilineInputWidget.collapsed = true;
this._completionList.hide();
@@ -495,7 +495,7 @@ const CommandLine = Module("commandline", {
* the MOW.
*/
echo: function echo(str, highlightGroup, flags) {
// liberator.echo uses different order of flags as it omits the highlight group, change commandline.echo argument order? --mst
// dactyl.echo uses different order of flags as it omits the highlight group, change commandline.echo argument order? --mst
if (this._silent)
return;
@@ -505,11 +505,11 @@ const CommandLine = Module("commandline", {
this._messageHistory.add({ str: str, highlight: highlightGroup });
if ((flags & this.ACTIVE_WINDOW) &&
window != services.get("windowWatcher").activeWindow &&
services.get("windowWatcher").activeWindow.liberator)
services.get("windowWatcher").activeWindow.dactyl)
return;
// The DOM isn't threadsafe. It must only be accessed from the main thread.
liberator.callInMainThread(function () {
dactyl.callInMainThread(function () {
if ((flags & this.DISALLOW_MULTILINE) && !this._outputContainer.collapsed)
return;
@@ -625,7 +625,7 @@ const CommandLine = Module("commandline", {
else if (event.type == "focus") {
if (!this._commandShown() && event.target == this._commandWidget.inputField) {
event.target.blur();
liberator.beep();
dactyl.beep();
}
}
else if (event.type == "input") {
@@ -655,7 +655,7 @@ const CommandLine = Module("commandline", {
event.preventDefault();
event.stopPropagation();
liberator.assert(this._history);
dactyl.assert(this._history);
this._history.select(/Up/.test(key), !/(Page|S-)/.test(key));
}
// user pressed <Tab> to get completions of a command
@@ -690,7 +690,7 @@ const CommandLine = Module("commandline", {
/**
* Multiline input events, they will come straight from
* #liberator-multiline-input in the XUL.
* #dactyl-multiline-input in the XUL.
*
* @param {Event} event
*/
@@ -722,8 +722,8 @@ const CommandLine = Module("commandline", {
/**
* Handle events when we are in multiline output mode, these come from
* liberator when modes.extended & modes.MULTILINE_OUTPUT and also from
* #liberator-multiline-output in the XUL.
* dactyl when modes.extended & modes.MULTILINE_OUTPUT and also from
* #dactyl-multiline-output in the XUL.
*
* @param {Event} event
*/
@@ -745,9 +745,9 @@ const CommandLine = Module("commandline", {
event.preventDefault();
// FIXME: Why is this needed? --djk
if (event.target.getAttribute("href") == "#")
liberator.open(event.target.textContent, where);
dactyl.open(event.target.textContent, where);
else
liberator.open(event.target.href, where);
dactyl.open(event.target.href, where);
}
switch (key) {
@@ -757,20 +757,20 @@ const CommandLine = Module("commandline", {
tabs.select(parseInt(event.originalTarget.parentNode.parentNode.firstChild.textContent, 10) - 1);
}
else
openLink(liberator.CURRENT_TAB);
openLink(dactyl.CURRENT_TAB);
break;
case "<MiddleMouse>":
case "<C-LeftMouse>":
case "<C-M-LeftMouse>":
openLink({ where: liberator.NEW_TAB, background: true });
openLink({ where: dactyl.NEW_TAB, background: true });
break;
case "<S-MiddleMouse>":
case "<C-S-LeftMouse>":
case "<C-M-S-LeftMouse>":
openLink({ where: liberator.NEW_TAB, background: false });
openLink({ where: dactyl.NEW_TAB, background: false });
break;
case "<S-LeftMouse>":
openLink(liberator.NEW_WINDOW);
openLink(dactyl.NEW_WINDOW);
break;
}
@@ -1039,7 +1039,7 @@ const CommandLine = Module("commandline", {
*/
sanitize: function (timespan) {
let range = [0, Number.MAX_VALUE];
if (liberator.has("sanitizer") && (timespan || options["sanitizetimespan"]))
if (dactyl.has("sanitizer") && (timespan || options["sanitizetimespan"]))
range = Sanitizer.getClearRange(timespan || options["sanitizetimespan"]);
const self = this;
@@ -1082,7 +1082,7 @@ const CommandLine = Module("commandline", {
this.index += diff;
if (this.index < 0 || this.index > this.store.length) {
this.index = util.Math.constrain(this.index, 0, this.store.length);
liberator.beep();
dactyl.beep();
// I don't know why this kludge is needed. It
// prevents the caret from moving to the end of
// the input field.
@@ -1305,7 +1305,7 @@ const CommandLine = Module("commandline", {
for (let [, context] in Iterator(list)) {
function done() !(idx >= n + context.items.length || idx == -2 && !context.items.length);
while (context.incomplete && !done())
liberator.threadYield(false, true);
dactyl.threadYield(false, true);
if (done())
break;
@@ -1371,7 +1371,7 @@ const CommandLine = Module("commandline", {
}
if (this.items.length == 0)
liberator.beep();
dactyl.beep();
}
}),
@@ -1388,10 +1388,10 @@ const CommandLine = Module("commandline", {
return "";
try {
arg = liberator.eval(arg);
arg = dactyl.eval(arg);
}
catch (e) {
liberator.echoerr(e);
dactyl.echoerr(e);
return null;
}
@@ -1410,17 +1410,17 @@ const CommandLine = Module("commandline", {
{
name: "ec[ho]",
description: "Echo the expression",
action: liberator.echo
action: dactyl.echo
},
{
name: "echoe[rr]",
description: "Echo the expression as an error message",
action: liberator.echoerr
action: dactyl.echoerr
},
{
name: "echom[sg]",
description: "Echo the expression as an informational message",
action: liberator.echomsg
action: dactyl.echomsg
}
].forEach(function (command) {
commands.add([command.name],
@@ -1448,7 +1448,7 @@ const CommandLine = Module("commandline", {
XML.ignoreWhitespace = false;
let list = template.map(commandline._messageHistory.messages, function (message)
<div highlight={message.highlight + " Message"}>{message.str}</div>);
liberator.echo(list, commandline.FORCE_MULTILINE);
dactyl.echo(list, commandline.FORCE_MULTILINE);
}
},
{ argCount: "0" });
@@ -1461,7 +1461,7 @@ const CommandLine = Module("commandline", {
commands.add(["sil[ent]"],
"Run a command silently",
function (args) {
commandline.runSilently(function () liberator.execute(args[0], null, true));
commandline.runSilently(function () dactyl.execute(args[0], null, true));
}, {
completer: function (context) completion.ex(context),
literal: 0
@@ -1497,7 +1497,7 @@ const CommandLine = Module("commandline", {
mappings.add([modes.NORMAL],
["g<"], "Redisplay the last command output",
function () {
liberator.assert(this._lastMowOutput);
dactyl.assert(this._lastMowOutput);
this._echoMultiline(this._lastMowOutput, commandline.HL_NORMAL);
});
},
@@ -1527,8 +1527,8 @@ const CommandLine = Module("commandline", {
},
styles: function () {
let fontSize = util.computedStyle(document.getElementById(config.mainWindowId)).fontSize;
styles.registerSheet("chrome://liberator/skin/liberator.css");
let error = styles.addSheet(true, "font-size", "chrome://liberator/content/buffer.xhtml",
styles.registerSheet("chrome://dactyl/skin/dactyl.css");
let error = styles.addSheet(true, "font-size", "chrome://dactyl/content/buffer.xhtml",
"body { font-size: " + fontSize + "; }");
}
});
@@ -1547,7 +1547,7 @@ const ItemList = Class("ItemList", {
var iframe = document.getElementById(id);
if (!iframe) {
liberator.log("No iframe with id: " + id + " found, strange things may happen!"); // "The truth is out there..." -- djk
dactyl.log("No iframe with id: " + id + " found, strange things may happen!"); // "The truth is out there..." -- djk
return; // XXX
}
@@ -1573,7 +1573,7 @@ const ItemList = Class("ItemList", {
_autoSize: function () {
if (this._container.collapsed)
this._div.style.minWidth = document.getElementById("liberator-commandline").scrollWidth + "px";
this._div.style.minWidth = document.getElementById("dactyl-commandline").scrollWidth + "px";
this._minHeight = Math.max(this._minHeight, this._divNodes.completions.getBoundingClientRect().bottom);
this._container.height = this._minHeight;
@@ -1706,7 +1706,7 @@ const ItemList = Class("ItemList", {
this._divNodes.noCompletions.style.display = haveCompletions ? "none" : "block";
this._completionElements = util.evaluateXPath("//xhtml:div[@liberator:highlight='CompItem']", this._doc);
this._completionElements = util.evaluateXPath("//xhtml:div[@dactyl:highlight='CompItem']", this._doc);
return true;
},
@@ -1780,7 +1780,7 @@ const ItemList = Class("ItemList", {
//if (index == 0)
// this.start = now;
//if (index == Math.min(len - 1, 100))
// liberator.dump({ time: Date.now() - this.start });
// dactyl.dump({ time: Date.now() - this.start });
},
onEvent: function onEvent(event) false

View File

@@ -80,7 +80,7 @@ const Command = Class("Command", {
return;
args.count = count;
args.bang = bang;
liberator.trapErrors(self.action, self, args, modifiers);
dactyl.trapErrors(self.action, self, args, modifiers);
}
if (this.hereDoc) {
@@ -188,7 +188,7 @@ const Command = Class("Command", {
/**
* @property {function} Should return an array of <b>Object</b>s suitable
* to be passed to {@link Commands#commandToString}, one for each past
* invocation which should be restored on subsequent @liberator
* invocation which should be restored on subsequent @dactyl
* startups.
*/
serial: null,
@@ -309,7 +309,7 @@ const Commands = Module("commands", {
if (command.user && replace)
commands.removeUserCommand(command.name);
else {
liberator.log("Warning: :" + command.name + " already exists, NOT replacing existing command.", 1);
dactyl.log("Warning: :" + command.name + " already exists, NOT replacing existing command.", 1);
return false;
}
}
@@ -538,7 +538,7 @@ const Commands = Module("commands", {
if (complete)
complete.message = error;
else
liberator.echoerr(error);
dactyl.echoerr(error);
}
outer:
@@ -571,7 +571,7 @@ const Commands = Module("commands", {
let sep = sub[optname.length];
if (sep == "=" || /\s/.test(sep) && opt[1] != this.OPTION_NOARG) {
[count, arg, quote, error] = getNextArg(sub.substr(optname.length + 1));
liberator.assert(!error, error);
dactyl.assert(!error, error);
// if we add the argument to an option after a space, it MUST not be empty
if (sep != "=" && !quote && arg.length == 0)
@@ -584,7 +584,7 @@ const Commands = Module("commands", {
let context = null;
if (!complete && quote) {
liberator.echoerr("Invalid argument for option " + optname);
dactyl.echoerr("Invalid argument for option " + optname);
return null;
}
@@ -655,18 +655,18 @@ const Commands = Module("commands", {
// if not an option, treat this token as an argument
let [count, arg, quote, error] = getNextArg(sub);
liberator.assert(!error, error);
dactyl.assert(!error, error);
if (complete) {
args.quote = Commands.complQuote[quote] || Commands.complQuote[""];
args.completeFilter = arg || "";
}
else if (count == -1) {
liberator.echoerr("Error parsing arguments: " + arg);
dactyl.echoerr("Error parsing arguments: " + arg);
return null;
}
else if (!onlyArgumentsRemaining && /^-/.test(arg)) {
liberator.echoerr("Invalid option: " + arg);
dactyl.echoerr("Invalid option: " + arg);
return null;
}
@@ -703,7 +703,7 @@ const Commands = Module("commands", {
if (args.length == 0 && /^[1+]$/.test(argCount) ||
literal != null && /[1+]/.test(argCount) && !/\S/.test(args.literalArg || "")) {
if (!complete) {
liberator.echoerr("E471: Argument required");
dactyl.echoerr("E471: Argument required");
return null;
}
}
@@ -816,7 +816,7 @@ const Commands = Module("commands", {
arg += res[2].replace(/\\(.)/g, "$1");
break;
case "vimperator":
case "pentadactyl":
if ((res = str.match(/^()((?:[^\\\s"']|\\.)+)((?:\\$)?)/)))
arg += res[2].replace(/\\(.)/g, "$1");
else if ((res = str.match(/^(")((?:[^\\"]|\\.)*)("?)/)))
@@ -864,10 +864,10 @@ const Commands = Module("commands", {
function (count) {
if (commands.repeat) {
for (let i in util.interruptibleRange(0, Math.max(count, 1), 100))
liberator.execute(commands.repeat);
dactyl.execute(commands.repeat);
}
else
liberator.echoerr("E30: No previous command line");
dactyl.echoerr("E30: No previous command line");
},
{ count: true });
},
@@ -923,7 +923,7 @@ const Commands = Module("commands", {
}
}
catch (e) {
liberator.reportError(e);
dactyl.reportError(e);
}
}
}
@@ -944,7 +944,7 @@ const Commands = Module("commands", {
count: this.count && args.count
};
liberator.execute(commands.replaceTokens(this.replacementText, tokens));
dactyl.execute(commands.replaceTokens(this.replacementText, tokens));
}
// TODO: offer completion.ex?
@@ -968,7 +968,7 @@ const Commands = Module("commands", {
function (args) {
let cmd = args[0];
liberator.assert(!/\W/.test(cmd || ''), "E182: Invalid command name");
dactyl.assert(!/\W/.test(cmd || ''), "E182: Invalid command name");
if (args.literalArg) {
let nargsOpt = args["-nargs"] || "0";
@@ -984,15 +984,15 @@ const Commands = Module("commands", {
completeOpt = completeOpt.substr(7);
completeFunc = function () {
try {
var completer = liberator.eval(completeOpt);
var completer = dactyl.eval(completeOpt);
if (!(completer instanceof Function))
throw new TypeError("User-defined custom completer " + completeOpt.quote() + " is not a function");
}
catch (e) {
liberator.echo(":" + this.name + " ...");
liberator.echoerr("E117: Unknown function: " + completeOpt);
liberator.log(e);
dactyl.echo(":" + this.name + " ...");
dactyl.echoerr("E117: Unknown function: " + completeOpt);
dactyl.log(e);
return undefined;
}
return completer.apply(this, Array.slice(arguments));
@@ -1013,7 +1013,7 @@ const Commands = Module("commands", {
}, args.bang);
if (!added)
liberator.echoerr("E174: Command already exists: add ! to replace it");
dactyl.echoerr("E174: Command already exists: add ! to replace it");
}
else {
function completerToString(completer) {
@@ -1041,7 +1041,7 @@ const Commands = Module("commands", {
commandline.echo(str, commandline.HL_NORMAL, commandline.FORCE_MULTILINE);
}
else
liberator.echomsg("No user-defined commands found");
dactyl.echomsg("No user-defined commands found");
}
}, {
bang: true,
@@ -1100,7 +1100,7 @@ const Commands = Module("commands", {
if (commands.get(name))
commands.removeUserCommand(name);
else
liberator.echoerr("E184: No such user-defined command: " + name);
dactyl.echoerr("E184: No such user-defined command: " + name);
}, {
argCount: "1",
completer: function (context) completion.userCommand(context)

View File

@@ -217,7 +217,7 @@ const CompletionContext = Class("CompletionContext", {
return { start: minStart, items: util.Array.flatten(items), longestSubstring: this.longestAllSubstring };
}
catch (e) {
liberator.reportError(e);
dactyl.reportError(e);
return { start: 0, items: [], longestAllSubstring: "" };
}
},
@@ -260,7 +260,7 @@ const CompletionContext = Class("CompletionContext", {
this._completions = items;
let self = this;
if (this.updateAsync && !this.noUpdate)
liberator.callInMainThread(function () { self.onUpdate.call(self); });
dactyl.callInMainThread(function () { self.onUpdate.call(self); });
},
get createRow() this._createRow || template.completionRow, // XXX
@@ -325,8 +325,8 @@ const CompletionContext = Class("CompletionContext", {
let lock = {};
this.cache.backgroundLock = lock;
this.incomplete = true;
let thread = this.getCache("backgroundThread", liberator.newThread);
liberator.callAsync(thread, this, function () {
let thread = this.getCache("backgroundThread", dactyl.newThread);
dactyl.callAsync(thread, this, function () {
if (this.cache.backgroundLock != lock)
return;
let items = this.generate();
@@ -609,7 +609,7 @@ const CompletionContext = Class("CompletionContext", {
wait: function wait(interruptable, timeout) {
let end = Date.now() + timeout;
while (this.incomplete && (!timeout || Date.now() > end))
liberator.threadYield(false, interruptable);
dactyl.threadYield(false, interruptable);
return this.incomplete;
}
}, {

View File

@@ -40,7 +40,7 @@ const ConfigBase = Class(ModuleBase, {
/**
* @property {string[]} A list of features available in this
* application. Used extensively in feature test macros. Use
* liberator.has(feature) to check for a feature's presence
* dactyl.has(feature) to check for a feature's presence
* in this array.
*/
features: [],
@@ -56,7 +56,7 @@ const ConfigBase = Class(ModuleBase, {
hostApplication: null,
/**
* @property {function} Called on liberator startup to allow for any
* @property {function} Called on dactyl startup to allow for any
* arbitrary application-specific initialization code.
*/
init: function () {},
@@ -75,7 +75,7 @@ const ConfigBase = Class(ModuleBase, {
/**
* @property {[[]]} An array of application specific mode specifications.
* The values of each mode are passed to modes.addMode during
* liberator startup.
* dactyl startup.
*/
modes: [],
@@ -92,8 +92,8 @@ const ConfigBase = Class(ModuleBase, {
get outputHeight() config.browser.mPanelContainer.boxObject.height,
/**
* @property {[string]} A list of extra scripts in the liberator or
* application namespaces which should be loaded before liberator
* @property {[string]} A list of extra scripts in the dactyl or
* application namespaces which should be loaded before dactyl
* initialization.
*/
scripts: [],

View File

@@ -6,7 +6,7 @@
(function () {
const modules = {};
const BASE = "chrome://liberator/content/";
const BASE = "chrome://dactyl/content/";
modules.modules = modules;
@@ -23,7 +23,7 @@
continue;
if (Components.utils.reportError)
Components.utils.reportError(e);
dump("liberator: Loading script " + script + ": " + e + "\n");
dump("dactyl: Loading script " + script + ": " + e + "\n");
dump(e.stack + "\n");
}
}
@@ -40,7 +40,7 @@
"completion.js",
"configbase.js",
"config.js",
"liberator.js",
"dactyl.js",
"editor.js",
"events.js",
"finder.js",

View File

@@ -13,23 +13,23 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm", modules);
const plugins = { __proto__: modules };
const userContext = { __proto__: modules };
const EVAL_ERROR = "__liberator_eval_error";
const EVAL_RESULT = "__liberator_eval_result";
const EVAL_STRING = "__liberator_eval_string";
const EVAL_ERROR = "__dactyl_eval_error";
const EVAL_RESULT = "__dactyl_eval_result";
const EVAL_STRING = "__dactyl_eval_string";
// Move elsewhere?
const Storage = Module("storage", {
requires: ["services"],
init: function () {
Components.utils.import("resource://liberator/storage.jsm", this);
Components.utils.import("resource://dactyl/storage.jsm", this);
modules.Timer = this.Timer; // Fix me, please.
try {
let infoPath = services.create("file");
infoPath.initWithPath(File.expandPath(IO.runtimePath.replace(/,.*/, "")));
infoPath.append("info");
infoPath.append(liberator.profileName);
infoPath.append(dactyl.profileName);
this.storage.infoPath = infoPath;
}
catch (e) {}
@@ -51,11 +51,11 @@ const FailedAssertion = Class("FailedAssertion", Error, {
}
});
const Liberator = Module("liberator", {
const Dactyl = Module("dactyl", {
requires: ["config", "services"],
init: function () {
window.liberator = this;
window.dactyl = this;
window.liberator = this;
modules.liberator = this;
this.observers = {};
@@ -69,14 +69,14 @@ const Liberator = Module("liberator", {
/** @property {string} The name of the current user profile. */
this.profileName = services.get("directory").get("ProfD", Ci.nsIFile).leafName.replace(/^.+?\./, "");
config.features.push(Liberator.getPlatformFeature());
config.features.push(Dactyl.getPlatformFeature());
},
destroy: function () {
autocommands.trigger(config.name + "LeavePre", {});
storage.saveAll();
liberator.triggerObserver("shutdown", null);
liberator.dump("All liberator modules destroyed\n");
dactyl.triggerObserver("shutdown", null);
dactyl.dump("All dactyl modules destroyed\n");
autocommands.trigger(config.name + "Leave", {});
},
@@ -87,7 +87,7 @@ const Liberator = Module("liberator", {
get mode() modes.main,
set mode(value) modes.main = value,
get menuItems() Liberator.getMenuItems(),
get menuItems() Dactyl.getMenuItems(),
/** @property {Element} The currently focused element. */
get focus() document.commandDispatcher.focusedElement,
@@ -135,15 +135,15 @@ const Liberator = Module("liberator", {
forceNewTab: false,
forceNewWindow: false,
/** @property {string} The Liberator version string. */
/** @property {string} The Dactyl version string. */
version: "@VERSION@ (created: @DATE@)", // these VERSION and DATE tokens are replaced by the Makefile
/**
* @property {Object} The map of command-line options. These are
* specified in the argument to the host application's -{config.name}
* option. E.g. $ firefox -vimperator '+u=/tmp/rcfile ++noplugin'
* option. E.g. $ firefox -pentadactyl '+u=/tmp/rcfile ++noplugin'
* Supported options:
* +u=RCFILE Use RCFILE instead of .vimperatorrc.
* +u=RCFILE Use RCFILE instead of .pentadactylrc.
* ++noplugin Don't load plugins.
*/
commandLineOptions: {
@@ -184,7 +184,7 @@ const Liberator = Module("liberator", {
// FIXME: popups clear the command line
if (options["visualbell"]) {
// flash the visual bell
let popup = document.getElementById("liberator-visualbell");
let popup = document.getElementById("dactyl-visualbell");
let win = config.visualbellWindow;
let rect = win.getBoundingClientRect();
let width = rect.right - rect.left;
@@ -199,7 +199,7 @@ const Liberator = Module("liberator", {
let soundService = Cc["@mozilla.org/sound;1"].getService(Ci.nsISound);
soundService.beep();
}
return false; // so you can do: if (...) return liberator.beep();
return false; // so you can do: if (...) return dactyl.beep();
},
/**
@@ -270,7 +270,7 @@ const Liberator = Module("liberator", {
let stack = Error().stack.replace(/(?:.*\n){2}/, "");
if (frames != null)
[stack] = stack.match(RegExp("(?:.*\n){0," + frames + "}"));
liberator.dump((msg || "Stack") + "\n" + stack + "\n");
dactyl.dump((msg || "Stack") + "\n" + stack + "\n");
},
/**
@@ -301,7 +301,7 @@ const Liberator = Module("liberator", {
str = str.fileName + ":" + str.lineNumber + ": " + str;
if (options["errorbells"])
liberator.beep();
dactyl.beep();
commandline.echo(str, commandline.HL_ERRORMSG, flags);
},
@@ -318,20 +318,7 @@ const Liberator = Module("liberator", {
* See {@link CommandLine#echo}.
*/
echomsg: function (str, verbosity, flags) {
// TODO: is there a reason for this? --djk
// yes, it doesn't show the MOW on startup if you have e.g. some qmarks in your vimperatorrc.
// Feel free to add another flag like DONT_OPEN_MULTILINE if really needed --mst
//
// But it's _supposed_ to show the MOW on startup when there are
// messages, surely? As far as I'm concerned it essentially works
// exactly as it should with the DISALLOW_MULTILINE flag removed.
// Sending N messages to the command line in a row and having them
// overwrite each other is completely broken. I also think many of
// those messages like "Added quick mark" are plain silly but if
// you don't like them you can set verbose=0, or use :silent when
// someone adds it. I reckon another flag and 'class' of messages
// is just going to unnecessarily complicate things. --djk
flags |= commandline.APPEND_TO_MESSAGES; // | commandline.DISALLOW_MULTILINE;
flags |= commandline.APPEND_TO_MESSAGES;
if (verbosity == null)
verbosity = 0; // verbosity level is exclusionary
@@ -362,7 +349,7 @@ const Liberator = Module("liberator", {
context[EVAL_ERROR] = null;
context[EVAL_STRING] = str;
context[EVAL_RESULT] = null;
this.loadScript("chrome://liberator/content/eval.js", context);
this.loadScript("chrome://dactyl/content/eval.js", context);
if (context[EVAL_ERROR]) {
try {
context[EVAL_ERROR].fileName = io.sourcing.file;
@@ -383,7 +370,7 @@ const Liberator = Module("liberator", {
// partial sixth level expression evaluation
// TODO: what is that really needed for, and where could it be used?
// Or should it be removed? (c) Viktor
// Better name? See other liberator.eval()
// Better name? See other dactyl.eval()
// I agree, the name is confusing, and so is the
// description --Kris
evalExpression: function (string) {
@@ -393,7 +380,7 @@ const Liberator = Module("liberator", {
if (matches) {
let opt = this.options.get(matches[1]);
liberator.assert(opt, "E113: Unknown option: " + matches[1]);
dactyl.assert(opt, "E113: Unknown option: " + matches[1]);
let type = opt.type;
let value = opt.getter();
@@ -442,7 +429,7 @@ const Liberator = Module("liberator", {
if (command === null) {
err = "E492: Not a " + config.name.toLowerCase() + " command: " + str;
liberator.focusContent();
dactyl.focusContent();
}
else if (command.action === null)
err = "E666: Internal error: command.action === null"; // TODO: need to perform this test? -- djk
@@ -451,7 +438,7 @@ const Liberator = Module("liberator", {
else if (special && !command.bang)
err = "E477: No ! allowed";
liberator.assert(!err, err);
dactyl.assert(!err, err);
if (!silent)
commandline.command = str.replace(/^\s*:\s*/, "");
@@ -485,14 +472,14 @@ const Liberator = Module("liberator", {
}
catch (e) {}
if (clearFocusedElement && liberator.focus)
liberator.focus.blur();
if (elem && elem != liberator.focus)
if (clearFocusedElement && dactyl.focus)
dactyl.focus.blur();
if (elem && elem != dactyl.focus)
elem.focus();
},
/**
* Returns whether this Liberator extension supports <b>feature</b>.
* Returns whether this Dactyl extension supports <b>feature</b>.
*
* @param {string} feature The feature name.
* @returns {boolean}
@@ -519,7 +506,7 @@ const Liberator = Module("liberator", {
* @returns {string}
*/
findHelp: function (topic, unchunked) {
if (topic in services.get("liberator:").FILE_MAP)
if (topic in services.get("dactyl:").FILE_MAP)
return topic;
unchunked = !!unchunked;
let items = completion._runCompleter("help", topic, null, unchunked).items;
@@ -544,13 +531,18 @@ const Liberator = Module("liberator", {
* Initialize the help system.
*/
initHelp: function () {
if(!this.helpInitialized) {
let namespaces = [config.name.toLowerCase(), "liberator"];
services.get("liberator:").init({});
if ("noscriptOverlay" in window) {
noscriptOverlay.safeAllow("chrome-data:", true, false);
noscriptOverlay.safeAllow("dactyl:", true, false);
}
let tagMap = services.get("liberator:").HELP_TAGS;
let fileMap = services.get("liberator:").FILE_MAP;
let overlayMap = services.get("liberator:").OVERLAY_MAP;
if(!this.helpInitialized) {
let namespaces = [config.name.toLowerCase(), "dactyl"];
services.get("dactyl:").init({});
let tagMap = services.get("dactyl:").HELP_TAGS;
let fileMap = services.get("dactyl:").FILE_MAP;
let overlayMap = services.get("dactyl:").OVERLAY_MAP;
// Left as an XPCOM instantiation so it can easilly be moved
// into XPCOM code.
@@ -583,7 +575,7 @@ const Liberator = Module("liberator", {
tagMap[elem.value] = file;
}
const XSLT = XSLTProcessor("chrome://liberator/content/help-single.xsl");
const XSLT = XSLTProcessor("chrome://dactyl/content/help-single.xsl");
// Scrape the list of help files from all.xml
// Always process main and overlay files, since XSLTProcessor and
@@ -591,7 +583,7 @@ const Liberator = Module("liberator", {
tagMap.all = "all";
let files = findHelpFile("all").map(function (doc)
[f.value for (f in util.evaluateXPath(
"//liberator:include/@href", doc))]);
"//dactyl:include/@href", doc))]);
// Scrape the tags from the rest of the help files.
util.Array.flatten(files).forEach(function (file) {
@@ -602,7 +594,6 @@ const Liberator = Module("liberator", {
// Process plugin help entries.
XML.ignoreWhiteSpace = false;
XML.prettyPrinting = false;
XML.prettyPrinting = true; // Should be false, but ignoreWhiteSpace=false doesn't work correctly. This is the lesser evil.
XML.prettyIndent = 4;
@@ -613,17 +604,18 @@ const Liberator = Module("liberator", {
context.INFO;
let help = '<?xml version="1.0"?>\n' +
'<?xml-stylesheet type="text/xsl" href="chrome://liberator/content/help.xsl"?>\n' +
'<!DOCTYPE document SYSTEM "chrome://liberator/content/liberator.dtd">' +
'<?xml-stylesheet type="text/xsl" href="chrome://dactyl/content/help.xsl"?>\n' +
'<!DOCTYPE document SYSTEM "chrome://dactyl/content/dactyl.dtd">' +
<document xmlns={NS}
name="plugins" title={config.name + " Plugins"}>
<h1 tag="using-plugins">Using Plugins</h1>
<toc start="2"/>
{body}
</document>.toXMLString();
fileMap["plugins"] = function () ['text/xml;charset=UTF-8', help];
addTags("plugins", util.httpGet("liberator://help/plugins").responseXML);
addTags("plugins", util.httpGet("dactyl://help/plugins").responseXML);
this.helpInitialized = true;
}
},
@@ -637,20 +629,21 @@ const Liberator = Module("liberator", {
* @returns {string}
*/
help: function (topic, unchunked) {
liberator.initHelp();
dactyl.initHelp();
if (!topic) {
let helpFile = unchunked ? "all" : options["helpfile"];
if (helpFile in services.get("liberator:").FILE_MAP)
liberator.open("liberator://help/" + helpFile, { from: "help" });
if (helpFile in services.get("dactyl:").FILE_MAP)
dactyl.open("dactyl://help/" + helpFile, { from: "help" });
else
liberator.echomsg("Sorry, help file " + helpFile.quote() + " not found");
dactyl.echomsg("Sorry, help file " + helpFile.quote() + " not found");
return;
}
let page = this.findHelp(topic, unchunked);
liberator.assert(page != null, "E149: Sorry, no help for " + topic);
dactyl.assert(page != null, "E149: Sorry, no help for " + topic);
liberator.open("liberator://help/" + page, { from: "help" });
dactyl.open("dactyl://help/" + page, { from: "help" });
if (options.get("activate").has("all", "help"))
content.postMessage("fragmentChange", "*");
},
@@ -664,17 +657,17 @@ const Liberator = Module("liberator", {
loadPlugins: function () {
function sourceDirectory(dir) {
liberator.assert(dir.isReadable(), "E484: Can't open file " + dir.path);
dactyl.assert(dir.isReadable(), "E484: Can't open file " + dir.path);
liberator.log("Sourcing plugin directory: " + dir.path + "...", 3);
dactyl.log("Sourcing plugin directory: " + dir.path + "...", 3);
dir.readDirectory(true).forEach(function (file) {
if (file.isFile() && /\.(js|vimp)$/i.test(file.path) && !(file.path in liberator.pluginFiles)) {
if (file.isFile() && /\.(js|vimp)$/i.test(file.path) && !(file.path in dactyl.pluginFiles)) {
try {
io.source(file.path, false);
liberator.pluginFiles[file.path] = true;
dactyl.pluginFiles[file.path] = true;
}
catch (e) {
liberator.reportError(e);
dactyl.reportError(e);
}
}
else if (file.isDirectory())
@@ -685,15 +678,15 @@ const Liberator = Module("liberator", {
let dirs = io.getRuntimeDirectories("plugin");
if (dirs.length == 0) {
liberator.log("No user plugin directory found", 3);
dactyl.log("No user plugin directory found", 3);
return;
}
liberator.echomsg('Searching for "plugin/**/*.{js,vimp}" in "'
dactyl.echomsg('Searching for "plugin/**/*.{js,vimp}" in "'
+ [dir.path.replace(/.plugin$/, "") for ([, dir] in Iterator(dirs))].join(",") + '"', 2);
dirs.forEach(function (dir) {
liberator.echomsg("Searching for \"" + (dir.path + "/**/*.{js,vimp}") + "\"", 3);
dactyl.echomsg("Searching for \"" + (dir.path + "/**/*.{js,vimp}") + "\"", 3);
sourceDirectory(dir);
});
},
@@ -715,7 +708,7 @@ const Liberator = Module("liberator", {
// options does not exist at the very beginning
if (modules.options)
verbose = options.getPref("extensions.liberator.loglevel", 0);
verbose = options.getPref("extensions.dactyl.loglevel", 0);
if (level > verbose)
return;
@@ -736,25 +729,25 @@ const Liberator = Module("liberator", {
* or:
* [["url1", postdata1], ["url2", postdata2], ...]
* @param {number|Object} where If ommited, CURRENT_TAB is assumed but NEW_TAB
* is set when liberator.forceNewTab is true.
* is set when dactyl.forceNewTab is true.
* @param {boolean} force Don't prompt whether to open more than 20
* tabs.
* @returns {boolean}
*/
open: function (urls, params, force) {
// convert the string to an array of converted URLs
// -> see liberator.stringToURLArray for more details
// -> see dactyl.stringToURLArray for more details
//
// This is strange. And counterintuitive. Is it really
// necessary? --Kris
if (typeof urls == "string")
urls = liberator.stringToURLArray(urls);
urls = dactyl.stringToURLArray(urls);
if (urls.length > 20 && !force) {
commandline.input("This will open " + urls.length + " new tabs. Would you like to continue? (yes/[no]) ",
function (resp) {
if (resp && resp.match(/^y(es)?$/i))
liberator.open(urls, params, true);
dactyl.open(urls, params, true);
});
return;
}
@@ -768,11 +761,11 @@ const Liberator = Module("liberator", {
if (params[opt])
flags |= Ci.nsIWebNavigation["LOAD_FLAGS_" + flag];
let where = params.where || liberator.CURRENT_TAB;
let background = ("background" in params) ? params.background : params.where == liberator.NEW_BACKGROUND_TAB;
if ("from" in params && liberator.has("tabs")) {
let where = params.where || dactyl.CURRENT_TAB;
let background = ("background" in params) ? params.background : params.where == dactyl.NEW_BACKGROUND_TAB;
if ("from" in params && dactyl.has("tabs")) {
if (!('where' in params) && options.get("newtab").has("all", params.from))
where = liberator.NEW_TAB;
where = dactyl.NEW_TAB;
background = !options.get("activate").has("all", params.from);
}
@@ -787,13 +780,13 @@ const Liberator = Module("liberator", {
// decide where to load the first url
switch (where) {
case liberator.CURRENT_TAB:
case dactyl.CURRENT_TAB:
browser.loadURIWithFlags(url, flags, null, null, postdata);
break;
case liberator.NEW_TAB:
if (!liberator.has("tabs")) {
open(urls, liberator.NEW_WINDOW);
case dactyl.NEW_TAB:
if (!dactyl.has("tabs")) {
open(urls, dactyl.NEW_WINDOW);
return;
}
@@ -803,7 +796,7 @@ const Liberator = Module("liberator", {
});
break;
case liberator.NEW_WINDOW:
case dactyl.NEW_WINDOW:
window.open();
let win = services.get("windowMediator").getMostRecentWindow("navigator:browser");
win.loadURI(url, null, postdata);
@@ -814,12 +807,12 @@ const Liberator = Module("liberator", {
catch(e) {}
}
if (liberator.forceNewTab)
where = liberator.NEW_TAB;
else if (liberator.forceNewWindow)
where = liberator.NEW_WINDOW;
if (dactyl.forceNewTab)
where = dactyl.NEW_TAB;
else if (dactyl.forceNewWindow)
where = dactyl.NEW_WINDOW;
else if (!where)
where = liberator.CURRENT_TAB;
where = dactyl.CURRENT_TAB;
for (let [, url] in Iterator(urls)) {
open(url, where);
@@ -940,12 +933,12 @@ const Liberator = Module("liberator", {
catch (e) {
if (e instanceof FailedAssertion) {
if (e.message)
liberator.echoerr(e.message);
dactyl.echoerr(e.message);
else
liberator.beep();
dactyl.beep();
}
else
liberator.reportError(e);
dactyl.reportError(e);
return undefined;
}
},
@@ -969,14 +962,14 @@ const Liberator = Module("liberator", {
if (!(k in obj))
obj[k] = v;
}
if (liberator.storeErrors) {
if (dactyl.storeErrors) {
let errors = storage.newArray("errors", { store: false });
errors.toString = function () [String(v[0]) + "\n" + v[1] for ([k, v] in this)].join("\n\n");
errors.push([new Date, obj + obj.stack]);
}
liberator.dump(String(error));
liberator.dump(obj);
liberator.dump("");
dactyl.dump(String(error));
dactyl.dump(obj);
dactyl.dump("");
}
catch (e) { window.dump(e); }
},
@@ -1007,8 +1000,8 @@ const Liberator = Module("liberator", {
},
/**
* Parses a Liberator command-line string i.e. the value of the
* -liberator command-line option.
* Parses a Dactyl command-line string i.e. the value of the
* -dactyl command-line option.
*
* @param {string} cmdline The string to parse for command-line
* options.
@@ -1044,10 +1037,10 @@ const Liberator = Module("liberator", {
threadYield: function (flush, interruptable) {
let mainThread = services.get("threadManager").mainThread;
liberator.interrupted = false;
dactyl.interrupted = false;
do {
mainThread.processNextEvent(!flush);
if (liberator.interrupted)
if (dactyl.interrupted)
throw new Error("Interrupted");
}
while (flush === true && mainThread.hasPendingEvents());
@@ -1136,13 +1129,13 @@ const Liberator = Module("liberator", {
// show a usage index either in the MOW or as a full help page
showHelpIndex: function (tag, items, inMow) {
if (inMow)
liberator.echo(template.usage(items), commandline.FORCE_MULTILINE);
dactyl.echo(template.usage(items), commandline.FORCE_MULTILINE);
else
liberator.help(tag);
dactyl.help(tag);
}
}, {
// Only general options are added here, which are valid for all Liberator extensions
// Only general options are added here, which are valid for all Dactyl extensions
options: function () {
options.add(["errorbells", "eb"],
"Ring the bell when an error message is displayed",
@@ -1287,31 +1280,31 @@ const Liberator = Module("liberator", {
mappings: function () {
mappings.add(modes.all, ["<F1>"],
"Open the help page",
function () { liberator.help(); });
function () { dactyl.help(); });
if (liberator.has("session")) {
if (dactyl.has("session")) {
mappings.add([modes.NORMAL], ["ZQ"],
"Quit and don't save the session",
function () { liberator.quit(false); });
function () { dactyl.quit(false); });
}
mappings.add([modes.NORMAL], ["ZZ"],
"Quit and save the session",
function () { liberator.quit(true); });
function () { dactyl.quit(true); });
},
commands: function () {
commands.add(["addo[ns]"],
"Manage available Extensions and Themes",
function () {
liberator.open("chrome://mozapps/content/extensions/extensions.xul",
dactyl.open("chrome://mozapps/content/extensions/extensions.xul",
{ from: "addons" });
},
{ argCount: "0" });
commands.add(["beep"],
"Play a system beep", // Play? Wrong word. Implies some kind of musicality. --Kris
function () { liberator.beep(); },
function () { dactyl.beep(); },
{ argCount: "0" });
commands.add(["dia[log]"],
@@ -1320,11 +1313,11 @@ const Liberator = Module("liberator", {
let arg = args[0];
try {
liberator.assert(args[0] in config.dialogs, "E475: Invalid argument: " + arg);
dactyl.assert(args[0] in config.dialogs, "E475: Invalid argument: " + arg);
config.dialogs[args[0]][1]();
}
catch (e) {
liberator.echoerr("Error opening " + arg.quote() + ": " + e);
dactyl.echoerr("Error opening " + arg.quote() + ": " + e);
}
}, {
argCount: "1",
@@ -1339,9 +1332,9 @@ const Liberator = Module("liberator", {
"Execute the specified menu item from the command line",
function (args) {
let arg = args.literalArg;
let items = Liberator.getMenuItems();
let items = Dactyl.getMenuItems();
liberator.assert(items.some(function (i) i.fullMenuPath == arg),
dactyl.assert(items.some(function (i) i.fullMenuPath == arg),
"E334: Menu not found: " + arg);
for (let [, item] in Iterator(items)) {
@@ -1363,11 +1356,11 @@ const Liberator = Module("liberator", {
// from quoted args
function (args) {
try {
let cmd = liberator.eval(args.string);
liberator.execute(cmd, null, true);
let cmd = dactyl.eval(args.string);
dactyl.execute(cmd, null, true);
}
catch (e) {
liberator.echoerr(e);
dactyl.echoerr(e);
}
});
@@ -1451,9 +1444,9 @@ const Liberator = Module("liberator", {
else if (file.isReadable() && file.isFile())
AddonManager.getInstallForFile(file, callResult("install"), "application/x-xpinstall");
else if (file.isDirectory())
liberator.echomsg("Cannot install a directory: \"" + file.path + "\"", 0);
dactyl.echomsg("Cannot install a directory: \"" + file.path + "\"", 0);
else
liberator.echoerr("E484: Can't open file " + file.path);
dactyl.echoerr("E484: Can't open file " + file.path);
}, {
argCount: "1",
completer: function (context) {
@@ -1487,9 +1480,9 @@ const Liberator = Module("liberator", {
function (args) {
let name = args[0];
if (args.bang)
liberator.assert(!name, "E488: Trailing characters");
dactyl.assert(!name, "E488: Trailing characters");
else
liberator.assert(name, "E471: Argument required");
dactyl.assert(name, "E471: Argument required");
AddonManager.getAddonsByTypes(["extension"], function (list) {
if (!args.bang)
@@ -1514,11 +1507,11 @@ const Liberator = Module("liberator", {
AddonManager.getAddonsByTypes(["extension"], function (list) {
list = list.filter(function (extension) extension.name == args[0]);
if (!list.length || !list[0].optionsURL)
liberator.echoerr("E474: Invalid argument");
dactyl.echoerr("E474: Invalid argument");
else if (args.bang)
window.openDialog(list[0].optionsURL, "_blank", "chrome");
else
liberator.open(list[0].optionsURL, { from: "extoptions" });
dactyl.open(list[0].optionsURL, { from: "extoptions" });
});
}, {
argCount: "1",
@@ -1559,9 +1552,9 @@ const Liberator = Module("liberator", {
}
else {
if (filter)
liberator.echoerr("Exxx: No extension matching \"" + filter + "\"");
dactyl.echoerr("Exxx: No extension matching \"" + filter + "\"");
else
liberator.echoerr("No extensions installed");
dactyl.echoerr("No extensions installed");
}
});
},
@@ -1571,7 +1564,7 @@ const Liberator = Module("liberator", {
commands.add(["exu[sage]"],
"List all Ex commands with a short description",
function (args) { Liberator.showHelpIndex("ex-cmd-index", commands, args.bang); }, {
function (args) { Dactyl.showHelpIndex("ex-cmd-index", commands, args.bang); }, {
argCount: "0",
bang: true
});
@@ -1590,9 +1583,9 @@ const Liberator = Module("liberator", {
commands.add([command.name],
command.description,
function (args) {
liberator.assert(!args.bang, "E478: Don't panic!");
dactyl.assert(!args.bang, "E478: Don't panic!");
liberator.help(args.literalArg, unchunked);
dactyl.help(args.literalArg, unchunked);
}, {
argCount: "?",
bang: true,
@@ -1605,15 +1598,15 @@ const Liberator = Module("liberator", {
"Run a JavaScript command through eval()",
function (args) {
if (args.bang) { // open JavaScript console
liberator.open("chrome://global/content/console.xul",
dactyl.open("chrome://global/content/console.xul",
{ from: "javascript" });
}
else {
try {
liberator.eval(args.string);
dactyl.eval(args.string);
}
catch (e) {
liberator.echoerr(e);
dactyl.echoerr(e);
}
}
}, {
@@ -1625,7 +1618,7 @@ const Liberator = Module("liberator", {
commands.add(["loadplugins", "lpl"],
"Load all plugins immediately",
function () { liberator.loadPlugins(); },
function () { dactyl.loadPlugins(); },
{ argCount: "0" });
commands.add(["norm[al]"],
@@ -1638,18 +1631,18 @@ const Liberator = Module("liberator", {
commands.add(["optionu[sage]"],
"List all options with a short description",
function (args) { Liberator.showHelpIndex("option-index", options, args.bang); }, {
function (args) { Dactyl.showHelpIndex("option-index", options, args.bang); }, {
argCount: "0",
bang: true
});
commands.add(["q[uit]"],
liberator.has("tabs") ? "Quit current tab" : "Quit application",
dactyl.has("tabs") ? "Quit current tab" : "Quit application",
function (args) {
if (liberator.has("tabs"))
if (dactyl.has("tabs"))
tabs.remove(config.browser.mCurrentTab, 1, false, 1);
else
liberator.quit(false, args.bang);
dactyl.quit(false, args.bang);
}, {
argCount: "0",
bang: true
@@ -1657,7 +1650,7 @@ const Liberator = Module("liberator", {
commands.add(["res[tart]"],
"Force " + config.name + " to restart",
function () { liberator.restart(); },
function () { dactyl.restart(); },
{ argCount: "0" });
var toolbox = document.getElementById("navigator-toolbox");
@@ -1670,7 +1663,7 @@ const Liberator = Module("liberator", {
commands.add(names, desc,
function (args) {
let toolbar = findToolbar(args[0]);
liberator.assert(toolbar, "E474: Invalid argument");
dactyl.assert(toolbar, "E474: Invalid argument");
action(toolbar);
}, {
argcount: "1",
@@ -1701,9 +1694,9 @@ const Liberator = Module("liberator", {
args = args.string;
if (args[0] == ":")
var method = function () liberator.execute(args, null, true);
var method = function () dactyl.execute(args, null, true);
else
method = liberator.eval("(function () {" + args + "})");
method = dactyl.eval("(function () {" + args + "})");
try {
if (count > 1) {
@@ -1756,13 +1749,13 @@ const Liberator = Module("liberator", {
let afterTime = Date.now();
if (afterTime - beforeTime >= 100)
liberator.echo("Total time: " + ((afterTime - beforeTime) / 1000.0).toFixed(2) + " sec");
dactyl.echo("Total time: " + ((afterTime - beforeTime) / 1000.0).toFixed(2) + " sec");
else
liberator.echo("Total time: " + (afterTime - beforeTime) + " msec");
dactyl.echo("Total time: " + (afterTime - beforeTime) + " msec");
}
}
catch (e) {
liberator.echoerr(e);
dactyl.echoerr(e);
}
}, {
argCount: "+",
@@ -1787,7 +1780,7 @@ const Liberator = Module("liberator", {
try {
vbs.set(args.count || 1);
vbs.setFrom = null;
liberator.execute(args[0], null, true);
dactyl.execute(args[0], null, true);
}
finally {
vbs.set(value);
@@ -1804,9 +1797,9 @@ const Liberator = Module("liberator", {
"Show version information",
function (args) {
if (args.bang)
liberator.open("about:");
dactyl.open("about:");
else
liberator.echo(template.commandOutput(<>{config.name} {liberator.version} running on:<br/>{navigator.userAgent}</>));
dactyl.echo(template.commandOutput(<>{config.name} {dactyl.version} running on:<br/>{navigator.userAgent}</>));
}, {
argCount: "0",
bang: true
@@ -1814,7 +1807,7 @@ const Liberator = Module("liberator", {
commands.add(["viu[sage]"],
"List all mappings with a short description",
function (args) { Liberator.showHelpIndex("normal-index", mappings, args.bang); }, {
function (args) { Dactyl.showHelpIndex("normal-index", mappings, args.bang); }, {
argCount: "0",
bang: true
});
@@ -1839,10 +1832,10 @@ const Liberator = Module("liberator", {
};
completion.help = function help(context, unchunked) {
liberator.initHelp();
dactyl.initHelp();
context.title = ["Help"];
context.anchored = false;
context.completions = services.get("liberator:").HELP_TAGS;
context.completions = services.get("dactyl:").HELP_TAGS;
if (unchunked)
context.keys = { text: 0, description: function () "all" };
};
@@ -1851,7 +1844,7 @@ const Liberator = Module("liberator", {
context.title = ["Menu Path", "Label"];
context.anchored = false;
context.keys = { text: "fullMenuPath", description: function (item) item.getAttribute("label") };
context.completions = liberator.menuItems;
context.completions = dactyl.menuItems;
};
var toolbox = document.getElementById("navigator-toolbox");
@@ -1863,34 +1856,34 @@ const Liberator = Module("liberator", {
completion.window = function window(context) {
context.title = ["Window", "Title"]
context.keys = { text: function (win) liberator.windows.indexOf(win) + 1, description: function (win) win.document.title };
context.completions = liberator.windows;
context.keys = { text: function (win) dactyl.windows.indexOf(win) + 1, description: function (win) win.document.title };
context.completions = dactyl.windows;
};
},
load: function () {
liberator.triggerObserver("load");
dactyl.triggerObserver("load");
liberator.log("All modules loaded", 3);
dactyl.log("All modules loaded", 3);
services.add("commandLineHandler", "@mozilla.org/commandlinehandler/general-startup;1?type=" + config.name.toLowerCase());
let commandline = services.get("commandLineHandler").optionValue;
if (commandline) {
let args = liberator.parseCommandLine(commandline);
liberator.commandLineOptions.rcFile = args["+u"];
liberator.commandLineOptions.noPlugins = "++noplugin" in args;
liberator.commandLineOptions.postCommands = args["+c"];
liberator.commandLineOptions.preCommands = args["++cmd"];
liberator.dump("Processing command-line option: " + commandline);
let args = dactyl.parseCommandLine(commandline);
dactyl.commandLineOptions.rcFile = args["+u"];
dactyl.commandLineOptions.noPlugins = "++noplugin" in args;
dactyl.commandLineOptions.postCommands = args["+c"];
dactyl.commandLineOptions.preCommands = args["++cmd"];
dactyl.dump("Processing command-line option: " + commandline);
}
liberator.log("Command-line options: " + util.objectToString(liberator.commandLineOptions), 3);
dactyl.log("Command-line options: " + util.objectToString(dactyl.commandLineOptions), 3);
// first time intro message
const firstTime = "extensions." + config.name.toLowerCase() + ".firsttime";
if (options.getPref(firstTime, true)) {
setTimeout(function () {
liberator.help();
dactyl.help();
options.setPref(firstTime, false);
}, 1000);
}
@@ -1899,11 +1892,11 @@ const Liberator = Module("liberator", {
modes.reset();
// TODO: we should have some class where all this guioptions stuff fits well
Liberator.hideGUI();
Dactyl.hideGUI();
if (liberator.commandLineOptions.preCommands)
liberator.commandLineOptions.preCommands.forEach(function (cmd) {
liberator.execute(cmd);
if (dactyl.commandLineOptions.preCommands)
dactyl.commandLineOptions.preCommands.forEach(function (cmd) {
dactyl.execute(cmd);
});
// finally, read the RC file and source plugins
@@ -1913,35 +1906,35 @@ const Liberator = Module("liberator", {
let init = services.get("environment").get(extensionName + "_INIT");
let rcFile = io.getRCFile("~");
if (liberator.commandLineOptions.rcFile) {
let filename = liberator.commandLineOptions.rcFile;
if (dactyl.commandLineOptions.rcFile) {
let filename = dactyl.commandLineOptions.rcFile;
if (!/^(NONE|NORC)$/.test(filename))
io.source(io.File(filename).path, false); // let io.source handle any read failure like Vim
}
else {
if (init)
liberator.execute(init);
dactyl.execute(init);
else {
if (rcFile) {
io.source(rcFile.path, true);
services.get("environment").set("MY_" + extensionName + "RC", rcFile.path);
}
else
liberator.log("No user RC file found", 3);
dactyl.log("No user RC file found", 3);
}
if (options["exrc"] && !liberator.commandLineOptions.rcFile) {
if (options["exrc"] && !dactyl.commandLineOptions.rcFile) {
let localRCFile = io.getRCFile(io.getCurrentDirectory().path);
if (localRCFile && !localRCFile.equals(rcFile))
io.source(localRCFile.path, true);
}
}
if (liberator.commandLineOptions.rcFile == "NONE" || liberator.commandLineOptions.noPlugins)
if (dactyl.commandLineOptions.rcFile == "NONE" || dactyl.commandLineOptions.noPlugins)
options["loadplugins"] = false;
if (options["loadplugins"])
liberator.loadPlugins();
dactyl.loadPlugins();
// after sourcing the initialization files, this function will set
// all gui options to their default values, if they have not been
@@ -1954,18 +1947,18 @@ const Liberator = Module("liberator", {
option.value = option.value;
}
if (liberator.commandLineOptions.postCommands)
liberator.commandLineOptions.postCommands.forEach(function (cmd) {
liberator.execute(cmd);
if (dactyl.commandLineOptions.postCommands)
dactyl.commandLineOptions.postCommands.forEach(function (cmd) {
dactyl.execute(cmd);
});
liberator.triggerObserver("enter", null);
dactyl.triggerObserver("enter", null);
autocommands.trigger(config.name + "Enter", {});
}, 0);
statusline.update();
liberator.log(config.name + " fully initialized", 0);
liberator.initialized = true;
dactyl.log(config.name + " fully initialized", 0);
dactyl.initialized = true;
}
});

104
common/content/dactyl.xul Normal file
View File

@@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ***** BEGIN LICENSE BLOCK ***** {{{
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
This work is licensed for reuse under an MIT license. Details are
given in the LICENSE.txt file included with this file.
}}} ***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://dactyl/skin/dactyl.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "dactyl.dtd" [
<!ENTITY dactyl.content "chrome://dactyl/content/">
<!ENTITY and "&amp;&amp;">
]>
<overlay id="dactyl"
xmlns:dactyl="http://vimperator.org/namespaces/liberator"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:nc="http://home.netscape.com/NC-rdf#"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript;version=1.8" src="&dactyl.content;dactyl-overlay.js"/>
<window id="&dactyl.mainWindow;">
<stringbundleset id="dactyl-stringbundles">
<stringbundle id="dactyl-charset-bundle"
src="chrome://global/locale/charsetTitles.properties"/>
</stringbundleset>
<keyset id="mainKeyset">
<key id="key_open_vimbar" key=":" oncommand="window.dactyl &and; dactyl.modules.commandline.open(':', '', dactyl.modules.modes.EX);" modifiers=""/>
<key id="key_stop" keycode="VK_ESCAPE" oncommand="window.dactyl &and; dactyl.modules.events.onEscape();"/>
<!-- other keys are handled inside the event loop in events.js -->
</keyset>
<popupset>
<panel id="dactyl-visualbell" dactyl:highlight="Bell"/>
</popupset>
<!--this notifies us also of focus events in the XUL
from: http://developer.mozilla.org/en/docs/XUL_Tutorial:Updating_Commands !-->
<commandset id="onPentadactylFocus"
commandupdater="true"
events="focus"
oncommandupdate="if (window.dactyl &and; dactyl.modules.events != undefined) dactyl.modules.events.onFocusChange(event);"/>
<commandset id="onPentadactylSelect"
commandupdater="true"
events="select"
oncommandupdate="if (window.dactyl &and; dactyl.modules.events != undefined) dactyl.modules.events.onSelectionChange(event);"/>
<!-- As of Firefox 3.1pre, <iframe>.height changes do not seem to have immediate effect,
therefore we need to put them into a <vbox> for which that works just fine -->
<vbox class="dactyl-container" hidden="false" collapsed="true">
<iframe id="dactyl-multiline-output" src="chrome://dactyl/content/buffer.xhtml"
flex="1" hidden="false" collapsed="false"
onclick="window.dactyl &and; dactyl.modules.commandline.onMultilineOutputEvent(event)"/>
</vbox>
<vbox class="dactyl-container" hidden="false" collapsed="true">
<iframe id="dactyl-completions" src="chrome://dactyl/content/buffer.xhtml"
flex="1" hidden="false" collapsed="false"
onclick="window.dactyl &and; dactyl.modules.commandline.onMultilineOutputEvent(event)"/>
</vbox>
<stack orient="horizontal" align="stretch" class="dactyl-container" dactyl:highlight="CmdLine">
<textbox class="plain" id="dactyl-message" flex="1" readonly="true" dactyl:highlight="Normal"/>
<hbox id="dactyl-commandline" hidden="false" collapsed="true" class="dactyl-container" dactyl:highlight="Normal">
<label class="plain" id="dactyl-commandline-prompt" flex="0" crop="end" value="" collapsed="true"/>
<textbox class="plain" id="dactyl-commandline-command" flex="1" type="search" timeout="100"
oninput="window.dactyl &and; dactyl.modules.commandline.onEvent(event);"
onkeyup="window.dactyl &and; dactyl.modules.commandline.onEvent(event);"
onfocus="window.dactyl &and; dactyl.modules.commandline.onEvent(event);"
onblur="window.dactyl &and; dactyl.modules.commandline.onEvent(event);"/>
</hbox>
</stack>
<vbox class="dactyl-container" hidden="false" collapsed="false" dactyl:highlight="CmdLine">
<textbox id="dactyl-multiline-input" class="plain" flex="1" rows="1" hidden="false" collapsed="true" multiline="true" dactyl:highlight="Normal"
onkeypress="window.dactyl &and; dactyl.modules.commandline.onMultilineInputEvent(event);"
oninput="window.dactyl &and; dactyl.modules.commandline.onMultilineInputEvent(event);"
onblur="window.dactyl &and; dactyl.modules.commandline.onMultilineInputEvent(event);"/>
</vbox>
</window>
<statusbar id="status-bar" dactyl:highlight="StatusLine">
<hbox insertbefore="&dactyl.statusBefore;" insertafter="&dactyl.statusAfter;"
id="dactyl-statusline-field-status" flex="1" hidden="false" align="center">
<textbox class="plain" id="dactyl-statusline-field-url" readonly="false" flex="1" crop="end"/>
<label class="plain" id="dactyl-statusline-field-inputbuffer" flex="0"/>
<label class="plain" id="dactyl-statusline-field-progress" flex="0"/>
<label class="plain" id="dactyl-statusline-field-tabcount" flex="0"/>
<label class="plain" id="dactyl-statusline-field-bufferposition" flex="0"/>
<label class="plain" id="dactyl-statusline-field-zoomlevel" flex="0"/>
</hbox>
<!-- just hide them since other elements expect them -->
<statusbarpanel id="statusbar-display" hidden="true"/>
<statusbarpanel id="statusbar-progresspanel" hidden="true"/>
</statusbar>
</overlay>
<!-- vim: set fdm=marker sw=4 ts=4 et: -->

View File

@@ -91,7 +91,7 @@ const Editor = Module("editor", {
},
unselectText: function () {
let elem = liberator.focus;
let elem = dactyl.focus;
// A error occurs if the element has been removed when "elem.selectionStart" is executed.
try {
if (elem && elem.selectionEnd)
@@ -106,13 +106,13 @@ const Editor = Module("editor", {
},
pasteClipboard: function () {
if (liberator.has("Win32")) {
if (dactyl.has("Win32")) {
this.executeCommand("cmd_paste");
return;
}
// FIXME: #93 (<s-insert> in the bottom of a long textarea bounces up)
let elem = liberator.focus;
let elem = dactyl.focus;
if (elem.setSelectionRange && util.readFromClipboard()) {
// readFromClipboard would return 'undefined' if not checked
@@ -139,7 +139,7 @@ const Editor = Module("editor", {
executeCommand: function (cmd, count) {
let controller = Editor.getController();
if (!controller || !controller.supportsCommand(cmd) || !controller.isCommandEnabled(cmd)) {
liberator.beep();
dactyl.beep();
return false;
}
@@ -157,7 +157,7 @@ const Editor = Module("editor", {
}
catch (e) {
if (!didCommand)
liberator.beep();
dactyl.beep();
return false;
}
}
@@ -220,7 +220,7 @@ const Editor = Module("editor", {
break;
default:
liberator.beep();
dactyl.beep();
return false;
}
@@ -240,7 +240,7 @@ const Editor = Module("editor", {
break;
default:
liberator.beep();
dactyl.beep();
return false;
}
return true;
@@ -297,7 +297,7 @@ const Editor = Module("editor", {
return i + 1; // always position the cursor after the char
}
liberator.beep();
dactyl.beep();
return -1;
},
@@ -322,7 +322,7 @@ const Editor = Module("editor", {
return i;
}
liberator.beep();
dactyl.beep();
return -1;
},
@@ -330,10 +330,10 @@ const Editor = Module("editor", {
// TODO: save return value in v:shell_error
let args = commands.parseArgs(options["editor"], [], "*", true);
liberator.assert(args.length >= 1, "No editor specified");
dactyl.assert(args.length >= 1, "No editor specified");
args.push(path);
liberator.callFunctionInThread(null, io.run, io.expandPath(args.shift()), args, true);
dactyl.callFunctionInThread(null, io.run, io.expandPath(args.shift()), args, true);
},
// TODO: clean up with 2 functions for textboxes and currentEditor?
@@ -343,7 +343,7 @@ const Editor = Module("editor", {
let textBox = null;
if (!(config.isComposeWindow))
textBox = liberator.focus;
textBox = dactyl.focus;
if (!forceEditing && textBox && textBox.type == "password") {
commandline.input("Editing a password field externally will reveal the password. Would you like to continue? (yes/[no]): ",
@@ -401,7 +401,7 @@ const Editor = Module("editor", {
// Errors are unlikely, and our error messages won't
// likely be any more helpful than that given in the
// exception.
liberator.echoerr(e);
dactyl.echoerr(e);
tmpBg = "red";
}
@@ -571,11 +571,11 @@ const Editor = Module("editor", {
let list = this.getAbbreviations(filter, lhs);
if (!list.length)
liberator.echomsg("No this._abbreviations found");
dactyl.echomsg("No this._abbreviations found");
else if (list.length == 1) {
let [mode, lhs, rhs] = list[0];
liberator.echo(mode + " " + lhs + " " + rhs, commandline.FORCE_SINGLELINE); // 2 spaces, 3 spaces
dactyl.echo(mode + " " + lhs + " " + rhs, commandline.FORCE_SINGLELINE); // 2 spaces, 3 spaces
}
else {
list = template.tabular(["", "LHS", "RHS"], [], list);
@@ -592,7 +592,7 @@ const Editor = Module("editor", {
*/
removeAbbreviation: function (filter, lhs) {
if (!lhs) {
liberator.echoerr("E474: Invalid argument");
dactyl.echoerr("E474: Invalid argument");
return false;
}
@@ -623,7 +623,7 @@ const Editor = Module("editor", {
}
}
liberator.echoerr("E24: No such abbreviation");
dactyl.echoerr("E24: No such abbreviation");
return false;
},
@@ -640,7 +640,7 @@ const Editor = Module("editor", {
this.removeAbbreviation(filter, lhs);
}
}, {
getEditor: function () liberator.focus,
getEditor: function () dactyl.focus,
getController: function () {
let ed = Editor.getEditor();
@@ -660,7 +660,7 @@ const Editor = Module("editor", {
"Abbreviate a key sequence" + modeDescription,
function (args) {
let matches = args.string.match(RegExp("^\\s*($|" + editor._abbrevmatch + ")(?:\\s*$|\\s+(.*))"));
liberator.assert(matches, "E474: Invalid argument");
dactyl.assert(matches, "E474: Invalid argument");
let [, lhs, rhs] = matches;
if (rhs)
@@ -866,7 +866,7 @@ const Editor = Module("editor", {
mappings.add([modes.INSERT],
["<C-t>"], "Edit text field in Vi mode",
function () { liberator.mode = modes.TEXTAREA; });
function () { dactyl.mode = modes.TEXTAREA; });
mappings.add([modes.INSERT],
["<Space>", "<Return>"], "Expand insert mode abbreviation",
@@ -886,7 +886,7 @@ const Editor = Module("editor", {
["u"], "Undo",
function (count) {
editor.executeCommand("cmd_undo", count);
liberator.mode = modes.TEXTAREA;
dactyl.mode = modes.TEXTAREA;
},
{ count: true });
@@ -894,7 +894,7 @@ const Editor = Module("editor", {
["<C-r>"], "Redo",
function (count) {
editor.executeCommand("cmd_redo", count);
liberator.mode = modes.TEXTAREA;
dactyl.mode = modes.TEXTAREA;
},
{ count: true });
@@ -932,7 +932,7 @@ const Editor = Module("editor", {
// visual mode
mappings.add([modes.CARET, modes.TEXTAREA],
["v"], "Start visual mode",
function (count) { modes.set(modes.VISUAL, liberator.mode); });
function (count) { modes.set(modes.VISUAL, dactyl.mode); });
mappings.add([modes.VISUAL],
["v"], "End visual mode",
@@ -949,7 +949,7 @@ const Editor = Module("editor", {
mappings.add([modes.VISUAL],
["c", "s"], "Change selected text",
function (count) {
liberator.assert(modes.extended & modes.TEXTAREA);
dactyl.assert(modes.extended & modes.TEXTAREA);
editor.executeCommand("cmd_cut");
modes.set(modes.INSERT, modes.TEXTAREA);
});
@@ -962,7 +962,7 @@ const Editor = Module("editor", {
modes.set(modes.TEXTAREA);
}
else
liberator.beep();
dactyl.beep();
});
mappings.add([modes.VISUAL],
@@ -974,7 +974,7 @@ const Editor = Module("editor", {
}
else {
let sel = window.content.document.getSelection();
liberator.assert(sel);
dactyl.assert(sel);
util.copyToClipboard(sel, true);
}
});
@@ -982,12 +982,12 @@ const Editor = Module("editor", {
mappings.add([modes.VISUAL, modes.TEXTAREA],
["p"], "Paste clipboard contents",
function (count) {
liberator.assert(!(modes.extended & modes.CARET));
dactyl.assert(!(modes.extended & modes.CARET));
if (!count)
count = 1;
while (count--)
editor.executeCommand("cmd_paste");
liberator.mode = modes.TEXTAREA;
dactyl.mode = modes.TEXTAREA;
});
// finding characters
@@ -996,7 +996,7 @@ const Editor = Module("editor", {
function (count, arg) {
let pos = editor.findCharForward(arg, count);
if (pos >= 0)
editor.moveToPosition(pos, true, liberator.mode == modes.VISUAL);
editor.moveToPosition(pos, true, dactyl.mode == modes.VISUAL);
},
{ arg: true, count: true });
@@ -1005,7 +1005,7 @@ const Editor = Module("editor", {
function (count, arg) {
let pos = editor.findCharBackward(arg, count);
if (pos >= 0)
editor.moveToPosition(pos, false, liberator.mode == modes.VISUAL);
editor.moveToPosition(pos, false, dactyl.mode == modes.VISUAL);
},
{ arg: true, count: true });
@@ -1014,7 +1014,7 @@ const Editor = Module("editor", {
function (count, arg) {
let pos = editor.findCharForward(arg, count);
if (pos >= 0)
editor.moveToPosition(pos - 1, true, liberator.mode == modes.VISUAL);
editor.moveToPosition(pos - 1, true, dactyl.mode == modes.VISUAL);
},
{ arg: true, count: true });
@@ -1023,7 +1023,7 @@ const Editor = Module("editor", {
function (count, arg) {
let pos = editor.findCharBackward(arg, count);
if (pos >= 0)
editor.moveToPosition(pos + 1, false, liberator.mode == modes.VISUAL);
editor.moveToPosition(pos + 1, false, dactyl.mode == modes.VISUAL);
},
{ arg: true, count: true });
@@ -1039,7 +1039,7 @@ const Editor = Module("editor", {
while (count-- > 0) {
let text = Editor.getEditor().value;
let pos = Editor.getEditor().selectionStart;
liberator.assert(pos < text.length);
dactyl.assert(pos < text.length);
let chr = text[pos];
Editor.getEditor().value = text.substring(0, pos) +

View File

@@ -1,7 +1,7 @@
try { __liberator_eval_result = eval(__liberator_eval_string);
try { __dactyl_eval_result = eval(__dactyl_eval_string);
}
catch (e) {
__liberator_eval_error = e;
__dactyl_eval_error = e;
}
// IMPORTANT: The eval statement *must* remain on the first line
// in order for line numbering in any errors to remain correct.

View File

@@ -28,7 +28,7 @@ const Events = Module("events", {
// NOTE: the order of ["Esc", "Escape"] or ["Escape", "Esc"]
// matters, so use that string as the first item, that you
// want to refer to within liberator's source code for
// want to refer to within dactyl's source code for
// comparisons like if (key == "<Esc>") { ... }
this._keyTable = {
add: ["Plus", "Add"],
@@ -80,8 +80,8 @@ const Events = Module("events", {
if (dirs.length > 0) {
for (let [, dir] in Iterator(dirs)) {
liberator.echomsg('Searching for "macros/*" in ' + dir.path.quote(), 2);
liberator.log("Sourcing macros directory: " + dir.path + "...", 3);
dactyl.echomsg('Searching for "macros/*" in ' + dir.path.quote(), 2);
dactyl.log("Sourcing macros directory: " + dir.path + "...", 3);
for (let file in dir.iterDirectory()) {
if (file.exists() && !file.isDirectory() && file.isReadable() &&
@@ -89,17 +89,17 @@ const Events = Module("events", {
let name = file.leafName.replace(/\.vimp$/i, "");
this._macros.set(name, file.read().split("\n")[0]);
liberator.log("Macro " + name + " added: " + this._macros.get(name), 5);
dactyl.log("Macro " + name + " added: " + this._macros.get(name), 5);
}
}
}
}
else
liberator.log("No user macros directory found", 3);
dactyl.log("No user macros directory found", 3);
}
catch (e) {
// thrown if directory does not exist
liberator.log("Error sourcing macros directory: " + e, 9);
dactyl.log("Error sourcing macros directory: " + e, 9);
}
}, 100);
@@ -118,14 +118,14 @@ const Events = Module("events", {
},
destroy: function () {
liberator.dump("Removing all event listeners");
dactyl.dump("Removing all event listeners");
for (let args in values(this.sessionListeners))
args[0].removeEventListener.apply(args[0], args.slice(1));
},
/**
* Adds an event listener for this session and removes it on
* liberator shutdown.
* dactyl shutdown.
*
* @param {Element} target The element on which to listen.
* @param {string} event The event to listen for.
@@ -149,10 +149,10 @@ const Events = Module("events", {
}
catch (e) {
if (e.message == "Interrupted")
liberator.echoerr("Interrupted");
dactyl.echoerr("Interrupted");
else
liberator.echoerr("Processing " + event.type + " event: " + (e.echoerr || e));
liberator.reportError(e);
dactyl.echoerr("Processing " + event.type + " event: " + (e.echoerr || e));
dactyl.reportError(e);
}
};
},
@@ -170,7 +170,7 @@ const Events = Module("events", {
*/
startRecording: function (macro) {
// TODO: ignore this like Vim?
liberator.assert(/[a-zA-Z0-9]/.test(macro),
dactyl.assert(/[a-zA-Z0-9]/.test(macro),
"E354: Invalid register name: '" + macro + "'");
modes.isRecording = true;
@@ -195,13 +195,13 @@ const Events = Module("events", {
playMacro: function (macro) {
let res = false;
if (!/[a-zA-Z0-9@]/.test(macro) && macro.length == 1) {
liberator.echoerr("E354: Invalid register name: '" + macro + "'");
dactyl.echoerr("E354: Invalid register name: '" + macro + "'");
return false;
}
if (macro == "@") { // use lastMacro if it's set
if (!this._lastMacro) {
liberator.echoerr("E748: No previously used register");
dactyl.echoerr("E748: No previously used register");
return false;
}
}
@@ -227,9 +227,9 @@ const Events = Module("events", {
else {
if (this._lastMacro.length == 1)
// TODO: ignore this like Vim?
liberator.echoerr("Exxx: Register '" + this._lastMacro + "' not set");
dactyl.echoerr("Exxx: Register '" + this._lastMacro + "' not set");
else
liberator.echoerr("Exxx: Named macro '" + this._lastMacro + "' not set");
dactyl.echoerr("Exxx: Named macro '" + this._lastMacro + "' not set");
}
return res;
},
@@ -264,7 +264,7 @@ const Events = Module("events", {
},
/**
* Pushes keys onto the event queue from liberator. It is similar to
* Pushes keys onto the event queue from dactyl. It is similar to
* Vim's feedkeys() method, but cannot cope with 2 partially-fed
* strings, you have to feed one parsable string.
*
@@ -288,10 +288,10 @@ const Events = Module("events", {
commandline.quiet = quiet;
try {
liberator.threadYield(1, true);
dactyl.threadYield(1, true);
for (let [, evt_obj] in Iterator(events.fromString(keys))) {
let elem = liberator.focus || window.content;
let elem = dactyl.focus || window.content;
let evt = events.create(doc, "keypress", evt_obj);
if (typeof noremap == "object")
@@ -300,10 +300,10 @@ const Events = Module("events", {
else
evt.noremap = !!noremap;
evt.isMacro = true;
// A special hack for liberator-specific key names.
if (evt_obj.liberatorString || evt_obj.liberatorShift) {
evt.liberatorString = evt_obj.liberatorString; // for key-less keypress events e.g. <Nop>
evt.liberatorShift = evt_obj.liberatorShift; // for untypable shift keys e.g. <S-1>
// A special hack for dactyl-specific key names.
if (evt_obj.dactylString || evt_obj.dactylShift) {
evt.dactylString = evt_obj.dactylString; // for key-less keypress events e.g. <Nop>
evt.dactylShift = evt_obj.dactylShift; // for untypable shift keys e.g. <S-1>
events.onKeyPress(evt);
}
@@ -404,10 +404,10 @@ const Events = Module("events", {
* purposes. They have many of the properties you'd expect to find on a
* real event, but none of the methods.
*
* Also may contain two "special" parameters, .liberatorString and
* .liberatorShift these are set for characters that can never by
* Also may contain two "special" parameters, .dactylString and
* .dactylShift these are set for characters that can never by
* typed, but may appear in mappings, for example <Nop> is passed as
* liberatorString, and liberatorShift is set when a user specifies
* dactylString, and dactylShift is set when a user specifies
* <S-@> where @ is a non-case-changable, non-space character.
*
* @param {string} keys The string to parse.
@@ -439,13 +439,13 @@ const Events = Module("events", {
if (evt_obj.shiftKey) {
keyname = keyname.toUpperCase();
if (keyname == keyname.toLowerCase())
evt_obj.liberatorShift = true;
evt_obj.dactylShift = true;
}
evt_obj.charCode = keyname.charCodeAt(0);
}
else if (keyname == "nop") {
evt_obj.liberatorString = "<Nop>";
evt_obj.dactylString = "<Nop>";
}
else if (/mouse$/.test(keyname)) { // mouse events
evt_obj.type = (/2-/.test(modifier) ? "dblclick" : "click");
@@ -478,7 +478,7 @@ const Events = Module("events", {
},
/**
* Converts the specified event to a string in liberator key-code
* Converts the specified event to a string in dactyl key-code
* notation. Returns null for an unknown event.
*
* E.g. pressing ctrl+n would result in the string "<C-n>".
@@ -490,8 +490,8 @@ const Events = Module("events", {
if (!event)
return "[instance events]";
if (event.liberatorString)
return event.liberatorString;
if (event.dactylString)
return event.dactylString;
let key = null;
let modifier = "";
@@ -516,22 +516,22 @@ const Events = Module("events", {
// (i.e., cntrl codes 27--31)
// ---
// For more information, see:
// [*] Vimp FAQ: http://vimperator.org/trac/wiki/Vimperator/FAQ#WhydoesntC-workforEscMacOSX
// [*] Referenced mailing list msg: http://www.mozdev.org/pipermail/vimperator/2008-May/001548.html
// [*] Vimp FAQ: http://vimperator.org/trac/wiki/Pentadactyl/FAQ#WhydoesntC-workforEscMacOSX
// [*] Referenced mailing list msg: http://www.mozdev.org/pipermail/pentadactyl/2008-May/001548.html
// [*] Mozilla bug 416227: event.charCode in keypress handler has unexpected values on Mac for Ctrl with chars in "[ ] _ \"
// https://bugzilla.mozilla.org/show_bug.cgi?query_format=specific&order=relevance+desc&bug_status=__open__&id=416227
// [*] Mozilla bug 432951: Ctrl+'foo' doesn't seem same charCode as Meta+'foo' on Cocoa
// https://bugzilla.mozilla.org/show_bug.cgi?query_format=specific&order=relevance+desc&bug_status=__open__&id=432951
// ---
//
// The following fixes are only activated if liberator.has("MacUnix").
// The following fixes are only activated if dactyl.has("MacUnix").
// Technically, they prevent mappings from <C-Esc> (and
// <C-C-]> if your fancy keyboard permits such things<?>), but
// these <C-control> mappings are probably pathological (<C-Esc>
// certainly is on Windows), and so it is probably
// harmless to remove the has("MacUnix") if desired.
//
else if (liberator.has("MacUnix") && event.ctrlKey && charCode >= 27 && charCode <= 31) {
else if (dactyl.has("MacUnix") && event.ctrlKey && charCode >= 27 && charCode <= 31) {
if (charCode == 27) { // [Ctrl-Bug 1/5] the <C-[> bug
key = "Esc";
modifier = modifier.replace("C-", "");
@@ -545,7 +545,7 @@ const Events = Module("events", {
if (key in this._key_code) {
// a named charcode key (<Space> and <lt>) space can be shifted, <lt> must be forced
if ((key.match(/^\s$/) && event.shiftKey) || event.liberatorShift)
if ((key.match(/^\s$/) && event.shiftKey) || event.dactylShift)
modifier += "S-";
key = this._code_key[this._key_code[key]];
@@ -553,7 +553,7 @@ const Events = Module("events", {
else {
// a shift modifier is only allowed if the key is alphabetical and used in a C-A-M- mapping in the uppercase,
// or if the shift has been forced for a non-alphabetical character by the user while :map-ping
if ((key != key.toLowerCase() && (event.ctrlKey || event.altKey || event.metaKey)) || event.liberatorShift)
if ((key != key.toLowerCase() && (event.ctrlKey || event.altKey || event.metaKey)) || event.dactylShift)
modifier += "S-";
else if (modifier.length == 0)
return key;
@@ -613,8 +613,8 @@ const Events = Module("events", {
* @returns {boolean}
*/
waitForPageLoad: function () {
//liberator.dump("start waiting in loaded state: " + buffer.loaded);
liberator.threadYield(true); // clear queue
//dactyl.dump("start waiting in loaded state: " + buffer.loaded);
dactyl.threadYield(true); // clear queue
if (buffer.loaded == 1)
return true;
@@ -624,31 +624,31 @@ const Events = Module("events", {
let end = start + (maxWaitTime * 1000); // maximum time to wait - TODO: add option
let now;
while (now = Date.now(), now < end) {
liberator.threadYield();
dactyl.threadYield();
//if ((now - start) % 1000 < 10)
// liberator.dump("waited: " + (now - start) + " ms");
// dactyl.dump("waited: " + (now - start) + " ms");
if (!events.feedingKeys)
return false;
if (buffer.loaded > 0) {
liberator.sleep(250);
dactyl.sleep(250);
break;
}
else
liberator.echo("Waiting for page to load...", commandline.DISALLOW_MULTILINE);
dactyl.echo("Waiting for page to load...", commandline.DISALLOW_MULTILINE);
}
modes.show();
// TODO: allow macros to be continued when page does not fully load with an option
let ret = (buffer.loaded == 1);
if (!ret)
liberator.echoerr("Page did not load completely in " + maxWaitTime + " seconds. Macro stopped.");
//liberator.dump("done waiting: " + ret);
dactyl.echoerr("Page did not load completely in " + maxWaitTime + " seconds. Macro stopped.");
//dactyl.dump("done waiting: " + ret);
// sometimes the input widget had focus when replaying a macro
// maybe this call should be moved somewhere else?
// liberator.focusContent(true);
// dactyl.focusContent(true);
return ret;
},
@@ -675,7 +675,7 @@ const Events = Module("events", {
return;
}
switch (liberator.mode) {
switch (dactyl.mode) {
case modes.NORMAL:
// clear any selection made
let selection = window.content.getSelection();
@@ -689,9 +689,9 @@ const Events = Module("events", {
case modes.VISUAL:
if (modes.extended & modes.TEXTAREA)
liberator.mode = modes.TEXTAREA;
dactyl.mode = modes.TEXTAREA;
else if (modes.extended & modes.CARET)
liberator.mode = modes.CARET;
dactyl.mode = modes.CARET;
break;
case modes.CARET:
@@ -711,20 +711,20 @@ const Events = Module("events", {
// it's a Vi editing mode. Extended modes really need to be
// displayed too. --djk
function isInputField() {
let elem = liberator.focus;
let elem = dactyl.focus;
return ((elem instanceof HTMLInputElement && !/image/.test(elem.type))
|| elem instanceof HTMLIsIndexElement);
}
if (options["insertmode"] || isInputField())
liberator.mode = modes.INSERT;
dactyl.mode = modes.INSERT;
else
modes.reset();
break;
case modes.INSERT:
if ((modes.extended & modes.TEXTAREA))
liberator.mode = modes.TEXTAREA;
dactyl.mode = modes.TEXTAREA;
else
modes.reset();
break;
@@ -752,7 +752,7 @@ const Events = Module("events", {
// Huh? --djk
onFocusChange: function (event) {
// command line has it's own focus change handler
if (liberator.mode == modes.COMMAND_LINE)
if (dactyl.mode == modes.COMMAND_LINE)
return;
function hasHTMLDocument(win) win && win.document && win.document instanceof HTMLDocument
@@ -760,7 +760,7 @@ const Events = Module("events", {
let win = window.document.commandDispatcher.focusedWindow;
let elem = window.document.commandDispatcher.focusedElement;
if (win && win.top == content && liberator.has("tabs"))
if (win && win.top == content && dactyl.has("tabs"))
tabs.localStore.focusedFrame = win;
try {
@@ -769,14 +769,14 @@ const Events = Module("events", {
if ((elem instanceof HTMLInputElement && /^(search|text|password)$/.test(elem.type)) ||
(elem instanceof HTMLSelectElement)) {
liberator.mode = modes.INSERT;
dactyl.mode = modes.INSERT;
if (hasHTMLDocument(win))
buffer.lastInputField = elem;
return;
}
if(isinstance(elem, [HTMLEmbedElement, HTMLEmbedElement])) {
liberator.mode = modes.EMBED;
dactyl.mode = modes.EMBED;
return;
}
@@ -799,9 +799,9 @@ const Events = Module("events", {
let urlbar = document.getElementById("urlbar");
if (elem == null && urlbar && urlbar.inputField == this._lastFocus)
liberator.threadYield(true);
dactyl.threadYield(true);
if (liberator.mode & (modes.EMBED | modes.INSERT | modes.TEXTAREA | modes.VISUAL))
if (dactyl.mode & (modes.EMBED | modes.INSERT | modes.TEXTAREA | modes.VISUAL))
modes.reset();
}
finally {
@@ -827,17 +827,17 @@ const Events = Module("events", {
if (modes.isRecording) {
if (key == "q") { // TODO: should not be hardcoded
modes.isRecording = false;
liberator.log("Recorded " + this._currentMacro + ": " + this._macros.get(this._currentMacro), 9);
liberator.echomsg("Recorded macro '" + this._currentMacro + "'");
dactyl.log("Recorded " + this._currentMacro + ": " + this._macros.get(this._currentMacro), 9);
dactyl.echomsg("Recorded macro '" + this._currentMacro + "'");
killEvent();
return;
}
else if (!mappings.hasMap(liberator.mode, this._input.buffer + key))
else if (!mappings.hasMap(dactyl.mode, this._input.buffer + key))
this._macros.set(this._currentMacro, this._macros.get(this._currentMacro) + key);
}
if (key == "<C-c>")
liberator.interrupted = true;
dactyl.interrupted = true;
// feedingKeys needs to be separate from interrupted so
// we can differentiate between a recorded <C-c>
@@ -848,7 +848,7 @@ const Events = Module("events", {
events.feedingKeys = false;
if (modes.isReplaying) {
modes.isReplaying = false;
this.setTimeout(function () { liberator.echomsg("Canceled playback of macro '" + this._lastMacro + "'"); }, 100);
this.setTimeout(function () { dactyl.echomsg("Canceled playback of macro '" + this._lastMacro + "'"); }, 100);
}
}
else
@@ -890,7 +890,7 @@ const Events = Module("events", {
stop = true; // set to false if we should NOT consume this event but let the host app handle it
// just forward event without checking any mappings when the MOW is open
if (liberator.mode == modes.COMMAND_LINE && (modes.extended & modes.OUTPUT_MULTILINE)) {
if (dactyl.mode == modes.COMMAND_LINE && (modes.extended & modes.OUTPUT_MULTILINE)) {
commandline.onMultilineOutputEvent(event);
throw killEvent();
}
@@ -899,7 +899,7 @@ const Events = Module("events", {
// they are without beeping also fixes key navigation in combo
// boxes, submitting forms, etc.
// FIXME: breaks iabbr for now --mst
if (key in config.ignoreKeys && (config.ignoreKeys[key] & liberator.mode)) {
if (key in config.ignoreKeys && (config.ignoreKeys[key] & dactyl.mode)) {
this._input.buffer = "";
return;
}
@@ -908,7 +908,7 @@ const Events = Module("events", {
if (!isEscapeKey(key)) {
// custom mode...
if (liberator.mode == modes.CUSTOM) {
if (dactyl.mode == modes.CUSTOM) {
plugins.onEvent(event);
throw killEvent();
}
@@ -938,15 +938,15 @@ const Events = Module("events", {
// whatever reason). if that happens to be correct, well..
// XXX: why not just do that as well for HINTS mode actually?
if (liberator.mode == modes.CUSTOM)
if (dactyl.mode == modes.CUSTOM)
return;
let inputStr = this._input.buffer + key;
let countStr = inputStr.match(/^[1-9][0-9]*|/)[0];
let candidateCommand = inputStr.substr(countStr.length);
let map = mappings[event.noremap ? "getDefault" : "get"](liberator.mode, candidateCommand);
let map = mappings[event.noremap ? "getDefault" : "get"](dactyl.mode, candidateCommand);
let candidates = mappings.getCandidates(liberator.mode, candidateCommand);
let candidates = mappings.getCandidates(dactyl.mode, candidateCommand);
if (candidates.length == 0 && !map) {
map = this._input.pendingMap;
this._input.pendingMap = null;
@@ -1002,14 +1002,14 @@ const Events = Module("events", {
stop = false;
}
}
else if (mappings.getCandidates(liberator.mode, candidateCommand).length > 0 && !event.skipmap) {
else if (mappings.getCandidates(dactyl.mode, candidateCommand).length > 0 && !event.skipmap) {
this._input.pendingMap = map;
this._input.buffer += key;
}
else { // if the key is neither a mapping nor the start of one
// the mode checking is necessary so that things like g<esc> do not beep
if (this._input.buffer != "" && !event.skipmap &&
(liberator.mode & (modes.INSERT | modes.COMMAND_LINE | modes.TEXTAREA)))
(dactyl.mode & (modes.INSERT | modes.COMMAND_LINE | modes.TEXTAREA)))
events.feedkeys(this._input.buffer, { noremap: true, skipmap: true });
this._input.buffer = "";
@@ -1021,14 +1021,14 @@ const Events = Module("events", {
// allow key to be passed to the host app if we can't handle it
stop = false;
if (liberator.mode == modes.COMMAND_LINE) {
if (dactyl.mode == modes.COMMAND_LINE) {
if (!(modes.extended & modes.INPUT_MULTILINE))
liberator.trapErrors(function () {
dactyl.trapErrors(function () {
commandline.onEvent(event); // reroute event in command line mode
});
}
else if (!modes.mainMode.input)
liberator.beep();
dactyl.beep();
}
}
@@ -1037,7 +1037,7 @@ const Events = Module("events", {
}
catch (e) {
if (e !== undefined)
liberator.reportError(e);
dactyl.reportError(e);
}
finally {
let motionMap = (this._input.pendingMotionMap && this._input.pendingMotionMap.names[0]) || "";
@@ -1057,11 +1057,11 @@ const Events = Module("events", {
let elem = event.target;
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
for(; win; win = win != win.parent && win.parent)
win.liberatorFocusAllowed = true;
win.dactylFocusAllowed = true;
},
onPopupShown: function (event) {
if (event.originalTarget.localName == "tooltip" || event.originalTarget.id == "liberator-visualbell")
if (event.originalTarget.localName == "tooltip" || event.originalTarget.id == "dactyl-visualbell")
return;
modes.add(modes.MENU);
},
@@ -1075,7 +1075,7 @@ const Events = Module("events", {
onResize: function (event) {
if (window.fullScreen != this._fullscreen) {
this._fullscreen = window.fullScreen;
liberator.triggerObserver("fullscreen", this._fullscreen);
dactyl.triggerObserver("fullscreen", this._fullscreen);
autocommands.trigger("Fullscreen", { state: this._fullscreen });
}
},
@@ -1086,13 +1086,13 @@ const Events = Module("events", {
if (controller && controller.isCommandEnabled("cmd_copy"))
couldCopy = true;
if (liberator.mode != modes.VISUAL) {
if (dactyl.mode != modes.VISUAL) {
if (couldCopy) {
if ((liberator.mode == modes.TEXTAREA ||
if ((dactyl.mode == modes.TEXTAREA ||
(modes.extended & modes.TEXTAREA))
&& !options["insertmode"])
modes.set(modes.VISUAL, modes.TEXTAREA);
else if (liberator.mode == modes.CARET)
else if (dactyl.mode == modes.CARET)
modes.set(modes.VISUAL, modes.CARET);
}
}
@@ -1100,12 +1100,12 @@ const Events = Module("events", {
// else
// {
// if (!couldCopy && modes.extended & modes.CARET)
// liberator.mode = modes.CARET;
// dactyl.mode = modes.CARET;
// }
}
}, {
isInputElemFocused: function () {
let elem = liberator.focus;
let elem = dactyl.focus;
return ((elem instanceof HTMLInputElement && !/image/.test(elem.type)) ||
elem instanceof HTMLTextAreaElement ||
elem instanceof HTMLIsIndexElement ||
@@ -1117,14 +1117,14 @@ const Events = Module("events", {
commands.add(["delmac[ros]"],
"Delete macros",
function (args) {
liberator.assert(!args.bang || !args.string, "E474: Invalid argument");
dactyl.assert(!args.bang || !args.string, "E474: Invalid argument");
if (args.bang)
events.deleteMacros();
else if (args.string)
events.deleteMacros(args.string);
else
liberator.echoerr("E471: Argument required");
dactyl.echoerr("E471: Argument required");
}, {
bang: true,
completer: function (context) completion.macro(context)

View File

@@ -61,7 +61,7 @@ const RangeFinder = Module("rangefinder", {
find: function (pattern, backwards) {
let str = this.bootstrap(pattern);
if (!this.rangeFind.search(str))
setTimeout(function () { liberator.echoerr("E486: Pattern not found: " + pattern); }, 0);
setTimeout(function () { dactyl.echoerr("E486: Pattern not found: " + pattern); }, 0);
return this.rangeFind.found;
},
@@ -70,7 +70,7 @@ const RangeFinder = Module("rangefinder", {
if (!this.rangeFind)
this.find(this.lastSearchPattern);
else if (!this.rangeFind.search(null, reverse))
liberator.echoerr("E486: Pattern not found: " + this.lastSearchPattern);
dactyl.echoerr("E486: Pattern not found: " + this.lastSearchPattern);
else if (this.rangeFind.wrapped) {
// hack needed, because wrapping causes a "scroll" event which clears
// our command line

View File

@@ -1,9 +1,9 @@
<!DOCTYPE document SYSTEM "chrome://liberator/content/liberator.dtd">
<!DOCTYPE document SYSTEM "chrome://dactyl/content/dactyl.dtd">
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:liberator="http://vimperator.org/namespaces/liberator"
xmlns:dactyl="http://vimperator.org/namespaces/liberator"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:str="http://exslt.org/strings"
xmlns:exsl="http://exslt.org/common"
@@ -11,19 +11,19 @@
<xsl:output method="xml" indent="no"/>
<xsl:variable name="root" select="/liberator:document"/>
<xsl:variable name="root" select="/dactyl:document"/>
<xsl:variable name="tags">
<xsl:text> </xsl:text>
<xsl:for-each select="$root//@tag|$root//liberator:tags/text()|$root//liberator:tag/text()">
<xsl:for-each select="$root//@tag|$root//dactyl:tags/text()|$root//dactyl:tag/text()">
<xsl:value-of select="concat(., ' ')"/>
</xsl:for-each>
</xsl:variable>
<xsl:template name="parse-tags">
<xsl:param name="text"/>
<div liberator:highlight="HelpTags">
<div dactyl:highlight="HelpTags">
<xsl:for-each select="str:tokenize($text)">
<a id="{.}" liberator:highlight="HelpTag"><xsl:value-of select="."/></a>
<a id="{.}" dactyl:highlight="HelpTag"><xsl:value-of select="."/></a>
</xsl:for-each>
</div>
</xsl:template>

View File

@@ -15,13 +15,13 @@ p.tagline {
font-weight: bold;
}
table.vimperator {
table.pentadactyl {
border-width: 1px;
border-style: dotted;
border-color: gray;
/*margin-bottom: 2em; /* FIXME: just a quick hack until we have proper pages */
}
table.vimperator td {
table.pentadactyl td {
border: none;
padding: 3px;
}

View File

@@ -1,10 +1,10 @@
<!DOCTYPE document SYSTEM "chrome://liberator/content/liberator.dtd">
<!DOCTYPE document SYSTEM "chrome://dactyl/content/dactyl.dtd">
<!-- Header {{{1 -->
<xsl:stylesheet version="1.0"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:liberator="http://vimperator.org/namespaces/liberator"
xmlns:dactyl="http://vimperator.org/namespaces/liberator"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:str="http://exslt.org/strings"
xmlns:exsl="http://exslt.org/common"
@@ -15,21 +15,21 @@
<!-- Variable Definitions {{{1 -->
<xsl:variable name="doc">
<xsl:apply-templates select="/liberator:document" mode="overlay"/>
<xsl:apply-templates select="/dactyl:document" mode="overlay"/>
</xsl:variable>
<xsl:variable name="root" select="exsl:node-set($doc)"/>
<xsl:variable name="tags">
<xsl:text> </xsl:text>
<xsl:for-each select="$root//@tag|$root//liberator:tags/text()|$root//liberator:tag/text()">
<xsl:for-each select="$root//@tag|$root//dactyl:tags/text()|$root//dactyl:tag/text()">
<xsl:value-of select="concat(., ' ')"/>
</xsl:for-each>
</xsl:variable>
<!-- Process Overlays {{{1 -->
<xsl:variable name="overlay" select="concat('liberator://help-overlay/', /liberator:document/@name)"/>
<xsl:variable name="overlaydoc" select="document($overlay)/liberator:overlay"/>
<xsl:variable name="overlay" select="concat('dactyl://help-overlay/', /dactyl:document/@name)"/>
<xsl:variable name="overlaydoc" select="document($overlay)/dactyl:overlay"/>
<xsl:template name="splice-overlays">
<xsl:param name="elem"/>
@@ -54,19 +54,19 @@
</xsl:for-each>
</xsl:template>
<xsl:template match="liberator:tags[parent::liberator:document]|liberator:tag" mode="overlay">
<xsl:template match="dactyl:tags[parent::dactyl:document]|dactyl:tag" mode="overlay">
<xsl:call-template name="splice-overlays">
<xsl:with-param name="tag" select="substring-before(concat(., ' '), ' ')"/>
<xsl:with-param name="elem" select="self::node()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="*[liberator:tags]" mode="overlay">
<xsl:template match="*[dactyl:tags]" mode="overlay">
<xsl:call-template name="splice-overlays">
<xsl:with-param name="tag" select="substring-before(concat(liberator:tags, ' '), ' ')"/>
<xsl:with-param name="tag" select="substring-before(concat(dactyl:tags, ' '), ' ')"/>
<xsl:with-param name="elem" select="self::node()"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="liberator:*[@tag and not(@replace)]" mode="overlay">
<xsl:template match="dactyl:*[@tag and not(@replace)]" mode="overlay">
<xsl:call-template name="splice-overlays">
<xsl:with-param name="tag" select="substring-before(concat(@tag, ' '), ' ')"/>
<xsl:with-param name="elem" select="self::node()"/>
@@ -75,9 +75,9 @@
<!-- Process Inclusions {{{1 -->
<xsl:template match="liberator:include" mode="overlay-2">
<div liberator:highlight="HelpInclude">
<xsl:apply-templates select="document(@href)/liberator:document/node()" mode="overlay"/>
<xsl:template match="dactyl:include" mode="overlay-2">
<div dactyl:highlight="HelpInclude">
<xsl:apply-templates select="document(@href)/dactyl:document/node()" mode="overlay"/>
</div>
</xsl:template>
@@ -93,15 +93,15 @@
<!-- Root {{{1 -->
<xsl:template match="/">
<xsl:for-each select="$root/liberator:document">
<html liberator:highlight="Help">
<xsl:for-each select="$root/dactyl:document">
<html dactyl:highlight="Help">
<head>
<title><xsl:value-of select="@title"/></title>
<script type="text/javascript"
src="chrome://liberator/content/help.js"/>
src="chrome://dactyl/content/help.js"/>
</head>
<body liberator:highlight="HelpBody">
<div liberator:highlight="Logo"/>
<body dactyl:highlight="HelpBody">
<div dactyl:highlight="Logo"/>
<xsl:call-template name="parse-tags">
<xsl:with-param name="text" select="concat(@name, '.html')"/>
</xsl:call-template>
@@ -125,7 +125,7 @@
local-name() = $tag and not(preceding::*[local-name() = $lasttag][position() = 1 and not(.=$context)])]"/>
<xsl:if test="$nodes">
<ol liberator:highlight="HelpOrderedList">
<ol dactyl:highlight="HelpOrderedList">
<xsl:for-each select="$nodes">
<li>
<a>
@@ -144,18 +144,18 @@
</ol>
</xsl:if>
</xsl:template>
<xsl:template match="liberator:toc" mode="pass-2">
<xsl:template match="dactyl:toc" mode="pass-2">
<xsl:variable name="TOC">
<context/>
<xsl:for-each
select="following::liberator:h1|following::liberator:h2|following::liberator:h3|following::liberator:h4|following::liberator:h5">
select="following::dactyl:h1|following::dactyl:h2|following::dactyl:h3|following::dactyl:h4|following::dactyl:h5">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="toc" select="exsl:node-set($TOC)"/>
<xsl:if test="//liberator:toc[1 and self::*]">
<div liberator:highlight="HelpTOC">
<xsl:if test="//dactyl:toc[1 and self::*]">
<div dactyl:highlight="HelpTOC">
<h2>Contents</h2>
<xsl:if test="@start">
<xsl:call-template name="toc">
@@ -174,40 +174,40 @@
<!-- Items {{{1 -->
<xsl:template match="liberator:strut" mode="pass-2">
<xsl:template match="dactyl:strut" mode="pass-2">
<div style="clear: both"/>
</xsl:template>
<xsl:template match="liberator:item" mode="pass-2">
<div liberator:highlight="HelpItem">
<xsl:apply-templates select="liberator:tags|liberator:spec|liberator:strut"/>
<xsl:if test="not(liberator:description/@short)">
<xsl:template match="dactyl:item" mode="pass-2">
<div dactyl:highlight="HelpItem">
<xsl:apply-templates select="dactyl:tags|dactyl:spec|dactyl:strut"/>
<xsl:if test="not(dactyl:description/@short)">
<hr style="border: 0; height: 0; margin: 0; width: 100%; float: right;"/>
<div liberator:highlight="HelpOptInfo">
<xsl:apply-templates select="liberator:type|liberator:default"/>
<div dactyl:highlight="HelpOptInfo">
<xsl:apply-templates select="dactyl:type|dactyl:default"/>
<div style="clear: both;"/>
</div>
</xsl:if>
<xsl:apply-templates select="liberator:description"/>
<xsl:apply-templates select="dactyl:description"/>
<div style="clear: both;"/>
</div>
</xsl:template>
<xsl:template match="liberator:spec[preceding-sibling::liberator:spec]" mode="pass-2">
<xsl:template match="dactyl:spec[preceding-sibling::dactyl:spec]" mode="pass-2">
<div style="clear: both;"/>
<div liberator:highlight="HelpSpec">
<div dactyl:highlight="HelpSpec">
<xsl:apply-templates/>
</div>
</xsl:template>
<xsl:template match="liberator:default[not(@type='plain')]" mode="pass-2">
<xsl:variable name="type" select="preceding-sibling::liberator:type[1] | following-sibling::liberator:type[1]"/>
<span liberator:highlight="HelpDefault">(default:<xsl:text> </xsl:text>
<xsl:template match="dactyl:default[not(@type='plain')]" mode="pass-2">
<xsl:variable name="type" select="preceding-sibling::dactyl:type[1] | following-sibling::dactyl:type[1]"/>
<span dactyl:highlight="HelpDefault">(default:<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="starts-with($type, 'string') or starts-with($type, 'regex')">
<span liberator:highlight="HelpString"><xsl:apply-templates/></span>
<span dactyl:highlight="HelpString"><xsl:apply-templates/></span>
</xsl:when>
<xsl:otherwise>
<span>
<xsl:attribute name="liberator:highlight">
<xsl:attribute name="dactyl:highlight">
<xsl:choose>
<xsl:when test="$type = 'boolean'">Boolean</xsl:when>
<xsl:when test="$type = 'number'">Number</xsl:when>
@@ -223,22 +223,22 @@
<!-- Tag Definitions {{{1 -->
<xsl:template match="liberator:tags" mode="pass-2">
<xsl:template match="dactyl:tags" mode="pass-2">
<div style="clear: right"/>
<xsl:call-template name="parse-tags">
<xsl:with-param name="text" select="."/>
</xsl:call-template>
</xsl:template>
<xsl:template match="liberator:tag|@tag" mode="pass-2">
<xsl:template match="dactyl:tag|@tag" mode="pass-2">
<xsl:call-template name="parse-tags">
<xsl:with-param name="text" select="."/>
</xsl:call-template>
</xsl:template>
<xsl:template name="parse-tags">
<xsl:param name="text"/>
<div liberator:highlight="HelpTags">
<div dactyl:highlight="HelpTags">
<xsl:for-each select="str:tokenize($text)">
<a id="{.}" liberator:highlight="HelpTag"><xsl:value-of select="."/></a>
<a id="{.}" dactyl:highlight="HelpTag"><xsl:value-of select="."/></a>
</xsl:for-each>
</div>
</xsl:template>
@@ -248,7 +248,7 @@
<xsl:template name="linkify-tag">
<xsl:param name="contents" select="text()"/>
<xsl:variable name="tag" select="str:tokenize($contents, ' [!')[1]"/>
<a href="liberator://help-tag/{$tag}" style="color: inherit;">
<a href="dactyl://help-tag/{$tag}" style="color: inherit;">
<xsl:if test="contains($tags, concat(' ', $tag, ' '))">
<xsl:attribute name="href">#<xsl:value-of select="$tag"/></xsl:attribute>
</xsl:if>
@@ -256,25 +256,25 @@
</a>
</xsl:template>
<xsl:template match="liberator:o" mode="pass-2">
<span liberator:highlight="HelpOption">
<xsl:template match="dactyl:o" mode="pass-2">
<span dactyl:highlight="HelpOption">
<xsl:call-template name="linkify-tag">
<xsl:with-param name="contents" select='concat("&#39;", text(), "&#39;")'/>
</xsl:call-template>
</span>
</xsl:template>
<xsl:template match="liberator:t" mode="pass-2">
<span liberator:highlight="HelpTopic">
<xsl:template match="dactyl:t" mode="pass-2">
<span dactyl:highlight="HelpTopic">
<xsl:call-template name="linkify-tag"/>
</span>
</xsl:template>
<xsl:template match="liberator:k" mode="pass-2">
<span liberator:highlight="HelpKey">
<xsl:template match="dactyl:k" mode="pass-2">
<span dactyl:highlight="HelpKey">
<xsl:call-template name="linkify-tag"/>
</span>
</xsl:template>
<xsl:template match="liberator:k[@name]" mode="pass-2">
<span liberator:highlight="HelpKey">
<xsl:template match="dactyl:k[@name]" mode="pass-2">
<span dactyl:highlight="HelpKey">
<xsl:call-template name="linkify-tag">
<xsl:with-param name="contents" select="concat('&lt;', @name, '>', .)"/>
</xsl:call-template>
@@ -283,76 +283,76 @@
<!-- HTML-ish elements {{{1 -->
<xsl:template match="liberator:dl" mode="pass-2">
<xsl:template match="dactyl:dl" mode="pass-2">
<dl>
<column/>
<column/>
<xsl:for-each select="liberator:dt">
<xsl:for-each select="dactyl:dt">
<tr>
<xsl:apply-templates select="."/>
<xsl:apply-templates select="following-sibling::liberator:dd[1]"/>
<xsl:apply-templates select="following-sibling::dactyl:dd[1]"/>
</tr>
</xsl:for-each>
</dl>
</xsl:template>
<xsl:template match="liberator:link" mode="pass-2">
<xsl:template match="dactyl:link" mode="pass-2">
<a href="{@topic}"><xsl:apply-templates select="@*|node()"/></a>
</xsl:template>
<xsl:template match="liberator:em | liberator:tt | liberator:p |
liberator:dt | liberator:dd |
liberator:ol | liberator:ul | liberator:li |
liberator:h1 | liberator:h2 | liberator:h3"
<xsl:template match="dactyl:em | dactyl:tt | dactyl:p |
dactyl:dt | dactyl:dd |
dactyl:ol | dactyl:ul | dactyl:li |
dactyl:h1 | dactyl:h2 | dactyl:h3"
mode="pass-2">
<xsl:element name="html:{local-name()}">
<xsl:apply-templates select="@*|node()"/>
</xsl:element>
</xsl:template>
<xsl:template match="liberator:code" mode="pass-2">
<pre liberator:highlight="HelpCode"><xsl:apply-templates select="@*|node()"/></pre>
<xsl:template match="dactyl:code" mode="pass-2">
<pre dactyl:highlight="HelpCode"><xsl:apply-templates select="@*|node()"/></pre>
</xsl:template>
<!-- Help elements {{{1 -->
<xsl:template match="liberator:a" mode="pass-2">
<span liberator:highlight="HelpArg">{<xsl:apply-templates select="@*|node()"/>}</span>
<xsl:template match="dactyl:a" mode="pass-2">
<span dactyl:highlight="HelpArg">{<xsl:apply-templates select="@*|node()"/>}</span>
</xsl:template>
<xsl:template match="liberator:oa" mode="pass-2">
<span liberator:highlight="HelpOptionalArg">[<xsl:apply-templates select="@*|node()"/>]</span>
<xsl:template match="dactyl:oa" mode="pass-2">
<span dactyl:highlight="HelpOptionalArg">[<xsl:apply-templates select="@*|node()"/>]</span>
</xsl:template>
<xsl:template match="liberator:note" mode="pass-2">
<xsl:template match="dactyl:note" mode="pass-2">
<p style="clear: both;">
<xsl:apply-templates select="@*"/>
<div style="clear: both;"/>
<span liberator:highlight="HelpNote">Note:</span>
<span dactyl:highlight="HelpNote">Note:</span>
<xsl:text> </xsl:text>
<xsl:apply-templates select="node()"/>
</p>
</xsl:template>
<xsl:template match="liberator:warning" mode="pass-2">
<xsl:template match="dactyl:warning" mode="pass-2">
<p style="clear: both;">
<xsl:apply-templates select="@*"/>
<div style="clear: both;"/>
<span liberator:highlight="HelpWarning">Warning:</span>
<span dactyl:highlight="HelpWarning">Warning:</span>
<xsl:text> </xsl:text>
<xsl:apply-templates select="node()"/>
</p>
</xsl:template>
<xsl:template match="liberator:default" mode="pass-2">
<span liberator:highlight="HelpDefault">
<xsl:template match="dactyl:default" mode="pass-2">
<span dactyl:highlight="HelpDefault">
(default:<xsl:text> </xsl:text><xsl:apply-templates select="@*|node()"/>)
</span>
</xsl:template>
<!-- HTML-ify other elements {{{1 -->
<xsl:template match="liberator:ex" mode="pass-2">
<span liberator:highlight="HelpEx">
<xsl:template match="dactyl:ex" mode="pass-2">
<span dactyl:highlight="HelpEx">
<xsl:variable name="tag" select="str:tokenize(text(), ' [!')[1]"/>
<a href="liberator://help-tag/{$tag}" style="color: inherit;">
<a href="dactyl://help-tag/{$tag}" style="color: inherit;">
<xsl:if test="contains($tags, concat(' ', $tag, ' '))">
<xsl:attribute name="href">#<xsl:value-of select="$tag"/></xsl:attribute>
</xsl:if>
@@ -361,19 +361,19 @@
</span>
</xsl:template>
<xsl:template match="liberator:description | liberator:example | liberator:spec" mode="pass-2">
<xsl:template match="dactyl:description | dactyl:example | dactyl:spec" mode="pass-2">
<div>
<xsl:if test="self::liberator:description"><xsl:attribute name="liberator:highlight">HelpDescription</xsl:attribute></xsl:if>
<xsl:if test="self::liberator:example"><xsl:attribute name="liberator:highlight">HelpExample</xsl:attribute></xsl:if>
<xsl:if test="self::liberator:spec"><xsl:attribute name="liberator:highlight">HelpSpec</xsl:attribute></xsl:if>
<xsl:if test="self::dactyl:description"><xsl:attribute name="dactyl:highlight">HelpDescription</xsl:attribute></xsl:if>
<xsl:if test="self::dactyl:example"><xsl:attribute name="dactyl:highlight">HelpExample</xsl:attribute></xsl:if>
<xsl:if test="self::dactyl:spec"><xsl:attribute name="dactyl:highlight">HelpSpec</xsl:attribute></xsl:if>
<xsl:apply-templates select="@*|node()"/>
</div>
</xsl:template>
<xsl:template match="liberator:str | liberator:t | liberator:type" mode="pass-2">
<xsl:template match="dactyl:str | dactyl:t | dactyl:type" mode="pass-2">
<span>
<xsl:if test="self::liberator:str"><xsl:attribute name="liberator:highlight">HelpString</xsl:attribute></xsl:if>
<xsl:if test="self::liberator:t"><xsl:attribute name="liberator:highlight">HelpTopic</xsl:attribute></xsl:if>
<xsl:if test="self::liberator:type"><xsl:attribute name="liberator:highlight">HelpType</xsl:attribute></xsl:if>
<xsl:if test="self::dactyl:str"><xsl:attribute name="dactyl:highlight">HelpString</xsl:attribute></xsl:if>
<xsl:if test="self::dactyl:t"><xsl:attribute name="dactyl:highlight">HelpTopic</xsl:attribute></xsl:if>
<xsl:if test="self::dactyl:type"><xsl:attribute name="dactyl:highlight">HelpType</xsl:attribute></xsl:if>
<xsl:apply-templates select="@*|node()"/>
</span>
</xsl:template>
@@ -385,11 +385,11 @@
<xsl:param name="link" select="@href"/>
<xsl:param name="nodes" select="node()"/>
<xsl:param name="extra"/>
<div liberator:highlight="HelpInfo">
<div liberator:highlight="HelpInfoLabel">
<div dactyl:highlight="HelpInfo">
<div dactyl:highlight="HelpInfoLabel">
<xsl:value-of select="$label"/>:
</div>
<span liberator:highlight="HelpInfoValue">
<span dactyl:highlight="HelpInfoValue">
<a>
<xsl:if test="$link">
<xsl:attribute name="href"><xsl:value-of select="$link"/></xsl:attribute>
@@ -400,7 +400,7 @@
</span>
</div>
</xsl:template>
<xsl:template match="liberator:author[@email]" mode="pass-2">
<xsl:template match="dactyl:author[@email]" mode="pass-2">
<xsl:call-template name="info">
<xsl:with-param name="label" select="'Author'"/>
<xsl:with-param name="extra">
@@ -408,17 +408,17 @@
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="liberator:author" mode="pass-2">
<xsl:template match="dactyl:author" mode="pass-2">
<xsl:call-template name="info">
<xsl:with-param name="label" select="'Author'"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="liberator:license" mode="pass-2">
<xsl:template match="dactyl:license" mode="pass-2">
<xsl:call-template name="info">
<xsl:with-param name="label" select="'License'"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="liberator:plugin" mode="pass-2">
<xsl:template match="dactyl:plugin" mode="pass-2">
<xsl:call-template name="info">
<xsl:with-param name="label" select="'Plugin'"/>
<xsl:with-param name="nodes">
@@ -430,15 +430,15 @@
<!-- Special Element Templates {{{1 -->
<xsl:template match="liberator:logo">
<span liberator:highlight="Logo"/>
<xsl:template match="dactyl:logo">
<span dactyl:highlight="Logo"/>
</xsl:template>
<xsl:template match="liberator:pan[liberator:handle]">
<xsl:template match="dactyl:pan[dactyl:handle]">
<form style="text-align:center" xmlns="http://www.w3.org/1999/xhtml"
action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick"/>
<input type="image" src="chrome://liberator/content/x-click-but21.png" border="0" name="submit" alt="Donate with PayPal"/>
<input type="image" src="chrome://dactyl/content/x-click-but21.png" border="0" name="submit" alt="Donate with PayPal"/>
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHPwYJKoZIhvcNAQcEoIIHMDCCBywCAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYAUOJADCwiik68MpIUKcMAtNfs4Cx6RY7604ZujgKj7WVaiELWyhUUDSaq8+iLYaNkRUq+dDld96KwhfodqP3MEmIzpQ/qKvh5+4JzTWSBU5G1lHzc4NJQw6TpXKloPxxXhuGKzZ84/asKZIZpLfkP5i8VtqVFecu7qYc0q1U2KoDELMAkGBSsOAwIaBQAwgbwGCSqGSIb3DQEHATAUBggqhkiG9w0DBwQIWR7nX4WwgcqAgZgO41g/NtgfBwI14LlJx3p5Hc4nHsQD2wyu5l4BMndkc3mc0uRTXvzutcfPBxYC4aGV5UDn6c+XPzsne+OAdSs4/0a2DJe85SBDOlVyOekz3rRhy5+6XKpKQ7qfiMpKROladi4opfMac/aDUPhGeVsY0jtQCtelIE199iaVKhlbiDvfE7nzV5dLU4d3VZwSDuWBIrIIi9GMtKCCA4cwggODMIIC7KADAgECAgEAMA0GCSqGSIb3DQEBBQUAMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbTAeFw0wNDAyMTMxMDEzMTVaFw0zNTAyMTMxMDEzMTVaMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwUdO3fxEzEtcnI7ZKZL412XvZPugoni7i7D7prCe0AtaHTc97CYgm7NsAtJyxNLixmhLV8pyIEaiHXWAh8fPKW+R017+EmXrr9EaquPmsVvTywAAE1PMNOKqo2kl4Gxiz9zZqIajOm1fZGWcGS0f5JQ2kBqNbvbg2/Za+GJ/qwUCAwEAAaOB7jCB6zAdBgNVHQ4EFgQUlp98u8ZvF71ZP1LXChvsENZklGswgbsGA1UdIwSBszCBsIAUlp98u8ZvF71ZP1LXChvsENZklGuhgZSkgZEwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTA4MDYwNTE0NDk1OFowIwYJKoZIhvcNAQkEMRYEFBpY8FafLq7i3V0czWS9TbR/RjyQMA0GCSqGSIb3DQEBAQUABIGAPvYR9EC2ynooWAvX0iw9aZYTrpX2XrTl6lYkZaLrhM1zKn4RuaiL33sPtq0o0uSKm98gQHzh4P6wmzES0jzHucZjCU4VlpW0fC+/pJxswbW7Qux+ObsNx3f45OcvprqMMZyJiEOULcNhxkm9pCeXQMUGwlHoRRtAxYK2T8L/rQQ=-----END PKCS7-----
"/>
</form>

View File

@@ -43,11 +43,11 @@ const Hints = Module("hints", {
s: Mode("Save hint", function (elem) buffer.saveLink(elem, true)),
a: Mode("Save hint with prompt", function (elem) buffer.saveLink(elem, false)),
f: Mode("Focus frame", function (elem) elem.ownerDocument.defaultView.focus(), function () ["body"]),
o: Mode("Follow hint", function (elem) buffer.followLink(elem, liberator.CURRENT_TAB)),
t: Mode("Follow hint in a new tab", function (elem) buffer.followLink(elem, liberator.NEW_TAB)),
b: Mode("Follow hint in a background tab", function (elem) buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB)),
w: Mode("Follow hint in a new window", function (elem) buffer.followLink(elem, liberator.NEW_WINDOW), extended),
F: Mode("Open multiple hints in tabs", function (elem) { buffer.followLink(elem, liberator.NEW_BACKGROUND_TAB); hints.show("F") }),
o: Mode("Follow hint", function (elem) buffer.followLink(elem, dactyl.CURRENT_TAB)),
t: Mode("Follow hint in a new tab", function (elem) buffer.followLink(elem, dactyl.NEW_TAB)),
b: Mode("Follow hint in a background tab", function (elem) buffer.followLink(elem, dactyl.NEW_BACKGROUND_TAB)),
w: Mode("Follow hint in a new window", function (elem) buffer.followLink(elem, dactyl.NEW_WINDOW), extended),
F: Mode("Open multiple hints in tabs", function (elem) { buffer.followLink(elem, dactyl.NEW_BACKGROUND_TAB); hints.show("F") }),
O: Mode("Generate an ':open URL' using hint", function (elem, loc) commandline.open(":", "open " + loc, modes.EX)),
T: Mode("Generate a ':tabopen URL' using hint", function (elem, loc) commandline.open(":", "tabopen " + loc, modes.EX)),
W: Mode("Generate a ':winopen URL' using hint", function (elem, loc) commandline.open(":", "winopen " + loc, modes.EX)),
@@ -56,8 +56,8 @@ const Hints = Module("hints", {
y: Mode("Yank hint location", function (elem, loc) util.copyToClipboard(loc, true)),
Y: Mode("Yank hint description", function (elem) util.copyToClipboard(elem.textContent || "", true), extended),
c: Mode("Open context menu", function (elem) buffer.openContextMenu(elem), extended),
i: Mode("Show image", function (elem) liberator.open(elem.src), images),
I: Mode("Show image in a new tab", function (elem) liberator.open(elem.src, liberator.NEW_TAB), images)
i: Mode("Show image", function (elem) dactyl.open(elem.src), images),
I: Mode("Show image in a new tab", function (elem) dactyl.open(elem.src, dactyl.NEW_TAB), images)
};
},
@@ -162,7 +162,7 @@ const Hints = Module("hints", {
_getAreaOffset: function (elem, leftPos, topPos) {
try {
// Need to add the offset to the area element.
// Always try to find the top-left point, as per liberator default.
// Always try to find the top-left point, as per dactyl default.
let shape = elem.getAttribute("shape").toLowerCase();
let coordStr = elem.getAttribute("coords");
// Technically it should be only commas, but hey
@@ -357,7 +357,7 @@ const Hints = Module("hints", {
if (!rect)
continue;
hint.imgSpan = util.xmlToDom(<span highlight="Hint" liberator:class="HintImage" xmlns:liberator={NS}/>, doc);
hint.imgSpan = util.xmlToDom(<span highlight="Hint" dactyl:class="HintImage" xmlns:dactyl={NS}/>, doc);
hint.imgSpan.style.left = (rect.left + offsetX) + "px";
hint.imgSpan.style.top = (rect.top + offsetY) + "px";
hint.imgSpan.style.width = (rect.right - rect.left) + "px";
@@ -381,7 +381,7 @@ const Hints = Module("hints", {
let css = [];
// FIXME: Broken for imgspans.
for (let [, { doc: doc }] in Iterator(this._docs)) {
for (let elem in util.evaluateXPath("//*[@liberator:highlight and @number]", doc)) {
for (let elem in util.evaluateXPath("//*[@dactyl:highlight and @number]", doc)) {
let group = elem.getAttributeNS(NS.uri, "highlight");
css.push(highlight.selector(group) + "[number=" + elem.getAttribute("number").quote() + "] { " + elem.style.cssText + " }");
}
@@ -404,7 +404,7 @@ const Hints = Module("hints", {
let firstElem = this._validHints[0] || null;
for (let [,{ doc: doc, start: start, end: end }] in Iterator(this._docs)) {
for (let elem in util.evaluateXPath("//*[@liberator:highlight='hints']", doc))
for (let elem in util.evaluateXPath("//*[@dactyl:highlight='hints']", doc))
elem.parentNode.removeChild(elem);
for (let i in util.range(start, end + 1)) {
let hint = this._pageHints[i];
@@ -433,7 +433,7 @@ const Hints = Module("hints", {
*/
_processHints: function (followFirst) {
if (this._validHints.length == 0) {
liberator.beep();
dactyl.beep();
return false;
}
@@ -445,7 +445,7 @@ const Hints = Module("hints", {
// OK. return hit. But there's more than one hint, and
// there's no tab-selected current link. Do not follow in mode 2
liberator.assert(options["followhints"] != 2 || this._validHints.length == 1 || this._hintNumber)
dactyl.assert(options["followhints"] != 2 || this._validHints.length == 1 || this._hintNumber)
}
if (!followFirst) {
@@ -478,7 +478,7 @@ const Hints = Module("hints", {
_checkUnique: function () {
if (this._hintNumber == 0)
return;
liberator.assert(this._hintNumber <= this._validHints.length);
dactyl.assert(this._hintNumber <= this._validHints.length);
// if we write a numeric part like 3, but we have 45 hints, only follow
// the hint after a timeout, as the user might have wanted to follow link 34
@@ -681,8 +681,8 @@ const Hints = Module("hints", {
case "contains" : return containsMatcher(hintString);
case "wordstartswith": return wordStartsWithMatcher(hintString, /*allowWordOverleaping=*/ true);
case "firstletters" : return wordStartsWithMatcher(hintString, /*allowWordOverleaping=*/ false);
case "custom" : return liberator.plugins.customHintMatcher(hintString);
default : liberator.echoerr("Invalid hintmatching type: " + hintMatching);
case "custom" : return dactyl.plugins.customHintMatcher(hintString);
default : dactyl.echoerr("Invalid hintmatching type: " + hintMatching);
}
return null;
}, //}}}
@@ -713,7 +713,7 @@ const Hints = Module("hints", {
*/
show: function (minor, filter, win) {
this._hintMode = this._hintModes[minor];
liberator.assert(this._hintMode);
dactyl.assert(this._hintMode);
commandline.input(this._hintMode.prompt + ": ", null, { onChange: this.closure._onInput });
modes.extended = modes.HINTS;
@@ -728,13 +728,13 @@ const Hints = Module("hints", {
this._generate(win);
// get all keys from the input queue
liberator.threadYield(true);
dactyl.threadYield(true);
this._canUpdate = true;
this._showHints();
if (this._validHints.length == 0) {
liberator.beep();
dactyl.beep();
modes.reset();
}
else if (this._validHints.length == 1)
@@ -798,7 +798,7 @@ const Hints = Module("hints", {
else {
this._usedTabKey = false;
this._hintNumber = 0;
liberator.beep();
dactyl.beep();
return;
}
break;
@@ -834,7 +834,7 @@ const Hints = Module("hints", {
}
this._showActiveHint(this._hintNumber, oldHintNumber || 1);
liberator.assert(this._hintNumber != 0);
dactyl.assert(this._hintNumber != 0);
this._checkUnique();
}
@@ -1016,8 +1016,8 @@ const Hints = Module("hints", {
// In fact, it might be nice if there was a "dual" to F (like H and
// gH, except that gF is already taken). --tpp
//
// Likewise, it might be nice to have a liberator.NEW_FOREGROUND_TAB
// and then make liberator.NEW_TAB always do what a Cntrl+Click
// Likewise, it might be nice to have a dactyl.NEW_FOREGROUND_TAB
// and then make dactyl.NEW_TAB always do what a Cntrl+Click
// does. --tpp
mappings.add(myModes, ["F"],
"Start QuickHint mode, but open link in a new tab",
@@ -1090,7 +1090,7 @@ const Hints = Module("hints", {
["contains", "The typed characters are split on whitespace. The resulting groups must all appear in the hint."],
["wordstartswith", "The typed characters are split on whitespace. The resulting groups must all match the beginings of words, in order."],
["firstletters", "Behaves like wordstartswith, but all groups much match a sequence of words."],
["custom", "Delegate to a custom function: liberator.plugins.customHintMatcher(hintString)"],
["custom", "Delegate to a custom function: dactyl.plugins.customHintMatcher(hintString)"],
["transliterated", "When true, special latin characters are translated to their ascii equivalent (e.g., \u00e9 -> e)"]
]
});

View File

@@ -63,7 +63,7 @@ const History = Module("history", {
let current = window.getWebNavigation().sessionHistory.index;
if (current == start && steps < 0 || current == end && steps > 0)
liberator.beep();
dactyl.beep();
else {
let index = util.Math.constrain(current + steps, start, end);
window.getWebNavigation().gotoIndex(index);
@@ -76,7 +76,7 @@ const History = Module("history", {
if (index > 0)
window.getWebNavigation().gotoIndex(0);
else
liberator.beep();
dactyl.beep();
},
@@ -87,7 +87,7 @@ const History = Module("history", {
if (sh.index < max)
window.getWebNavigation().gotoIndex(max);
else
liberator.beep();
dactyl.beep();
},
@@ -101,12 +101,12 @@ const History = Module("history", {
let items = completion.runCompleter("history", filter, maxItems);
if (items.length)
return liberator.open(items.map(function (i) i.url), liberator.NEW_TAB);
return dactyl.open(items.map(function (i) i.url), dactyl.NEW_TAB);
if (filter.length > 0)
liberator.echoerr("E283: No history matching \"" + filter + "\"");
dactyl.echoerr("E283: No history matching \"" + filter + "\"");
else
liberator.echoerr("No history set");
dactyl.echoerr("No history set");
return null;
}
}, {
@@ -128,7 +128,7 @@ const History = Module("history", {
for (let [i, ent] in Iterator(sh.slice(0, sh.index).reverse()))
if (ent.URI.spec == url)
return void window.getWebNavigation().gotoIndex(i);
liberator.echoerr("Exxx: URL not found in history");
dactyl.echoerr("Exxx: URL not found in history");
}
else
history.stepTo(-Math.max(args.count, 1));
@@ -167,7 +167,7 @@ const History = Module("history", {
for (let [i, ent] in Iterator(sh.slice(sh.index + 1)))
if (ent.URI.spec == url)
return void window.getWebNavigation().gotoIndex(i);
liberator.echoerr("Exxx: URL not found in history");
dactyl.echoerr("Exxx: URL not found in history");
}
else
history.stepTo(Math.max(args.count, 1));

View File

@@ -170,7 +170,7 @@ const File = Class("File", {
ocstream.writeString(buf);
}
catch (e) {
liberator.dump(e);
dactyl.dump(e);
if (e.result == Cr.NS_ERROR_LOSS_OF_SIGNIFICANT_DATA) {
ocstream = getStream("?".charCodeAt(0));
ocstream.writeString(buf);
@@ -251,7 +251,7 @@ const File = Class("File", {
// Kris reckons we shouldn't replicate this 'bug'. --djk
// TODO: should we be doing this for all paths?
function expand(path) path.replace(
!liberator.has("Win32") ? /\$(\w+)\b|\${(\w+)}/g
!dactyl.has("Win32") ? /\$(\w+)\b|\${(\w+)}/g
: /\$(\w+)\b|\${(\w+)}|%(\w+)%/g,
function (m, n1, n2, n3) services.get("environment").get(n1 || n2 || n3) || m
);
@@ -264,7 +264,7 @@ const File = Class("File", {
let home = services.get("environment").get("HOME");
// Windows has its own idiosyncratic $HOME variables.
if (!home && liberator.has("Win32"))
if (!home && dactyl.has("Win32"))
home = services.get("environment").get("USERPROFILE") ||
services.get("environment").get("HOMEDRIVE") + services.get("environment").get("HOMEPATH");
@@ -340,7 +340,7 @@ const IO = Module("io", {
let file = download.targetFile.path;
let size = download.size;
liberator.echomsg("Download of " + title + " to " + file + " finished", 1, commandline.ACTIVE_WINDOW);
dactyl.echomsg("Download of " + title + " to " + file + " finished", 1, commandline.ACTIVE_WINDOW);
autocommands.trigger("DownloadPost", { url: url, title: title, file: file, size: size });
}
},
@@ -426,7 +426,7 @@ const IO = Module("io", {
let dir = File(newDir);
if (!dir.exists() || !dir.isDirectory()) {
liberator.echoerr("E344: Can't find directory \"" + dir.path + "\" in path");
dactyl.echoerr("E344: Can't find directory \"" + dir.path + "\" in path");
return null;
}
@@ -465,7 +465,7 @@ const IO = Module("io", {
let rcFile1 = File.joinPaths(dir, "." + config.name.toLowerCase() + "rc");
let rcFile2 = File.joinPaths(dir, "_" + config.name.toLowerCase() + "rc");
if (liberator.has("Win32"))
if (dactyl.has("Win32"))
[rcFile1, rcFile2] = [rcFile2, rcFile1];
if (rcFile1.exists() && rcFile1.isFile())
@@ -509,9 +509,9 @@ const IO = Module("io", {
if (File.isAbsolutePath(program))
file = File(program, true);
else {
let dirs = services.get("environment").get("PATH").split(liberator.has("Win32") ? ";" : ":");
let dirs = services.get("environment").get("PATH").split(dactyl.has("Win32") ? ";" : ":");
// Windows tries the CWD first TODO: desirable?
if (liberator.has("Win32"))
if (dactyl.has("Win32"))
dirs = [io.getCurrentDirectory().path].concat(dirs);
lookup:
@@ -523,7 +523,7 @@ lookup:
// TODO: couldn't we just palm this off to the start command?
// automatically try to add the executable path extensions on windows
if (liberator.has("Win32")) {
if (dactyl.has("Win32")) {
let extensions = services.get("environment").get("PATHEXT").split(";");
for (let [, extension] in Iterator(extensions)) {
file = File.joinPaths(dir, program + extension);
@@ -537,7 +537,7 @@ lookup:
}
if (!file || !file.exists()) {
liberator.echoerr("Command not found: " + program);
dactyl.echoerr("Command not found: " + program);
return -1;
}
@@ -564,14 +564,14 @@ lookup:
let dirs = File.getPathsFromPathList(options["runtimepath"]);
let found = false;
liberator.echomsg("Searching for \"" + paths.join(" ") + "\" in \"" + options["runtimepath"] + "\"", 2);
dactyl.echomsg("Searching for \"" + paths.join(" ") + "\" in \"" + options["runtimepath"] + "\"", 2);
outer:
for (let [, dir] in Iterator(dirs)) {
for (let [, path] in Iterator(paths)) {
let file = File.joinPaths(dir, path);
liberator.echomsg("Searching for \"" + file.path + "\"", 3);
dactyl.echomsg("Searching for \"" + file.path + "\"", 3);
if (file.exists() && file.isFile() && file.isReadable()) {
io.source(file.path, false);
@@ -584,7 +584,7 @@ lookup:
}
if (!found)
liberator.echomsg("not found in 'runtimepath': \"" + paths.join(" ") + "\"", 1);
dactyl.echomsg("not found in 'runtimepath': \"" + paths.join(" ") + "\"", 1);
return found;
},
@@ -597,7 +597,7 @@ lookup:
*/
source: function (filename, silent) {
let wasSourcing = this.sourcing;
liberator.dump("sourcing " + filename);
dactyl.dump("sourcing " + filename);
let time = Date.now();
try {
var file = File(filename);
@@ -609,17 +609,17 @@ lookup:
if (!file.exists() || !file.isReadable() || file.isDirectory()) {
if (!silent) {
if (file.exists() && file.isDirectory())
liberator.echomsg("Cannot source a directory: \"" + filename + "\"", 0);
dactyl.echomsg("Cannot source a directory: \"" + filename + "\"", 0);
else
liberator.echomsg("could not source: \"" + filename + "\"", 1);
dactyl.echomsg("could not source: \"" + filename + "\"", 1);
liberator.echoerr("E484: Can't open file " + filename);
dactyl.echoerr("E484: Can't open file " + filename);
}
return;
}
liberator.echomsg("sourcing \"" + filename + "\"", 2);
dactyl.echomsg("sourcing \"" + filename + "\"", 2);
let str = file.read();
let uri = services.get("io").newFileURI(file);
@@ -627,8 +627,8 @@ lookup:
// handle pure JavaScript files specially
if (/\.js$/.test(filename)) {
try {
liberator.loadScript(uri.spec, Script(file));
liberator.helpInitialized = false;
dactyl.loadScript(uri.spec, Script(file));
dactyl.helpInitialized = false;
}
catch (e) {
let err = new Error();
@@ -671,9 +671,9 @@ lookup:
if (!command) {
let lineNumber = i + 1;
liberator.echoerr("Error detected while processing " + file.path, commandline.FORCE_MULTILINE);
dactyl.echoerr("Error detected while processing " + file.path, commandline.FORCE_MULTILINE);
commandline.echo("line " + lineNumber + ":", commandline.HL_LINENR, commandline.APPEND_TO_MESSAGES);
liberator.echoerr("E492: Not an editor command: " + line);
dactyl.echoerr("E492: Not an editor command: " + line);
}
else {
if (command.name == "finish")
@@ -705,18 +705,18 @@ lookup:
if (this._scriptNames.indexOf(file.path) == -1)
this._scriptNames.push(file.path);
liberator.echomsg("finished sourcing \"" + filename + "\"", 2);
dactyl.echomsg("finished sourcing \"" + filename + "\"", 2);
liberator.log("Sourced: " + filename, 3);
dactyl.log("Sourced: " + filename, 3);
}
catch (e) {
liberator.reportError(e);
dactyl.reportError(e);
let message = "Sourcing file: " + (e.echoerr || file.path + ": " + e);
if (!silent)
liberator.echoerr(message);
dactyl.echoerr(message);
}
finally {
liberator.dump("done sourcing " + filename + ": " + (Date.now() - time) + "ms");
dactyl.dump("done sourcing " + filename + ": " + (Date.now() - time) + "ms");
this.sourcing = wasSourcing;
}
},
@@ -732,7 +732,7 @@ lookup:
* @returns {string}
*/
system: function (command, input) {
liberator.echomsg("Calling shell to execute: " + command, 4);
dactyl.echomsg("Calling shell to execute: " + command, 4);
function escape(str) '"' + str.replace(/[\\"$]/g, "\\$&") + '"';
@@ -741,7 +741,7 @@ lookup:
stdin.write(input);
// TODO: implement 'shellredir'
if (liberator.has("Win32")) {
if (dactyl.has("Win32")) {
command = "cd /D " + this._cwd.path + " && " + command + " > " + stdout.path + " 2>&1" + " < " + stdin.path;
var res = this.run(options["shell"], options["shellcmdflag"].split(/\s+/).concat(command), true);
}
@@ -788,14 +788,14 @@ lookup:
}
}, {
/**
* @property {string} The value of the $VIMPERATOR_RUNTIME environment
* @property {string} The value of the $PENTADACTYL_RUNTIME environment
* variable.
*/
get runtimePath() {
const rtpvar = config.name.toUpperCase() + "_RUNTIME";
let rtp = services.get("environment").get(rtpvar);
if (!rtp) {
rtp = "~/" + (liberator.has("Win32") ? "" : ".") + config.name.toLowerCase();
rtp = "~/" + (dactyl.has("Win32") ? "" : ".") + config.name.toLowerCase();
services.get("environment").set(rtpvar, rtp);
}
return rtp;
@@ -820,7 +820,7 @@ lookup:
if (!arg)
arg = "~";
else if (arg == "-") {
liberator.assert(io._oldcwd, "E186: No previous directory");
dactyl.assert(io._oldcwd, "E186: No previous directory");
arg = io._oldcwd.path;
}
@@ -831,7 +831,7 @@ lookup:
// TODO: handle ../ and ./ paths
if (File.isAbsolutePath(arg)) {
if (io.setCurrentDirectory(arg))
liberator.echomsg(io.getCurrentDirectory().path);
dactyl.echomsg(io.getCurrentDirectory().path);
}
else {
let dirs = File.getPathsFromPathList(options["cdpath"]);
@@ -842,14 +842,14 @@ lookup:
if (dir.exists() && dir.isDirectory() && dir.isReadable()) {
io.setCurrentDirectory(dir.path);
liberator.echomsg(io.getCurrentDirectory().path);
dactyl.echomsg(io.getCurrentDirectory().path);
found = true;
break;
}
}
if (!found) {
liberator.echoerr("E344: Can't find directory " + arg.quote() + " in cdpath\n"
dactyl.echoerr("E344: Can't find directory " + arg.quote() + " in cdpath\n"
+ "E472: Command failed");
}
}
@@ -862,32 +862,32 @@ lookup:
// NOTE: this command is only used in :source
commands.add(["fini[sh]"],
"Stop sourcing a script file",
function () { liberator.echoerr("E168: :finish used outside of a sourced file"); },
function () { dactyl.echoerr("E168: :finish used outside of a sourced file"); },
{ argCount: "0" });
commands.add(["pw[d]"],
"Print the current directory name",
function () { liberator.echomsg(io.getCurrentDirectory().path); },
function () { dactyl.echomsg(io.getCurrentDirectory().path); },
{ argCount: "0" });
// "mkv[imperatorrc]" or "mkm[uttatorrc]"
commands.add([config.name.toLowerCase().replace(/(.)(.*)/, "mk$1[$2rc]")],
"Write current key mappings and changed options to the config file",
function (args) {
liberator.assert(args.length <= 1, "E172: Only one file name allowed");
dactyl.assert(args.length <= 1, "E172: Only one file name allowed");
let filename = args[0] || io.getRCFile(null, true).path;
let file = File(filename);
liberator.assert(!file.exists() || args.bang,
dactyl.assert(!file.exists() || args.bang,
"E189: \"" + filename + "\" exists (add ! to override)");
// TODO: Use a set/specifiable list here:
let lines = [cmd.serial().map(commands.commandToString) for (cmd in commands) if (cmd.serial)];
lines = util.Array.flatten(lines);
// source a user .vimperatorrc file
lines.unshift('"' + liberator.version + "\n");
// source a user .pentadactylrc file
lines.unshift('"' + dactyl.version + "\n");
// For the record, I think that adding this line is absurd. --Kris
// I can't disagree. --djk
@@ -903,8 +903,8 @@ lookup:
file.write(lines.join("\n"));
}
catch (e) {
liberator.echoerr("E190: Cannot open \"" + filename + "\" for writing");
liberator.log("Could not write to " + file.path + ": " + e.message); // XXX
dactyl.echoerr("E190: Cannot open \"" + filename + "\" for writing");
dactyl.log("Could not write to " + file.path + ": " + e.message); // XXX
}
}, {
argCount: "*", // FIXME: should be "?" but kludged for proper error message
@@ -934,7 +934,7 @@ lookup:
"Read Ex commands from a file",
function (args) {
if (args.length > 1)
liberator.echoerr("E172: Only one file name allowed");
dactyl.echoerr("E172: Only one file name allowed");
else
io.source(args[0], args.bang);
}, {
@@ -954,7 +954,7 @@ lookup:
arg = "!" + arg;
// replaceable bang and no previous command?
liberator.assert(!/((^|[^\\])(\\\\)*)!/.test(arg) || io._lastRunCommand,
dactyl.assert(!/((^|[^\\])(\\\\)*)!/.test(arg) || io._lastRunCommand,
"E34: No previous command");
// NOTE: Vim doesn't replace ! preceded by 2 or more backslashes and documents it - desirable?
@@ -992,7 +992,7 @@ lookup:
"more1 more2 more3 more4 more5 unicode".split(" ").map(function (key)
options.getPref("intl.charsetmenu.browser." + key).split(', '))
).flatten().uniq();
let bundle = document.getElementById("liberator-charset-bundle");
let bundle = document.getElementById("dactyl-charset-bundle");
return names.map(function (name) [name, bundle.getString(name.toLowerCase() + ".title")]);
};
};
@@ -1003,7 +1003,7 @@ lookup:
};
completion.environment = function environment(context) {
let command = liberator.has("Win32") ? "set" : "env";
let command = dactyl.has("Win32") ? "set" : "env";
let lines = io.system(command).split("\n");
lines.pop();
@@ -1050,7 +1050,7 @@ lookup:
completion.shellCommand = function shellCommand(context) {
context.title = ["Shell Command", "Path"];
context.generate = function () {
let dirNames = services.get("environment").get("PATH").split(RegExp(liberator.has("Win32") ? ";" : ":"));
let dirNames = services.get("environment").get("PATH").split(RegExp(dactyl.has("Win32") ? ";" : ":"));
let commands = [];
for (let [, dirName] in Iterator(dirNames)) {
@@ -1072,7 +1072,7 @@ lookup:
},
options: function () {
var shell, shellcmdflag;
if (liberator.has("Win32")) {
if (dactyl.has("Win32")) {
shell = "cmd.exe";
// TODO: setting 'shell' to "something containing sh" updates
// 'shellcmdflag' appropriately at startup on Windows in Vim

View File

@@ -123,7 +123,7 @@ const JavaScript = Module("javascript", {
context[JavaScript.EVAL_TMP] = tmp;
try {
return cache[key] = liberator.eval(arg, context);
return cache[key] = dactyl.eval(arg, context);
}
catch (e) {
return null;
@@ -429,7 +429,7 @@ const JavaScript = Module("javascript", {
}
catch (e) {
if (e.message != "Invalid JS")
liberator.reportError(e);
dactyl.reportError(e);
this._lastIdx = 0;
return null;
}
@@ -499,7 +499,7 @@ const JavaScript = Module("javascript", {
obj = obj.slice(0, 1);
try {
var completer = obj[0][0][func].liberatorCompleter;
var completer = obj[0][0][func].dactylCompleter;
}
catch (e) {}
if (!completer)
@@ -566,7 +566,7 @@ const JavaScript = Module("javascript", {
return null;
}
}, {
EVAL_TMP: "__liberator_eval_tmp",
EVAL_TMP: "__dactyl_eval_tmp",
/**
* A map of argument completion functions for named methods. The
@@ -598,7 +598,7 @@ const JavaScript = Module("javascript", {
setCompleter: function (funcs, completers) {
funcs = Array.concat(funcs);
for (let [, func] in Iterator(funcs)) {
func.liberatorCompleter = function (context, func, obj, args) {
func.dactylCompleter = function (context, func, obj, args) {
let completer = completers[args.length - 1];
if (!completer)
return [];

View File

@@ -1,104 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ***** BEGIN LICENSE BLOCK ***** {{{
Copyright (c) 2006-2009 by Martin Stubenschrott <stubenschrott@vimperator.org>
This work is licensed for reuse under an MIT license. Details are
given in the LICENSE.txt file included with this file.
}}} ***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://liberator/skin/liberator.css" type="text/css"?>
<!DOCTYPE overlay SYSTEM "liberator.dtd" [
<!ENTITY liberator.content "chrome://liberator/content/">
<!ENTITY and "&amp;&amp;">
]>
<overlay id="liberator"
xmlns:liberator="http://vimperator.org/namespaces/liberator"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:nc="http://home.netscape.com/NC-rdf#"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript;version=1.8" src="&liberator.content;liberator-overlay.js"/>
<window id="&liberator.mainWindow;">
<stringbundleset id="liberator-stringbundles">
<stringbundle id="liberator-charset-bundle"
src="chrome://global/locale/charsetTitles.properties"/>
</stringbundleset>
<keyset id="mainKeyset">
<key id="key_open_vimbar" key=":" oncommand="window.liberator &and; liberator.modules.commandline.open(':', '', liberator.modules.modes.EX);" modifiers=""/>
<key id="key_stop" keycode="VK_ESCAPE" oncommand="window.liberator &and; liberator.modules.events.onEscape();"/>
<!-- other keys are handled inside the event loop in events.js -->
</keyset>
<popupset>
<panel id="liberator-visualbell" liberator:highlight="Bell"/>
</popupset>
<!--this notifies us also of focus events in the XUL
from: http://developer.mozilla.org/en/docs/XUL_Tutorial:Updating_Commands !-->
<commandset id="onVimperatorFocus"
commandupdater="true"
events="focus"
oncommandupdate="if (window.liberator &and; liberator.modules.events != undefined) liberator.modules.events.onFocusChange(event);"/>
<commandset id="onVimperatorSelect"
commandupdater="true"
events="select"
oncommandupdate="if (window.liberator &and; liberator.modules.events != undefined) liberator.modules.events.onSelectionChange(event);"/>
<!-- As of Firefox 3.1pre, <iframe>.height changes do not seem to have immediate effect,
therefore we need to put them into a <vbox> for which that works just fine -->
<vbox class="liberator-container" hidden="false" collapsed="true">
<iframe id="liberator-multiline-output" src="chrome://liberator/content/buffer.xhtml"
flex="1" hidden="false" collapsed="false"
onclick="window.liberator &and; liberator.modules.commandline.onMultilineOutputEvent(event)"/>
</vbox>
<vbox class="liberator-container" hidden="false" collapsed="true">
<iframe id="liberator-completions" src="chrome://liberator/content/buffer.xhtml"
flex="1" hidden="false" collapsed="false"
onclick="window.liberator &and; liberator.modules.commandline.onMultilineOutputEvent(event)"/>
</vbox>
<stack orient="horizontal" align="stretch" class="liberator-container" liberator:highlight="CmdLine">
<textbox class="plain" id="liberator-message" flex="1" readonly="true" liberator:highlight="Normal"/>
<hbox id="liberator-commandline" hidden="false" collapsed="true" class="liberator-container" liberator:highlight="Normal">
<label class="plain" id="liberator-commandline-prompt" flex="0" crop="end" value="" collapsed="true"/>
<textbox class="plain" id="liberator-commandline-command" flex="1" type="search" timeout="100"
oninput="window.liberator &and; liberator.modules.commandline.onEvent(event);"
onkeyup="window.liberator &and; liberator.modules.commandline.onEvent(event);"
onfocus="window.liberator &and; liberator.modules.commandline.onEvent(event);"
onblur="window.liberator &and; liberator.modules.commandline.onEvent(event);"/>
</hbox>
</stack>
<vbox class="liberator-container" hidden="false" collapsed="false" liberator:highlight="CmdLine">
<textbox id="liberator-multiline-input" class="plain" flex="1" rows="1" hidden="false" collapsed="true" multiline="true" liberator:highlight="Normal"
onkeypress="window.liberator &and; liberator.modules.commandline.onMultilineInputEvent(event);"
oninput="window.liberator &and; liberator.modules.commandline.onMultilineInputEvent(event);"
onblur="window.liberator &and; liberator.modules.commandline.onMultilineInputEvent(event);"/>
</vbox>
</window>
<statusbar id="status-bar" liberator:highlight="StatusLine">
<hbox insertbefore="&liberator.statusBefore;" insertafter="&liberator.statusAfter;"
id="liberator-statusline-field-status" flex="1" hidden="false" align="center">
<textbox class="plain" id="liberator-statusline-field-url" readonly="false" flex="1" crop="end"/>
<label class="plain" id="liberator-statusline-field-inputbuffer" flex="0"/>
<label class="plain" id="liberator-statusline-field-progress" flex="0"/>
<label class="plain" id="liberator-statusline-field-tabcount" flex="0"/>
<label class="plain" id="liberator-statusline-field-bufferposition" flex="0"/>
<label class="plain" id="liberator-statusline-field-zoomlevel" flex="0"/>
</hbox>
<!-- just hide them since other elements expect them -->
<statusbarpanel id="statusbar-display" hidden="true"/>
<statusbarpanel id="statusbar-progresspanel" hidden="true"/>
</statusbar>
</overlay>
<!-- vim: set fdm=marker sw=4 ts=4 et: -->

View File

@@ -113,7 +113,7 @@ const Map = Class("Map", {
if (this.names[0] != ".") // FIXME: Kludge.
mappings.repeat = repeat;
return liberator.trapErrors(repeat);
return dactyl.trapErrors(repeat);
}
});
@@ -179,7 +179,7 @@ const Mappings = Module("mappings", {
/** @property {Iterator(Map)} @private */
__iterator__: function () this._mappingsIterator([modes.NORMAL], this._main),
// used by :mkvimperatorrc to save mappings
// used by :mkpentadactylrc to save mappings
/**
* Returns a user-defined mappings iterator for the specified
* <b>mode</b>.
@@ -295,7 +295,7 @@ const Mappings = Module("mappings", {
*/
// FIXME: property
getMapLeader: function () {
let leaderRef = liberator.variableReference("mapleader");
let leaderRef = dactyl.variableReference("mapleader");
return leaderRef[0] ? leaderRef[0][leaderRef[1]] : "\\";
},
@@ -364,7 +364,7 @@ const Mappings = Module("mappings", {
// TODO: Move this to an ItemList to show this automatically
if (list.*.length() == list.text().length()) {
liberator.echomsg("No mapping found");
dactyl.echomsg("No mapping found");
return;
}
commandline.echo(list, commandline.HL_NORMAL, commandline.FORCE_MULTILINE);
@@ -460,7 +460,7 @@ const Mappings = Module("mappings", {
}
}
if (!found)
liberator.echoerr("E31: No such mapping");
dactyl.echoerr("E31: No such mapping");
},
{
argCount: "1",

View File

@@ -58,7 +58,7 @@ const Marks = Module("marks", {
return;
if (doc.body instanceof HTMLFrameSetElement) {
if (!silent)
liberator.echoerr("Marks support for frameset pages not implemented yet");
dactyl.echoerr("Marks support for frameset pages not implemented yet");
return;
}
@@ -69,7 +69,7 @@ const Marks = Module("marks", {
if (Marks.isURLMark(mark)) {
this._urlMarks.set(mark, { location: win.location.href, position: position, tab: tabs.getTab() });
if (!silent)
liberator.log("Adding URL mark: " + Marks.markToString(mark, this._urlMarks.get(mark)), 5);
dactyl.log("Adding URL mark: " + Marks.markToString(mark, this._urlMarks.get(mark)), 5);
}
else if (Marks.isLocalMark(mark)) {
// remove any previous mark of the same name for this location
@@ -79,7 +79,7 @@ const Marks = Module("marks", {
let vals = { location: win.location.href, position: position };
this._localMarks.get(mark).push(vals);
if (!silent)
liberator.log("Adding local mark: " + Marks.markToString(mark, vals), 5);
dactyl.log("Adding local mark: " + Marks.markToString(mark, vals), 5);
}
},
@@ -125,7 +125,7 @@ const Marks = Module("marks", {
this._pendingJumps.push(slice);
// NOTE: this obviously won't work on generated pages using
// non-unique URLs :(
liberator.open(slice.location, liberator.NEW_TAB);
dactyl.open(slice.location, dactyl.NEW_TAB);
return;
}
let index = tabs.index(slice.tab);
@@ -137,7 +137,7 @@ const Marks = Module("marks", {
win.location.href = slice.location;
return;
}
liberator.log("Jumping to URL mark: " + Marks.markToString(mark, slice), 5);
dactyl.log("Jumping to URL mark: " + Marks.markToString(mark, slice), 5);
buffer.scrollToPercent(slice.position.x * 100, slice.position.y * 100);
ok = true;
}
@@ -149,7 +149,7 @@ const Marks = Module("marks", {
for (let [, lmark] in Iterator(slice)) {
if (win.location.href == lmark.location) {
liberator.log("Jumping to local mark: " + Marks.markToString(mark, lmark), 5);
dactyl.log("Jumping to local mark: " + Marks.markToString(mark, lmark), 5);
buffer.scrollToPercent(lmark.position.x * 100, lmark.position.y * 100);
ok = true;
break;
@@ -158,7 +158,7 @@ const Marks = Module("marks", {
}
if (!ok)
liberator.echoerr("E20: Mark not set");
dactyl.echoerr("E20: Mark not set");
},
/**
@@ -169,11 +169,11 @@ const Marks = Module("marks", {
list: function (filter) {
let marks = this.all;
liberator.assert(marks.length > 0, "No marks set");
dactyl.assert(marks.length > 0, "No marks set");
if (filter.length > 0) {
marks = marks.filter(function (mark) filter.indexOf(mark[0]) >= 0);
liberator.assert(marks.length > 0, "E283: No marks matching " + filter.quote());
dactyl.assert(marks.length > 0, "E283: No marks matching " + filter.quote());
}
let list = template.tabular(
@@ -204,7 +204,7 @@ const Marks = Module("marks", {
let win = window.content;
for (let [i, ] in Iterator(localmark)) {
if (localmark[i].location == win.location.href) {
liberator.log("Deleting local mark: " + Marks.markToString(mark, localmark[i]), 5);
dactyl.log("Deleting local mark: " + Marks.markToString(mark, localmark[i]), 5);
localmark.splice(i, 1);
if (localmark.length == 0)
this._localMarks.remove(mark);
@@ -217,7 +217,7 @@ const Marks = Module("marks", {
_removeURLMark: function _removeURLMark(mark) {
let urlmark = this._urlMarks.get(mark);
if (urlmark) {
liberator.log("Deleting URL mark: " + Marks.markToString(mark, urlmark), 5);
dactyl.log("Deleting URL mark: " + Marks.markToString(mark, urlmark), 5);
this._urlMarks.remove(mark);
}
},
@@ -251,7 +251,7 @@ const Marks = Module("marks", {
mappings.add(myModes,
["m"], "Set mark at the cursor position",
function (arg) {
liberator.assert(/^[a-zA-Z]$/.test(arg));
dactyl.assert(/^[a-zA-Z]$/.test(arg));
marks.add(arg);
},
{ arg: true });
@@ -270,19 +270,19 @@ const Marks = Module("marks", {
args = args.string;
// assert(special ^ args)
liberator.assert( special || args, "E471: Argument required");
liberator.assert(!special || !args, "E474: Invalid argument");
dactyl.assert( special || args, "E471: Argument required");
dactyl.assert(!special || !args, "E474: Invalid argument");
let matches = args.match(/(?:(?:^|[^a-zA-Z0-9])-|-(?:$|[^a-zA-Z0-9])|[^a-zA-Z0-9 -]).*/);
// NOTE: this currently differs from Vim's behavior which
// deletes any valid marks in the arg list, up to the first
// invalid arg, as well as giving the error message.
liberator.assert(!matches, "E475: Invalid argument: " + matches[0]);
dactyl.assert(!matches, "E475: Invalid argument: " + matches[0]);
// check for illegal ranges - only allow a-z A-Z 0-9
if ((matches = args.match(/[a-zA-Z0-9]-[a-zA-Z0-9]/g))) {
for (let match in values(matches))
liberator.assert(/[a-z]-[a-z]|[A-Z]-[A-Z]|[0-9]-[0-9]/.test(match) &&
dactyl.assert(/[a-z]-[a-z]|[A-Z]-[A-Z]|[0-9]-[0-9]/.test(match) &&
match[0] <= match[2],
"E475: Invalid argument: " + args.match(match + ".*")[0]);
}
@@ -298,8 +298,8 @@ const Marks = Module("marks", {
"Mark current location within the web page",
function (args) {
let mark = args[0];
liberator.assert(mark.length <= 1, "E488: Trailing characters");
liberator.assert(/[a-zA-Z]/.test(mark),
dactyl.assert(mark.length <= 1, "E488: Trailing characters");
dactyl.assert(/[a-zA-Z]/.test(mark),
"E191: Argument must be a letter or forward/backward quote");
marks.add(mark);
@@ -312,7 +312,7 @@ const Marks = Module("marks", {
args = args.string;
// ignore invalid mark characters unless there are no valid mark chars
liberator.assert(!args || /[a-zA-Z]/.test(args),
dactyl.assert(!args || /[a-zA-Z]/.test(args),
"E283: No marks matching " + args.quote());
let filter = args.replace(/[^a-zA-Z]/g, "");

View File

@@ -118,7 +118,7 @@ const Modes = Module("modes", {
options.setPref("accessibility.browsewithcaret", false);
statusline.updateUrl();
liberator.focusContent(true);
dactyl.focusContent(true);
}
},
@@ -191,7 +191,7 @@ const Modes = Module("modes", {
if (this._main != oldMain)
this._handleModeChange(oldMain, mainMode, oldExtended);
}
liberator.triggerObserver("modeChange", [oldMain, oldExtended], [this._main, this._extended], stack);
dactyl.triggerObserver("modeChange", [oldMain, oldExtended], [this._main, this._extended], stack);
if (!silent)
this.show();

View File

@@ -100,8 +100,8 @@ window.addEventListener("load", function () {
delete module.INIT[mod];
}
catch (e) {
if (modules.liberator)
liberator.reportError(e);
if (modules.dactyl)
dactyl.reportError(e);
}
}
for (let mod in keys(module.INIT)) {

View File

@@ -104,13 +104,13 @@ const Option = Class("Option", {
let values;
if (liberator.has("tabs") && (scope & Option.SCOPE_LOCAL))
if (dactyl.has("tabs") && (scope & Option.SCOPE_LOCAL))
values = tabs.options[this.name];
if ((scope & Option.SCOPE_GLOBAL) && (values == undefined))
values = this.globalValue;
if (this.getter)
return liberator.trapErrors(this.getter, this, values);
return dactyl.trapErrors(this.getter, this, values);
return values;
},
@@ -128,11 +128,11 @@ const Option = Class("Option", {
return;
if (this.setter)
newValues = liberator.trapErrors(this.setter, this, newValues);
newValues = dactyl.trapErrors(this.setter, this, newValues);
if (newValues === undefined)
return;
if (liberator.has("tabs") && (scope & Option.SCOPE_LOCAL))
if (dactyl.has("tabs") && (scope & Option.SCOPE_LOCAL))
tabs.options[this.name] = newValues;
if ((scope & Option.SCOPE_GLOBAL) && !skipGlobal)
this.globalValue = newValues;
@@ -235,7 +235,7 @@ const Option = Class("Option", {
* @property {string} The option's data type. One of:
* "boolean" - Boolean, e.g., true
* "number" - Integer, e.g., 1
* "string" - String, e.g., "Vimperator"
* "string" - String, e.g., "Pentadactyl"
* "charlist" - Character list, e.g., "rb"
* "regexlist" - Regex list, e.g., "^foo,bar$"
* "stringmap" - String map, e.g., "key=v,foo=bar"
@@ -499,7 +499,7 @@ const Options = Module("options", {
var popupAllowedEvents = this._loadPreference("dom.popup_allowed_events", "change click dblclick mouseup reset submit");
if (!/keypress/.test(popupAllowedEvents)) {
this._storePreference("dom.popup_allowed_events", popupAllowedEvents + " keypress");
liberator.registerObserver("shutdown", function () {
dactyl.registerObserver("shutdown", function () {
if (this._loadPreference("dom.popup_allowed_events", "") == popupAllowedEvents + " keypress")
this._storePreference("dom.popup_allowed_events", popupAllowedEvents);
});
@@ -550,7 +550,7 @@ const Options = Module("options", {
switch (data) {
case "accessibility.browsewithcaret":
let value = options.getPref("accessibility.browsewithcaret", false);
liberator.mode = value ? modes.CARET : modes.NORMAL;
dactyl.mode = value ? modes.CARET : modes.NORMAL;
break;
}
}
@@ -579,7 +579,7 @@ const Options = Module("options", {
if (option.name in this._optionHash) {
// never replace for now
liberator.log("Warning: " + names[0].quote() + " already exists, NOT replacing existing option.", 1);
dactyl.log("Warning: " + names[0].quote() + " already exists, NOT replacing existing option.", 1);
return false;
}
@@ -777,7 +777,7 @@ const Options = Module("options", {
*
* @param {string} name The preference name.
* @param {value} forcedDefault The the default value for this
* preference. Used for internal liberator preferences.
* preference. Used for internal dactyl preferences.
*/
getPref: function (name, forcedDefault) {
return this._loadPreference(name, forcedDefault);
@@ -799,7 +799,7 @@ const Options = Module("options", {
let msg = "Warning: setting preference " + name + ", but it's changed from its default value.";
if (message)
msg += " " + message;
liberator.echomsg(msg);
dactyl.echomsg(msg);
}
this._storePreference(name, value);
this._storePreference(Options.SAVED + name, value);
@@ -838,7 +838,7 @@ const Options = Module("options", {
if (services.get("pref").getPrefType(name) == Ci.nsIPrefBranch.PREF_BOOL)
this.setPref(name, !this.getPref(name));
else
liberator.echoerr("E488: Trailing characters: " + name + "!");
dactyl.echoerr("E488: Trailing characters: " + name + "!");
},
/**
@@ -897,26 +897,26 @@ const Options = Module("options", {
services.get("pref").setComplexValue(name, Ci.nsISupportsString, supportString);
}
else if (type == Ci.nsIPrefBranch.PREF_INT)
liberator.echoerr("E521: Number required after =: " + name + "=" + value);
dactyl.echoerr("E521: Number required after =: " + name + "=" + value);
else
liberator.echoerr("E474: Invalid argument: " + name + "=" + value);
dactyl.echoerr("E474: Invalid argument: " + name + "=" + value);
break;
case "number":
if (type == Ci.nsIPrefBranch.PREF_INVALID || type == Ci.nsIPrefBranch.PREF_INT)
services.get("pref").setIntPref(name, value);
else
liberator.echoerr("E474: Invalid argument: " + name + "=" + value);
dactyl.echoerr("E474: Invalid argument: " + name + "=" + value);
break;
case "boolean":
if (type == Ci.nsIPrefBranch.PREF_INVALID || type == Ci.nsIPrefBranch.PREF_BOOL)
services.get("pref").setBoolPref(name, value);
else if (type == Ci.nsIPrefBranch.PREF_INT)
liberator.echoerr("E521: Number required after =: " + name + "=" + value);
dactyl.echoerr("E521: Number required after =: " + name + "=" + value);
else
liberator.echoerr("E474: Invalid argument: " + name + "=" + value);
dactyl.echoerr("E474: Invalid argument: " + name + "=" + value);
break;
default:
liberator.echoerr("Unknown preference type: " + typeof value + " (" + name + "=" + value + ")");
dactyl.echoerr("Unknown preference type: " + typeof value + " (" + name + "=" + value + ")");
}
},
@@ -949,8 +949,8 @@ const Options = Module("options", {
}
}
}, {
SAVED: "extensions.liberator.saved.",
OLD_SAVED: "liberator.saved."
SAVED: "extensions.dactyl.saved.",
OLD_SAVED: "dactyl.saved."
}, {
commandline: function () {
// TODO: maybe reset in .destroy()?
@@ -1020,10 +1020,10 @@ const Options = Module("options", {
}
let opt = options.parseOpt(arg, modifiers);
liberator.assert(opt, "Error parsing :set command: " + arg);
dactyl.assert(opt, "Error parsing :set command: " + arg);
let option = opt.option;
liberator.assert(option != null || opt.all,
dactyl.assert(option != null || opt.all,
"E518: Unknown option: " + opt.name);
// reset a variable to its default value
@@ -1051,7 +1051,7 @@ const Options = Module("options", {
msg += "\n Last set from " + option.setFrom.path;
// FIXME: Message highlight group wrapping messes up the indent up for multi-arg verbose :set queries
liberator.echo(<span highlight="CmdOutput">{msg}</span>);
dactyl.echo(<span highlight="CmdOutput">{msg}</span>);
}
}
// write access
@@ -1059,7 +1059,7 @@ const Options = Module("options", {
option.setFrom = modifiers.setFrom || null;
if (opt.option.type == "boolean") {
liberator.assert(!opt.valueGiven, "E474: Invalid argument: " + arg);
dactyl.assert(!opt.valueGiven, "E474: Invalid argument: " + arg);
opt.values = !opt.unsetBoolean;
}
try {
@@ -1069,7 +1069,7 @@ const Options = Module("options", {
res = e;
}
if (res)
liberator.echoerr(res);
dactyl.echoerr(res);
}
}
}
@@ -1138,7 +1138,7 @@ const Options = Module("options", {
let str =
<table>
{
template.map(liberator.globalVariables, function ([i, value]) {
template.map(dactyl.globalVariables, function ([i, value]) {
let prefix = typeof value == "number" ? "#" :
typeof value == "function" ? "*" :
" ";
@@ -1150,9 +1150,9 @@ const Options = Module("options", {
}
</table>;
if (str.*.length())
liberator.echo(str, commandline.FORCE_MULTILINE);
dactyl.echo(str, commandline.FORCE_MULTILINE);
else
liberator.echomsg("No variables found");
dactyl.echomsg("No variables found");
return;
}
@@ -1161,16 +1161,16 @@ const Options = Module("options", {
if (matches) {
let [, type, name, stuff, expr] = matches;
if (!type) {
let reference = liberator.variableReference(name);
liberator.assert(reference[0] || !stuff,
let reference = dactyl.variableReference(name);
dactyl.assert(reference[0] || !stuff,
"E121: Undefined variable: " + name);
expr = liberator.evalExpression(expr);
liberator.assert(expr !== undefined, "E15: Invalid expression: " + expr);
expr = dactyl.evalExpression(expr);
dactyl.assert(expr !== undefined, "E15: Invalid expression: " + expr);
if (!reference[0]) {
if (reference[2] == "g")
reference[0] = liberator.globalVariables;
reference[0] = dactyl.globalVariables;
else
return; // for now
}
@@ -1190,14 +1190,14 @@ const Options = Module("options", {
}
// 1 - name
else if ((matches = args.match(/^\s*([\w:]+)\s*$/))) {
let reference = liberator.variableReference(matches[1]);
liberator.assert(reference[0], "E121: Undefined variable: " + matches[1]);
let reference = dactyl.variableReference(matches[1]);
dactyl.assert(reference[0], "E121: Undefined variable: " + matches[1]);
let value = reference[0][reference[1]];
let prefix = typeof value == "number" ? "#" :
typeof value == "function" ? "*" :
" ";
liberator.echo(reference[1] + "\t\t" + prefix + value);
dactyl.echo(reference[1] + "\t\t" + prefix + value);
}
},
{
@@ -1260,10 +1260,10 @@ const Options = Module("options", {
"Delete a variable",
function (args) {
for (let [, name] in args) {
let reference = liberator.variableReference(name);
let reference = dactyl.variableReference(name);
if (!reference[0]) {
if (!args.bang)
liberator.echoerr("E108: No such variable: " + name);
dactyl.echoerr("E108: No such variable: " + name);
return;
}

View File

@@ -4,7 +4,7 @@
<script type="application/javascript;version=1.8">
let uri = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI("liberator://help/options", null, null);
.newURI("dactyl://help/options", null, null);
Application.activeWindow.open(uri).focus(); // TODO: generalise for Muttator et al.
window.close();
</script>

View File

@@ -28,7 +28,7 @@ const QuickMarks = Module("quickmarks", {
*/
add: function add(qmark, location) {
this._qmarks.set(qmark, location);
liberator.echomsg("Added Quick Mark '" + qmark + "': " + location, 1);
dactyl.echomsg("Added Quick Mark '" + qmark + "': " + location, 1);
},
/**
@@ -59,15 +59,15 @@ const QuickMarks = Module("quickmarks", {
*
* @param {string} qmark The quickmark to open.
* @param {number} where A constant describing where to open the page.
* See {@link Liberator#open}.
* See {@link Dactyl#open}.
*/
jumpTo: function jumpTo(qmark, where) {
let url = this._qmarks.get(qmark);
if (url)
liberator.open(url, where);
dactyl.open(url, where);
else
liberator.echoerr("E20: QuickMark not set");
dactyl.echoerr("E20: QuickMark not set");
},
/**
@@ -85,11 +85,11 @@ const QuickMarks = Module("quickmarks", {
marks = Array.concat(lowercaseMarks, uppercaseMarks, numberMarks);
liberator.assert(marks.length > 0, "No QuickMarks set");
dactyl.assert(marks.length > 0, "No QuickMarks set");
if (filter.length > 0) {
marks = marks.filter(function (qmark) filter.indexOf(qmark) >= 0);
liberator.assert(marks.length >= 0, "E283: No QuickMarks matching \"" + filter + "\"");
dactyl.assert(marks.length >= 0, "E283: No QuickMarks matching \"" + filter + "\"");
}
let items = [[mark, this._qmarks.get(mark)] for ([k, mark] in Iterator(marks))];
@@ -103,8 +103,8 @@ const QuickMarks = Module("quickmarks", {
function (args) {
// TODO: finish arg parsing - we really need a proper way to do this. :)
// assert(args.bang ^ args.string)
liberator.assert( args.bang || args.string, "E471: Argument required");
liberator.assert(!args.bang || !args.string, "E474: Invalid argument");
dactyl.assert( args.bang || args.string, "E471: Argument required");
dactyl.assert(!args.bang || !args.string, "E474: Invalid argument");
if (args.bang)
quickmarks.removeAll();
@@ -124,7 +124,7 @@ const QuickMarks = Module("quickmarks", {
function (args) {
let matches = args.string.match(/^([a-zA-Z0-9])(?:\s+(.+))?$/);
if (!matches)
liberator.echoerr("E488: Trailing characters");
dactyl.echoerr("E488: Trailing characters");
else if (!matches[2])
quickmarks.add(matches[1], buffer.URL);
else
@@ -138,7 +138,7 @@ const QuickMarks = Module("quickmarks", {
args = args.string;
// ignore invalid qmark characters unless there are no valid qmark chars
liberator.assert(!args || /[a-zA-Z0-9]/.test(args), "E283: No QuickMarks matching \"" + args + "\"");
dactyl.assert(!args || /[a-zA-Z0-9]/.test(args), "E283: No QuickMarks matching \"" + args + "\"");
let filter = args.replace(/[^a-zA-Z0-9]/g, "");
quickmarks.list(filter);
@@ -149,7 +149,7 @@ const QuickMarks = Module("quickmarks", {
mappings.add(myModes,
["go"], "Jump to a QuickMark",
function (arg) { quickmarks.jumpTo(arg, liberator.CURRENT_TAB); },
function (arg) { quickmarks.jumpTo(arg, dactyl.CURRENT_TAB); },
{ arg: true });
mappings.add(myModes,
@@ -157,14 +157,14 @@ const QuickMarks = Module("quickmarks", {
function (arg) {
quickmarks.jumpTo(arg,
/\bquickmark\b/.test(options["activate"]) ?
liberator.NEW_TAB : liberator.NEW_BACKGROUND_TAB);
dactyl.NEW_TAB : dactyl.NEW_BACKGROUND_TAB);
},
{ arg: true });
mappings.add(myModes,
["M"], "Add new QuickMark for current URL",
function (arg) {
liberator.assert(/^[a-zA-Z0-9]$/.test(arg));
dactyl.assert(/^[a-zA-Z0-9]$/.test(arg));
quickmarks.add(arg, buffer.URL);
},
{ arg: true });

View File

@@ -7,7 +7,7 @@
// TODO:
// - fix Sanitize autocommand
// - add warning for TIMESPAN_EVERYTHING?
// - respect privacy.clearOnShutdown et al or recommend VimperatorLeave autocommand?
// - respect privacy.clearOnShutdown et al or recommend PentadactylLeave autocommand?
// - add support for :set sanitizeitems=all like 'eventignore'?
// - integrate with the Clear Private Data dialog?
@@ -15,11 +15,11 @@
// - finish 1.9.0 support if we're going to support sanitizing in Xulmus
const Sanitizer = Module("sanitizer", {
requires: ["liberator"],
requires: ["dactyl"],
init: function () {
const self = this;
liberator.loadScript("chrome://browser/content/sanitize.js", Sanitizer);
dactyl.loadScript("chrome://browser/content/sanitize.js", Sanitizer);
Sanitizer.getClearRange = Sanitizer.Sanitizer.getClearRange;
this.__proto__.__proto__ = new Sanitizer.Sanitizer; // Good enough.
@@ -29,7 +29,7 @@ const Sanitizer = Module("sanitizer", {
else
self.prefDomain = "privacy.item.";
self.prefDomain2 = "extensions.liberator.privacy.cpd.";
self.prefDomain2 = "extensions.dactyl.privacy.cpd.";
},
// Largely ripped from from browser/base/content/sanitize.js so we can override
@@ -60,7 +60,7 @@ const Sanitizer = Module("sanitizer", {
item.range = range;
if ("clear" in item && item.canClear && prefSet(itemName)) {
liberator.log("Sanitizing " + itemName + " items...");
dactyl.log("Sanitizing " + itemName + " items...");
// Some of these clear() may raise exceptions (see bug #265028)
// to sanitize as much as possible, we catch and store them,
// rather than fail fast.
@@ -97,7 +97,7 @@ const Sanitizer = Module("sanitizer", {
commands.add(["sa[nitize]"],
"Clear private data",
function (args) {
liberator.assert(!options['private'], "Cannot sanitize items in private mode");
dactyl.assert(!options['private'], "Cannot sanitize items in private mode");
let timespan = args["-timespan"] || options["sanitizetimespan"];
@@ -105,22 +105,22 @@ const Sanitizer = Module("sanitizer", {
sanitizer.ignoreTimespan = !sanitizer.range;
if (args.bang) {
liberator.assert(args.length == 0, "E488: Trailing characters");
dactyl.assert(args.length == 0, "E488: Trailing characters");
liberator.log("Sanitizing all items in 'sanitizeitems'...");
dactyl.log("Sanitizing all items in 'sanitizeitems'...");
let errors = sanitizer.sanitize();
if (errors) {
for (let item in errors)
liberator.echoerr("Error sanitizing " + item + ": " + errors[item]);
dactyl.echoerr("Error sanitizing " + item + ": " + errors[item]);
}
}
else {
liberator.assert(args.length > 0, "E471: Argument required");
dactyl.assert(args.length > 0, "E471: Argument required");
for (let [, item] in Iterator(args.map(Sanitizer.argToPref))) {
liberator.log("Sanitizing " + item + " items...");
dactyl.log("Sanitizing " + item + " items...");
if (sanitizer.canClearItem(item)) {
try {
@@ -128,11 +128,11 @@ const Sanitizer = Module("sanitizer", {
sanitizer.clearItem(item);
}
catch (e) {
liberator.echoerr("Error sanitizing " + item + ": " + e);
dactyl.echoerr("Error sanitizing " + item + ": " + e);
}
}
else
liberator.echomsg("Cannot sanitize " + item);
dactyl.echomsg("Cannot sanitize " + item);
}
}
},
@@ -154,7 +154,7 @@ const Sanitizer = Module("sanitizer", {
options: function () {
const self = this;
// add liberator-specific private items
// add dactyl-specific private items
[
{
name: "commandLine",

View File

@@ -22,7 +22,7 @@ const Services = Module("services", {
this.add("browserSearch", "@mozilla.org/browser/search-service;1", Ci.nsIBrowserSearchService);
this.add("cache", "@mozilla.org/network/cache-service;1", Ci.nsICacheService);
this.add("console", "@mozilla.org/consoleservice;1", Ci.nsIConsoleService);
this.add("liberator:", "@mozilla.org/network/protocol;1?name=liberator");
this.add("dactyl:", "@mozilla.org/network/protocol;1?name=dactyl");
this.add("debugger", "@mozilla.org/js/jsd/debugger-service;1", Ci.jsdIDebuggerService);
this.add("directory", "@mozilla.org/file/directory_service;1", Ci.nsIProperties);
this.add("downloadManager", "@mozilla.org/download-manager;1", Ci.nsIDownloadManager);
@@ -64,7 +64,7 @@ const Services = Module("services", {
return res;
}
catch (e) {
// liberator.log() is not defined at this time, so just dump any error
// dactyl.log() is not defined at this time, so just dump any error
dump("Service creation failed for '" + classes + "': " + e + "\n");
return null;
}

View File

@@ -15,7 +15,7 @@ const StatusLine = Module("statusline", {
// our status bar fields
this.widgets = dict(["status", "url", "inputbuffer", "progress", "tabcount", "bufferposition", "zoomlevel"].map(
function (field) [field, document.getElementById("liberator-statusline-field-" + field)]));
function (field) [field, document.getElementById("dactyl-statusline-field-" + field)]));
},
/**
@@ -99,8 +99,8 @@ const StatusLine = Module("statusline", {
url = "[No Name]";
}
else {
url = url.replace(RegExp("^liberator://help/(\\S+)#(.*)"), function (m, n1, n2) n1 + " " + decodeURIComponent(n2) + " [Help]")
.replace(RegExp("^liberator://help/(\\S+)"), "$1 [Help]");
url = url.replace(RegExp("^dactyl://help/(\\S+)#(.*)"), function (m, n1, n2) n1 + " " + decodeURIComponent(n2) + " [Help]")
.replace(RegExp("^dactyl://help/(\\S+)"), "$1 [Help]");
}
// when session information is available, add [+] when we can go
@@ -180,7 +180,7 @@ const StatusLine = Module("statusline", {
* the tab state is fully updated.
*/
updateTabCount: function updateTabCount(delayed) {
if (liberator.has("tabs")) {
if (dactyl.has("tabs")) {
if (delayed) {
this.setTimeout(function () this.updateTabCount(false), 0);
return;
@@ -257,7 +257,7 @@ const StatusLine = Module("statusline", {
if (value == 0)
document.getElementById("status-bar").collapsed = true;
else if (value == 1)
liberator.echoerr("show status line only with > 1 window not implemented yet");
dactyl.echoerr("show status line only with > 1 window not implemented yet");
else
document.getElementById("status-bar").collapsed = false;

View File

@@ -128,13 +128,13 @@ Highlights.prototype.CSS = <![CDATA[
HelpOptionalArg color: #6A97D4;
HelpBody display: block; margin: 1em auto; max-width: 100ex;
HelpBorder,*,liberator://help/* border-color: silver; border-width: 0px; border-style: solid;
HelpBorder,*,dactyl://help/* border-color: silver; border-width: 0px; border-style: solid;
HelpCode display: block; white-space: pre; margin-left: 2em; font-family: Terminus, Fixed, monospace;
HelpDefault margin-right: 1ex; white-space: pre;
HelpDescription display: block;
HelpEm,html|em,liberator://help/* font-weight: bold; font-style: normal;
HelpEm,html|em,dactyl://help/* font-weight: bold; font-style: normal;
HelpEx display: inline-block; color: #527BBD; font-weight: bold;
@@ -149,19 +149,19 @@ Highlights.prototype.CSS = <![CDATA[
HelpKey color: #102663;
HelpLink,html|a,liberator://help/* text-decoration: none;
HelpLink,html|a,dactyl://help/* text-decoration: none;
HelpLink[href]:hover text-decoration: underline;
HelpList,html|ul,liberator://help/* display: block; list-style: outside disc;
HelpOrderedList,html|ol,liberator://help/* display: block; list-style: outside decimal;
HelpListItem,html|li,liberator://help/* display: list-item;
HelpList,html|ul,dactyl://help/* display: block; list-style: outside disc;
HelpOrderedList,html|ol,dactyl://help/* display: block; list-style: outside decimal;
HelpListItem,html|li,dactyl://help/* display: list-item;
HelpNote color: red; font-weight: bold;
HelpOpt color: #106326;
HelpOptInfo display: inline-block; margin-bottom: 1ex;
HelpParagraph,html|p,liberator://help/* display: block; margin: 1em 0em;
HelpParagraph,html|p,dactyl://help/* display: block; margin: 1em 0em;
HelpParagraph:first-child margin-top: 0;
HelpSpec display: block; margin-left: -10em; float: left; clear: left; color: #527BBD;
@@ -171,7 +171,7 @@ Highlights.prototype.CSS = <![CDATA[
HelpString[delim]::before content: attr(delim);
HelpString[delim]::after content: attr(delim);
HelpHead,html|h1,liberator://help/* {
HelpHead,html|h1,dactyl://help/* {
display: block;
margin: 1em 0;
padding-bottom: .2ex;
@@ -181,7 +181,7 @@ Highlights.prototype.CSS = <![CDATA[
color: #527BBD;
clear: both;
}
HelpSubhead,html|h2,liberator://help/* {
HelpSubhead,html|h2,dactyl://help/* {
display: block;
margin: 1em 0;
padding-bottom: .2ex;
@@ -191,7 +191,7 @@ Highlights.prototype.CSS = <![CDATA[
color: #527BBD;
clear: both;
}
HelpSubsubhead,html|h3,liberator://help/* {
HelpSubsubhead,html|h3,dactyl://help/* {
display: block;
margin: 1em 0;
padding-bottom: .2ex;
@@ -204,12 +204,12 @@ Highlights.prototype.CSS = <![CDATA[
HelpTOC
HelpTOC>ol ol margin-left: -1em;
HelpTab,html|dl,liberator://help/* display: table; width: 100%; margin: 1em 0; border-bottom-width: 1px; border-top-width: 1px; padding: .5ex 0; table-layout: fixed;
HelpTabColumn,html|column,liberator://help/* display: table-column;
HelpTab,html|dl,dactyl://help/* display: table; width: 100%; margin: 1em 0; border-bottom-width: 1px; border-top-width: 1px; padding: .5ex 0; table-layout: fixed;
HelpTabColumn,html|column,dactyl://help/* display: table-column;
HelpTabColumn:first-child width: 25%;
HelpTabTitle,html|dt,liberator://help/* display: table-cell; padding: .1ex 1ex; font-weight: bold;
HelpTabDescription,html|dd,liberator://help/* display: table-cell; padding: .1ex 1ex; border-width: 0px;
HelpTabRow,html|dl>html|tr,liberator://help/* display: table-row;
HelpTabTitle,html|dt,dactyl://help/* display: table-cell; padding: .1ex 1ex; font-weight: bold;
HelpTabDescription,html|dd,dactyl://help/* display: table-cell; padding: .1ex 1ex; border-width: 0px;
HelpTabRow,html|dl>html|tr,dactyl://help/* display: table-row;
HelpTag display: inline-block; color: #527BBD; margin-left: 1ex; font-size: 8pt; font-weight: bold;
HelpTags display: block; float: right; clear: right;
@@ -242,8 +242,8 @@ function Highlights(name, store) {
const Highlight = Struct("class", "selector", "filter", "default", "value", "base");
Highlight.defaultValue("filter", function ()
this.base ? this.base.filter :
["chrome://liberator/*",
"liberator:*",
["chrome://dactyl/*",
"dactyl:*",
"file://*"].concat(config.styleableChrome).join(","));
Highlight.defaultValue("selector", function () self.selector(this.class));
Highlight.defaultValue("value", function () this.default);
@@ -302,7 +302,7 @@ function Highlights(name, store) {
*/
this.selector = function (class_) {
let [, hl, rest] = class_.match(/^(\w*)(.*)/);
let pattern = "[liberator|highlight~=" + hl + "]"
let pattern = "[dactyl|highlight~=" + hl + "]"
if (highlight[hl] && highlight[hl].class != class_)
pattern = highlight[hl].selector;
return pattern + rest;
@@ -351,18 +351,18 @@ function Highlights(name, store) {
* @author Kris Maglione <maglione.k@gmail.com>
*/
function Styles(name, store) {
// Can't reference liberator or Components inside Styles --
// Can't reference dactyl or Components inside Styles --
// they're members of the window object, which disappear
// with this window.
const self = this;
const util = modules.util;
const sleep = liberator.sleep;
const sleep = dactyl.sleep;
const storage = modules.storage;
const ios = services.get("io");
const sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
const namespace = "@namespace html " + XHTML.uri.quote() + ";\n" +
"@namespace xul " + XUL.uri.quote() + ";\n" +
"@namespace liberator " + NS.uri.quote() + ";\n";
"@namespace dactyl " + NS.uri.quote() + ";\n";
const Sheet = Struct("name", "id", "sites", "css", "system", "agent");
Sheet.prototype.__defineGetter__("fullCSS", function wrapCSS() {
@@ -375,7 +375,7 @@ function Styles(name, store) {
: "domain")
+ '("' + part.replace(/"/g, "%22").replace(/[*]$/, "") + '")')
.join(", ");
return namespace + "/* Liberator style #" + this.id + " */ @-moz-document " + selectors + "{\n" + css + "\n}\n";
return namespace + "/* Dactyl style #" + this.id + " */ @-moz-document " + selectors + "{\n" + css + "\n}\n";
});
Sheet.prototype.__defineGetter__("enabled", function () this._enabled);
Sheet.prototype.__defineSetter__("enabled", function (on) {
@@ -411,7 +411,7 @@ function Styles(name, store) {
*
* @param {boolean} system Declares whether this is a system or
* user sheet. System sheets are used internally by
* @liberator.
* @dactyl.
* @param {string} name The name given to the style sheet by
* which it may be later referenced.
* @param {string} filter The sites to which this sheet will
@@ -561,7 +561,7 @@ function Styles(name, store) {
}
Module("styles", {
requires: ["config", "liberator", "storage", "util"],
requires: ["config", "dactyl", "storage", "util"],
init: function () {
let (array = util.Array) {
@@ -622,7 +622,7 @@ Module("styles", {
}
let err = styles.addSheet(false, name, filter, css);
if (err)
liberator.echoerr(err);
dactyl.echoerr(err);
}
},
{
@@ -733,7 +733,7 @@ Module("highlight", {
if (scheme == "default")
highlight.clear();
else
liberator.assert(io.sourceFromRuntimePath(["colors/" + scheme + ".vimp"]),
dactyl.assert(io.sourceFromRuntimePath(["colors/" + scheme + ".vimp"]),
"E185: Cannot find color scheme " + scheme);
autocommands.trigger("ColorScheme", { name: scheme });
},
@@ -759,7 +759,7 @@ Module("highlight", {
args.shift();
let [key, css] = args;
liberator.assert(!(clear && css), "E488: Trailing characters");
dactyl.assert(!(clear && css), "E488: Trailing characters");
if (!css && !clear) {
// List matching keys
@@ -779,7 +779,7 @@ Module("highlight", {
else {
let error = highlight.set(key, css, clear, "-append" in args);
if (error)
liberator.echoerr(error);
dactyl.echoerr(error);
}
},
{

View File

@@ -40,7 +40,7 @@ const Tabs = Module("tabs", {
statusline.updateTabCount(true);
this.updateSelectionHistory();
if (options["focuscontent"])
setTimeout(function () { liberator.focusContent(true); }, 10); // just make sure, that no widget has focus
setTimeout(function () { dactyl.focusContent(true); }, 10); // just make sure, that no widget has focus
},
/**
@@ -65,12 +65,12 @@ const Tabs = Module("tabs", {
*/
get tabsBound() Boolean(styles.get(true, "tab-binding")),
set tabsBound(val) {
let fragment = liberator.has("MacUnix") ? "tab-mac" : "tab";
let fragment = dactyl.has("MacUnix") ? "tab-mac" : "tab";
if (!val)
styles.removeSheet(true, "tab-binding");
else if (!this.tabsBound)
styles.addSheet(true, "tab-binding", "chrome://browser/content/browser.xul",
".tabbrowser-tab { -moz-binding: url(chrome://liberator/content/bindings.xml#" + fragment + ") !important; }" +
".tabbrowser-tab { -moz-binding: url(chrome://dactyl/content/bindings.xml#" + fragment + ") !important; }" +
// FIXME: better solution for themes?
".tabbrowser-tab[busy] > .tab-icon > .tab-icon-image { list-style-image: url('chrome://global/skin/icons/loading_16.png') !important; }");
},
@@ -105,9 +105,9 @@ const Tabs = Module("tabs", {
// useful for autocommands, and they get index arguments. --Kris
getLocalStore: function (tabIndex) {
let tab = this.getTab(tabIndex);
if (!tab.liberatorStore)
tab.liberatorStore = {};
return tab.liberatorStore;
if (!tab.dactylStore)
tab.dactylStore = {};
return tab.dactylStore;
},
/**
@@ -230,29 +230,29 @@ const Tabs = Module("tabs", {
else {
if (buffer.URL != "about:blank" ||
window.getWebNavigation().sessionHistory.count > 0) {
liberator.open("about:blank", liberator.NEW_BACKGROUND_TAB);
dactyl.open("about:blank", dactyl.NEW_BACKGROUND_TAB);
config.tabbrowser.removeTab(tab);
}
else
liberator.beep();
dactyl.beep();
}
},
Thunderbird: function (tab) {
if (config.tabbrowser.mTabs.length > 1)
config.tabbrowser.removeTab(tab);
else
liberator.beep();
dactyl.beep();
},
Songbird: function (tab) {
if (config.tabbrowser.mTabs.length > 1)
config.tabbrowser.removeTab(tab);
else {
if (buffer.URL != "about:blank" || window.getWebNavigation().sessionHistory.count > 0) {
liberator.open("about:blank", liberator.NEW_BACKGROUND_TAB);
dactyl.open("about:blank", dactyl.NEW_BACKGROUND_TAB);
config.tabbrowser.removeTab(tab);
}
else
liberator.beep();
dactyl.beep();
}
}
}[config.hostApplication] || function () {};
@@ -261,10 +261,10 @@ const Tabs = Module("tabs", {
count = 1;
if (quitOnLastTab >= 1 && config.tabbrowser.mTabs.length <= count) {
if (liberator.windows.length > 1)
if (dactyl.windows.length > 1)
window.close();
else
liberator.quit(quitOnLastTab == 2);
dactyl.quit(quitOnLastTab == 2);
return;
}
@@ -310,7 +310,7 @@ const Tabs = Module("tabs", {
let index = Tabs.indexFromSpec(spec, wrap);
// FIXME:
if (index == -1)
liberator.beep();
dactyl.beep();
else
config.tabbrowser.mTabContainer.selectedIndex = index;
},
@@ -435,9 +435,9 @@ const Tabs = Module("tabs", {
matches.push(index);
}
if (matches.length == 0)
liberator.echoerr("E94: No matching buffer for " + buffer);
dactyl.echoerr("E94: No matching buffer for " + buffer);
else if (matches.length > 1 && !allowNonUnique)
liberator.echoerr("E93: More than one match for " + buffer);
dactyl.echoerr("E93: More than one match for " + buffer);
else {
if (reverse) {
index = matches.length - count;
@@ -485,7 +485,7 @@ const Tabs = Module("tabs", {
* Selects the alternate tab.
*/
selectAlternateTab: function () {
liberator.assert(tabs.alternate != null && tabs.getTab() != tabs.alternate,
dactyl.assert(tabs.alternate != null && tabs.getTab() != tabs.alternate,
"E23: No alternate page");
// NOTE: this currently relies on v.tabs.index() returning the
@@ -495,7 +495,7 @@ const Tabs = Module("tabs", {
// TODO: since a tab close is more like a bdelete for us we
// should probably reopen the closed tab when a 'deleted'
// alternate is selected
liberator.assert(index >= 0, "E86: Buffer does not exist"); // TODO: This should read "Buffer N does not exist"
dactyl.assert(index >= 0, "E86: Buffer does not exist"); // TODO: This should read "Buffer N does not exist"
tabs.select(index);
},
@@ -599,9 +599,9 @@ const Tabs = Module("tabs", {
}
if (removed > 0)
liberator.echomsg(removed + " fewer tab(s)", 9);
dactyl.echomsg(removed + " fewer tab(s)", 9);
else
liberator.echoerr("E94: No matching tab for " + arg);
dactyl.echoerr("E94: No matching tab for " + arg);
}
else // just remove the current tab
tabs.remove(tabs.getTab(), Math.max(count, 1), special, 0);
@@ -619,7 +619,7 @@ const Tabs = Module("tabs", {
let alternate = tabs.alternate;
try {
liberator.execute(args[0], null, true);
dactyl.execute(args[0], null, true);
}
finally {
tabs.updateSelectionHistory([tabs.getTab(), alternate]);
@@ -634,9 +634,9 @@ const Tabs = Module("tabs", {
commands.add(["tab"],
"Execute a command and tell it to output in a new tab",
function (args) {
liberator.forceNewTab = true;
liberator.execute(args.string, null, true);
liberator.forceNewTab = false;
dactyl.forceNewTab = true;
dactyl.execute(args.string, null, true);
dactyl.forceNewTab = false;
}, {
argCount: "+",
completer: function (context) completion.ex(context),
@@ -648,7 +648,7 @@ const Tabs = Module("tabs", {
function (args) {
for (let i = 0; i < tabs.count; i++) {
tabs.select(i);
liberator.execute(args.string, null, true);
dactyl.execute(args.string, null, true);
}
}, {
argCount: "1",
@@ -673,7 +673,7 @@ const Tabs = Module("tabs", {
if (/^\d+$/.test(arg))
tabs.select("-" + arg, true);
else
liberator.echoerr("E488: Trailing characters");
dactyl.echoerr("E488: Trailing characters");
}
else if (count > 0)
tabs.select("-" + count, true);
@@ -696,7 +696,7 @@ const Tabs = Module("tabs", {
// count is ignored if an arg is specified, as per Vim
if (arg) {
liberator.assert(/^\d+$/.test(arg), "E488: Trailing characters");
dactyl.assert(/^\d+$/.test(arg), "E488: Trailing characters");
index = arg - 1;
}
else
@@ -705,7 +705,7 @@ const Tabs = Module("tabs", {
if (index < tabs.count)
tabs.select(index, true);
else
liberator.beep();
dactyl.beep();
}
else
tabs.select("+1", true);
@@ -731,7 +731,7 @@ const Tabs = Module("tabs", {
// if a numeric arg is specified any count is ignored; if a
// count and non-numeric arg are both specified then E488
if (arg && count > 0) {
liberator.assert(/^\d+$/.test(arg), "E488: Trailing characters");
dactyl.assert(/^\d+$/.test(arg), "E488: Trailing characters");
tabs.switchTo(arg, special);
}
else if (count > 0)
@@ -755,7 +755,7 @@ const Tabs = Module("tabs", {
commands.add(["quita[ll]", "qa[ll]"],
"Quit " + config.name,
function (args) { liberator.quit(false, args.bang); }, {
function (args) { dactyl.quit(false, args.bang); }, {
argCount: "0",
bang: true
});
@@ -779,7 +779,7 @@ const Tabs = Module("tabs", {
let arg = args[0];
// FIXME: tabmove! N should probably produce an error
liberator.assert(!arg || /^([+-]?\d+)$/.test(arg),
dactyl.assert(!arg || /^([+-]?\d+)$/.test(arg),
"E488: Trailing characters");
// if not specified, move to after the last tab
@@ -797,7 +797,7 @@ const Tabs = Module("tabs", {
commands.add(["tabopen", "t[open]", "tabnew"],
"Open one or more URLs in a new tab",
function (args) {
liberator.open(args.string || "about:blank", { from: "tabopen", where: liberator.NEW_TAB, background: args.bang });
dactyl.open(args.string || "about:blank", { from: "tabopen", where: dactyl.NEW_TAB, background: args.bang });
}, {
bang: true,
completer: function (context) completion.url(context),
@@ -808,7 +808,7 @@ const Tabs = Module("tabs", {
commands.add(["tabde[tach]"],
"Detach current tab to its own window",
function () {
liberator.assert(tabs.count > 1, "Can't detach the last tab");
dactyl.assert(tabs.count > 1, "Can't detach the last tab");
tabs.detachTab(null);
},
@@ -837,14 +837,14 @@ const Tabs = Module("tabs", {
commands.add(["taba[ttach]"],
"Attach the current tab to another window",
function (args) {
liberator.assert(args.length <= 2 && !args.some(function (i) !/^\d+$/.test(i)),
dactyl.assert(args.length <= 2 && !args.some(function (i) !/^\d+$/.test(i)),
"E488: Trailing characters");
let [winIndex, tabIndex] = args.map(parseInt);
let win = liberator.windows[winIndex - 1];
let win = dactyl.windows[winIndex - 1];
liberator.assert(win, "Window " + winIndex + " does not exist");
liberator.assert(win != window, "Can't reattach to the same window");
dactyl.assert(win, "Window " + winIndex + " does not exist");
dactyl.assert(win != window, "Can't reattach to the same window");
let browser = win.getBrowser();
let dummy = browser.addTab("about:blank");
@@ -870,7 +870,7 @@ const Tabs = Module("tabs", {
});
}
if (liberator.has("tabs_undo")) {
if (dactyl.has("tabs_undo")) {
commands.add(["u[ndo]"],
"Undo closing of a tab",
function (args) {
@@ -889,7 +889,7 @@ const Tabs = Module("tabs", {
return;
}
liberator.echoerr("Exxx: No matching closed tab");
dactyl.echoerr("Exxx: No matching closed tab");
}
}, {
argCount: "?",
@@ -915,10 +915,10 @@ const Tabs = Module("tabs", {
}
if (liberator.has("session")) {
if (dactyl.has("session")) {
commands.add(["wqa[ll]", "wq", "xa[ll]"],
"Save the session and quit",
function () { liberator.quit(true); },
function () { dactyl.quit(true); },
{ argCount: "0" });
}
},
@@ -999,7 +999,7 @@ const Tabs = Module("tabs", {
{ count: true });
// TODO: feature dependencies - implies "session"?
if (liberator.has("tabs_undo")) {
if (dactyl.has("tabs_undo")) {
mappings.add([modes.NORMAL], ["u"],
"Undo closing of a tab",
function (count) { commands.get("undo").execute("", false, count); },

View File

@@ -22,7 +22,7 @@ const Template = Module("template", {
if (sep && n++)
ret += sep;
if (interruptable && n % interruptable == 0)
liberator.threadYield(true, true);
dactyl.threadYield(true, true);
ret += val;
}
return ret;

View File

@@ -10,7 +10,7 @@
const XHTML = Namespace("html", "http://www.w3.org/1999/xhtml");
const XUL = Namespace("xul", "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
const NS = Namespace("liberator", "http://vimperator.org/namespaces/liberator");
const NS = Namespace("dactyl", "http://vimperator.org/namespaces/liberator");
default xml namespace = XHTML;
const Util = Module("util", {
@@ -79,7 +79,7 @@ const Util = Module("util", {
clipboardHelper.copyString(str);
if (verbose)
liberator.echo("Yanked " + str, commandline.FORCE_SINGLELINE);
dactyl.echo("Yanked " + str, commandline.FORCE_SINGLELINE);
},
/**
@@ -310,7 +310,7 @@ const Util = Module("util", {
const PATH = FILE.leafName.replace(/\..*/, "") + "/";
const TIME = Date.now();
liberator.initHelp();
dactyl.initHelp();
let zip = services.create("zipWriter");
zip.open(FILE, File.MODE_CREATE | File.MODE_WRONLY | File.MODE_TRUNCATE);
function addURIEntry(file, uri)
@@ -324,8 +324,8 @@ const Util = Module("util", {
.split(" ").map(Array.concat));
let chrome = {};
for (let [file,] in Iterator(services.get("liberator:").FILE_MAP)) {
liberator.open("liberator://help/" + file);
for (let [file,] in Iterator(services.get("dactyl:").FILE_MAP)) {
dactyl.open("dactyl://help/" + file);
events.waitForPageLoad();
let data = [
'<?xml version="1.0" encoding="UTF-8"?>\n',
@@ -343,12 +343,12 @@ const Util = Module("util", {
data.push(" xmlns=" + XHTML.uri.quote());
for (let { name: name, value: value } in util.Array.itervalues(node.attributes)) {
if (name == "liberator:highlight") {
if (name == "dactyl:highlight") {
name = "class";
value = "hl-" + value;
}
if (name == "href") {
if (value.indexOf("liberator://help-tag/") == 0)
if (value.indexOf("dactyl://help-tag/") == 0)
value = services.get("io").newChannel(value, null, null).originalURI.path.substr(1);
if (!/[#\/]/.test(value))
value += ".xhtml";
@@ -423,14 +423,14 @@ const Util = Module("util", {
return xmlhttp;
}
catch (e) {
liberator.log("Error opening " + url + ": " + e, 1);
dactyl.log("Error opening " + url + ": " + e, 1);
return null;
}
},
/**
* Evaluates an XPath expression in the current or provided
* document. It provides the xhtml, xhtml2 and liberator XML
* document. It provides the xhtml, xhtml2 and dactyl XML
* namespaces. The result may be used as an iterator.
*
* @param {string} expression The XPath expression to evaluate.
@@ -454,7 +454,7 @@ const Util = Module("util", {
return {
xhtml: "http://www.w3.org/1999/xhtml",
xhtml2: "http://www.w3.org/2002/06/xhtml2",
liberator: NS.uri
dactyl: NS.uri
}[prefix] || null;
},
asIterator ? XPathResult.ORDERED_NODE_ITERATOR_TYPE : XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
@@ -559,7 +559,7 @@ const Util = Module("util", {
return false;
const NAMESPACES = util.Array.toObject([
[NS, 'liberator'],
[NS, 'dactyl'],
[XHTML, 'html'],
[XUL, 'xul']
]);
@@ -674,7 +674,7 @@ const Util = Module("util", {
let endTime = Date.now() + time;
while (start < end) {
if (Date.now() > endTime) {
liberator.threadYield(true, true);
dactyl.threadYield(true, true);
endTime = Date.now() + time;
}
yield start++;