1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-29 19:53:31 +02:00

Move :downloads button logic into binding classes.

--HG--
branch : key-processing
This commit is contained in:
Kris Maglione
2011-01-23 23:25:08 -05:00
parent df4fc65102
commit 3cd40141f9
5 changed files with 100 additions and 32 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;
},
@@ -289,12 +275,6 @@ var Downloads = Module("downloads", {
if (modules.commandline.savingOutput)
util.waitFor(function () downloads.document);
});
},
dactyl: function (dactyl, modules, window) {
dactyl.commands["download.command"] = function (event) {
let elem = event.originalTarget;
elem.dactylDownload.command(elem.getAttribute("key"));
}
}
});