X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=common%2Fmodules%2Fdownloads.jsm;fp=common%2Fmodules%2Fdownloads.jsm;h=26ac1ccd31dc0df00f00d86bfdb954e27f2d0cd5;hb=3d837eb266a3a01d424192aa4ec1a167366178c5;hp=fdf5925b846d5d01853db1de0debec0aad957919;hpb=d8a3bcebff36df7b128b36e0b57b715479e155a0;p=dactyl.git diff --git a/common/modules/downloads.jsm b/common/modules/downloads.jsm index fdf5925..26ac1cc 100644 --- a/common/modules/downloads.jsm +++ b/common/modules/downloads.jsm @@ -23,21 +23,20 @@ var states = iter([v, k.slice(prefix.length).toLowerCase()] 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")], @@ -54,19 +53,19 @@ var Download = Class("Download", { ["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], @@ -102,7 +101,6 @@ var Download = Class("Download", { this.updateStatus(); }, launch: function launch() { - let self = this; // Behavior mimics that of the builtin Download Manager. function action() { try { @@ -119,13 +117,13 @@ var Download = Class("Download", { 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); @@ -419,7 +417,6 @@ var Downloads = Module("downloads", XPCOM(Ci.nsIDownloadProgressListener), { 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); @@ -516,4 +513,4 @@ endModule(); // 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: