mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 09:48:00 +01:00
Deal with fallout from 609832.
This commit is contained in:
@@ -9,8 +9,6 @@ function reportError(e) {
|
|||||||
Cu.reportError(e);
|
Cu.reportError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
var global = this;
|
var global = this;
|
||||||
var NAME = "command-line-handler";
|
var NAME = "command-line-handler";
|
||||||
var Cc = Components.classes;
|
var Cc = Components.classes;
|
||||||
@@ -61,6 +59,4 @@ else
|
|||||||
var NSGetModule = XPCOMUtils.generateNSGetModule([CommandLineHandler]);
|
var NSGetModule = XPCOMUtils.generateNSGetModule([CommandLineHandler]);
|
||||||
var EXPORTED_SYMBOLS = ["NSGetFactory", "global"];
|
var EXPORTED_SYMBOLS = ["NSGetFactory", "global"];
|
||||||
|
|
||||||
} catch (e) { reportError(e) }
|
|
||||||
|
|
||||||
// vim: set fdm=marker sw=4 ts=4 et:
|
// vim: set fdm=marker sw=4 ts=4 et:
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ function reportError(e) {
|
|||||||
Cu.reportError(e);
|
Cu.reportError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
/* Adds support for data: URIs with chrome privileges
|
/* Adds support for data: URIs with chrome privileges
|
||||||
* and fragment identifiers.
|
* and fragment identifiers.
|
||||||
*
|
*
|
||||||
@@ -334,6 +332,4 @@ else
|
|||||||
var NSGetModule = XPCOMUtils.generateNSGetModule([ChromeData, Dactyl, Shim]);
|
var NSGetModule = XPCOMUtils.generateNSGetModule([ChromeData, Dactyl, Shim]);
|
||||||
var EXPORTED_SYMBOLS = ["NSGetFactory", "global"];
|
var EXPORTED_SYMBOLS = ["NSGetFactory", "global"];
|
||||||
|
|
||||||
} catch (e) { reportError(e) }
|
|
||||||
|
|
||||||
// vim: set fdm=marker sw=4 ts=4 et:
|
// vim: set fdm=marker sw=4 ts=4 et:
|
||||||
|
|||||||
@@ -1064,12 +1064,13 @@ var CommandLine = Module("commandline", {
|
|||||||
|
|
||||||
let key = events.toString(event);
|
let key = events.toString(event);
|
||||||
|
|
||||||
|
function openLink(where) {
|
||||||
|
event.preventDefault();
|
||||||
|
dactyl.open(event.target.href, where);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: Wouldn't multiple handlers be cleaner? --djk
|
// TODO: Wouldn't multiple handlers be cleaner? --djk
|
||||||
if (event.type == "click" && event.target instanceof HTMLAnchorElement) {
|
if (event.type == "click" && event.target instanceof HTMLAnchorElement) {
|
||||||
function openLink(where) {
|
|
||||||
event.preventDefault();
|
|
||||||
dactyl.open(event.target.href, where);
|
|
||||||
}
|
|
||||||
|
|
||||||
let command = event.originalTarget.getAttributeNS(NS.uri, "command");
|
let command = event.originalTarget.getAttributeNS(NS.uri, "command");
|
||||||
if (command && dactyl.commands[command]) {
|
if (command && dactyl.commands[command]) {
|
||||||
@@ -1494,7 +1495,7 @@ var CommandLine = Module("commandline", {
|
|||||||
try {
|
try {
|
||||||
this.waiting = true;
|
this.waiting = true;
|
||||||
for (let [, context] in Iterator(list)) {
|
for (let [, context] in Iterator(list)) {
|
||||||
function done() !(idx >= n + context.items.length || idx == -2 && !context.items.length);
|
let done = function done() !(idx >= n + context.items.length || idx == -2 && !context.items.length);
|
||||||
while (context.incomplete && !done())
|
while (context.incomplete && !done())
|
||||||
util.threadYield(false, true);
|
util.threadYield(false, true);
|
||||||
|
|
||||||
|
|||||||
@@ -320,11 +320,11 @@ var Command = Class("Command", {
|
|||||||
let process = util.identity;
|
let process = util.identity;
|
||||||
|
|
||||||
if (callable(params))
|
if (callable(params))
|
||||||
function makeParams(self, args)
|
var makeParams = function makeParams(self, args)
|
||||||
iter.toObject([k, process(v)]
|
iter.toObject([k, process(v)]
|
||||||
for ([k, v] in iter(params.apply(self, args))))
|
for ([k, v] in iter(params.apply(self, args))))
|
||||||
else if (params)
|
else if (params)
|
||||||
function makeParams(self, args)
|
makeParams = function makeParams(self, args)
|
||||||
iter.toObject([name, process(args[i])]
|
iter.toObject([name, process(args[i])]
|
||||||
for ([i, name] in Iterator(params)));
|
for ([i, name] in Iterator(params)));
|
||||||
|
|
||||||
@@ -749,25 +749,26 @@ var Commands = Module("commands", {
|
|||||||
* @returns {Args}
|
* @returns {Args}
|
||||||
*/
|
*/
|
||||||
parseArgs: function (str, params) {
|
parseArgs: function (str, params) {
|
||||||
try {
|
function getNextArg(str, _keepQuotes) {
|
||||||
function getNextArg(str, _keepQuotes) {
|
if (arguments.length < 2)
|
||||||
if (arguments.length < 2)
|
_keepQuotes = keepQuotes;
|
||||||
_keepQuotes = keepQuotes;
|
|
||||||
|
|
||||||
if (str.substr(0, 2) === "<<" && hereDoc) {
|
if (str.substr(0, 2) === "<<" && hereDoc) {
|
||||||
let arg = /^<<(\S*)/.exec(str)[1];
|
let arg = /^<<(\S*)/.exec(str)[1];
|
||||||
let count = arg.length + 2;
|
let count = arg.length + 2;
|
||||||
if (complete)
|
if (complete)
|
||||||
return [count, "", ""];
|
return [count, "", ""];
|
||||||
return [count, io.readHeredoc(arg), ""];
|
return [count, io.readHeredoc(arg), ""];
|
||||||
}
|
|
||||||
let [count, arg, quote] = Commands.parseArg(str, null, _keepQuotes);
|
|
||||||
if (quote == "\\" && !complete)
|
|
||||||
return [, , , "Trailing \\"];
|
|
||||||
if (quote && !complete)
|
|
||||||
return [, , , "E114: Missing quote: " + quote];
|
|
||||||
return [count, arg, quote];
|
|
||||||
}
|
}
|
||||||
|
let [count, arg, quote] = Commands.parseArg(str, null, _keepQuotes);
|
||||||
|
if (quote == "\\" && !complete)
|
||||||
|
return [, , , "Trailing \\"];
|
||||||
|
if (quote && !complete)
|
||||||
|
return [, , , "E114: Missing quote: " + quote];
|
||||||
|
return [count, arg, quote];
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
var { allowUnknownOptions, argCount, complete, extra, hereDoc, literal, options, keepQuotes } = params || {};
|
var { allowUnknownOptions, argCount, complete, extra, hereDoc, literal, options, keepQuotes } = params || {};
|
||||||
|
|
||||||
@@ -793,12 +794,12 @@ var Commands = Module("commands", {
|
|||||||
var completeOpts;
|
var completeOpts;
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
function matchOpts(arg) {
|
let matchOpts = function matchOpts(arg) {
|
||||||
// Push possible option matches into completions
|
// Push possible option matches into completions
|
||||||
if (complete && !onlyArgumentsRemaining)
|
if (complete && !onlyArgumentsRemaining)
|
||||||
completeOpts = options.filter(function (opt) opt.multiple || !set.has(args, opt.names[0]));
|
completeOpts = options.filter(function (opt) opt.multiple || !set.has(args, opt.names[0]));
|
||||||
}
|
}
|
||||||
function resetCompletions() {
|
let resetCompletions = function resetCompletions() {
|
||||||
completeOpts = null;
|
completeOpts = null;
|
||||||
args.completeArg = null;
|
args.completeArg = null;
|
||||||
args.completeOpt = null;
|
args.completeOpt = null;
|
||||||
@@ -812,7 +813,7 @@ var Commands = Module("commands", {
|
|||||||
args.completeArg = 0;
|
args.completeArg = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fail(error) {
|
let fail = function fail(error) {
|
||||||
if (complete)
|
if (complete)
|
||||||
complete.message = error;
|
complete.message = error;
|
||||||
else
|
else
|
||||||
@@ -1328,7 +1329,7 @@ var Commands = Module("commands", {
|
|||||||
dactyl.echoerr("E174: Command already exists: add ! to replace it");
|
dactyl.echoerr("E174: Command already exists: add ! to replace it");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
function completerToString(completer) {
|
let completerToString = function completerToString(completer) {
|
||||||
if (completer)
|
if (completer)
|
||||||
return [k for ([k, v] in Iterator(completerMap)) if (completer == completion.closure[v])][0] || "custom";
|
return [k for ([k, v] in Iterator(completerMap)) if (completer == completion.closure[v])][0] || "custom";
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
@@ -534,6 +534,29 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
* Initialize the help system.
|
* Initialize the help system.
|
||||||
*/
|
*/
|
||||||
initHelp: function (force) {
|
initHelp: function (force) {
|
||||||
|
// Find help and overlay files with the given name.
|
||||||
|
function findHelpFile(file) {
|
||||||
|
let result = [];
|
||||||
|
for (let [, namespace] in Iterator(namespaces)) {
|
||||||
|
let url = ["dactyl://", namespace, "/", file, ".xml"].join("");
|
||||||
|
let res = util.httpGet(url);
|
||||||
|
if (res) {
|
||||||
|
if (res.responseXML.documentElement.localName == "document")
|
||||||
|
fileMap[file] = url;
|
||||||
|
if (res.responseXML.documentElement.localName == "overlay")
|
||||||
|
overlayMap[file] = url;
|
||||||
|
result.push(res.responseXML);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
// Find the tags in the document.
|
||||||
|
function addTags(file, doc) {
|
||||||
|
for (let elem in util.evaluateXPath("//@tag|//dactyl:tags/text()|//dactyl:tag/text()", doc))
|
||||||
|
for (let tag in values((elem.value || elem.textContent).split(/\s+/)))
|
||||||
|
tagMap[tag] = file;
|
||||||
|
}
|
||||||
|
|
||||||
if (!force && !this.helpInitialized) {
|
if (!force && !this.helpInitialized) {
|
||||||
if ("noscriptOverlay" in window) {
|
if ("noscriptOverlay" in window) {
|
||||||
noscriptOverlay.safeAllow("chrome-data:", true, false);
|
noscriptOverlay.safeAllow("chrome-data:", true, false);
|
||||||
@@ -547,29 +570,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
let fileMap = services["dactyl:"].FILE_MAP;
|
let fileMap = services["dactyl:"].FILE_MAP;
|
||||||
let overlayMap = services["dactyl:"].OVERLAY_MAP;
|
let overlayMap = services["dactyl:"].OVERLAY_MAP;
|
||||||
|
|
||||||
// Find help and overlay files with the given name.
|
|
||||||
function findHelpFile(file) {
|
|
||||||
let result = [];
|
|
||||||
for (let [, namespace] in Iterator(namespaces)) {
|
|
||||||
let url = ["dactyl://", namespace, "/", file, ".xml"].join("");
|
|
||||||
let res = util.httpGet(url);
|
|
||||||
if (res) {
|
|
||||||
if (res.responseXML.documentElement.localName == "document")
|
|
||||||
fileMap[file] = url;
|
|
||||||
if (res.responseXML.documentElement.localName == "overlay")
|
|
||||||
overlayMap[file] = url;
|
|
||||||
result.push(res.responseXML);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
// Find the tags in the document.
|
|
||||||
function addTags(file, doc) {
|
|
||||||
for (let elem in util.evaluateXPath("//@tag|//dactyl:tags/text()|//dactyl:tag/text()", doc))
|
|
||||||
for (let tag in values((elem.value || elem.textContent).split(/\s+/)))
|
|
||||||
tagMap[tag] = file;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scrape the list of help files from all.xml
|
// Scrape the list of help files from all.xml
|
||||||
// Manually process main and overlay files, since XSLTProcessor and
|
// Manually process main and overlay files, since XSLTProcessor and
|
||||||
// XMLHttpRequest don't allow access to chrome documents.
|
// XMLHttpRequest don't allow access to chrome documents.
|
||||||
@@ -658,21 +658,71 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
|
|
||||||
dactyl.initHelp();
|
dactyl.initHelp();
|
||||||
if (FILE.isDirectory()) {
|
if (FILE.isDirectory()) {
|
||||||
function addDataEntry(file, data) FILE.child(file).write(data);
|
var addDataEntry = function addDataEntry(file, data) FILE.child(file).write(data);
|
||||||
function addURIEntry(file, uri) addDataEntry(file, util.httpGet(uri).responseText);
|
var addURIEntry = function addURIEntry(file, uri) addDataEntry(file, util.httpGet(uri).responseText);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var zip = services.ZipWriter();
|
var zip = services.ZipWriter();
|
||||||
zip.open(FILE, File.MODE_CREATE | File.MODE_WRONLY | File.MODE_TRUNCATE);
|
zip.open(FILE, File.MODE_CREATE | File.MODE_WRONLY | File.MODE_TRUNCATE);
|
||||||
function addURIEntry(file, uri)
|
|
||||||
|
addURIEntry = function addURIEntry(file, uri)
|
||||||
zip.addEntryChannel(PATH + file, TIME, 9,
|
zip.addEntryChannel(PATH + file, TIME, 9,
|
||||||
services.io.newChannel(uri, null, null), false);
|
services.io.newChannel(uri, null, null), false);
|
||||||
function addDataEntry(file, data) // Unideal to an extreme.
|
addDataEntry = function addDataEntry(file, data) // Unideal to an extreme.
|
||||||
addURIEntry(file, "data:text/plain;charset=UTF-8," + encodeURI(data));
|
addURIEntry(file, "data:text/plain;charset=UTF-8," + encodeURI(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
let empty = set("area base basefont br col frame hr img input isindex link meta param"
|
let empty = set("area base basefont br col frame hr img input isindex link meta param"
|
||||||
.split(" "));
|
.split(" "));
|
||||||
|
function fix(node) {
|
||||||
|
switch(node.nodeType) {
|
||||||
|
case Node.ELEMENT_NODE:
|
||||||
|
if (isinstance(node, [HTMLBaseElement]))
|
||||||
|
return;
|
||||||
|
|
||||||
|
data.push("<"); data.push(node.localName);
|
||||||
|
if (node instanceof HTMLHtmlElement)
|
||||||
|
data.push(" xmlns=" + XHTML.uri.quote());
|
||||||
|
|
||||||
|
for (let { name, value } in array.iterValues(node.attributes)) {
|
||||||
|
if (name == "dactyl:highlight") {
|
||||||
|
set.add(styles, value);
|
||||||
|
name = "class";
|
||||||
|
value = "hl-" + value;
|
||||||
|
}
|
||||||
|
if (name == "href") {
|
||||||
|
value = node.href;
|
||||||
|
if (value.indexOf("dactyl://help-tag/") == 0) {
|
||||||
|
let uri = services.io.newChannel(value, null, null).originalURI;
|
||||||
|
value = uri.spec == value ? "javascript:;" : uri.path.substr(1);
|
||||||
|
}
|
||||||
|
if (!/^#|[\/](#|$)|^[a-z]+:/.test(value))
|
||||||
|
value = value.replace(/(#|$)/, ".xhtml$1");
|
||||||
|
}
|
||||||
|
if (name == "src" && value.indexOf(":") > 0) {
|
||||||
|
chromeFiles[value] = value.replace(/.*\//, "");
|
||||||
|
value = value.replace(/.*\//, "");
|
||||||
|
}
|
||||||
|
data.push(" ");
|
||||||
|
data.push(name);
|
||||||
|
data.push('="');
|
||||||
|
data.push(<>{value}</>.toXMLString());
|
||||||
|
data.push('"');
|
||||||
|
}
|
||||||
|
if (node.localName in empty)
|
||||||
|
data.push(" />");
|
||||||
|
else {
|
||||||
|
data.push(">");
|
||||||
|
if (node instanceof HTMLHeadElement)
|
||||||
|
data.push(<link rel="stylesheet" type="text/css" href="help.css"/>.toXMLString());
|
||||||
|
Array.map(node.childNodes, fix);
|
||||||
|
data.push("</"); data.push(node.localName); data.push(">");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case Node.TEXT_NODE:
|
||||||
|
data.push(<>{node.textContent}</>.toXMLString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let chromeFiles = {};
|
let chromeFiles = {};
|
||||||
let styles = {};
|
let styles = {};
|
||||||
@@ -684,55 +734,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n',
|
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n',
|
||||||
' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n'
|
' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n'
|
||||||
];
|
];
|
||||||
function fix(node) {
|
|
||||||
switch(node.nodeType) {
|
|
||||||
case Node.ELEMENT_NODE:
|
|
||||||
if (isinstance(node, [HTMLBaseElement]))
|
|
||||||
return;
|
|
||||||
|
|
||||||
data.push("<"); data.push(node.localName);
|
|
||||||
if (node instanceof HTMLHtmlElement)
|
|
||||||
data.push(" xmlns=" + XHTML.uri.quote());
|
|
||||||
|
|
||||||
for (let { name, value } in array.iterValues(node.attributes)) {
|
|
||||||
if (name == "dactyl:highlight") {
|
|
||||||
set.add(styles, value);
|
|
||||||
name = "class";
|
|
||||||
value = "hl-" + value;
|
|
||||||
}
|
|
||||||
if (name == "href") {
|
|
||||||
value = node.href;
|
|
||||||
if (value.indexOf("dactyl://help-tag/") == 0) {
|
|
||||||
let uri = services.io.newChannel(value, null, null).originalURI;
|
|
||||||
value = uri.spec == value ? "javascript:;" : uri.path.substr(1);
|
|
||||||
}
|
|
||||||
if (!/^#|[\/](#|$)|^[a-z]+:/.test(value))
|
|
||||||
value = value.replace(/(#|$)/, ".xhtml$1");
|
|
||||||
}
|
|
||||||
if (name == "src" && value.indexOf(":") > 0) {
|
|
||||||
chromeFiles[value] = value.replace(/.*\//, "");
|
|
||||||
value = value.replace(/.*\//, "");
|
|
||||||
}
|
|
||||||
data.push(" ");
|
|
||||||
data.push(name);
|
|
||||||
data.push('="');
|
|
||||||
data.push(<>{value}</>.toXMLString());
|
|
||||||
data.push('"');
|
|
||||||
}
|
|
||||||
if (node.localName in empty)
|
|
||||||
data.push(" />");
|
|
||||||
else {
|
|
||||||
data.push(">");
|
|
||||||
if (node instanceof HTMLHeadElement)
|
|
||||||
data.push(<link rel="stylesheet" type="text/css" href="help.css"/>.toXMLString());
|
|
||||||
Array.map(node.childNodes, fix);
|
|
||||||
data.push("</"); data.push(node.localName); data.push(">");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Node.TEXT_NODE:
|
|
||||||
data.push(<>{node.textContent}</>.toXMLString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fix(content.document.documentElement);
|
fix(content.document.documentElement);
|
||||||
addDataEntry(file + ".xhtml", data.join(""));
|
addDataEntry(file + ".xhtml", data.join(""));
|
||||||
}
|
}
|
||||||
@@ -1893,12 +1894,12 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
"Force " + config.appName + " to restart",
|
"Force " + config.appName + " to restart",
|
||||||
function () { dactyl.restart(); });
|
function () { dactyl.restart(); });
|
||||||
|
|
||||||
|
function findToolbar(name) util.evaluateXPath(
|
||||||
|
"./*[@toolbarname=" + util.escapeString(name, "'") + "]",
|
||||||
|
document, toolbox).snapshotItem(0);
|
||||||
|
|
||||||
var toolbox = document.getElementById("navigator-toolbox");
|
var toolbox = document.getElementById("navigator-toolbox");
|
||||||
if (toolbox) {
|
if (toolbox) {
|
||||||
function findToolbar(name) util.evaluateXPath(
|
|
||||||
"./*[@toolbarname=" + util.escapeString(name, "'") + "]",
|
|
||||||
document, toolbox).snapshotItem(0);
|
|
||||||
|
|
||||||
let toolbarCommand = function (names, desc, action, filter) {
|
let toolbarCommand = function (names, desc, action, filter) {
|
||||||
commands.add(names, desc,
|
commands.add(names, desc,
|
||||||
function (args) {
|
function (args) {
|
||||||
|
|||||||
@@ -307,6 +307,21 @@ var Editor = Module("editor", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function update(force) {
|
||||||
|
if (force !== true && tmpfile.lastModifiedTime <= lastUpdate)
|
||||||
|
return;
|
||||||
|
lastUpdate = Date.now();
|
||||||
|
|
||||||
|
let val = tmpfile.read();
|
||||||
|
if (textBox)
|
||||||
|
textBox.value = val;
|
||||||
|
else {
|
||||||
|
while (editor.rootElement.firstChild)
|
||||||
|
editor.rootElement.removeChild(editor.rootElement.firstChild);
|
||||||
|
editor.rootElement.innerHTML = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var tmpfile = io.createTempFile();
|
var tmpfile = io.createTempFile();
|
||||||
if (!tmpfile)
|
if (!tmpfile)
|
||||||
@@ -322,20 +337,6 @@ var Editor = Module("editor", {
|
|||||||
"file encoding");
|
"file encoding");
|
||||||
|
|
||||||
let lastUpdate = Date.now();
|
let lastUpdate = Date.now();
|
||||||
function update(force) {
|
|
||||||
if (force !== true && tmpfile.lastModifiedTime <= lastUpdate)
|
|
||||||
return;
|
|
||||||
lastUpdate = Date.now();
|
|
||||||
|
|
||||||
let val = tmpfile.read();
|
|
||||||
if (textBox)
|
|
||||||
textBox.value = val;
|
|
||||||
else {
|
|
||||||
while (editor.rootElement.firstChild)
|
|
||||||
editor.rootElement.removeChild(editor.rootElement.firstChild);
|
|
||||||
editor.rootElement.innerHTML = val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var timer = services.Timer(update, 100, services.Timer.TYPE_REPEATING_SLACK);
|
var timer = services.Timer(update, 100, services.Timer.TYPE_REPEATING_SLACK);
|
||||||
this.editFileExternally({ file: tmpfile.path, line: line, column: column }, cleanup);
|
this.editFileExternally({ file: tmpfile.path, line: line, column: column }, cleanup);
|
||||||
|
|||||||
@@ -899,15 +899,15 @@ var Events = Module("events", {
|
|||||||
return killEvent();
|
return killEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function shouldPass()
|
||||||
|
(!dactyl.focusedElement || events.isContentNode(dactyl.focusedElement)) &&
|
||||||
|
options.get("passkeys").has(events.toString(event));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let mode = modes.getStack(0);
|
let mode = modes.getStack(0);
|
||||||
if (event.dactylMode)
|
if (event.dactylMode)
|
||||||
mode = Modes.StackElement(event.dactylMode);
|
mode = Modes.StackElement(event.dactylMode);
|
||||||
|
|
||||||
function shouldPass()
|
|
||||||
(!dactyl.focusedElement || events.isContentNode(dactyl.focusedElement)) &&
|
|
||||||
options.get("passkeys").has(events.toString(event));
|
|
||||||
|
|
||||||
let input = this._input;
|
let input = this._input;
|
||||||
this._input = null;
|
this._input = null;
|
||||||
if (!input) {
|
if (!input) {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ var Tabs = Module("tabs", {
|
|||||||
|
|
||||||
cleanup: function cleanup() {
|
cleanup: function cleanup() {
|
||||||
for (let [i, tab] in Iterator(this.allTabs)) {
|
for (let [i, tab] in Iterator(this.allTabs)) {
|
||||||
function node(clas) document.getAnonymousElementByAttribute(tab, "class", clas);
|
let node = function node(clas) document.getAnonymousElementByAttribute(tab, "class", clas);
|
||||||
for (let elem in values(["dactyl-tab-icon-number", "dactyl-tab-number"].map(node)))
|
for (let elem in values(["dactyl-tab-icon-number", "dactyl-tab-number"].map(node)))
|
||||||
if (elem)
|
if (elem)
|
||||||
elem.parentNode.parentNode.removeChild(elem.parentNode);
|
elem.parentNode.parentNode.removeChild(elem.parentNode);
|
||||||
@@ -53,7 +53,7 @@ var Tabs = Module("tabs", {
|
|||||||
updateTabCount: function () {
|
updateTabCount: function () {
|
||||||
for (let [i, tab] in Iterator(this.visibleTabs)) {
|
for (let [i, tab] in Iterator(this.visibleTabs)) {
|
||||||
if (dactyl.has("Gecko2")) {
|
if (dactyl.has("Gecko2")) {
|
||||||
function node(clas) document.getAnonymousElementByAttribute(tab, "class", clas);
|
let node = function node(clas) document.getAnonymousElementByAttribute(tab, "class", clas);
|
||||||
if (!node("dactyl-tab-number")) {
|
if (!node("dactyl-tab-number")) {
|
||||||
let nodes = {};
|
let nodes = {};
|
||||||
let dom = util.xmlToDom(<xul xmlns:xul={XUL} xmlns:html={XHTML}
|
let dom = util.xmlToDom(<xul xmlns:xul={XUL} xmlns:html={XHTML}
|
||||||
|
|||||||
@@ -309,15 +309,15 @@ var Styles = Module("Styles", {
|
|||||||
*/
|
*/
|
||||||
matchFilter: function (filter) {
|
matchFilter: function (filter) {
|
||||||
if (filter === "*")
|
if (filter === "*")
|
||||||
function test(uri) true;
|
var test = function test(uri) true;
|
||||||
else if (/[*]$/.test(filter)) {
|
else if (/[*]$/.test(filter)) {
|
||||||
let re = RegExp("^" + util.regexp.escape(filter.substr(0, filter.length - 1)));
|
let re = RegExp("^" + util.regexp.escape(filter.substr(0, filter.length - 1)));
|
||||||
function test(uri) re.test(uri.spec);
|
test = function test(uri) re.test(uri.spec);
|
||||||
}
|
}
|
||||||
else if (/[\/:]/.test(filter))
|
else if (/[\/:]/.test(filter))
|
||||||
function test(uri) uri.spec === filter;
|
test = function test(uri) uri.spec === filter;
|
||||||
else
|
else
|
||||||
function test(uri) { try { return util.isSubdomain(uri.host, filter); } catch (e) { return false; } };
|
test = function test(uri) { try { return util.isSubdomain(uri.host, filter); } catch (e) { return false; } };
|
||||||
test.toString = function toString() filter;
|
test.toString = function toString() filter;
|
||||||
if (arguments.length < 2)
|
if (arguments.length < 2)
|
||||||
return test;
|
return test;
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ memoize(this, "Commands", function () {
|
|||||||
var FailedAssertion = Class("FailedAssertion", ErrorBase);
|
var FailedAssertion = Class("FailedAssertion", ErrorBase);
|
||||||
var Point = Struct("x", "y");
|
var Point = Struct("x", "y");
|
||||||
|
|
||||||
function wrapCallback(fn)
|
var wrapCallback = function wrapCallback(fn)
|
||||||
fn.wrapper = function wrappedCallback () {
|
fn.wrapper = (function wrappedCallback () {
|
||||||
try {
|
try {
|
||||||
return fn.apply(this, arguments);
|
return fn.apply(this, arguments);
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ function wrapCallback(fn)
|
|||||||
util.reportError(e);
|
util.reportError(e);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
|
||||||
var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), {
|
var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), {
|
||||||
init: function () {
|
init: function () {
|
||||||
@@ -820,6 +820,15 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
if (!isObject(object))
|
if (!isObject(object))
|
||||||
return String(object);
|
return String(object);
|
||||||
|
|
||||||
|
function namespaced(node) {
|
||||||
|
var ns = NAMESPACES[node.namespaceURI] || /^(?:(.*?):)?/.exec(node.name)[0];
|
||||||
|
if (!ns)
|
||||||
|
return node.localName;
|
||||||
|
if (color)
|
||||||
|
return <><span highlight="HelpXMLNamespace">{ns}</span>{node.localName}</>
|
||||||
|
return ns + ":" + node.localName;
|
||||||
|
}
|
||||||
|
|
||||||
if (object instanceof Ci.nsIDOMElement) {
|
if (object instanceof Ci.nsIDOMElement) {
|
||||||
const NAMESPACES = array.toObject([
|
const NAMESPACES = array.toObject([
|
||||||
[NS, "dactyl"],
|
[NS, "dactyl"],
|
||||||
@@ -830,14 +839,6 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
if (elem.nodeType == elem.TEXT_NODE)
|
if (elem.nodeType == elem.TEXT_NODE)
|
||||||
return elem.data;
|
return elem.data;
|
||||||
|
|
||||||
function namespaced(node) {
|
|
||||||
var ns = NAMESPACES[node.namespaceURI] || /^(?:(.*?):)?/.exec(node.name)[0];
|
|
||||||
if (!ns)
|
|
||||||
return node.localName;
|
|
||||||
if (color)
|
|
||||||
return <><span highlight="HelpXMLNamespace">{ns}</span>{node.localName}</>
|
|
||||||
return ns + ":" + node.localName;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
let hasChildren = elem.firstChild && (!/^\s*$/.test(elem.firstChild) || elem.firstChild.nextSibling)
|
let hasChildren = elem.firstChild && (!/^\s*$/.test(elem.firstChild) || elem.firstChild.nextSibling)
|
||||||
if (color)
|
if (color)
|
||||||
|
|||||||
Reference in New Issue
Block a user