From 41b13b6c1e7cf04ae5c357e6a5a048e342ff0876 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Thu, 13 Sep 2018 00:15:13 -0700 Subject: [PATCH] Added download Signed-off-by: James Ketrenos --- frontend/elements/photo-lightbox.html | 29 ++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/frontend/elements/photo-lightbox.html b/frontend/elements/photo-lightbox.html index d3ae966..deecf50 100644 --- a/frontend/elements/photo-lightbox.html +++ b/frontend/elements/photo-lightbox.html @@ -4,8 +4,14 @@ + + + + + + @@ -37,7 +43,10 @@ background-repeat: no-repeat; transition: opacity 0.5s ease-in-out; -webkit-transition: opacity 0.5s ease-in-out; - pointer-events: none; + } + + #image paper-icon-button { + color: white; } #overlay { @@ -54,7 +63,8 @@ } -
+
+
@@ -87,7 +97,6 @@ Polymer({ listeners: { "keydown": "onKeyDown", - "tap": "onTap", "blur": "onBlur", "focus": "onFocus", "scroll": "onScroll" @@ -139,6 +148,20 @@ Polymer({ } }, + download: function(event) { + event.preventDefault(); + event.stopPropagation(); + event.stopImmediatePropagation(); + + var anchor = document.createElement('a'); + anchor.href = this.src; + anchor.setAttribute("download", this.src.replace(/.*\/([^/]+)$/, "$1")); + anchor.style.display = "none"; + document.body.appendChild(anchor); + anchor.click(); + document.body.removeChild(anchor); + }, + close: function() { this.style.opacity = 0;