Skip to content

Commit

Permalink
Issue #335
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-stastny authored and jirikrepl committed Apr 21, 2016
1 parent d858d62 commit 423c093
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions search/web/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,8 @@ PDF.prototype.downloadFile = function(url) {
console.log("dialog " + this.waitDialog);
if (xhr.readyState == 4) {
if (xhr.status == 200) {
var name = (function() {
var date = new Date();
return "" + date.getFullYear() + "" + date.getDate() + ""
+ date.getMonth() + "_" + date.getHours() + ""
+ date.getMinutes() + "" + date.getSeconds() + ".pdf";
})();
var date = new Date();
var name = "" + date.getFullYear() + "" + date.getDate() + "" + date.getMonth() + "_" + date.getHours() + "" + date.getMinutes() + "" + date.getSeconds()+"_"+date.getMilliseconds()+ ".pdf";
var blob = xhr.response;
var burl = window.URL.createObjectURL(blob);
var ref = $('<a/>', {
Expand All @@ -176,14 +172,14 @@ PDF.prototype.downloadFile = function(url) {
style : "display:none"
});
ref.text("click to download");
$("#waitPdf").append(ref);

// JQuery issue, the code:
// $("#_pdf_download_bloblink").trigger('click');
// doesn't work
$("#_pdf_download_bloblink" ).remove();
$("#waitPdf").append(ref);

$("#_pdf_download_bloblink").get(0).click();

this.waitDialog.dialog('close');

} else if (xhr.status == 400) {
this.waitDialog.dialog('close');
this.showPagesValidationError();
Expand Down

0 comments on commit 423c093

Please sign in to comment.