mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-14 20:03:32 +01:00
Death to E4X and stuff.
This commit is contained in:
@@ -111,7 +111,7 @@ var AutoCommands = Module("autocommands", {
|
|||||||
["tr", {},
|
["tr", {},
|
||||||
["td", { colspan: "3" },
|
["td", { colspan: "3" },
|
||||||
["span", { highlight: "Title" }, hive.name],
|
["span", { highlight: "Title" }, hive.name],
|
||||||
" ", /* E4X-FIXME: Filter is formatted E4X. */ String(hive.filter)]],
|
" ", hive.filter.toJSONXML(modules)]],
|
||||||
["tr", { style: "height: .5ex;" }],
|
["tr", { style: "height: .5ex;" }],
|
||||||
iter(cmds(hive)).map(function ([event, items]) [
|
iter(cmds(hive)).map(function ([event, items]) [
|
||||||
["tr", { style: "height: .5ex;" }],
|
["tr", { style: "height: .5ex;" }],
|
||||||
@@ -119,8 +119,7 @@ var AutoCommands = Module("autocommands", {
|
|||||||
["tr", {},
|
["tr", {},
|
||||||
["td", { highlight: "Title", style: "padding-left: 1em; padding-right: 1em;" },
|
["td", { highlight: "Title", style: "padding-left: 1em; padding-right: 1em;" },
|
||||||
i == 0 ? event : ""],
|
i == 0 ? event : ""],
|
||||||
// E4X-FIXME: ["td", {}, item.filter.toXML ? item.filter.toXML() : String(item.filter)],
|
["td", {}, item.filter.toJSONXML ? item.filter.toJSONXML(modules) : String(item.filter)],
|
||||||
["td", {}, String(item.filter)],
|
|
||||||
["td", {}, String(item.command)]]),
|
["td", {}, String(item.command)]]),
|
||||||
["tr", { style: "height: .5ex;" }]]).toArray(),
|
["tr", { style: "height: .5ex;" }]]).toArray(),
|
||||||
["tr", { style: "height: .5ex;" }],
|
["tr", { style: "height: .5ex;" }],
|
||||||
|
|||||||
@@ -1294,7 +1294,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
b.name)),
|
b.name)),
|
||||||
function ({ name, description })
|
function ({ name, description })
|
||||||
[["dt", {}, name],
|
[["dt", {}, name],
|
||||||
["dd", {}, template.linkifyHelp(description, true)]],
|
["dd", {}, template_.linkifyHelp(description, true)]],
|
||||||
"\n")]]);
|
"\n")]]);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ lazyRequire("commands", ["ArgType", "CommandOption", "commands"]);
|
|||||||
lazyRequire("options", ["Option"]);
|
lazyRequire("options", ["Option"]);
|
||||||
lazyRequire("overlay", ["overlay"]);
|
lazyRequire("overlay", ["overlay"]);
|
||||||
lazyRequire("storage", ["File"]);
|
lazyRequire("storage", ["File"]);
|
||||||
lazyRequire("template", ["template"]);
|
lazyRequire("template", ["template", "template_"]);
|
||||||
|
|
||||||
var Const = function Const(val) Class.Property({ enumerable: true, value: val });
|
var Const = function Const(val) Class.Property({ enumerable: true, value: val });
|
||||||
|
|
||||||
@@ -78,10 +78,11 @@ var Group = Class("Group", {
|
|||||||
return update(siteFilter, {
|
return update(siteFilter, {
|
||||||
toString: function () this.filters.join(","),
|
toString: function () this.filters.join(","),
|
||||||
|
|
||||||
toXML: function (modules) let (uri = modules && modules.buffer.uri)
|
toJSONXML: function (modules) let (uri = modules && modules.buffer.uri)
|
||||||
template.map(this.filters,
|
template_.map(this.filters,
|
||||||
function (f) <span highlight={uri && f(uri) ? "Filter" : ""}>{f}</span>,
|
function (f) ["span", { highlight: uri && f(uri) ? "Filter" : "" },
|
||||||
<>,</>),
|
"toJSONXML" in f ? f.toJSONXML() : String(f)],
|
||||||
|
","),
|
||||||
|
|
||||||
filters: Option.parse.sitelist(patterns)
|
filters: Option.parse.sitelist(patterns)
|
||||||
});
|
});
|
||||||
@@ -668,12 +669,12 @@ var Contexts = Module("contexts", {
|
|||||||
{
|
{
|
||||||
names: ["-description", "-desc", "-d"],
|
names: ["-description", "-desc", "-d"],
|
||||||
description: "A description of this group",
|
description: "A description of this group",
|
||||||
default: ["User-defined group"],
|
default: "User-defined group",
|
||||||
type: CommandOption.STRING
|
type: CommandOption.STRING
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
names: ["-locations", "-locs", "-loc", "-l"],
|
names: ["-locations", "-locs", "-loc", "-l"],
|
||||||
description: ["The URLs for which this group should be active"],
|
description: "The URLs for which this group should be active",
|
||||||
default: ["*"],
|
default: ["*"],
|
||||||
type: CommandOption.LIST
|
type: CommandOption.LIST
|
||||||
},
|
},
|
||||||
@@ -799,7 +800,7 @@ var Contexts = Module("contexts", {
|
|||||||
context.keys = {
|
context.keys = {
|
||||||
active: function (group) group.filter(uri),
|
active: function (group) group.filter(uri),
|
||||||
text: "name",
|
text: "name",
|
||||||
description: function (g) <>{g.filter.toXML ? g.filter.toXML(modules) + <> </> : ""}{g.description || ""}</>
|
description: function (g) ["", g.filter.toJSONXML ? g.filter.toJSONXML(modules).concat("\u00a0") : "", g.description || ""]
|
||||||
};
|
};
|
||||||
context.completions = (active === undefined ? contexts.groupList : contexts.initializedGroups(active))
|
context.completions = (active === undefined ? contexts.groupList : contexts.initializedGroups(active))
|
||||||
.slice(0, -1);
|
.slice(0, -1);
|
||||||
|
|||||||
@@ -1570,6 +1570,8 @@ var DOM = Class("DOM", {
|
|||||||
return args.toDOM(doc, namespaces, nodes);
|
return args.toDOM(doc, namespaces, nodes);
|
||||||
if (args instanceof Ci.nsIDOMNode)
|
if (args instanceof Ci.nsIDOMNode)
|
||||||
return args;
|
return args;
|
||||||
|
if ("toJSONXML" in args)
|
||||||
|
args = args.toJSONXML();
|
||||||
|
|
||||||
let [name, attr] = args;
|
let [name, attr] = args;
|
||||||
|
|
||||||
@@ -1606,8 +1608,13 @@ var DOM = Class("DOM", {
|
|||||||
|
|
||||||
var args = Array.slice(args, 2);
|
var args = Array.slice(args, 2);
|
||||||
var vals = parseNamespace(name);
|
var vals = parseNamespace(name);
|
||||||
var elem = doc.createElementNS(vals[0] || namespaces[""],
|
try {
|
||||||
name);
|
var elem = doc.createElementNS(vals[0] || namespaces[""],
|
||||||
|
name);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
util.dump("FOO", vals[0] || namespaces[""], name);
|
||||||
|
}
|
||||||
|
|
||||||
for (var key in attr)
|
for (var key in attr)
|
||||||
if (!/^xmlns(?:$|:)/.test(key)) {
|
if (!/^xmlns(?:$|:)/.test(key)) {
|
||||||
@@ -1688,7 +1695,7 @@ var DOM = Class("DOM", {
|
|||||||
if (args == "")
|
if (args == "")
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
if (isinstance(args, ["String", "Number", _, DOM.DOMString]))
|
if (isinstance(args, ["String", "Number", "Boolean", _, DOM.DOMString]))
|
||||||
return indent +
|
return indent +
|
||||||
DOM.escapeHTML(String(args), true);
|
DOM.escapeHTML(String(args), true);
|
||||||
|
|
||||||
@@ -1709,6 +1716,15 @@ var DOM = Class("DOM", {
|
|||||||
.serializeToString(args)
|
.serializeToString(args)
|
||||||
.replace(/^/m, indent);
|
.replace(/^/m, indent);
|
||||||
|
|
||||||
|
if ("toJSONXML" in args)
|
||||||
|
args = args.toJSONXML();
|
||||||
|
|
||||||
|
// Deal with common error case
|
||||||
|
if (args == null) {
|
||||||
|
util.reportError(Error("Unexpected null when processing XML."));
|
||||||
|
return "[NULL]";
|
||||||
|
}
|
||||||
|
|
||||||
let [name, attr] = args;
|
let [name, attr] = args;
|
||||||
|
|
||||||
if (isFragment(args)) {
|
if (isFragment(args)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user