mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 04:27:58 +01:00
Death to E4X and stuff.
This commit is contained in:
@@ -3,7 +3,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";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -146,21 +146,18 @@ var Addon = Class("Addon", {
|
|||||||
this.nodes = {
|
this.nodes = {
|
||||||
commandTarget: this
|
commandTarget: this
|
||||||
};
|
};
|
||||||
XML.ignoreWhitespace = true;
|
DOM.fromJSON(
|
||||||
util.xmlToDom(
|
["tr", { highlight: "Addon", key: "row" },
|
||||||
<tr highlight="Addon" key="row" xmlns:dactyl={NS} xmlns={XHTML}>
|
["td", { highlight: "AddonName", key: "name" }],
|
||||||
<td highlight="AddonName" key="name"/>
|
["td", { highlight: "AddonVersion", key: "version" }],
|
||||||
<td highlight="AddonVersion" key="version"/>
|
["td", { highlight: "AddonButtons Buttons" },
|
||||||
<td highlight="AddonButtons Buttons">
|
["a", { highlight: "Button", href: "javascript:0", key: "enable" }, _("addon.action.On")],
|
||||||
<a highlight="Button" href="javascript:0" key="enable">{_("addon.action.On")}</a>
|
["a", { highlight: "Button", href: "javascript:0", key: "disable" }, _("addon.action.Off")],
|
||||||
<a highlight="Button" href="javascript:0" key="disable">{_("addon.action.Off")}</a>
|
["a", { highlight: "Button", href: "javascript:0", key: "delete" }, _("addon.action.Delete")],
|
||||||
<a highlight="Button" href="javascript:0" key="delete">{_("addon.action.Delete")}</a>
|
["a", { highlight: "Button", href: "javascript:0", key: "update" }, _("addon.action.Update")],
|
||||||
<a highlight="Button" href="javascript:0" key="update">{_("addon.action.Update")}</a>
|
["a", { highlight: "Button", href: "javascript:0", key: "options" }, _("addon.action.Options")]],
|
||||||
<a highlight="Button" href="javascript:0" key="options">{_("addon.action.Options")}</a>
|
["td", { highlight: "AddonStatus", key: "status" }],
|
||||||
</td>
|
["td", { highlight: "AddonDescription", key: "description" }]],
|
||||||
<td highlight="AddonStatus" key="status"/>
|
|
||||||
<td highlight="AddonDescription" key="description"/>
|
|
||||||
</tr>,
|
|
||||||
this.list.document, this.nodes);
|
this.list.document, this.nodes);
|
||||||
|
|
||||||
this.update();
|
this.update();
|
||||||
@@ -190,11 +187,8 @@ var Addon = Class("Addon", {
|
|||||||
compare: function compare(other) String.localeCompare(this.name, other.name),
|
compare: function compare(other) String.localeCompare(this.name, other.name),
|
||||||
|
|
||||||
get statusInfo() {
|
get statusInfo() {
|
||||||
XML.ignoreWhitespace = XML.prettyPrinting = false;
|
let info = this.isActive ? ["span", { highlight: "Enabled" }, "enabled"]
|
||||||
default xml namespace = XHTML;
|
: ["span", { highlight: "Disabled" }, "disabled"];
|
||||||
|
|
||||||
let info = this.isActive ? <span highlight="Enabled">enabled</span>
|
|
||||||
: <span highlight="Disabled">disabled</span>;
|
|
||||||
|
|
||||||
let pending;
|
let pending;
|
||||||
if (this.pendingOperations & AddonManager.PENDING_UNINSTALL)
|
if (this.pendingOperations & AddonManager.PENDING_UNINSTALL)
|
||||||
@@ -208,8 +202,11 @@ var Addon = Class("Addon", {
|
|||||||
else if (this.pendingOperations & AddonManager.PENDING_UPGRADE)
|
else if (this.pendingOperations & AddonManager.PENDING_UPGRADE)
|
||||||
pending = ["Enabled", "upgraded"];
|
pending = ["Enabled", "upgraded"];
|
||||||
if (pending)
|
if (pending)
|
||||||
return <>{info} (<span highlight={pending[0]}>{pending[1]}</span>
|
return [info, " (",
|
||||||
 on <a href="#" dactyl:command="dactyl.restart" xmlns:dactyl={NS}>restart</a>)</>;
|
["span", { highlight: pending[0] }, pending[1]],
|
||||||
|
" on ",
|
||||||
|
["a", { href: "#", "dactyl:command": "dactyl.restart" }, "restart"],
|
||||||
|
")"]
|
||||||
return info;
|
return info;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -219,7 +216,8 @@ var Addon = Class("Addon", {
|
|||||||
let node = self.nodes[key];
|
let node = self.nodes[key];
|
||||||
while (node.firstChild)
|
while (node.firstChild)
|
||||||
node.removeChild(node.firstChild);
|
node.removeChild(node.firstChild);
|
||||||
node.appendChild(util.xmlToDom(<>{xml}</>, self.list.document));
|
|
||||||
|
DOM(node).append(isArray(xml) || isXML(xml) ? xml : DOM.DOMString(xml));
|
||||||
}
|
}
|
||||||
|
|
||||||
update("name", template.icon({ icon: this.iconURL }, this.name));
|
update("name", template.icon({ icon: this.iconURL }, this.name));
|
||||||
@@ -283,15 +281,14 @@ var AddonList = Class("AddonList", {
|
|||||||
message: Class.Memoize(function () {
|
message: Class.Memoize(function () {
|
||||||
|
|
||||||
XML.ignoreWhitespace = true;
|
XML.ignoreWhitespace = true;
|
||||||
util.xmlToDom(<table highlight="Addons" key="list" xmlns={XHTML}>
|
DOM.fromJSON(["table", { highlight: "Addons", key: "list" },
|
||||||
<tr highlight="AddonHead">
|
["tr", { highlight: "AddonHead" },
|
||||||
<td>{_("title.Name")}</td>
|
["td", {}, _("title.Name")],
|
||||||
<td>{_("title.Version")}</td>
|
["td", {}, _("title.Version")],
|
||||||
<td/>
|
["td"],
|
||||||
<td>{_("title.Status")}</td>
|
["td", {}, _("title.Status")],
|
||||||
<td>{_("title.Description")}</td>
|
["td", {}, _("title.Description")]]],
|
||||||
</tr>
|
this.document, this.nodes);
|
||||||
</table>, this.document, this.nodes);
|
|
||||||
|
|
||||||
if (this._addons)
|
if (this._addons)
|
||||||
this._init();
|
this._init();
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ var DOM = Class("DOM", {
|
|||||||
if (val instanceof Ci.nsIDOMNode)
|
if (val instanceof Ci.nsIDOMNode)
|
||||||
return val;
|
return val;
|
||||||
|
|
||||||
if (typeof val == "xml") {
|
if (typeof val == "xml" || DOM.isJSONXML(val)) {
|
||||||
val = dom.constructor(val, dom.document);
|
val = dom.constructor(val, dom.document);
|
||||||
if (container)
|
if (container)
|
||||||
container[idx] = val[0];
|
container[idx] = val[0];
|
||||||
@@ -1562,12 +1562,11 @@ var DOM = Class("DOM", {
|
|||||||
let [name, attr] = args;
|
let [name, attr] = args;
|
||||||
attr = attr || {};
|
attr = attr || {};
|
||||||
|
|
||||||
if (Array.isArray(name) || args.length == 0) {
|
if (Array.isArray(name) || args.length == 0 || name == "") {
|
||||||
var frag = doc.createDocumentFragment();
|
var frag = doc.createDocumentFragment();
|
||||||
Array.forEach(args, function (arg) {
|
Array.forEach(args, function (arg) {
|
||||||
if (!Array.isArray(arg[0]))
|
if (!isArray(arg[0]))
|
||||||
frag.appendChild(tag(arg, namespaces));
|
arg = [arg];
|
||||||
else
|
|
||||||
arg.forEach(function (arg) {
|
arg.forEach(function (arg) {
|
||||||
frag.appendChild(tag(arg, namespaces));
|
frag.appendChild(tag(arg, namespaces));
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user