var Download = Class("Download", {
init: function init(id, list) {
- let self = this;
this.download = services.downloadManager.getDownload(id);
this.list = list;
this.nodes = {
- commandTarget: self
+ commandTarget: this
};
DOM.fromJSON(
["tr", { highlight: "Download", key: "row" },
["td", { highlight: "DownloadTitle" },
["span", { highlight: "Link" },
- ["a", { key: "launch", href: self.target.spec, path: self.targetFile.path },
- self.displayName],
+ ["a", { key: "launch", href: this.target.spec, path: this.targetFile.path },
+ this.displayName],
["span", { highlight: "LinkInfo" },
- self.targetFile.path]]],
+ this.targetFile.path]]],
["td", { highlight: "DownloadState", key: "state" }],
["td", { highlight: "DownloadButtons Buttons" },
["a", { highlight: "Button", href: "javascript:0", key: "pause" }, _("download.action.Pause")],
["td", { highlight: "DownloadSpeed", key: "speed" }],
["td", { highlight: "DownloadTime", key: "time" }],
["td", {},
- ["a", { highlight: "DownloadSource", key: "source", href: self.source.spec },
- self.source.spec]]],
+ ["a", { highlight: "DownloadSource", key: "source", href: this.source.spec },
+ this.source.spec]]],
this.list.document, this.nodes);
- this.nodes.launch.addEventListener("click", function (event) {
+ this.nodes.launch.addEventListener("click", (event) => {
if (event.button == 0) {
event.preventDefault();
- self.command("launch");
+ this.command("launch");
}
}, false);
- self.updateStatus();
- return self;
+ this.updateStatus();
+ return this;
},
get status() states[this.state],
this.updateStatus();
},
launch: function launch() {
- let self = this;
// Behavior mimics that of the builtin Download Manager.
function action() {
try {
let file = io.File(this.targetFile);
if (file.isExecutable() && prefs.get("browser.download.manager.alertOnEXEOpen", true))
this.list.modules.commandline.input(_("download.prompt.launchExecutable") + " ",
- function (resp) {
+ (resp) => {
if (/^a(lways)$/i.test(resp)) {
prefs.set("browser.download.manager.alertOnEXEOpen", false);
resp = "yes";
}
if (/^y(es)?$/i.test(resp))
- action.call(self);
+ action.call(this);
});
else
action.call(this);
let file = download.targetFile.path;
let size = download.size;
-
overlay.modules.forEach(function (modules) {
modules.dactyl.echomsg({ domains: [util.getHost(url)], message: _("io.downloadFinished", title, file) },
1, modules.commandline.ACTIVE_WINDOW);
// catch(e){ if (isString(e)) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
-// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
+// vim: set fdm=marker sw=4 sts=4 ts=8 et ft=javascript: