[Pkg-javascript-commits] [pdf.js] 90/116: Determine filename only once and reduce code for _bindLink
David Prévot
taffit at moszumanska.debian.org
Fri Mar 6 16:20:04 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit b72395d5cebd34272b702f1c6cf6bfeb3a4cf60d
Author: Tim van der Meij <timvandermeij at gmail.com>
Date: Tue Jan 27 23:16:05 2015 +0100
Determine filename only once and reduce code for _bindLink
---
web/pdf_attachment_view.js | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/web/pdf_attachment_view.js b/web/pdf_attachment_view.js
index 2ccce3c..ad1b7df 100644
--- a/web/pdf_attachment_view.js
+++ b/web/pdf_attachment_view.js
@@ -50,11 +50,9 @@ var PDFAttachmentView = (function PDFAttachmentViewClosure() {
/**
* @private
*/
- _bindLink: function PDFAttachmentView_bindLink(button, item) {
+ _bindLink: function PDFAttachmentView_bindLink(button, content, filename) {
button.onclick = function downloadFile(e) {
- var content = item.content;
- var filename = item.filename;
- this.downloadManager.downloadData(content, getFileName(filename), '');
+ this.downloadManager.downloadData(content, filename, '');
return false;
}.bind(this);
},
@@ -73,11 +71,12 @@ var PDFAttachmentView = (function PDFAttachmentViewClosure() {
});
for (var i = 0, len = names.length; i < len; i++) {
var item = attachments[names[i]];
+ var filename = getFileName(item.filename);
var div = document.createElement('div');
div.className = 'attachmentsItem';
var button = document.createElement('button');
- this._bindLink(button, item);
- button.textContent = getFileName(item.filename);
+ this._bindLink(button, item.content, filename);
+ button.textContent = filename;
div.appendChild(button);
this.container.appendChild(div);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list