1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-18 00:15:46 +01:00

Add Clear button to :downloads.

--HG--
branch : key-processing
This commit is contained in:
Kris Maglione
2011-01-24 00:37:32 -05:00
parent beb9d69eaa
commit 0a422502ba
4 changed files with 84 additions and 31 deletions

View File

@@ -104,15 +104,32 @@ var Template = Module("Template", {
init.supercall(this, node);
this.target = params.commandTarget;
if (callable(this.target))
this.target = { command: this.target }
},
get command() this.getAttribute("command") || this.getAttribute("key"),
events: {
"click": function onClick(event) {
event.preventDefault();
this.target.command(this.getAttribute("key"));
if (this.commandAllowed) {
if (set.has(this.target.commands || {}, this.command))
this.target.commands[this.command].call(this.target);
else
this.target.command(this.command);
}
}
},
get commandAllowed() {
if (set.has(this.target.allowedCommands || {}, this.command))
return this.target.allowedCommands[this.command];
if ("commandAllowed" in this.target)
return this.target.commandAllowed(this.command);
return true;
},
update: function update() {
this.collapsed = !this.commandAllowed;
}
})
},