1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 05:54:11 +01:00

Death to E4X and stuff.

This commit is contained in:
Kris Maglione
2012-11-28 00:37:45 -08:00
parent b7fa2f904d
commit 8d1d33aeeb
3 changed files with 72 additions and 71 deletions

View File

@@ -451,21 +451,22 @@ var ConfigBase = Class("ConfigBase", {
init: function init() { init: function init() {
this.loadConfig(document.documentURI); this.loadConfig(document.documentURI);
let append = <e4x xmlns={XUL} xmlns:dactyl={NS}> let append = [
<menupopup id="viewSidebarMenu"/> ["menupopup", { id: "viewSidebarMenu", xmlns: "xul" }],
<broadcasterset id="mainBroadcasterSet"/> ["broadcasterset", { id: "mainBroadcasterSet", xmlns: "xul" }]];
</e4x>;
for each (let [id, [name, key, uri]] in Iterator(this.sidebars)) { for each (let [id, [name, key, uri]] in Iterator(this.sidebars)) {
append.XUL::menupopup[0].* += append[0].push(
<menuitem observes={"pentadactyl-" + id + "Sidebar"} label={name} accesskey={key} xmlns={XUL}/>; ["menuitem", { observes: "pentadactyl-" + id + "Sidebar", label: name,
append.XUL::broadcasterset[0].* += accesskey: key }]);
<broadcaster id={"pentadactyl-" + id + "Sidebar"} append[1].push(
autoCheck="false" type="checkbox" group="sidebar" ["broadcaster", { id: "pentadactyl-" + id + "Sidebar", autoCheck: "false",
sidebartitle={name} sidebarurl={uri} type: "checkbox", group: "sidebar", sidebartitle: name,
oncommand="toggleSidebar(this.id || this.observes);" xmlns={XUL}/>; sidebarurl: uri,
oncommand: "toggleSidebar(this.id || this.observes);" }]);
} }
util.overlayWindow(window, { append: append.elements() }); util.overlayWindow(window, { append: append });
}, },
get window() window, get window() window,

View File

@@ -2,7 +2,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";
defineModule("downloads", { defineModule("downloads", {
exports: ["Download", "Downloads", "downloads"], exports: ["Download", "Downloads", "downloads"],
@@ -28,35 +28,32 @@ var Download = Class("Download", {
this.nodes = { this.nodes = {
commandTarget: self commandTarget: self
}; };
XML.ignoreWhitespace = true; DOM.fromJSON(
XML.prettyPrinting = false; ["tr", { highlight: "Download", key: "row" },
util.xmlToDom( ["td", { highlight: "DownloadTitle" },
<tr highlight="Download" key="row" xmlns:dactyl={NS} xmlns={XHTML}> ["span", { highlight: "Link" },
<td highlight="DownloadTitle"> ["a", { key: "launch", href: self.target.spec, path: self.targetFile.path },
<span highlight="Link"> self.displayName],
<a key="launch" ["span", { highlight: "LinkInfo" },
href={self.target.spec} path={self.targetFile.path}>{self.displayName}</a> self.targetFile.path]]],
<span highlight="LinkInfo">{self.targetFile.path}</span> ["td", { highlight: "DownloadState", key: "state" }],
</span> ["td", { highlight: "DownloadButtons Buttons" },
</td> ["a", { highlight: "Button", href: "javascript:0", key: "pause" }, _("download.action.Pause")],
<td highlight="DownloadState" key="state"/> ["a", { highlight: "Button", href: "javascript:0", key: "remove" }, _("download.action.Remove")],
<td highlight="DownloadButtons Buttons"> ["a", { highlight: "Button", href: "javascript:0", key: "resume" }, _("download.action.Resume")],
<a highlight="Button" href="javascript:0" key="pause">{_("download.action.Pause")}</a> ["a", { highlight: "Button", href: "javascript:0", key: "retry" }, _("download.action.Retry")],
<a highlight="Button" href="javascript:0" key="remove">{_("download.action.Remove")}</a> ["a", { highlight: "Button", href: "javascript:0", key: "cancel" }, _("download.action.Cancel")],
<a highlight="Button" href="javascript:0" key="resume">{_("download.action.Resume")}</a> ["a", { highlight: "Button", href: "javascript:0", key: "delete" }, _("download.action.Delete")]],
<a highlight="Button" href="javascript:0" key="retry">{_("download.action.Retry")}</a> ["td", { highlight: "DownloadProgress", key: "progress" },
<a highlight="Button" href="javascript:0" key="cancel">{_("download.action.Cancel")}</a> ["span", { highlight: "DownloadProgressHave", key: "progressHave" }],
<a highlight="Button" href="javascript:0" key="delete">{_("download.action.Delete")}</a> "/",
</td> ["span", { highlight: "DownloadProgressTotal", key: "progressTotal" }]],,
<td highlight="DownloadProgress" key="progress"> ["td", { highlight: "DownloadPercent", key: "percent" }],
<span highlight="DownloadProgressHave" key="progressHave" ["td", { highlight: "DownloadSpeed", key: "speed" }],
/>/<span highlight="DownloadProgressTotal" key="progressTotal"/> ["td", { highlight: "DownloadTime", key: "time" }],
</td> ["td", {},
<td highlight="DownloadPercent" key="percent"/> ["a", { highlight: "DownloadSource", key: "source", href: self.source.spec },
<td highlight="DownloadSpeed" key="speed"/> self.source.spec]]],
<td highlight="DownloadTime" key="time"/>
<td><a highlight="DownloadSource" key="source" href={self.source.spec}>{self.source.spec}</a></td>
</tr>,
this.list.document, this.nodes); this.list.document, this.nodes);
this.nodes.launch.addEventListener("click", function (event) { this.nodes.launch.addEventListener("click", function (event) {
@@ -228,34 +225,37 @@ var DownloadList = Class("DownloadList",
XML.ignoreWhitespace = true; XML.ignoreWhitespace = true;
XML.prettyPrinting = false; XML.prettyPrinting = false;
util.xmlToDom(<table highlight="Downloads" key="list" xmlns={XHTML}> DOM.fromJSON(["table", { highlight: "Downloads", key: "list" },
<tr highlight="DownloadHead" key="head"> ["tr", { highlight: "DownloadHead", key: "head" },
<span>{_("title.Title")}</span> ["span", {}, _("title.Title")],
<span>{_("title.Status")}</span> ["span", {}, _("title.Status")],
<span/> ["span"],
<span>{_("title.Progress")}</span> ["span", {}, _("title.Progress")],
<span/> ["span"],
<span>{_("title.Speed")}</span> ["span", {}, _("title.Speed")],
<span>{_("title.Time remaining")}</span> ["span", {}, _("title.Time remaining")],
<span>{_("title.Source")}</span> ["span", {}, _("title.Source")]],
</tr> ["tr", { highlight: "Download" },
<tr highlight="Download"><span><div style="min-height: 1ex; /* FIXME */"/></span></tr> ["span", {},
<tr highlight="Download" key="totals" active="true"> ["div", { style: "min-height: 1ex; /* FIXME */" }]]],
<td><span highlight="Title">{_("title.Totals")}:</span>&#xa0;<span key="total"/></td> ["tr", { highlight: "Download", key: "totals", active: "true" },
<td/> ["td", {},
<td highlight="DownloadButtons"> ["span", { highlight: "Title" },
<a highlight="Button" href="javascript:0" key="clear">{_("download.action.Clear")}</a> _("title.Totals") + ":"],
</td> " ",
<td highlight="DownloadProgress" key="progress"> ["span", { key: "total" }]],
<span highlight="DownloadProgressHave" key="progressHave" ["td"],
/>/<span highlight="DownloadProgressTotal" key="progressTotal"/> ["td", { highlight: "DownloadButtons" },
</td> ["a", { highlight: "Button", href: "javascript:0", key: "clear" }, _("download.action.Clear")]],
<td highlight="DownloadPercent" key="percent"/> ["td", { highlight: "DownloadProgress", key: "progress" },
<td highlight="DownloadSpeed" key="speed"/> ["span", { highlight: "DownloadProgressHave", key: "progressHave" }],
<td highlight="DownloadTime" key="time"/> "/",
<td/> ["span", { highlight: "DownloadProgressTotal", key: "progressTotal" }]],
</tr> ["td", { highlight: "DownloadPercent", key: "percent" }],
</table>, this.document, this.nodes); ["td", { highlight: "DownloadSpeed", key: "speed" }],
["td", { highlight: "DownloadTime", key: "time" }],
["td"]]],
this.document, this.nodes);
this.index = Array.indexOf(this.nodes.list.childNodes, this.index = Array.indexOf(this.nodes.list.childNodes,
this.nodes.head); this.nodes.head);

View File

@@ -2,7 +2,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";
defineModule("finder", { defineModule("finder", {
exports: ["RangeFind", "RangeFinder", "rangefinder"], exports: ["RangeFind", "RangeFinder", "rangefinder"],