1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-09 04:54:10 +01:00

Add Clear button to :downloads.

--HG--
extra : transplant_source : %14%3E%7Dk%3F%D0Q%DF%D4BdO%D0q%1D%A4D%E5%09%E9
This commit is contained in:
Kris Maglione
2011-01-24 00:37:32 -05:00
parent 8e270cdb0c
commit bd431b92b5
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;
}
})
},