1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-30 17:23:33 +02:00

Move :downloads button logic into binding classes.

--HG--
extra : transplant_source : %CF.%29Y%88%B5%0AU%18%E0%B9%EA%85%94%F1%99%16b9%F3
This commit is contained in:
Kris Maglione
2011-01-23 23:25:08 -05:00
parent 2956548352
commit 8e270cdb0c
4 changed files with 95 additions and 29 deletions

View File

@@ -25,7 +25,9 @@ var Download = Class("Download", {
this.instance = this;
this.list = list;
this.nodes = {};
this.nodes = {
commandTarget: self
};
util.xmlToDom(
<li highlight="Download" key="row" xmlns:dactyl={NS} xmlns={XHTML}>
<span highlight="DownloadTitle">
@@ -54,22 +56,6 @@ var Download = Class("Download", {
</li>,
this.list.document, this.nodes);
for (let [key, node] in Iterator(this.nodes)) {
node.dactylDownload = self;
if (node.getAttributeNS(NS, "highlight") == "Button") {
node.setAttributeNS(NS, "command", "download.command");
update(node, {
set collapsed(collapsed) {
if (collapsed)
this.setAttribute("collapsed", "true");
else
this.removeAttribute("collapsed");
},
get collapsed() !!this.getAttribute("collapsed")
});
}
}
self.updateStatus();
return self;
},
@@ -293,12 +279,6 @@ var Downloads = Module("downloads", {
{
argCount: "?"
});
},
dactyl: function (dactyl, modules, window) {
dactyl.commands["download.command"] = function (event) {
let elem = event.originalTarget;
elem.dactylDownload.command(elem.getAttribute("key"));
}
}
});