Fix on-tap for download

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2018-09-13 00:37:05 -07:00
parent ea1fb82005
commit 649e4d0964

View File

@ -149,10 +149,7 @@ Polymer({
}, },
download: function(event) { download: function(event) {
event.preventDefault(); console.log("Download tapped");
event.stopPropagation();
event.stopImmediatePropagation();
var anchor = document.createElement('a'); var anchor = document.createElement('a');
anchor.href = this.src; anchor.href = this.src;
anchor.setAttribute("download", this.src.replace(/.*\/([^/]+)$/, "$1")); anchor.setAttribute("download", this.src.replace(/.*\/([^/]+)$/, "$1"));
@ -160,6 +157,9 @@ Polymer({
document.body.appendChild(anchor); document.body.appendChild(anchor);
anchor.click(); anchor.click();
document.body.removeChild(anchor); document.body.removeChild(anchor);
event.preventDefault();
event.stopPropagation();
event.stopImmediatePropagation();
}, },
close: function() { close: function() {