Added download
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
2e46a17405
commit
41b13b6c1e
@ -4,8 +4,14 @@
|
|||||||
<link rel="import" href="../bower_components/polymer/polymer.html">
|
<link rel="import" href="../bower_components/polymer/polymer.html">
|
||||||
<link rel="import" href="../bower_components/iron-icon/iron-icon.html">
|
<link rel="import" href="../bower_components/iron-icon/iron-icon.html">
|
||||||
<link rel="import" href="../bower_components/iron-icons/iron-icons.html">
|
<link rel="import" href="../bower_components/iron-icons/iron-icons.html">
|
||||||
|
<link rel="import" href="../bower_components/iron-iconset/iron-iconset.html">
|
||||||
<link rel="import" href="../bower_components/iron-pages/iron-pages.html">
|
<link rel="import" href="../bower_components/iron-pages/iron-pages.html">
|
||||||
|
|
||||||
|
<link rel="import" href="../bower_components/paper-button/paper-button.html">
|
||||||
<link rel="import" href="../bower_components/paper-spinner/paper-spinner.html">
|
<link rel="import" href="../bower_components/paper-spinner/paper-spinner.html">
|
||||||
|
|
||||||
|
<link rel="import" href="../bower_components/iron-flex-layout/iron-flex-layout-classes.html">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<dom-module id="photo-lightbox">
|
<dom-module id="photo-lightbox">
|
||||||
@ -37,7 +43,10 @@
|
|||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
transition: opacity 0.5s ease-in-out;
|
transition: opacity 0.5s ease-in-out;
|
||||||
-webkit-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 {
|
#overlay {
|
||||||
@ -54,7 +63,8 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<div id="image">
|
<div id="image" class="layout vertical" on-tap="onTap">
|
||||||
|
<paper-icon-button on-tap="download" class="start-end" icon="file-download"></paper-icon-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="overlay" class="layout vertical center">
|
<div id="overlay" class="layout vertical center">
|
||||||
@ -87,7 +97,6 @@ Polymer({
|
|||||||
|
|
||||||
listeners: {
|
listeners: {
|
||||||
"keydown": "onKeyDown",
|
"keydown": "onKeyDown",
|
||||||
"tap": "onTap",
|
|
||||||
"blur": "onBlur",
|
"blur": "onBlur",
|
||||||
"focus": "onFocus",
|
"focus": "onFocus",
|
||||||
"scroll": "onScroll"
|
"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() {
|
close: function() {
|
||||||
this.style.opacity = 0;
|
this.style.opacity = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user