1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-04-07 22:03:32 +02:00

Death to E4X and stuff.

This commit is contained in:
Kris Maglione
2012-11-30 19:41:56 -08:00
parent 81b41176b6
commit 9305f1a6a4
3 changed files with 63 additions and 57 deletions

View File

@@ -1234,7 +1234,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
// Process plugin help entries. // Process plugin help entries.
XML.ignoreWhiteSpace = XML.prettyPrinting = false; XML.ignoreWhiteSpace = XML.prettyPrinting = false;
let body = XML(); let body = [];
for (let [, context] in Iterator(plugins.contexts)) for (let [, context] in Iterator(plugins.contexts))
try { try {
let info = contexts.getDocs(context); let info = contexts.getDocs(context);
@@ -1249,8 +1249,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
if (elem[attr].length()) if (elem[attr].length())
info[attr] = elem[attr]; info[attr] = elem[attr];
} }
body += <h2 xmlns={NS.uri} tag={info.@name + '-plugin'}>{info.@summary}</h2> + body.push(["h2", { xmlns: NS.uri, tag: info.@name + '-plugin' },
info; String(info.@summary)]);
body.push(info);
} }
} }
catch (e) { catch (e) {
@@ -1259,55 +1260,47 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
return '<?xml version="1.0"?>\n' + return '<?xml version="1.0"?>\n' +
'<?xml-stylesheet type="text/xsl" href="dactyl://content/help.xsl"?>\n' + '<?xml-stylesheet type="text/xsl" href="dactyl://content/help.xsl"?>\n' +
<document xmlns={NS} DOM.toXML(
name="plugins" title={config.appName + " Plugins"}> ["document", { xmlns: "dactyl", name: "plugins",
<h1 tag="using-plugins">{_("help.title.Using Plugins")}</h1> title: config.appName + ", Plugins" },
<toc start="2"/> ["h1", { tag: "using-plugins" }, _("help.title.Using Plugins")],
["toc", { start: "2" }],
{body} body]);
</document>.toXMLString();
}); });
cache.register("help/index.xml", function () { cache.register("help/index.xml", function () {
default xml namespace = NS;
return '<?xml version="1.0"?>\n' + return '<?xml version="1.0"?>\n' +
<overlay xmlns={NS}>{ DOM.toXML(["overlay", { xmlns: "dactyl" },
template.map(dactyl.indices, function ([name, iter]) template_.map(dactyl.indices, function ([name, iter])
<dl insertafter={name + "-index"}>{ ["dl", { insertafter: name + "-index" },
template.map(iter(), util.identity) template_.map(iter(), util.identity)],
}</dl>, <>{"\n\n"}</>) "\n\n")]);
}</overlay>;
}); });
cache.register("help/gui.xml", function () { cache.register("help/gui.xml", function () {
default xml namespace = NS;
return '<?xml version="1.0"?>\n' + return '<?xml version="1.0"?>\n' +
<overlay xmlns={NS}> DOM.toXML(["overlay", { xmlns: "dactyl" },
<dl insertafter="dialog-list">{ ["dl", { insertafter: "dialog-list" },
template.map(config.dialogs, function ([name, val]) template_.map(config.dialogs, function ([name, val])
(!val[2] || val[2]()) (!val[2] || val[2]())
? <><dt>{name}</dt><dd>{val[0]}</dd></> ? [["dt", {}, name],
: undefined, ["dd", {}, val[0]]]
<>{"\n"}</>) : undefined,
}</dl> "\n")]]);
</overlay>;
}); });
cache.register("help/privacy.xml", function () { cache.register("help/privacy.xml", function () {
default xml namespace = NS;
return '<?xml version="1.0"?>\n' + return '<?xml version="1.0"?>\n' +
<overlay xmlns={NS}> DOM.toXML(["overlay", { xmlns: "dactyl" },
<dl insertafter="sanitize-items">{ ["dl", { insertafter: "sanitize-items" },
template.map(options.get("sanitizeitems").values template_.map(options.get("sanitizeitems").values
.sort(function (a, b) String.localeCompare(a.name, b.name)), .sort(function (a, b) String.localeCompare(a.name,
function ({ name, description }) b.name)),
<><dt>{name}</dt><dd>{template.linkifyHelp(description, true)}</dd></>, function ({ name, description })
<>{"\n"}</>) [["dt", {}, name],
}</dl> ["dd", {}, template.linkifyHelp(description, true)]],
</overlay>; "\n")]]);
}); });
}, },
events: function initEvents() { events: function initEvents() {
@@ -1747,14 +1740,24 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
totalUnits = "msec"; totalUnits = "msec";
commandline.commandOutput( commandline.commandOutput(
<table> ["table", {}
<tr highlight="Title" align="left"> ["tr", { highlight: "Title", align: "left" },
<th colspan="3">{_("title.Code execution summary")}</th> ["th", { colspan: "3" }, _("title.Code execution summary")]],
</tr> ["tr", {},
<tr><td>&#xa0;&#xa0;{_("title.Executed")}:</td><td align="right"><span class="times-executed">{count}</span></td><td><!--L-->times</td></tr> ["td", {}, _("title.Executed"), ":"],
<tr><td>&#xa0;&#xa0;{_("title.Average time")}:</td><td align="right"><span class="time-average">{each.toFixed(2)}</span></td><td>{eachUnits}</td></tr> ["td", { align: "right" },
<tr><td>&#xa0;&#xa0;{_("title.Total time")}:</td><td align="right"><span class="time-total">{total.toFixed(2)}</span></td><td>{totalUnits}</td></tr> ["span", { class: "times-executed" }, count]],
</table>); ["td", {}, /*L*/"times"]],
["tr", {},
["td", {}, _("title.Average time"), ":"],
["td", { align: "right" },
["span", { class: "time-average" }, each.toFixed(2)]],
["td", {}, eachUnits]],
["tr", {},
["td", {}, _("title.Total time"), ":"],
["td", { align: "right" },
["span", { class: "time-total" }, total.toFixed(2)]],
["td", {}, totalUnits]]]);
} }
else { else {
let beforeTime = Date.now(); let beforeTime = Date.now();
@@ -1822,9 +1825,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
let date = config.buildDate; let date = config.buildDate;
date = date ? " (" + date + ")" : ""; date = date ? " (" + date + ")" : "";
commandline.commandOutput( commandline.commandOutput([
<div>{config.appName} {config.version}{date} running on: </div> + ["div", {}, [config.appName, " ", config.version, date, " running on: "].join("")],
<div>{navigator.userAgent}</div>) ["div", {}, [navigator.userAgent].join("")]
])
} }
}, { }, {
argCount: "0", argCount: "0",

View File

@@ -4,7 +4,7 @@
// //
// This work is licensed for reuse under an MIT license. Details are // This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file. // given in the LICENSE.txt file included with this file.
/* use strict */ "use strict";
let global = this; let global = this;
defineModule("config", { defineModule("config", {
@@ -592,12 +592,14 @@ config.INIT = update(Object.create(config.INIT), config.INIT, {
let img = window.Image(); let img = window.Image();
img.src = this.logo || "resource://dactyl-local-content/logo.png"; img.src = this.logo || "resource://dactyl-local-content/logo.png";
img.onload = util.wrapCallback(function () { img.onload = util.wrapCallback(function () {
highlight.loadCSS(<>{"!Logo {"} highlight.loadCSS(literal(/*
!Logo {
display: inline-block; display: inline-block;
background: url({img.src}); background: url({src});
width: {img.width}px; width: {width}px;
height: {img.height}px; height: {height}px;
{"}"}</>); }
*/).replace(/\{(.*?)\}/g, function (m, m1) img[m1]));
img = null; img = null;
}); });
}, },

View File

@@ -1561,7 +1561,7 @@ var DOM = Class("DOM", {
function tag(args, namespaces) { function tag(args, namespaces) {
let _namespaces = namespaces; let _namespaces = namespaces;
if (isinstance(args, ["String", _])) if (isinstance(args, ["String", "Number", _]))
return doc.createTextNode(args); return doc.createTextNode(args);
if (isXML(args)) if (isXML(args))
return DOM.fromXML(args, doc, nodes); return DOM.fromXML(args, doc, nodes);